scorrpeio
Full Member level 5
Here is the requirement...
The sensor connected to channel A15 (Port pin P7.7) is to be read as ADC input and its equivalent count to display.
I have written a code for it but unfortunately I dont get nothing in the count Register.
the execution doesnt cross while loop which means ADC12IFG15 flag is not set.
Any suggestion?
The sensor connected to channel A15 (Port pin P7.7) is to be read as ADC input and its equivalent count to display.
I have written a code for it but unfortunately I dont get nothing in the count Register.
Code:
UINT16_T u16Count;
P7SEL |= 0x80; //P7.7 = A15 channel is connected to TempSensor
//P7DIR |= 0x80;
/* Initialize ADC12 */
ADC12CTL0 = ADC12ON+ADC12SHT0_2+ADC12REF2_5V; // Turn on ADC12, set sampling time, //internal reference 2.5V
ADC12CTL1 = ADC12SHP + ADC12CONSEQ_2 + ADC12SSEL1; // Use sampling timer, set clock src
ADC12MCTL15 = ADC12INCH_15 + ADC12SREF_1; // Vr+ = VeREF+ (int) and Vr-=AVss
ADC12CTL1 = ADC12RES_2;
Delay_ms(50);
ADC12CTL0 |= ADC12ENC + ADC12SC; // Enable and start conversions
while (!(ADC12IFG & ADC12IFG15));
// while (!(ADC12IFG ));
u16Count = ADC12MEM15;
the execution doesnt cross while loop which means ADC12IFG15 flag is not set.
Any suggestion?