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