#include <msp430g2553.h>
void main(void)
{
WDTCTL = WDTPW | WDTHOLD;
//P1SEL = BIT0 +BIT6;
P1DIR |= BIT0+BIT6;
P1DIR &= ~BIT3;
P1IE |= BIT3;
P1IES |=BIT3;
P1IFG &= ~BIT3;
P1REN |= BIT3;
P1OUT|=BIT0;
_bis_SR_register( GIE);
while(1)
{
P1OUT ^=BIT0;
__delay_cycles(500000);
}
}
#pragma vector = PORT1_VECTOR
__interrupt void port1_isr()
{
if ( P1IFG & BIT3)
{
P1OUT ^=BIT6 ;
P1IFG &= ~BIT3;
//P1IES ^= BIT3;
}
}
#include <msp430g2553.h>
int mode =1;
void main(void)
{
WDTCTL = WDTPW | WDTHOLD;
//P1SEL = BIT0 +BIT6;
P1DIR |= BIT0+BIT6;
P1DIR &= ~BIT3;
P1IE |= BIT3;
P1IES |=BIT3;
P1IFG &= ~BIT3;
P1REN |= BIT3;
P1OUT|=BIT0;
_bis_SR_register( GIE);
while(1)
{
switch( mode)
{
case 0:
//put fuction 0
P1OUT &= ~BIT0;
break;
case 1:
//put function 1
//example
P1OUT |= BIT0;
break;
default:
//put default function, if mode # 0,1
break;
}
}
}
#pragma vector = PORT1_VECTOR
__interrupt void port1_isr()
{
char int_flag = P1IFG;
P1IFG &=~ (int_flag);
switch( int_flag)
{
case BIT3:
mode ^= 1;
break;
default:
break;
}
}