Part Number:MSP430FR5739
I wrote a code which lights up leds when two switches connected to pins in port 3 are pressed together. The code is displayed below:
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop the watchdog timer
P3DIR = 0; // Set P3as inputs
P3REN = (BIT0 + BIT1 + BIT2 + BIT3); // Pull BIT 0,1 HIGH and Keep them HIGH.
P3OUT = (BIT0 | BIT1 | BIT2 | BIT3);
PJDIR = ( BIT0 + BIT1 + BIT2 + BIT3); // Set outputs in PORT
PJOUT = 0; //set initial outputs to LOW
while (1) {
if ((!(P3IN & 0x04)) && (!(P3IN & 0x08))) {
PJOUT = ( BIT0 + BIT1 + BIT2 + BIT3);
}
}
}
The code failed to work as expected and it turned out that adding a external pullup resistor to port 3.2 solved my problem.
Is there any particular reason why the internal pullup configuration of port3.3 works fine but not in port 3.2?
P.S. I am using the FRAM experimeter's board which consists the MSP430FR5739 MCU.
Thanks in advance.