1.代码:
#include <reg52.h>
typedef unsigned int u16;
typedef unsigned char u8;
sbit led = P1^0;
void delay(u16 num)
{
u16 x,y;
for(x=num; x>0; x--)
for(y=110; y>0; y--)
{
;//延时1ms
}
}
void main(void)
{
led = 1;//LED输出模式
while(1)
{
led = 0;
delay(500);
led = 1;
delay(500);
}
}
2.电路图: