70,017
社区成员




#include<reg52.h>
#include<intrins.h>
typedef unsigned int u16;
typedef unsigned char u8;
#define LED_PORT P2
void delay_10us(u16 ten_us)
{
while(ten_us--);
}
void main()
{
u8 i=0;
P1=0xFF;
LED_PORT=~0x01;
delay_10us(50000);
while(1)
{
bit K=P1^0;
if(K==1)
{
LED_PORT=_cror_(LED_PORT,1);
delay_10us(50000);
}
else
{
LED_PORT=_crol_(LED_PORT,1);
delay_10us(50000);
}
}
}
编译出错么?出啥错?
代码和板子是一致的么?我是说引脚号码。
频率和延时函数是一致的么?要是差十倍,肉眼根本看不出来闪。
P1^0 这个没用吧~