Hi everyone,
I need some help in my implementation. So far I can read value from the ADC10MEM reg. However, I need to read 3 pins (A0, A1 and A2). I configured the ADC whith the help of a Grace project and my configuration is the following:
ADC10CTL0 &= ~ENC;
ADC10CTL0 = ADC10IE + ADC10ON + ADC10SHT_2 + SREF_0;
ADC10CTL1 = CONSEQ_1 + ADC10SSEL_2 + ADC10DIV_0 + SHS_0 + INCH_2;
ADC10AE0 = 0x7;
ADC10DTC0 = ADC10TB + ADC10CT;
ADC10DTC1 = 3;
ADC10CTL0 |= ENC;
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR_HOOK(void)
{
__bic_SR_register_on_exit(CPUOFF);
}
I attempt to use the ADC like this:
unsigned int values[3];
int main(void)
{
Grace_init(); // Activate Grace-generated configuration
while(1)
{
read();
control();
update();
}
}
void read(void)
{
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & ADC10BUSY);
ADC10SA = values;
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE);
}
The control() and update() functions are not important for the moment. Can anyone tell me please how can I read the thee pins successfully? When I try to debug the code as it is implemented, the Code Composer Studio points out an error that says: "A Value Of Type "unsigned int *" can not be assigned to entity of type "unsigned int" ". I know that this error may be caused by me due to lack of knowledge I am better C# programmer that C/C++ and this may be the big problem now. Can anyone provide me with code that can read all the three pins one after another
Furthermore I can provide you with a snap shot of the Grace project where I setup the ADC. Here it is:
Please suggest an approach in my scenario.
Thank you for your time and cooperation.