Hi,
I have four channels analog valtage to collect:0.64V,0.53V,1.89V,2.78V. The reference voltage is 3.3V and GND. I use 12bits resolution,so the digital convertion results are as follows:800,664,2346,3456. Then I use ADC1 Group1 channel0,1,2,4. when I use CAN send the digital result,the channel0,1,4 are all right,only the channel2 digital result is wrong. The value is 864.The id is right. what's wrong ?
The part code as following:
void main(void)
{
/* USER CODE BEGIN (3) */
uint32 ch_count ;
uint32 id =0;
uint32 value =0;
adcInit();
canInit();
while(1)
{
adcStartConversion(adcREG1,adcGROUP1);
while((adcIsConversionComplete(adcREG1,adcGROUP1))==0);
ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data[0]);
ch_count = ch_count;
id = adc_data[0].id;
value = adc_data[0].value;
tx_data[0]= value&0xff;
tx_data[1]= value>>8;
tx_data[2]= id;
tx_data[3]=ch_count;
canTransmit(canREG1, canMESSAGE_BOX1, tx_data);
}
thanks!