Quantcast
Channel: MSP 低功耗微控制器论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 3634

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

$
0
0

代码如下,对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);

}

}
}
}


Viewing all articles
Browse latest Browse all 3634

Trending Articles