I'm using a DEMOQE board and trying to setup the ADC on pin 18 of the header which is PTF0/ADP10. I believe I have it setup right, but it reads a voltage of around 1.3V on that pin. If I overdrive it to ground, my adc value will be 0, if I put voltage to it, it sources current like I'm shorting it. Why is it doing this?
here is how I'm setting up the adc..
void InitADC(void) { byte done = 0x00; ADCSC1 = 0x0A; ADCSC2 = 0x00; ADCCFG = 0x04; APCTL2 = 0x04; } void SetADC(byte adc_channel, byte aien_value) { ADCSC1_AIEN = aien_value&0x01; ADCSC1_ADCH = adc_channel;} //end SetADC
Then my main looks like this:
void main(void) { initSystems(); InitADC(); initLCD(); SetADC(0x0A,0x01); // ADC10, enable interrupt EnableInterrupts; /* enable interrupts */ while(1){ ADCSC1 = 0x6A;//triggers adc } }
Thanks,
Travis
Hello Travis,
What level of external voltage are you applying? If it should exceed the Vdd voltage for the MCU, a substantial current may flow into the pin, with the potential to permanently damage the MCU.
At each I/O pin there is an intrinsic diode between the pin and Vdd, and it is this diode that conducts under these circumstances. The pin current must not exceed the injection current limit specified in the datasheet. It is also possible for this current to raise the Vdd voltage level, above the maximum allowable limit.
Regards,
Mac