单片机点阵LED灯
代码如下:
#include
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
//unsigned char code tab[]={0x7f,0xbf,0xdf,0xef,0xfe,0xfd,0xfb,0xf7};
unsigned char code graph[3][8]={ {0x21,0x32,0xac,0x6c,0x32,0x21,0x3a,0x7f},
{0x00,0x02,0x04,0x0a,0xff,0x08,0x04,0x02},
{0xe1,0x55,0x55,0xdf,0x55,0x55,0x43,0x71}
};
unsigned char count;
unsigned char cnta;
sbit P1_0 = P1^0;
void main(void) {
unsigned char i,j;
TMOD=0x01;
TH0=(65536-4000)/256;
TL0=(65536-4000)%6;
TR0=1;
ET0=1;
EA=1;
while(1) {
if(P1_0==0) {
for(i=5;i>0;i--)
for(j=248;j>0;j--);
if(P1_0==0) {
count++;
if(count==3) {
count=0;
}
while(P1_0==0);
}
}
}
}
void t0(void) interrupt 1 using 0 {
TH0=(65536-4000)/256;
TL0=(65536-4000)%6;
P2=tab[cnta];
P3=graph[count][cnta];
cnta++;
if(cnta==8) {
}
}
单片机点阵LED 相关文章:
- 单片机程序-点阵LED显示I LVOE U(12-02)
- 单片机程序-点阵LED(11-30)
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)