#include <msp430f5529.h>
void main(void) {
WDTCTL = WDTPW | WDTHOLD;
volatile int temp;
P6DIR &=0x00;
P6SEL = 0X00;
P1DIR |= BIT0;
//temp=P6IN;
while(1)
{
if(P6IN)
{ P1OUT |= BIT0;}
else
P1OUT &= ~BIT0;
}
}
程序的大概意思是P6.1口读取热释电的高电平信号,当检测到高电平时,P1.0控制led亮 |
这是分享贴?感谢分享