单片机开发板是自己做的,电路很简单8*8点阵的行和列分别接在单片机的p0口和p1口,p0口记得要上拉电阻哦,我测试成功见图片,
#includeunsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; unsigned char code graph[]={0x30,0x48,0x44,0x22,0x44,0x48,0x30,0x00}; unsigned char cnta; void main(void) { unsigned int i,j; TMOD=0x01; TH0=(65536-2000)/256; TL0=(65536-2000)%256; TR0=1; ET0=1; EA=1; while(1) { } } void t0(void) interrupt 1 using 0 { TH0=(65536-2000)/256; TL0=(65536-2000)%256; P1=tab[cnta]; P0=graph[cnta]; cnta++; if(cnta==8) { cnta=0; } }
上一篇:32*32点阵LED显示汉字-STC单片机
下一篇:一个闹钟的单片机程序
推荐阅读最新更新时间:2024-03-16 13:05