2013-08-28 10:47 PM
What is correct sequence of reading two adc pins in software control mode of module ADC1
I have to scan 14 & 9 channel but under software control mode .while(1){
SQR3 = 0x0E; /* select 14 channel to scan */
CR2 |= SWSTART; /* start the conv */
while( !EOC ); /* while end of conversion */
data = DR; /* read data */
SQR3 = 0x09; /* select 9 channel to scan */
CR2 |= SWSTART; /* start the conv */
while( !EOC ); /* while end of conversion */
data = DR; /* read data */
}
2013-08-29 06:42 AM
You do have a sequence here that is software control. Call the results data1 and data2 to keep the results distinct.
The elegant way is to program the ADC in scan mode, DMA 2 word buffer, and read the results when the DMA flags complete. Up to the all channels on that ADC can be read with one start command. Read the user manual for more details. Cheers, Hal