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

MSP430G2553: Pin change Interrupt on P2.3

$
0
0

Part Number:MSP430G2553

Hello,

I am using MSP430G2553, specifically MSP430G2253IPW28 - TSSOP28 pin package.

The problem I am facing is with a button connected to the Pin P2.3.

There is no external pull-up on this pin only an internal Pull-up enabled upon configuration.

The program has a the PORT2_VECTOR configured.

But there is no interrupt break point hit.

There is an LED connected at Pin P1.0 in Active High configuration to indicate the occurrence of the interrupt.

Here is the snippet of the main I am trying to execute:

// P1.0 LED Active High/Low
// P2.3 Button Input with Pull-up

#include <msp430.h>

int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer

  BCSCTL1 = CALBC1_1MHZ;                    //set range for the O.
  DCOCTL  = CALDCO_1MHZ;                    //set DCO step  modulation 1MHZ

  P1DIR = 0x01;                             // P1.0 output, else input
  P1OUT =  0x0;                             // P1.0 LED Off

  P2DIR &= ~BIT3;                           // P2.3 Input
  P2REN |= BIT3;                            // P2.3 pullup
  P2SEL &=~BIT3;
  P2SEL2&=~BIT3;
  P2OUT |= BIT3;                            // P2.3 set

  __disable_interrupt();
  P2IES |= BIT3;                            // P2.3 Hi/lo edge
  P2IFG &= ~BIT3;                           // P2.3 IFG cleared
  P2IE |= BIT3;                             // P2.3 interrupt enabled

  while(1)
  //__bis_SR_register(LPM4_bits + GIE);       // Enter LPM4 w/interrupt
      __bis_SR_register(GIE);
}

// Port 2 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT2_VECTOR))) Port_2 (void)
#else
#error Compiler not supported!
#endif
{
  P1OUT ^= 0x01;                            // P1.0 = toggle
  P2IFG &= ~BIT3;                           // P2.3 IFG cleared
}

I would like to know if there is any mistake in the initialisation or configuration for P2.3.

Regards,

Ab


Viewing all articles
Browse latest Browse all 22002

Trending Articles



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