簡易點(diǎn)陣顯示器:
1、使用51單片機(jī)。
2、用4個16×16點(diǎn)陣實(shí)現(xiàn)漢字顯示:畢業(yè)快樂。
3、具有靜態(tài)和滾動顯示功能。
uchar next=0;//滾動控制
uchar time=0;
uchar start=0;//移位控制
uchar code str[] = {//編碼
0x00,0x00,0xFF,0x88,0x88,0x48,0x48,0x00,0x7F,0x88,0x84,0x84,0x82,0xE0,0x00,0x00,
0x00,0x10,0x60,0x80,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0xC0,0x30,0x00,0x00,
0x00,0xE0,0x00,0xFF,0x10,0x20,0x08,0x08,0x08,0xFF,0x08,0x08,0xF8,0x00,0x00,0x00,
0x00,0x00,0xE0,0x9C,0x84,0x84,0x84,0xF4,0x82,0x82,0x83,0x82,0x80,0x80,0x00,0x00,
0x04,0x04,0x05,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,/*"畢",0*/
0x40,0x40,0x40,0x43,0x40,0x7F,0x40,0x40,0x40,0x7F,0x42,0x41,0x40,0x40,0x40,0x00,/*"業(yè)",1*/
0x01,0x00,0x00,0xFF,0x00,0x81,0x41,0x31,0x0D,0x03,0x0D,0x31,0x41,0x81,0x81,0x00,/*"快",2*/
0x00,0x20,0x10,0x08,0x06,0x40,0x80,0x7F,0x00,0x00,0x02,0x04,0x08,0x30,0x00,0x00};/*"樂",3*/
void delay(uint xms)//延時(shí)函數(shù)
{
while(xms--);
}
void keyscan()//按鍵控制程序
{
if(!k1)//靜態(tài)
{
start=0;
next=0;
}
if(!k2)//動態(tài)
start=1;
}
void display()//顯示
{
uchar i;
for(i=0;i<64;i++)
{
P1=0xff;
keyscan();//按鍵檢測
P3=~str[(next+i)%64+64];
P2=~str[(next+i)%64];
P1=i;
delay(50);
}
}
//主程序
void main()
{
TMOD=0X01; //配置 16 位定時(shí)器/計(jì)數(shù)器
TH0=0x3c;//重新賦值計(jì)時(shí)初值 50ms
TL0=0xb0;
EA=1; //打開全局中斷
ET0=1; //打開定時(shí)/計(jì)數(shù) 0 中斷
TR0=1;
while(1) //主程序循環(huán)程序
{
display();
}
}
//定時(shí)器 1 中斷服務(wù)程序
void timer0() interrupt 1 using 1
{
if(time<3)//定時(shí)
文章借鑒于此紛傳
閱讀全文