Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Thank you so much, NurseBob! It works as it should now, and I can see the switch bounce you are talking about. But it is interrupting like it should. I was thinking of BIT3 as an input and apparently this was wrong, but I don't understand that logic. To me, pressing the button is an input that causes the interrupt. Why is that not the case? Thanks again!!
  2. I just started playing with the MSP430 with the G2553 chip and am having problems with interrupts. I have the following code just for testing and sometimes pressing the button works and sometimes it doesn't. I thought maybe I had a bad board and replaced it but I still have the same problem. I am beginning to think I am just doing something wrong in the debugging or something. But, here is my code: #include <msp430g2553.h> #define LED1 BIT0 int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_1MHZ; //Set DCO to 1Mhz DCOCTL = CALDCO_1MHZ; P1OUT=BIT0; P1DIR=BIT0; //P1.0 (LED) as output) P1IES |= BIT3; // high -> low is selected with IESx = 1. P1IFG &= ~BIT3; // To prevent an immediate interrupt, clear the flag for // P1.3 before enabling the interrupt. P1IE |= BIT3; // Enable interrupts for P1.3 __enable_interrupt(); P1OUT |= BIT0; //Initially the led will glow while(1) {} return 0; } #pragma vector = PORT1_VECTOR //PORT1 interrupt vector name __interrupt void P1_ISR(void) { P1OUT ^= BIT0; P1IFG &= ~BIT3; // clear the interrupt flag } So I hit the debug button in CCS 7.4, and it loads to the board. I have a breakpoint at stopping the watchdog timer and a breakpoint at toggling BIT0 in the ISR. I hit resume at the watchdog timer and start trying the button at P1.3. Maybe 1 out of 10 times I'll hit the breakpoint in the ISR but the rest of the time I get nothing. I apologize if this is just a really basic and dumb question, but I have Googled everything I can think of and searched the forums and come up with nothing. Any help is appreciated,
  • Create New...