您的位置 首页 数字

8*8LED点阵显现0-9

电路很简单8*8点阵的行和列分别接在单片机的p3口和p1口,我测试成功includeAT89X52H>unsignedcharcodetab[]={0xfe,0xfd,0xfb,0

电路很简单8*8点阵的行和列别离接在单片机的p3口和p1口,我测验成功.

#include unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsigned char code digittab[10][8]={       {0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00},     //0{0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00},     //1{0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00},    //2{0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00},    //3{0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00},     //4{0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00},    //5{0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00},    //6{0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00},     //7{0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00},    //8{0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00}     //9};unsigned int timecount;unsigned char cnta;unsigned char cntb;void main(void){TMOD=0x01;TH0=(65536-3000)/256;TL0=(65536-3000)%256;TR0=1;ET0=1;EA=1;while(1){;}}void t0(void) interrupt 1 using 0{TH0=(65536-3000)/256;TL0=(65536-3000)%256;P3=tab[cnta];P1=digittab[cntb][cnta];cnta++;if(cnta==8){cnta=0;}timecount++;if(timecount==333){timecount=0;cntb++;if(cntb==10){cntb=0;}}}

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

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

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

微信扫一扫关注我们

返回顶部