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:如何读取配置为输出引脚的引脚的状态

Guru**** 2551110 points
Other Parts Discussed in Thread: MSP430F5438A

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/789435/msp430f5438a-how-to-read-the-status-of-the-pin-which-is-configured-as-output-pin

器件型号:MSP430F5438A

您好!

我使用的是 MSP430F5438a 控制器。

我正在使用 PxDIR 寄存器将该引脚配置为输出。 如果我想读取输出引脚的状态、我可以使用 PxIN 寄存器。

示例:

P1DIR = 0x01;

IF (PxIN & 0x01)

采取一些行动;

IF (PxOUT & 0x01)

采取一些行动;

这是正确的、使用两个寄存器读取引脚状态的区别是什么

提前感谢

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    如果要读取输出引脚的状态、则需要读取 PxOUT 寄存器(第二个选项)。 PxOUT 寄存器是一个读/写寄存器、可让您分配输出引脚值并读取该寄存器的状态。

    PxIN 寄存器是用于读取输入引脚状态的只读寄存器。

    谢谢、

    Mitch