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.

MSP430F5438A: How to read the status of the PIN which is configured as output pin

Part Number: MSP430F5438A

Hello,

I am using MSP430F5438a controller.

I am configuring the pin as output using PxDIR register. If i want to read the status of the output pin can i use PxIN register.

Example:

P1DIR = 0x01;

if(PxIN & 0x01)

{

do some action;

}

or

if(PxOUT & 0x01)

{

do some action;

}

which is correct and what will be difference of reading the pin status using two register

Thanks in advance

  • Hello!

    If you want to read the status of the output pin, you will want to read the PxOUT register (your second option). The PxOUT register is a read/write register that allows you to assign the output pin value and also read the status of this register.

    The PxIN register is a read only register used to read the status of input pins.

    Thanks,

    Mitch

**Attention** This is a public forum