выдержка из даташита на AD7865
"The designed code transitions take place midway between successive
integer LSB values (i.e., 1/2 LSB, 3/2 LSBs, 5/2 LSBs
etc.) LSB size is given by the formula, 1 LSB = FSR/16384. For
the ±5 V range, 1 LSB = 10 V/16384 = 610.4 μV."
кусок кода считывание АЦП:
Код: Выделить всё
int16_t adc_data_read(void)
{
AD7865_CONTROL_PORT &= ~(_BV(AD7865_CS)|_BV(AD7865_RD));//
_delay_us(3);
int16_t adc1=(int16_t)((AD7865_OUTL_PIN))| (AD7865_OUTH_PIN<<8);
adc1 >>= 2;
AD7865_CONTROL_PORT|=_BV(AD7865_CS)|_BV(AD7865_RD);//
return adc1;
}Код: Выделить всё
cli();
int16_t temp = adc_data_read();//
uint16_t x = (uint16_t)((uint32_t)temp+0x2000);
adc_res=x;
sei();


