Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22188

Compiler/MSP430FR5969: Switch press isn't calling the ISR

$
0
0

Part Number:MSP430FR5969

Tool/software: TI C/C++ Compiler

/*Here's the code:*/

#include <msp430.h> #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { P1OUT ^= 0x01; //toggle led P1IFG &= ~0x02; //PxIFG clear } void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode /************ Configure CS Registers **************/ CSCTL0_H = 0xA5; //UNLOCK CS Registers CSCTL1_H = 0x00; //Set DCO to 8Mhz CSCTL1_L = 0x0c; CSCTL2 = 0x0003 | 0x0100 | 0x0030; //setting DCO = SMCLK = MCLK CSCTL3 = 0x0000 | 0x0000 | 0x0000; // for now setting the divider value to 1 CSCTL0_H = 0x00; // lock the CS registers /****************************************************/ P1DIR |= 0x01; //set P1.0 as output pin P1OUT &= ~0x01; //set led as initial low P1REN |= 0x02; //Pull up register for switch P1IE |= 0x02; //PxIE - interrupt enable P1IES |= 0x02; //PxIES- high for falling edge P1IFG &= ~0x02; //Clear the PxIFG flag initially /* Interrupt v/s polling method examples Read more at : processors.wiki.ti.com/.../MSP430_LaunchPad_Interrupt_vs_Polling */ __bis_SR_register(LPM4_bits + GIE); // Enter Low Power Mode 4 with interrupt }

The problem I'm facing is that the code seems to get stuck at the line where it enters LPM4. The switch press, isn't generating interrupt. Please point out my mistake?


Viewing all articles
Browse latest Browse all 22188


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>