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.

CCS/MSP430G2553: CCS/MSP430G2553

Part Number: MSP430G2553

Tool/software: Code Composer Studio

Hiiii,

im using msp430 launcher pad, im trying to connect two input at same port but not working properly

one pin is working but but other is not responding, what shall i do for this?/

#include <msp430.h>

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD; //Stop watchdog timer to Prevent PUC Reset


       P2DIR = 0b00000000 ; //explicitly making P1.3 as Input - even though by default its Input
       P2REN = 0b11111111; //Enable Pullup/down
       P2OUT = 0b11111111; //Select Pullup

    P1DIR |= BIT6; //Configuring P1.6(LED2) as Output
    P1OUT |= BIT6; //drive output HIGH initially
    P1DIR |= BIT0;
    P1OUT &= ~BIT0;
    while(1)
    {      P1OUT &= ~BIT0;
           P1OUT &= ~BIT6;
        if( !(P2IN & BIT1))
        {
         P1OUT |= BIT0;
         P1OUT &= ~BIT6;
        }
        if( !(P2IN & BIT2))
                {
                P1OUT |= BIT6;
                 P1OUT &= ~BIT0;
                }
        else
           {
            P1OUT |= BIT0;
            P1OUT |= BIT6;
           }
    }
    //return 0; //this won't execute normally
}

this is my code in this pin 2.2 is working properly but p2.1 is not working.

also send me code for pullup resistor with two input.

thank you

  • Hello Vinod,

    When posting code to the forum, please use the </> button as it will format the code to make it easier to read. This will lead to better rand faster responses to your issue. When replying to a post and posting code, the </> button can be found in the advanced editor found by clicking the "Insert Code, Attach Files and more..." link to the bottom write of the comment box. I've already edited your orignal post to reflect this change.

    The main issue I see with your code is the test for P2.1 doesn't matter in your above code as it will be overwritten by the else statement attached to your check on P2.2. You need an if / else if / else structure to get the result I think you are after.
  • sir,

    You didn't understand my problem.

    i want a program in which there should have 2 input with +ve trigger.

    when there is no trigger 2 led should be on, when i trigger 1st pin one led should off and when i trigger 2nd will off

    can you please send me this kind of program in polling method

  • issue is solve by using delay...

**Attention** This is a public forum