Part Number: MSP430F5529 Hi, I'm trying to do an ADC single-channel single-conversion of A4 (P6.4) on the MSP430F5529 . I used `MSP430F55xx_adc_05.c` from `slac300k MSP430F55xx_Code_Examples` which samples A0 (P6.0): int main(void) { WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer P6SEL |= 0x01; // Enable A/D channel A0 ADC12CTL0 = ADC12ON+ADC12SHT0_2; // Turn on ADC12, set sampling time ADC12CTL1 = ADC12SHP; // Use sampling timer ADC12MCTL0 = ADC12SREF_2; // Vr+ = VeREF+ (ext) and Vr-=AVss ADC12CTL0 |= ADC12ENC; // Enable conversions while (1) { ADC12CTL0 |= ADC12SC; // Start conversion-software trigger while (!(ADC12IFG & BIT0)); __no_operation(); // SET BREAKPOINT HERE } } I tried to run the example and saw that the everything is working and I'm reading 0 when it is connected to GND and 4096 when connected to VCC. I changed it as follows in order to sample A4 (P6.4): volatile unsigned int result; void main() { // setup(); WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer P6SEL |= 0x10; // Enable A/D channel A0 ADC12CTL0 = ADC12ON+ADC12SHT0_2; // Turn on ADC12, set sampling time ADC12CTL1 = ADC12SHP; // Use sampling timer ADC12MCTL0 = ADC12INCH_4 | ADC12SREF_2; // Vr+ = VeREF+ (ext) and Vr-=AVss ADC12CTL0 |= ADC12ENC; // Enable conversions while (1) { ADC12CTL0 |= ADC12SC; // Start conversion-software trigger while (!(ADC12IFG & BIT0)); result = ADC12MEM0; __no_operation(); // SET BREAKPOINT HERE } } However, it doesn't work... When I read the value in result, I see that the value is 0 always. Also, when I try and hookup the pin to 3.3V, the board resets... It looks like I haven't configured the pin right, and that it is tied to GND (it will also explain the reset when hooking up to 3.3V), but I haven't found the mistake in the code... I got the same behavior using the driverlib. Also, I get this behavior also on an MSP430F5529 Launchpad and also on some other propriety MSP430F5529 board. Thanks a lot!
↧