下面是一段简单的流水灯程序,请问,怎么样让单片机接通电源后延时400ms,然后再运行流水灯程序?
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar LED[]=
{
0XFE,0XFC,0XF8,0XF0,
0XE0,0XC0,0X80,0X00
};
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=124;j>0;j--);
}
void main()
{
uchar n;
while(1)
{
for(n=0;n<8;n++)
{
P2=LED[n];
delayms(50);
}
}
}
|