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.

关于msp单片机浮空端口的读入



代码如下,对p2.0端口读入,发现除非p2.0接地,其余(浮空和接高电平)都是读出来的高,这是为什么啊,io口问题?


#include "io430.h"
#include "oled.h"
#include "stdint.h"

int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
OLED_Init();

P2DIR&=~BIT0;

while(1)
{

interface_3();

if(P2IN&BIT0)
{
delay_ms(10);
if(P2IN&BIT0)
{
interface_5();

delay_ms(100);

}

}
}
}