Problem with ADC using ST72F324J2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-21 10:17 PM
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-21 12:41 AM
Posted on April 21, 2004 at 09:41
Hi!
I have just started to use the Metrowerks CodeWarrior C compiler and have a problem with the A/D CONVERTER. I want to use the AIN2, AIN3, AIN4, AIN5. (PD2 to PD5 ST72F324J2) When i use only one channel, All is ok. But when i want to make the acquisition of one channel after one channel, it's not ok. I have a function that is named Adc() void Adc(void) { ADCCSR = 0x22; // Channel 2 while (!(ADCCSR & 0x07)); In_ana2 = ADCDRH; ADCCSR = 0x23; // Channel 3 while (!(ADCCSR & 0x07)); In_ana3 = ADCDRH; ADCCSR = 0x24; and so ... } If i use only anyone channel the acquisiton in the variable In_anaX is correct. But if use all the channel, the acqusition in the variable is false. What is my mistake? /Fred.BOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-21 5:02 AM
Posted on April 21, 2004 at 14:02
For checking the End of conversion you have to use
while (!(ADCCSR & 0x80)); But you are using ''while (!(ADCCSR & 0x07));''. You can also download the ST7 software library to have the ''ADC code'' from the same site.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-21 5:43 AM
Posted on April 21, 2004 at 14:43
Hello, Thanks Jatin. Could you give me the links to the ST7 software library because i have found in this site the AN979 but in this apllication note there is only the main code and it refers to the library. Example ADC_Enable();. The problem was the link :http://cmg.st.com/stonline/products/cmg/mcd/st7.html (ST7 software library version1.1). It doesn't match. So could you give me the right link to download the ST7 software library included ADC_Enable() for the ST72F324 Fred.B
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-21 10:17 PM
Posted on April 22, 2004 at 07:17
In the Main Menu Click - Downloads -> St7Microcontrollers -> Software-Microcontrollers->ST7 Software Library
