2016-12-21 02:03 AM
Dear all
I am using ADC in stm8s105c6. I use ADC1 for two channel for example AIN9 and AIN8.
the problem is that when I switch the ADC1 from channel 9 to 8 the output result of the are being swapped.
the input signal which is connected to the channel 9 gives the result of the input signal which is connected to channel 8 and vice versa.
this the code that use.
ADC1->CSR &= 0x00;
ADC1->CSR |= 0x09; TIM1_SetCompare1(sample_average(pch1)); ADC1->CSR &= 0x00; ADC1->CSR |= 0x08; TIM1_SetCompare2(sample_average(pch2));(but when I use just one channel everything is ok);
Many Thanks for your help.