#include#define uchar unsigned char uchar code tab[]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*空白*/ 0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x24,0x18,/*0*/ //共阴 0x00,0x18,0x1C,0x18,0x18,0x18,0x18,0x18,0x3C,/*1*/ 0x00,0x3C,0x66,0x42,0x60,0x30,0x1C,0x86,0x7E,/*2*/ 0x00,0x3C,0x42,0x40,0x3C,0x40,0x40,0x42,0x3C,/*3*/ 0x00,0x30,0x38,0x2C,0x26,0x23,0xFF,0x20,0x20,/*4*/ 0x00,0x7E,0x02,0x3E,0x40,0x40,0x40,0x42,0x3C,/*5*/ 0x00,0x3C,0x42,0x02,0x3A,0x46,0x42,0x42,0x3C,/*6*/ 0x00,0x7C,0x42,0x40,0x20,0x10,0x08,0x08,0x08,/*7*/ 0x00,0x3C,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,/*8*/ 0x00,0x3C,0x42,0x42,0x42,0x7C,0x40,0x42,0x3C,/*9*/ 0x00,0x24,0x7E,0xFF,0xFF,0xFF,0x7E,0x3C,0x18,//心形 }; uchar count; void delay (uchar t) { uchar i=100; while(t--) while(i--); } void init_T() //中断和定时器初始化 { IE=0x82; //打开总中断,定时器T1和T0中断 TMOD=0x01; //设定T1,T0位工作方式1 TH0=0x9e; TL0=0x58; //T0装初值 TR0=1; //开始时钟开始工作 } void main() { uchar i,j; init_T(); while(1) { for(j=0;j<99;j++) //控制显示的字符数,一定要为8的整数倍 { for(count=0;count<5;) //此处控制每个字的滚动时间,5为1秒一帧,10为2秒,一次类推 { for(i=0;i<8;i++) //行扫描,此为8*8点阵,扫描8行 { P1=(0x01<
上一篇:Adc0831(模数转化)驱动程序
下一篇:查表法矩阵键盘
推荐阅读最新更新时间:2024-03-16 14:25