Other Parts Discussed in Thread: MSP-EXP430FR5969
DEar All,
Today I tried to test the button interface of the MSP-EXP430FR5969 Launchpad, button could not for some reason. Any of you please let me know how can I successfully detect the button press.
I have used the Blink program and modified the same to detect the button press and release. But the pin status to which the button is connected always shows 0 whether it is pressed or released.
My source code to test the button interface is as follows....Please let me know if the code is correct or anything missing or wrong.
void main (void)
{
BSP_Init();
P1DIR |= 0x01; // Set P1.0 to output direction
P4DIR |= 0x40; // Set P4.6 to output direction
P1DIR &= 0xFD; // Set P1.1 to input direction
P4DIR &= 0xDF; // Set P4.5 to input direction
while(1)
{
if(P4IN & 0x20)
{
P4OUT &= 0xDF;
}
else
{
P4OUT |= 0x40;
}
if(P1IN & 0x02)
{
P1OUT &= 0xFE;
}
else
{
P1OUT |= 0x01;
}
}
}
Thanks,
Raghu Devisetti