您的位置 首页 厂商

单片机点阵LED灯

电路图如下:代码如下:#includereg51.h>unsignedcharcodetab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//unsi

电路图如下:


代码如下:
#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) {
cnta=0;
}
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/changshang/262781.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部