led点阵程序求教 万分感谢 请赐教

2019-03-24 18:55发布

#include <AT89X52.H>
unsigned char code tab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
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;
P0=tab[cnta];
P1=digittab[cntb][cnta];
cnta++;
if(cnta==8)
{
cnta=0;
}
timecount++;
if(timecount==333)
{
timecount=0;
cntb++;
if(cntb==10)
{
cntb=0;
}
}
请教下 第二行程序 有什么作用本人不是很理解 万分感谢  另求教下 点阵原理  万分感谢 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
11条回答
gunai
2019-03-25 20:59
其中unsigned char code   tab  []={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
对应P0=tab[cnta];
P1=digittab[cntb][cnta];
cnta++;
当cnta=1时P0=0x7f;对应二进制数0111 1111
当cnta=2时P0=0xbf;对应二进制数1011 1111
当cnta=3时P0=0xdf;对应二进制数1101 1111
当cnta=4时P0=0xef;对应二进制数1110 1111
当cnta=5时P0=0xf7;对应二进制数1111 0111
当cnta=6时P0=0xfb;对应二进制数1111 1011
当cnta=7时P0=0xfd;对应二进制数1111 1101
当cnta=8时P0=0xfe;对应二进制数1111 1110
也就是分别点亮相应的列。

一周热门 更多>