51單片機驅(qū)動16X16點陣(上移左移閃爍顯示)
仿真文件里面有電路圖下載地址:http://www.51hei.com/bbs/dpj-20402-1.html,大家可以用protues直接看到效果
下面是源代碼:
/*本次16X16點陣顯示各種方式的顯示程序全部由本人編寫,由于本人學(xué)習(xí)C語言并不是太深,正好借此機會讓各位老師學(xué)習(xí)學(xué)習(xí)。*/
/*本次顯示程序的設(shè)計分三個階斷
第一階段:左移顯示方式的設(shè)計
第二階段:上移顯示方式的設(shè)計
第三階段:閃爍顯示方式的設(shè)計 */
#include
#define uchar unsigned char
#define uint unsigned int
uchar table1[]={
0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,
0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"O",0*/
0x08,0x20,0xF8,0x3F,0x88,0x20,0xC0,0x01,
0x28,0x26,0x18,0x38,0x08,0x20,0x00,0x00};/*"K",1*//*上移顯示的字符*/
uchar code table[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0C,0x20,0x0C,0x38,
0x0C,0x0F,0xEC,0x03,
0x7F,0x60,0x0F,0x63,
0xCC,0x31,0x0C,0x18,
0xEC,0x0F,0xEC,0x07,
0x0C,0x0C,0x0C,0x19,
0x8C,0x31,0xCC,0x60,
0x0C,0x20,0x00,0x00,/*"灰",0*/
0x20,0x00,0x30,0x00,
0xF8,0x3F,0xFC,0x7F,
0x6F,0x63,0x6F,0x63,
0xEC,0x63,0xFC,0x63,
0x7C,0x63,0x6C,0x63,
0x64,0x63,0xE0,0x63,
0xE0,0x73,0x00,0x30,
0x00,0x00,0x00,0x00,/*"色",1*/
0x00,0x00,0x9C,0x60,
0xDC,0x60,0x4C,0x66,
0x6C,0x66,0x2C,0x66,
0x0D,0x66,0x0F,0x7E,
0x0E,0x7E,0x2C,0x66,
0x6C,0x66,0x4C,0x66,
0xCC,0x66,0x9C,0x60,
0x1C,0x60,0x00,0x00,/*"空",2*/
0x00,0x00,0xF8,0x7F,
0xFB,0x7F,0x07,0x00,
0xF6,0x0F,0xF0,0x0F,
0x36,0x0D,0x36,0x0D,
0x36,0x0D,0xF6,0x0F,
0xF6,0x2F,0x06,0x60,
0xFE,0x7F,0xFE,0x3F,
0x00,0x00,0x00,0x00,/*"間",3*//*左移顯示的字符*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uchar code table2[]={
0x60,0x06,0x6C,0x06,
0x6C,0x66,0xFC,0x7F,
0xFE,0x3F,0x66,0x03,
0x66,0x23,0x60,0x30,
0xFF,0x33,0xFF,0x1F,
0x60,0x1C,0x66,0x37,
0x6C,0x63,0x68,0x70,
0x00,0x70,0x00,0x00,/*"我",0*/
0x70,0x08,0x76,0x18,
0xB6,0x5D,0xBE,0x4D,
0xBE,0x67,0xF6,0x6F,
0xF6,0x3D,0xBE,0x35,
0xBE,0x35,0xB3,0x3D,
0xBB,0x6D,0xBF,0x65,
0xF7,0x61,0x70,0x60,
0x00,0x20,0x00,0x00,/*"愛",1*/
0x00,0x00,0xF8,0x18,
0x48,0x20,0x48,0x20,
0x48,0x20,0x48,0x20,
0x88,0x1F,0x00,0x00,/*"5",2*/
0x00,0x00,0x20,0x00,
0x30,0x00,0xF8,0x3F,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,/*"1",3*/
0x00,0x00,0x00,0x18,
0xFC,0x1B,0xFC,0x1B,
0x6D,0x1B,0x6F,0x1B,
0x6E,0x1B,0xFC,0x7F,
0xFC,0x7F,0x6E,0x1B,
0x6F,0x1B,0x6D,0x1B,
0xFC,0x1B,0xFC,0x1B,
0x00,0x18,0x00,0x00,/*"單",4*/
0x00,0x00,0x00,0x60,
0x00,0x38,0xFE,0x1F,
0xFE,0x07,0x30,0x03,
0x30,0x03,0x30,0x03,
0x30,0x03,0x3F,0x03,
0x3F,0x7F,0x30,0x7F,
0x30,0x00,0x30,0x00,
0x00,0x00,0x00,0x00,/*"片",5*/
0x18,0x06,0x98,0x03,
0xFF,0x7F,0xFF,0x7F,
0x98,0x01,0x18,0x23,
0x00,0x70,0xFE,0x3F,
0xFE,0x0F,0x06,0x00,
0x06,0x00,0xFE,0x3F,
0xFE,0x7F,0x00,0x60,
0x00,0x70,0x00,0x00,/*"機",6*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/*閃爍顯示字符*/
uchar v,flag,temp;
uchar i,j,k,shuz,shub,temp1;
uchar a,b,c,d,e,f,numa,numb;
uchar ii,jj,kk;
uchar iii,jjj,kkk;
uchar a3,b3;
uchar num3,temp3;
uchar temp2;
sbit le=P3^0;/*各變量值的初始化*/
void init();/*主函數(shù)的初始化聲名*/
void init1();/*左移顯示方式的初始化聲名*/
void init2();/*上移顯示方式的初始化聲名*/
void init3();/*閃爍顯示方式的初始化聲名*/
void disp1();/*左移顯示子程序聲名*/
void disp2();/*上移顯示子程序聲名*/
void disp3();/*閃爍顯示子程序聲名*/
評論