/* AM12864系列测试程序 1.0 */
/* Designed by Andorin LCM R&D Group */
/* 2003.04.23 */
/********************************************/
#include
#include
#include
#include
#include
#include
/********************************************/
/* AM12864系列测试程序 1.0 */
/* Designed by Andorin LCM R&D Group */
/* 2003.04.23 */
/********************************************/
/* Define the register command co
#define Disp_On 0x3f
#define Disp_Off 0x3e
#define Col_Add 0x40
#define Page_Add 0xb8
#define Start_Line 0xc0
#define Lcd_Bus P1 //MCU P1<------> LCM
sbit Mcs=P3^3; //Master chip enable
sbit Scs=P3^4; //Slave chip enable
sbit Enable=P3^0; //6800 mode Enable single
sbit Di=P3^5; //Da
sbit RW=P3^6; //Write or Read
sbit Lcd_Rst=P3^2; //Lcm reset
sbit Test_Key=P3^1;
char co
/*-- 文字: 测 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00,
0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00
};
char co
/*-- 文字: 试 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,
0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00
};
char co
/*-- 文字: 开 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00
};
char co
/*-- 文字: 始 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x10,0x90,0x70,0x1F,0x12,0xF0,0x00,0x20,0x70,0x28,0x27,0x22,0x28,0x70,0x20,0x00,
0x40,0x21,0x12,0x0C,0x06,0x09,0x30,0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00
};
char co
/*-- 文字: 完 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x90,0x8C,0xA4,0xA4,0xA4,0xA5,0xA6,0xA4,0xA4,0xA4,0xA4,0x94,0x8C,0x04,0x00,
0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x70,0x00,0x00
};
char co
/*-- 文字: 毕 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0xFF,0x88,0x48,0x28,0x08,0x80,0x7F,0x88,0x88,0x88,0x84,0x84,0xE0,0x00,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00
};
/* AM12864B系列测试首页显示内容 */
/*****************/
/* ANDORIN */
/* 安的利光电科技*/
/* AM12864 */
/* 测试程序 1.0 */
/*****************/
unsigned char co
/*-- 调入了一幅图像:\\Andorin-server\开发部\arin\12864.bmp --*/
/*-- 宽度x高度=128x64 --*/
0x00,0x00,0x00,0x80,0xF0,0xFE,0x7E,0x0E,0x7E,0xFE,0xF0,0x80,0x00,0x00,0x00,0x00,
0xFE,0xFE,0xFE,0x3C,0xF0,0xE0,0x80,0x00,0x00,0xFE,0xFE,0xFE,0x00,0x00,0x00,0xFE,
0xFE,0xFE,0x0E,0x0E,0x0E,0x0E,0x0E,0x3E,0xFC,0xF8,0xE0,0x00,0x00,0xE0,0xF8,0xFC,
0x3C,0x1E,0x0E,0x0E,0x0E,0x0E,0x1E,0x3C,0xFC,0xF8,0xE0,0x00,0x00,0x00,0xFE,0xFE,
0xFE,0x8E,0x8E,0x8E,0x8E,0x8E,0xFE,0xFC,0xF8,0x00,0x00,0x00,0xFE,0xFE,0xFE,0x00,
0x00,0xFE,0xFE,0xFE,0x3C,0xF0,0xE0,0x80,0x00,0x00,0xFE,0xFE,0xFE,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,
0x80,0xF0,0xFE,0x7F,0x1F,0x1D,0x1C,0x1C,0x1C,0x1D,0x1F,0x7F,0xFE,0xF0,0x80,0x00,
0xFF,0xFF,0xFF,0x00,0x00,0x03,0x0F,0x3E,0x78,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,
0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0x70,0x7F,0x3F,0x0F,0x00,0x00,0x0F,0x3F,0x7F,
0x78,0xF0,0xE0,0xE0,0xE0,0xE0,0xF0,0x78,0x7F,0x3F,0x0F,0x00,0x00,0x00,0xFF,0xFF,
0xFF,0x03,0x03,0x03,0x0F,0x1F,0x7D,0xF9,0xE0,0x80,0x00,0x00,0xFF,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0xFF,0x00,0x00,0x03,0x0F,0x3E,0x78,0xFF,0xFF,0xFF,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,0x40,0x30,0x10,0x10,0x10,0xD0,0x12,0x1C,0x10,0x10,0x10,0x10,0x50,
0x30,0x00,0x00,0x00,0x00,0xF0,0x10,0x18,0x16,0x10,0xF0,0x80,0x40,0x30,0x1E,0x10,
0x10,0x10,0xF8,0x10,0x00,0x00,0x40,0x48,0x48,0x48,0xC8,0xF8,0x44,0x46,0x44,0x40,
0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x60,0x00,0x00,
0xFE,0x00,0x80,0x60,0x18,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,
0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0xF8,0x10,0x00,0x00,0x00,0x48,0x48,0x48,0x44,
0xFC,0x42,0x42,0x40,0x80,0x08,0x30,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x20,0x20,
0x20,0xFE,0x20,0x20,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x30,0x20,0x00,0x00,
0x00,0x00,0x01,0x01,0x01,0x01,0x09,0x8F,0x91,0x51,0x21,0x21,0x59,0x47,0x81,0x81,
0x81,0x01,0x00,0x00,0x00,0xFF,0x42,0x42,0x42,0x42,0xFF,0x00,0x00,0x01,0x0E,0x80,
0x00,0x80,0x7F,0x00,0x00,0x00,0x20,0x10,0x08,0x06,0x01,0xFF,0x01,0x02,0x0C,0x00,
0x00,0x1F,0x80,0x00,0xFF,0x00,0x00,0x00,0x01,0x01,0x01,0x81,0x41,0x3F,0x01,0x01,
0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0xF1,0x00,0x00,0x00,0x00,0x1F,0x09,0x09,0x09,
0x09,0xFF,0x09,0x09,0x09,0x09,0x09,0x1F,0xC0,0x00,0x00,0x00,0x10,0x08,0x04,0x03,
0xFF,0x01,0x06,0x10,0x10,0x13,0x08,0x08,0x08,0xFF,0x04,0x04,0x00,0x00,0x04,0x84,
0x02,0xFF,0x01,0x01,0x00,0x81,0x87,0x59,0x21,0x51,0x4D,0x83,0x81,0x80,0x00,0x00,
0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x80,0xF1,0x7C,0x0C,0x7C,0xF0,0x80,
0x01,0x00,0x00,0xFC,0xFC,0x3C,0xF8,0xC0,0x00,0x00,0x00,0xC1,0xF8,0x3C,0xFC,0xFC,
0x00,0x00,0x00,0x61,0x30,0x18,0xFC,0xFC,0x01,0x01,0x01,0x00,0x30,0x38,0x1C,0x0C,
0x0C,0x1C,0xF9,0xF1,0x01,0x01,0x71,0xF9,0x8C,0x8C,0x8C,0x8C,0xF8,0x70,0x00,0x00,
0xE0,0xF8,0x1D,0x8D,0x8D,0x8D,0x19,0x11,0x01,0x00,0x00,0xC0,0xE0,0x38,0xFC,0xFC,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,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,0x60,0x7C,0x1F,0x07,0x06,0x06,0x06,0x07,0x1F,
0x7C,0x60,0x00,0x7F,0x7F,0x00,0x01,0x1F,0x7C,0x60,0x7C,0x1F,0x01,0x00,0x7F,0x7F,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x00,0x00,0x00,0x00,0x60,0x70,0x78,0x6C,
0x66,0x63,0x61,0x60,0x00,0x00,0x1E,0x3F,0x61,0x61,0x61,0x61,0x3F,0x1E,0x00,0x00,
0x0F,0x3F,0x73,0x61,0x61,0x61,0x3F,0x1E,0x00,0x0E,0x0F,0x0D,0x0C,0x0C,0x7F,0x7F,
0x0C,0x0C,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,0x10,0x61,0x06,0xC0,
0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0x00,0xF8,0x00,0xFF,0x00,0x00,0x00,0x80,0x82,
0x84,0x8C,0x00,0x10,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x14,0x10,0x00,0x00,
0x24,0x24,0xA4,0xFE,0xA2,0x23,0x22,0x80,0xBE,0xA2,0xA2,0xA2,0xA2,0xA2,0xBF,0x82,
0x00,0x00,0x00,0x00,0xFC,0x04,0x14,0x14,0x14,0x15,0x56,0x94,0x54,0x34,0x14,0x14,
0x06,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x18,0xFC,0xFC,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF8,0x1C,0x0C,0x0C,0x1C,0xF8,0xF0,
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,0x08,0x08,0x7E,0x81,
0x40,0x27,0x10,0x0F,0x10,0x67,0x00,0x00,0x4F,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0x20,0x10,0x20,0x60,0x3F,0x10,0x10,0x03,0x1C,0x20,0x40,0xF0,0x00,0x00,
0x10,0x0E,0x01,0xFF,0x00,0x03,0x80,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0xC8,
0x80,0x00,0x80,0x60,0x1F,0x00,0x01,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x01,0x05,
0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x00,
0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x1F,0x3F,0x70,0x60,0x60,0x70,0x3F,0x1F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/*------------------延时子程序-----------------------------*/
void delay(unsigned int t)
{
unsigned int i,j;
for(i=0;i
;
}
/*------------------写命令到LCD------------------------------*/
void write_com(unsigned char cmdcode)
{
Di=0;
RW=0;
Lcd_Bus=cmdcode;
delay(0);
Enable=1;
delay(0);
Enable=0;
}
/*-------------------写数据到LCD----------------------------*/
void write_da
{
Di=1;
RW=0;
Lcd_Bus=Dispdata;
delay(0);
Enable=1;
delay(0);
Enable=0;
}
/*-------------------读LCD数据----------------------------*/
unsigned char read_da
{
unsigned char tmpin;
Di=1;
RW=1;
delay(0);
Enable=1;
delay(0);
Enable=0;
tmpin=Lcd_Bus;
return tmpin;
}
/*------------------显示边框-------------------------------*/
void frame()
{
unsigned char i;
Mcs=1;
Scs=1;
write_com(Page_Add+0);
write_com(Col_Add+0);
for(i=0;i<64;i++) write_da
write_com(Page_Add+7);
write_com(Col_Add+0);
for(i=0;i<64;i++) write_da
for(i=0;i<8;i++)
{
Mcs=0;
Scs=1;
write_com(Page_Add+i);
write_com(Col_Add+63);
write_da
Mcs=1;
Scs=0;
write_com(Page_Add+i);
write_com(Col_Add+0);
write_da
}
}
/*------------------清除内存---------------*/
void Clr_Scr()
{
unsigned char j,k;
Mcs=1;Scs=1;
write_com(Page_Add+0);
write_com(Col_Add+0);
for(k=0;k<8;k++){
write_com(Page_Add+k);
for(j=0;j<64;j++)write_da
}
}
/*------------------显示12864图片---------------------------*/
void Disp_Img(unsigned char co
{
unsigned char j,k;
for(k=0;k<8;k++){
Mcs=1;Scs=0;delay(10);
write_com(Page_Add+k);
write_com(Col_Add+0);
for(j=0;j<64;j++) write_da
Mcs=0;Scs=1; delay(10);
write_com(Page_Add+k);
write_com(Col_Add+0);
for(j=64;j<128;j++) write_da
}
}
/*------------------显示横---------------------------*/
void Disp_H_Line()
{
unsigned char i,j;
Mcs=1;
Scs=1;
write_com(Disp_On);
write_com(Page_Add);
write_com(Start_Line);
write_com(Col_Add);
for(j=0;j<8;j++)
{
write_com(Page_Add+j);
write_com(Col_Add+0);
// write_com(Start_Line+0);
for(i=0;i<64;i++)write_da
}
}
/*------------------显示列-----------------------------*/
void Disp_V_Line()
{
unsigned char i,j;
write_com(Disp_On);
write_com(Page_Add);
write_com(Start_Line);
write_com(Col_Add);
for(j=0;j<8;j++)
{
write_com(Page_Add+j);
write_com(Col_Add+0);
write_com(Start_Line+0);
for(i=0;i<32;i++)
{
write_da
write_da
}
}
}
/*------------------棋盘-----------------------------*/
void Disp_Cross_Line(unsigned char mode)
{
unsigned char i,j;
unsigned char da
if(mode==0) {da
else if(mode==1) {da
else return;
Mcs=1;Scs=1;
write_com(Disp_On);
write_com(Page_Add);
write_com(Start_Line);
write_com(Col_Add);
for(j=0;j<8;j++)
{
write_com(Page_Add+j);
write_com(Col_Add+0);
write_com(Start_Line+0);
for(i=0;i<32;i++){
write_da
write_da
}
}
}
/*---------------------指定位置显示汉字16*16-----------------------*/
void hz_disp16(unsigned char pag,unsigned char col, unsigned char co
{
unsigned char j=0,i=0;
for(j=0;j<2;j++){
write_com(Page_Add+pag+j);
write_com(Col_Add+col);
for(i=0;i<16;i++) write_da
}
}
/*------------------初始化LCD屏--------------------------*/
void init_lcd()
{
Lcd_Rst=0;
delay(100);
Lcd_Rst=1;
delay(100);
Mcs=1;
Scs=1;
delay(100);
write_com(Disp_Off);
write_com(Page_Add+0);
write_com(Start_Line+0);
write_com(Col_Add+0);
write_com(Disp_On);
}
/*------------------------------信息显示------------------------*/
void Msg(int flg)
{
Clr_Scr();
frame();
if(flg==0){ //显示“测试开始”
Mcs=1;Scs=0;
hz_disp16(3,32,ce);
delay(2000);
hz_disp16(3,48,shi);
delay(2000);
Mcs=0;Scs=1;
hz_disp16(3,0,kai);
delay(2000);
hz_disp16(3,16,shi3);
delay(2000);
}
else if(flg==1){ //显示“测试完毕”
Mcs=1;Scs=0;
hz_disp16(3,32,ce);
hz_disp16(3,48,shi);
Mcs=0;Scs=1;
hz_disp16(3,0,wan);
hz_disp16(3,16,bi);
}
}
/*--------------------------------键盘扫描-------------------------*/
void Key_Scan()
{
while(Test_Key);
while(~Test_Key);
}
/*--------------------主程序---------------------------------*/
main()
{
unsigned char i=0;
while(1){
// Key_Scan();
init_lcd();
Disp_Img(FirstPage);
delay(10000);
// Key_Scan();
Msg(0);
delay(10000);
Disp_H_Line();
delay(10000);
Disp_V_Line();
delay(10000);
Msg(1);
delay(10000);
}
}
上一篇:8051中断定时器及串行口初始化
下一篇:VB实现PC与单片机串口通信
推荐阅读最新更新时间:2024-03-16 15:16
设计资源 培训 开发板 精华推荐
- 开学季!EEworld下载中心 Cortex主题资源上传
- 是德科技电子书,下载有礼进行时!
- 我们猜啦!MDO3000之竞猜有奖:免费的部分会值多少?
- 阅读是德科技 Power Supply、汽车电子精彩专题,让您的设计更精准!参与答题赢好礼!
- 体积小、功耗低、安全性高,专用加密芯片ATSHA204 精彩专题,答题有好礼!
- ADI有奖下载之电磁流量计解决方案
- VISHAY医疗主题月 幸运闯关赢大奖!
- 3月21日有奖直播:ADI新一代高阻抗输入SAR ADC的优势与应用
- EEWORLD芯积分上线,加分规则公示~关系到每一个EE网友
- #Micropython大作战#第三弹:抢楼!大家一起来整理micropython资料