2004-04-21 10:17 PM
2004-04-21 12:41 AM
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.B2004-04-21 05:02 AM
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.2004-04-21 05:43 AM
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
2004-04-21 10:17 PM
In the Main Menu Click - Downloads -> St7Microcontrollers -> Software-Microcontrollers->ST7 Software Library