Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MSP430 Rising Edge Interupt

Status
Not open for further replies.

Andy2k7

Newbie level 3
Joined
Feb 29, 2012
Messages
4
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,323
OK im doing a uni project where im connecting up a keypad to the MSP430. I have all the rest of my code sorted out but what im struggling with is a way to have my interrupt only trigger on either a rising or falling edge not on both. That's my code below but like I said when P1.4 goes high the LED's come on but when I let go off the button they go off.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "io430.h"
#define LED0 BIT0
#define LED1 BIT6 
 
void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;
  P1DIR |= (LED0 + LED1);
  P1OUT &= ~(LED0 + LED1);
  P1IE |= BIT4;
  P1IFG &= ~BIT4;
  
  __enable_interrupt();
  
  while(1)
  {
  }
}
 
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1OUT ^= (LED0 + LED1); // P1.0 = toggle
P1IFG &= ~BIT4; // P1.4 IFG cleared
P1IES ^= BIT4; // toggle the interrupt edge,
}

 
Last edited:

Hello!

I can't believe you ask us this question.
If the MCU triggers on both edges, it's simply because you tell it to trigger on both edges.
Read the comment you have written on line 26 and you will understand the whole problem.

Or perhaps it's not code you wrote yourself. More likely you have copied it from somewhere
without understanding what it does and you complain it does not work the way you want.

Please read it step by step and try to understand every step. After all it's a university
project so it would be better if you learn something with it, right?

Dora.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top