I have a Launchpad (the USB 5529 version) that I have been trying to use to get up to speed on the MSP430 (I am coming from a PIC world). I've looked at the example code that you can get CC to generate, but I am having issues understanding how to get the ADC to do what I want.
All I really want to do is sample a pin as fast as is reasonable and toggle a pin so I can figure out how fast I am going.
My code looked like:
WDTCTL = WDTPW + WDTHOLD; // Halt the dog // MSP430 USB requires a Vcore setting of at least 2. 2 is high enough // for 8MHz MCLK, below. PMM_setVCore(PMM_BASE, PMM_CORE_LEVEL_2); //for the ADC REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to //Enable ADC12, enable internal ref, set to 2.5V, 4 ADC clock cycles sample/hold ADC12CTL0 = ADC12ON + ADC12REFON + ADC12REF2_5V + ADC12SHT0_0; // Internal ref = 1.5V //Repeat multiple channels, ACLK, clock divider is /1, use the sampling timer ADC12CTL1 = ADC12SSEL_1 + ADC12DIV_0 + ADC12SHP; //12 bit resolution -> 13 clock cycle conversion ADC12CTL2 = ADC12RES_3; ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_10; // ADC i/p ch A10 = temp sense i/p ADC12IE = 0x001; // ADC_IFG upon conv result-ADCMEMO __delay_cycles(100); // delay to allow Ref to settle ADC12CTL0 |= ADC12ENC;
and I sit in a while look waiting on my flag to be set in the interrupt routine. Is anyone able to spot my issue or point me to some code that helps clear it up?
Thanks!