Dear all,
I'm using CCS on Win7 and Launchpad 430g2 with a 2452 chip.
I cannot get the ISR to execute when I externally drive comparator input voltage up and down. Minimal code is here. I think it should toggle LED whenever I go up. (Other code examples are reading P1.1 comparator correctly in same setup and also LED is connected correctly as tested with other code.)
Any idea? Any obvious fault in code? Thanks!
Matjaz
#include <msp430.h>
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timeractivate comp
P1OUT = 0;
P1DIR = BIT0;
CACTL1 = CAREF1 + CARSEL + CAIE; // 0.5 Vcc ref on - pin, enable interrupts on rising edge.
CACTL2 = P2CA4; // Input CA1 on + pin
CACTL1 = CAON; // activate comparator
for (;;) {
}
}
#pragma vector=COMPARATORA_VECTOR
__interrupt void my_isr (void) {
P1OUT ^= BIT0;
}
// EOF