This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR5994: Input Pin Not Being Tied Low

Part Number: MSP430FR5994

Hi,

I am attempting to initialize a pin (4.2) as an input pin tied low, but after configuration, it remains tied high. I am using the timer to periodically poll the value on the pin, and the value is always 4 (meaning BIT2 = 1) unless I tie that pin to ground using a jumper, in which case the value printed is 0.

Can anyone point out what is going wrong? My code is attached below.

#include <msp430.h> 
#include <stdio.h>

//Global Variables
volatile int read = 0;

/**
 * main.c
 */
int main(void)
{
	WDTCTL = WDTPW | WDTHOLD;	//Stop WDT

	//Configure Pins
    P4OUT = 0;
    P4DIR = ~BIT2;          //Set 4.2 as Input
    P4REN = BIT2;           //Enable pulldown resistor 4.2

    PM5CTL0 &= ~LOCKLPM5;       // Disable the GPIO power-on default high-impedance mode
                                // to activate previously configured port settings

    //Set Timer A0
    TA0CCTL0 = CCIE;                        // CCR0 interrupt enabled
    TA0CTL = TASSEL__ACLK | MC_1;           // Clock used is ACLK, Up mode (0 to TA0CCR0)
    TA0CCR0 =  65535;

    __enable_interrupt();

    printf("TestProgram Start:\n");

    while(1);
}

#pragma vector = TIMER0_A0_VECTOR;
__interrupt void Timer_A0 (void){
   P1OUT ^= BIT0;
   read = P4IN;
   printf("Input: %d\n", read);
}

Thanks, 

John

**Attention** This is a public forum