/************************************************************************
函數(shù)庫(kù)名稱:12864顯示函數(shù)
設(shè)計(jì)者: 05級(jí)新本一班 易龍明
************************************************************************/
#ifndef _12864_h_
#define _12864_h_
#include<reg51.h>
#include<absacc.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
#define PORT P0
uchar code Num[]={ //32×32字節(jié)的漢字取模,一個(gè)漢字72字節(jié)
0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x10,
0x00,0x00,0x18,0x00,0x08,0x76,0x00,0x88,
0xF3,0x07,0xF8,0x11,0x07,0x78,0x10,0x03,
0x08,0x13,0x01,0x0C,0x9B,0x01,0xE4,0xF9,
0x01,0xFE,0x30,0x01,0x1C,0x10,0x00,0x00,
0x00,0x00,0xF0,0xFF,0xFF,0xF0,0xFF,0xFF,
0x30,0x00,0x00,0x10,0x86,0x00,0xD0,0x85,
0x00,0xF8,0x9C,0x01,0x38,0xF8,0x01,0x10,
0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,//紹
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x08,0x00,0x1C,0xF8,0xFF,0x3F,0xF8,
0xFF,0x0F,0x08,0x04,0x00,0xFC,0x0F,0x00,
0x3C,0x0F,0x00,0x0C,0x08,0x00,0x00,0x00,
0x00,0x20,0x00,0x00,0xE0,0xFF,0x07,0xE0,
0xFF,0x07,0x60,0x0C,0x03,0x20,0x0C,0x01,
0x20,0x0C,0x01,0x30,0x0C,0x01,0x30,0x00,
0x01,0xF0,0xFF,0x0F,0xF0,0xFF,0x07,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//陽 72
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,
0x00,0x00,0x1F,0x01,0x80,0x07,0x03,0x00,
0x01,0x03,0x0C,0x01,0x01,0x9C,0x09,0x01,
0xB8,0x8C,0x01,0x80,0x8C,0x41,0x86,0x8C,
0xC0,0x9E,0xA4,0xC0,0x98,0xE4,0xFF,0x80,
0xDE,0x7F,0x60,0x8E,0x00,0x7F,0xCC,0x00,
0x4F,0xC0,0x00,0x43,0xC0,0x00,0x40,0xC3,
0x00,0xC0,0xC3,0x00,0xC0,0xC1,0x00,0x80,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//學(xué) 144
0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,
0x1C,0xF0,0xFF,0x1F,0x10,0x04,0x00,0x18,
0x04,0x00,0xFC,0x0F,0x10,0x1C,0x1E,0x10,
0x08,0x00,0x08,0xE0,0x23,0x0C,0xE0,0x30,
0x07,0x40,0xF2,0x01,0x26,0xD2,0x00,0x2E,
0x12,0x00,0x2C,0xF3,0x0F,0x28,0xFB,0x1C,
0x30,0x19,0x10,0xF0,0x18,0x10,0x70,0x08,
0x10,0x70,0x00,0x18,0x60,0x00,0x1C,0x00,
0x80,0x1F,0x00,0x00,0x08,0x00,0x00,0x00,//院 216
0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,
0x00,0x00,0x46,0x00,0x00,0x47,0x00,0xC0,
0x45,0x00,0xF0,0x64,0x1E,0x7E,0xFE,0x1F,
0x4E,0x26,0x0C,0x60,0x32,0x06,0x60,0x32,
0x42,0x00,0x00,0x40,0x30,0x86,0x21,0x70,
0xFF,0x33,0x20,0x03,0x18,0x03,0xD9,0x0F,
0xFF,0xF9,0x03,0x06,0x09,0x04,0x20,0x01,
0x0C,0xB0,0xFF,0x1B,0x1C,0xFF,0x39,0x0C,
0x00,0x70,0x08,0x00,0x00,0x00,0x00,0x00,//鎖 288
0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,
0x00,0x00,0x08,0x10,0x00,0x08,0x10,0x10,
0x0C,0x08,0x10,0x0C,0x0E,0x10,0x84,0x03,
0xF8,0xFF,0x01,0xF8,0x3F,0x00,0x18,0x06,
0x00,0x18,0x06,0x00,0x1C,0x06,0x00,0xFC,
0xFF,0x07,0xFC,0xFF,0xFF,0x0C,0x02,0x00,
0x0C,0x03,0x00,0x0C,0x03,0x00,0x00,0x03,
0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,
0x03,0x00,0x00,0x02,0x00,0x00,0x00,0x00,//開 360
};
uchar code Tab[]={ //16×16字節(jié)的漢字取模,一個(gè)漢字32個(gè)字節(jié)
0x00,0x00,0x40,0x44,0xD8,0x00,0x40,0xBC,
0x84,0x84,0x84,0xBC,0x40,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0x28,0x24,0x11,
0x16,0x08,0x16,0x11,0x20,0x20,0x00,0x00,//設(shè)
0x00,0x00,0x40,0x44,0xD8,0x00,0x40,0x40,
0x40,0x40,0xFC,0x40,0x60,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0x08,0x04,0x00,
0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,//計(jì) +32
0x00,0x00,0x40,0x40,0x48,0x48,0x48,0xFC,
0x48,0x68,0x50,0x48,0x64,0x40,0x00,0x00,
0x00,0x00,0x04,0x04,0x02,0x3F,0x15,0x15,
0x15,0x15,0x15,0x3F,0x00,0x00,0x00,0x00,//者 +64
0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,
0x48,0x48,0x48,0xFC,0x08,0x00,0x00,0x00,
0x00,0x07,0x02,0x02,0x02,0x02,0x3F,0x42,
0x42,0x42,0x42,0x47,0x40,0x70,0x00,0x00,//電 +96
0x80,0x80,0x82,0x82,0x82,0x82,0x82,0xE2,
0xA2,0x92,0x8A,0x86,0x80,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//子 +128
0x10,0x4C,0x24,0x04,0xF4,0x84,0x4D,0x56,
0x24,0x24,0x14,0x84,0x24,0x54,0x0C,0x00,
0x00,0x01,0xFD,0x41,0x40,0x41,0x41,0x7F,
0x41,0x41,0x41,0x41,0xFC,0x00,0x00,0x00,//密 +160
0x02,0x82,0xF2,0x4E,0x43,0xE2,0x42,0xFA,
0x02,0x02,0x02,0xFF,0x02,0x80,0x00,0x00,
0x01,0x00,0x7F,0x20,0x20,0x7F,0x08,0x09,
0x09,0x09,0x0D,0x49,0x81,0x7F,0x01,0x00,//碼 +192
0x80,0x40,0x70,0xCF,0x48,0x48,0x00,0xE2,
0x2C,0x20,0xBF,0x20,0x28,0xF6,0x20,0x00,
0x00,0x02,0x02,0x7F,0x22,0x92,0x80,0x4F,
0x40,0x20,0x1F,0x20,0x20,0x4F,0x80,0x00,//鎖 +224
0x20,0x22,0xEC,0x00,0x20,0x22,0xAA,0xAA,
0xAA,0xBF,0xAA,0xAA,0xEB,0xA2,0x20,0x00,
0x00,0x00,0x7F,0x20,0x10,0x00,0xFF,0x0A,
0x0A,0x0A,0x4A,0x8A,0x7F,0x00,0x00,0x00,//請(qǐng) 256
0x88,0x68,0x1F,0xC8,0x0C,0x28,0x90,0xA8,
0xA6,0xA1,0x26,0x28,0x10,0xB0,0x10,0x00,
0x09,0x09,0x05,0xFF,0x05,0x00,0xFF,0x0A,
0x8A,0xFF,0x00,0x1F,0x80,0xFF,0x00,0x00,//輸 288
0x00,0x00,0x00,0x00,0x00,0x01,0xE2,0x1C,
0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,
0x00,0x03,0x0C,0x30,0x40,0xC0,0x40,0x00,//入 320
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x33,0x33,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//: 冒號(hào) 352
0x80,0x40,0x70,0xCF,0x48,0x48,0x48,0x48,
0x7F,0x48,0x48,0x7F,0xC8,0x68,0x40,0x00,
0x00,0x02,0x02,0x7F,0x22,0x12,0x00,0xFF,
0x49,0x49,0x49,0x49,0xFF,0x01,0x00,0x00,//錯(cuò) 384
0x40,0x42,0xC4,0x0C,0x00,0x40,0x5E,0x52,
0x52,0xD2,0x52,0x52,0x5F,0x42,0x00,0x00,
0x00,0x00,0x7F,0x20,0x12,0x82,0x42,0x22,
0x1A,0x07,0x1A,0x22,0x42,0xC3,0x42,0x00,//誤 416
0x08,0x08,0x0A,0xEA,0xAA,0xAA,0xAA,0xFE,
0xAA,0xAA,0xA9,0xF9,0x29,0x0C,0x08,0x00,
0x40,0x40,0x48,0x4B,0x4A,0x4A,0x4A,0x7F,
0x4A,0x4A,0x4A,0x4B,0x48,0x60,0x40,0x00,//重 448
0x40,0x44,0x54,0x65,0xC6,0x64,0xD6,0x44,
0x40,0xFC,0x44,0x42,0xC3,0x62,0x40,0x00,
0x20,0x11,0x49,0x81,0x7F,0x01,0x05,0x29,
0x18,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,//新 480
0x40,0x42,0x44,0xCC,0x00,0x60,0x5E,0x48,
0xC8,0x7F,0xC8,0x48,0x4C,0x68,0x40,0x00,
0x00,0x40,0x20,0x1F,0x20,0x60,0x90,0x8C,
0x83,0x80,0x8F,0x90,0x90,0xD0,0x5C,0x00,//選 512
0x10,0x10,0x10,0xFF,0x90,0x50,0x82,0x46,
0x2A,0x92,0x2A,0x46,0x82,0x80,0x80,0x00,
0x02,0x42,0x81,0x7F,0x00,0x09,0x08,0x09,
0x09,0xFF,0x09,0x09,0x0C,0x09,0x00,0x00,//擇 544
0x80,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,
0x82,0x82,0xFE,0x82,0x83,0xC2,0x80,0x00,
0x00,0x80,0x40,0x30,0x0F,0x00,0x00,0x00,
0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,//開 576
0x40,0x20,0xF8,0x07,0xF0,0xA0,0x90,0x4F,
0x54,0x24,0xD4,0x4C,0x84,0x80,0x80,0x00,
0x00,0x00,0xFF,0x00,0x0F,0x80,0x92,0x52,
0x49,0x25,0x24,0x12,0x08,0x00,0x00,0x00,//修 608
0x04,0xC4,0x44,0x44,0x44,0xFE,0x44,0x20,
0xDF,0x10,0x10,0x10,0xF0,0x18,0x10,0x00,
0x00,0x7F,0x20,0x20,0x10,0x90,0x80,0x40,
0x21,0x16,0x08,0x16,0x61,0xC0,0x40,0x00,//改 640
0x00,0x02,0x02,0xF2,0x92,0x92,0x92,0xFE,
0x92,0x92,0x92,0xFA,0x13,0x02,0x00,0x00,
0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x07,
0x04,0x44,0x84,0x7F,0x04,0x06,0x04,0x00,//再 672
0x00,0x02,0x04,0x8C,0x40,0x00,0x20,0x18,
0x17,0xD0,0x10,0x50,0x38,0x10,0x00,0x00,
0x02,0x02,0xFF,0x00,0x80,0x40,0x20,0x10,
0x0C,0x03,0x0C,0x10,0x60,0xC0,0x40,0x00,//次 704
0x04,0x84,0xE4,0x9C,0x84,0xC6,0x24,0xF0,
0x28,0x27,0xF4,0x2C,0x24,0xF0,0x20,0x00,
0x01,0x00,0x7F,0x20,0x20,0xBF,0x40,0x3F,
0x09,0x09,0x7F,0x09,0x89,0xFF,0x00,0x00,//確 736
0x40,0x42,0x44,0xCC,0x00,0x00,0x00,0x00,
0xC0,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3F,0x90,0x48,0x30,0x0E,
0x01,0x00,0x01,0x0E,0x30,0xC0,0x40,0x00,//認(rèn) 768
0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0x08,
0x7F,0x88,0x0A,0x0C,0x08,0xC8,0x00,0x00,
0x40,0x20,0x1F,0x00,0x08,0x10,0x0F,0x40,
0x20,0x13,0x1C,0x24,0x43,0x80,0xF0,0x00,//成 800
0x08,0x08,0x08,0xF8,0x0C,0x28,0x20,0x20,
0xFF,0x20,0x20,0x20,0x20,0xF0,0x20,0x00,
0x08,0x18,0x08,0x0F,0x84,0x44,0x20,0x1C,
0x03,0x20,0x40,0x80,0x40,0x3F,0x00,0x00,//功 832
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xF8,
0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,
0x3F,0x20,0x00,0x00,0x00,0x00,0x00,0x00,//1 864
0x00,0x00,0x00,0x00,0x30,0x38,0x0C,0x04,
0x04,0x0C,0xF8,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x20,0x30,0x38,0x2C,
0x26,0x23,0x21,0x38,0x00,0x00,0x00,0x00,//2 896
0x00,0x00,0x00,0x08,0xF8,0xF8,0x80,0xE0,
0x78,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x0F,0x0F,0x00,0x03,
0x0F,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,//k 928
0x00,0x00,0x00,0x00,0x08,0xF8,0xF8,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x08,0x0F,0x0F,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//i 960
0x00,0x00,0x00,0x08,0xF8,0xF8,0x08,0x18,
0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x0F,0x0F,0x08,0x0C,
0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,//d 992
};
uchar code star[]={0x00,0x08,0x2A,0x1C,0x1C,0x2A,0x08,0x00,};//輸入密碼時(shí)顯示的符號(hào),而不顯示真正的密碼
sbit CS1=P1^0;
sbit CS2=P1^1;
sbit RS=P1^2;
sbit RW=P1^3;
sbit E=P1^4;
sbit bflag=P0^7;
//**************************************************************************驅(qū)動(dòng)函數(shù)
void Left()
{
CS1=0;
CS2=1;
}
void Right()
{
CS1=1;
CS2=0;
}
void Busy_12864()
{
do{E=0;
RS=0;
RW=1;
PORT=0xff;
E=1;
E=0;}while(bflag);
}
void Wreg(uchar c)
{
Busy_12864();
RS=0;
RW=0;
PORT=c;
E=1;
E=0;
}
void Wdata(uchar c)
{
Busy_12864();
RS=1;
RW=0;
PORT=c;
E=1;
E=0;
}
void Pagefirst(uchar c)
{
uchar i;
i=c;
c=i|0xb8;
Busy_12864();
Wreg(c);
}
void Linefirst(uchar c)
{
uchar i;
i=c;
c=i|0x40;
Busy_12864();
Wreg(c);
}
//********************************************************************
void Ready_12864() //清屏函數(shù)
{
uint i,j;
Left();
Wreg(0x3f);
Right();
Wreg(0x3f);
Left();
for(i=0;i<8;i++)
{
Pagefirst(i);
Linefirst(0x00);
for(j=0;j<64;j++)
{
Wdata(0x00);
}
}
Right();
for(i=0;i<8;i++)
{
Pagefirst(i);
Linefirst(0x00);
for(j=0;j<64;j++)
{
Wdata(0x00);
}
}
}
//**********************************************************************************
void Display(uchar *s,uchar page,uchar line) //16×16的漢字顯示函數(shù) ,下半排列取模
{
uchar i,j;
Pagefirst(page);
Linefirst(line);
for(i=0;i<16;i++)
{ Wdata(*s);
s++;
}
Pagefirst(page+1);
Linefirst(line);
for(j=0;j<16;j++)
{ Wdata(*s);
s++;
}
}
//********************************************************************************
void Display_32(uchar *s,uchar page,uchar line) //24×24的漢字顯示函數(shù),下上排列取模
{
uchar i,j;
for(i=0;i<24;i++)
{
for(j=0;j<3;j++)
{
Pagefirst(page+j);
Linefirst(line+i);
Wdata(*s);
s++;
}
}
}
//*******************************************************************************
void star_12864(uchar *s,uchar page,uchar line) //com=10,18,26,,.在顯示屏上寫入星號(hào),代表密碼
{
uchar i;
Pagefirst(page);
Linefirst(line);
for(i=0;i<8;i++)
{Wdata(*s);
s++;}
}
void point_12864(uchar page,uchar line) //在顯示屏上畫一條線
{
uchar i;
Pagefirst(page);
Linefirst(line);
for(i=0;i<56;i++)
{
Wdata(0x1e);
}
}
void Init_12864() //初始化,顯示實(shí)驗(yàn)名稱
{
Ready_12864(); //邵陽學(xué)院
Left();
Display_32(Num,0x00,16);
Display_32(Num+72,0x00,40);
point_12864(0x03,8);
Display(Tab,0x04,16);
Display(Tab+32,0x04,32);
Display(Tab+64,0x04,48);
Display(Tab+96,0x06,16);
Display(Tab+128,0x06,32);
Display(Tab+160,0x06,48);
Right();
Display_32(Num+144,0x00,0);
Display_32(Num+216,0x00,24);
point_12864(0x03,0);
Display(Tab+352,0x04,0);
Display(Tab+928,0x04,4);
Display(Tab+960,0x04,18);
Display(Tab+992,0x04,30);
Display(Tab+192,0x06,0);
Display(Tab+224,0x06,16);
}
void System() //在顯示屏上顯示初始字幕:請(qǐng)輸入密碼
{
Ready_12864();
Left();
Display(Tab+256,0x02,16);
Display(Tab+288,0x02,32);
Display(Tab+320,0x02,48);
point_12864(0x04,8);
Right();
Display(Tab+160,0x02,0);
Display(Tab+192,0x02,16);
Display(Tab+352,0x02,32);
point_12864(0x04,0);
}
void error() //密碼錯(cuò)誤,重新輸入密碼
{
Ready_12864();
Left();
Display(Tab+160,0x02,32);
Display(Tab+192,0x02,48);
Display(Tab+448,0x04,16);
Display(Tab+480,0x04,32);
Display(Tab+288,0x04,48);
Right();
Display(Tab+384,0x02,0);
Display(Tab+416,0x02,16);
Display(Tab+320,0x04,0);
Display(Tab+160,0x04,16);
Display(Tab+192,0x04,32);
}
void true() //請(qǐng)選擇 1 開鎖 2 修改密碼
{
Ready_12864();
Left();
Display(Tab+256,0x00,0);
Display(Tab+512,0x00,16);
Display(Tab+544,0x00,32);
Display(Tab+352,0x00,48);
Display(Tab+864,0x03,0);
Display(Tab+576,0x03,16);
Display(Tab+224,0x03,32);
Display(Tab+896,0x06,0);
Display(Tab+608,0x06,16);
Display(Tab+640,0x06,32);
Display(Tab+160,0x06,48);
Right();
Display(Tab+192,0x06,0);
}
void unlock() //開鎖畫面
{
Ready_12864();
Left();
Display_32(Num+288,0x03,20);
point_12864(0x02,8);
point_12864(0x06,8);
Right();
Display_32(Num+360,0x03,20);
point_12864(0x02,0);
point_12864(0x06,0);
}
void again() //請(qǐng)?jiān)俅屋斎朊艽a
{
Ready_12864();
Left();
Display(Tab+256,0x00,0);
Display(Tab+672,0x00,16);
Display(Tab+704,0x00,32);
Display(Tab+288,0x00,48);
Right();
Display(Tab+320,0x00,0);
Display(Tab+160,0x00,16);
Display(Tab+192,0x00,32);
Display(Tab+352,0x00,48);
}
void repeat() //密碼確認(rèn)錯(cuò)誤,請(qǐng)重新修改密碼
{
Ready_12864();
Left();
Display(Tab+160,0x02,16);
Display(Tab+192,0x02,32);
Display(Tab+736,0x02,48);
Display(Tab+256,0x04,16);
Display(Tab+448,0x04,32);
Display(Tab+480,0x04,48);
Right();
Display(Tab+768,0x02,0);
Display(Tab+384,0x02,16);
Display(Tab+416,0x02,32);
Display(Tab+608,0x04,0);
Display(Tab+640,0x04,16);
Display(Tab+160,0x04,32);
Display(Tab+192,0x04,48);
}
void succeed() //修改密碼成功
{
Ready_12864();
Left();
Display(Tab+608,0x02,16);
Display(Tab+640,0x02,32);
Display(Tab+160,0x02,48);
Right();
Display(Tab+192,0x02,0);
Display(Tab+800,0x02,16);
Display(Tab+832,0x02,32);
}
#endif
|