What is correct sequence of reading two adc pins
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-08-28 10:47 PM
Posted on August 29, 2013 at 07:47
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 */
}
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-08-29 6:42 AM
Posted on August 29, 2013 at 15:42
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