Hello everyone!
I have a big Problem using the 12 Bit ADC on my MSP-EXP430F5529. Ref. Vol. is 2,5 V. But If i am trying to measure i get at about 0,5 V the maximum of 4095 . I am using the Pin 7.0 (ADC Channel 12). I connected my device at 7.0 and GND.
My Code is:
#define ADC_PORT_SEL P7SEL#define ADC_INPUT_A12 BIT0char display[10]; uint32_t messung; /***************************************************************************//** * measure ******************************************************************************/void mess(void) { buttonsPressed = 0; Dogs102x6_clearScreen(); ADC12CTL0 |= ADC12SC; // start conversionwhile ((ADC12CTL1 & ADC12BUSY) == 1); // ready? messung = (ADC12MEM0); my_itoa(messung,display);return; }/***************************************************************************//** * measure prep. ******************************************************************************/void messprep(void) {
P7SEL |= 0x01;
REFCTL0 & = ~REFMSTR;
ADC12CTL0 = ADC12ON + ADC12SHT0_15 + ADC12MSC + ADC12REFON + ADC12REF2_5V; // turn on, multi konversions, ref. to 2,5V ADC12CTL1 = ADC12SHP; ADC12MCTL0 = ADC12SREF_1+ADC12INCH_12; ADC12CTL0 |= ADC12ENC; // beginreturn; }/***************************************************************************//** * eo measure ******************************************************************************/void messend(void) { ADC12CTL0 &= ~ADC12ENC; // Disable conversions ADC12CTL0 &= ~ADC12ON; // ADC12 offreturn; }/***************************************************************************//** * itoa von mikrocontroller.net ******************************************************************************/void my_itoa(int32_t zahl, char* string) //mikrocontroller.net { uint8_t i; string[11]='\0'; // String Terminatorif( zahl < 0 ) // negative? { string[0] = '-'; zahl = -zahl; }else string[0] = ' '; // Zahl ist positivfor(i=10; i>=1; i--) { string[i]=(zahl % 10) +'0'; // Modulo rechnen, dann den ASCII-Code von '0' addieren zahl /= 10; } }
Has anyone of you ever tried to use the ADC on the MSP-EXP430F5529? Is it even possible because of the capacitors witch were built into the board?
I hope someone can help me!