免费文档

STC89C52单片机花样流水灯C语言程序Word版

传播优秀Word版文档,希望对您有帮助,可双击去除!

花样流水灯程序

#include<reg52.h>

#define uint unsigned int

#define uchar unsigned char

uchar num;

uchar code table[]={

0xaa,~0xaa,0x7e,0xbd,0xdb,

0xe7,0xf3,0xf9,0xfc,0xfa,

0xf6,0xee,0xde,0xbe,0x7e,

0xbe,0xde,0xee,0xf6,0xfa,

0xfc,0xf0,0xc0,0x0,0x5f,0xaf,0xd7,0xeb,0xf5,0xfa,0xff};

void delayms(uint);

void main()

{

while(1)

{

for(num=0;num<31;num++)

{

P2=table[num];

delayms(200);

}

P2=0x7f;

delayms(40);

P2=0x3f;

delayms(80);

P2=0x1f;

delayms(130);

P2=0x0f;

delayms(190);

P2=0x07;

delayms(260);

P2=0x03;

delayms(240);

P2=0x01;

delayms(330);

P2=0x00;

相关文档
热门文档
评论