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.

msp430的launch pad 开发板

P1.3通过S2按下是接地,再按下S2之前,先将P1.3上拉,按下S2后,P1.3为0,松手后P1.3依旧为0(已检测P1.3在按下按键前后的电压),为何?是因为刚开始设置P1.3为输入,按下S2相当于命令P1.3=0,而后面没有P1.3=1的指令吗?S2松手不能看做是一条类似P1.3=1的指令?

  • xi,

      你直接将P1.3设置成输入,然后去读取P1.3的电平就行了。考虑到你按键的抖动,你可以用延时消抖或是用定时中断读取的方式去查看P1.3的输入电平。

    这样会比较好一些。

    谢谢

x 出现错误。请重试或与管理员联系。