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.

msp430g2231 floating error

Other Parts Discussed in Thread: MSP430G2231

this is my code ,but when i touch or connect empty pin led starts to glow 

pls help me how to resolve this problem


#include <msp430g2231.h>

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= 0x01; // Set P1.0 to output direction

while (1) // Test P1.4
{
if ((0x10 & P1IN)) P1OUT |= 0x01; // if P1.4 set, set P1.0
else P1OUT &= ~0x01; // else reset
}
}

  • Don't let P1.4 float.

    Drive it either high or low. For example:

    a) Connect it to push-button to ground + a pull-up resister (or internal pull-up)
    b) Connect it to push-button to Vcc + a pull-down resister (or internal pull-down)
    c) Connect it to an active signal that is either high or low

**Attention** This is a public forum