自己没事随便写的
有需要的自己看吧
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
uchar a[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f, //正向流水
0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff, //反向流水
0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, //隔灯闪烁三次
0xf0,0x0f,0xf0,0x0f,0xf0,0x0f, //高四位、低四位闪烁两次
0x33,0xcc,0x33,0xcc,0x33,0xcc,0xff}; //隔两盏闪烁三次
void delay (uint z)
{
uint i,j;
for(i=0;i<z;i++)
for(j=0;j<i;j++);
}
void main(void)
{
uchar i;
P0=0xff;
while(1)
{
for(i=0;i<8;i++)
{
P0=a[i];
delay(200);
}
}
}
|