Part Number:MSP430F133
Tool/software: Code Composer Studio
Hello,
I've been working on an application that uses TimerA to generate various square waves using the GPIO. I have that working. I also need to periodically read the ADC. When I add the ADC code, the square wave code stops running. I've been pouring over the user guide to determine what I'm doing wrong but the user guide is somewhat obtuse and I've not found my problem yet... The timer is setup as follows:
void Init_Clock() { // Stop Watchdog timer WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer CCTL1 = CCIE; // CCR1 interrupt enabled CCR1 = TICS_FOR_50ms; CCTL2 = CCIE; // CCR2 interrupt enabled CCR2 = TICS_FOR_20ms; TACTL = TASSEL_2 + MC_2 + TAIE; // SMCLK, Contmode, }
The ADC is setup as follows.
void Init_ADC() { ADC12CTL0 = SHT0_10 + ADC12ON; // Set sampling time, turn on ADC12 ADC12CTL1 = SHP; // Use sampling timer, SMCLK ADC12IE = 0x01; // Enable interrupt ADC12CTL0 |= ENC; // Conversion enabled P6SEL |= 0x01; // P6.0 ADC option select }
I start the ADC acquisition periodically from the timerA CCR2 countdown interrupt by calling
ADC12CTL0 |= ADC12SC; // Start Conversion
The timerA code runs fine until I make the above start conversion call. When I make that call, the repetitive TimerA interrupts (in which we create the square waves) stop being generated.
I'm sure I've not configured the clock for the ADC correctly but that secret sauce seems to elude me. Obviously I need a better clock subsystem understanding.
Suggestions appreciated.
- Dave