Hi,
This is my first post here.
I just have a basic problem about the usage of IES. (interrupt enable edge select)
I have mspg2553, button is located at P1.3 and red led at P1.0. I want to light the led with pushing button. So I wrote a code, enable everything needed, select pull up resistor, so when I push the button I get low in P1.3 port and enable flag is set. This is what happens when I release P1IES as it is. But if I want to use pull down resistor and make configuration in P1OUT and P1ES, I can't get the flag so interrupt. What s wrong? Is there anything wrong logically?
here is the code. pull up resistor selected. when we push the button P1.3 gets 0 and IE sense the high to low transition and set flag(I suppose)
#include <msp430g2553.h>
// P1.0 red led
// P1.3 button
void main(void) {
WDTCTL = WDTPW | WDTHOLD;
P1DIR = BIT0 ;
P1REN |= BIT3 ;
P1OUT |= BIT3 ; //pull up selected
P1IES |= BIT3; //set it high to low
P1IE |= BIT3 ;
P1IFG &= ~BIT3 ;
_BIS_SR(GIE + LPM0_bits );
//_bis_SR_register(GIE + LPM0_bits);
}
#pragma vector = PORT1_VECTOR
__interrupt void A(void){
volatile unsigned int a;
P1OUT ^= BIT0;
for(a = 0 ; a < 50000 ; a++){
}
P1IFG &= ~BIT3;
}
here is the other code. I select pull down configuration. when I push the button P1.3 port gets 1 and due to low to high transition IE should sense and set the flag but it doesnt.
#include <msp430g2553.h>
// P1.0 red led
// P1.3 button
void main(void) {
WDTCTL = WDTPW | WDTHOLD;
P1DIR = BIT0 ;
P1REN |= BIT3 ;
P1OUT &= ~BIT3 ; //pull down selected
P1IES &= ~ BIT3; //set it low to high
P1IE |= BIT3 ;
P1IFG &= ~BIT3 ;
_BIS_SR(GIE + LPM0_bits );
//_bis_SR_register(GIE + LPM0_bits);
}
#pragma vector = PORT1_VECTOR
__interrupt void A(void){
volatile unsigned int a;
P1OUT ^= BIT0;
for(a = 0 ; a < 50000 ; a++){
}
P1IFG &= ~BIT3;
}
what should I do to use pull down resistor confguration? thanks