1.功能描述
2程序
#include <REGX51.H>
#define uint unsigned int
#define uchar unsigned char
sbit LED1=P1^0;
sbit LED2=P1^1;
sbit LED3=P1^2;
void delay(uint ms);
void main(void)
{
LED1=1;
LED2=1;
LED3=1;
while(3)
{
LED1=~LED1;
delay(3000);
LED2=~LED2;
delay(3000);
LED3=~LED3;
delay(3000);
}
}
void delay(uint ms)
{
uchar i;
uint j;
for(j=0;j<ms;j++)
{
for(i=0;i<125;i++)
{;}
}
}
3,电路图·