官方参考程序:
//OCM12864参考程序
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
#define disp_off 0x3e
#define disp_on 0x3f
#define disp_x 0xb8
#define disp_z 0xc0
#define disp_y 0x40
#define comm 0
#define dat 1
#define data_ora P1 //MCU P1<------> LCM
sbit di =P3^0; //Data or Instrument Select,H:写数据,L:写指令
sbit rw =P3^1; //Write or Read,H:read,L:write
sbit e =P3^2; //读写使能
sbit cs1=P3^3; //cs1=H,选择左半屏
sbit cs2=P3^4; //cs2=H,选择右半屏
sbit rst=P3^5; //Lcm reset,低有效
sbit bf =P1^7;
sbit res=P1^4;
void chk_busy (void);
uchar code hz11[]={
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
/*-- 文字: 金 --*/
0x40,0x40,0x20,0x20,0x50,0x48,0x44,0xC3,0x44,0x48,0x50,0x50,0x20,0x60,0x20,0x00,
0x40,0x40,0x42,0x42,0x4A,0x72,0x42,0x7F,0x42,0x62,0x5A,0x42,0x42,0x40,0x40,0x00,
/*-- 文字: 鹏 --*/
0x00,0xFE,0x12,0xFE,0x00,0xFE,0x12,0xFE,0x00,0xFC,0x0E,0x35,0x44,0x7C,0x00,0x00,
0x20,0x1F,0x21,0x7F,0x20,0x1F,0x41,0x7F,0x08,0x09,0x09,0x29,0x49,0x21,0x1F,0x00,
/*-- 文字: 科 --*/
0x10,0x12,0x92,0x72,0xFE,0x51,0x91,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00,
0x04,0x02,0x01,0x00,0xFF,0x00,0x04,0x04,0x04,0x02,0x02,0x02,0xFF,0x01,0x01,0x00,
/*-- 文字: 技 --*/
0x08,0x08,0x88,0xFF,0x48,0x28,0x00,0xC8,0x48,0x48,0x7F,0x48,0xC8,0x48,0x08,0x00,
0x01,0x41,0x80,0x7F,0x00,0x40,0x40,0x20,0x13,0x0C,0x0C,0x12,0x21,0x60,0x20,0x00,
/*-- 文字: 奥 --*/
0xFF,0xFF,0x01,0xDD,0xD5,0x4D,0x9C,0x01,0x9D,0x4D,0x55,0xDD,0x01,0xFF,0xFF,0xFF,
0x7F,0x7B,0xBA,0xBB,0xDA,0xEB,0xF3,0xF8,0xF3,0xEB,0xDA,0xDB,0xBA,0x3B,0xBB,0xFF,
/*-- 文字: 可 --*/
0xFF,0xFD,0xFD,0x0D,0xED,0xED,0xED,0xED,0x0D,0xFD,0xFD,0xFD,0x01,0xFD,0xFD,0xFF,
0xFF,0xFF,0xFF,0xF8,0xFD,0xFD,0xFD,0xFD,0xF8,0xEF,0xDF,0xBF,0xC0,0xFF,0xFF,0xFF,
/*-- 文字: 拉 --*/
0xEF,0xEF,0xEF,0x00,0x6F,0xAF,0xFF,0xB7,0x76,0xF5,0xF1,0xF7,0x17,0xB7,0xF7,0xFF,
0xFD,0xBD,0x7E,0x80,0xFF,0xDF,0xDF,0xDF,0xDE,0xC1,0xDF,0xC3,0xDC,0xDF,0xDF,0xFF,
/*-- 文字: 液 --*/
0xEF,0x9E,0xF9,0x1F,0xE7,0x7B,0x1B,0xE3,0x7B,0x9A,0x41,0xDB,0x5B,0x9B,0xFB,0xFF,
0xFB,0xFB,0x00,0xFF,0xFE,0xFF,0x00,0xBE,0xDE,0xED,0xF3,0xE4,0x9E,0x3F,0xBF,0xFF};
uchar code hz12[]={
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
/*-- 文字: 有 --*/
0x00,0x04,0x84,0x44,0xE4,0x34,0x2C,0x27,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0x00,
0x02,0x01,0x00,0x00,0xFF,0x09,0x09,0x09,0x29,0x49,0xC9,0x7F,0x00,0x00,0x00,0x00,
/*-- 文字: 限 --*/
0xFE,0x02,0x32,0x4E,0x82,0x00,0xFE,0x4A,0xCA,0x4A,0x4A,0x4A,0x7E,0x00,0x00,0x00,
0xFF,0x00,0x02,0x04,0x03,0x00,0xFF,0x40,0x20,0x03,0x0C,0x12,0x21,0x60,0x20,0x00,
/*-- 文字: 公 --*/
0x00,0x00,0x80,0x40,0x30,0x0E,0x84,0x00,0x00,0x0E,0x10,0x60,0xC0,0x80,0x80,0x00,
0x00,0x01,0x20,0x70,0x28,0x24,0x23,0x31,0x10,0x10,0x14,0x78,0x30,0x01,0x00,0x00,
/*-- 文字: 司 --*/
0x00,0x10,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x12,0x02,0x02,0xFE,0x00,0x00,
0x00,0x00,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x0F,0x00,0x20,0x40,0x3F,0x00,0x00,
/*-- 文字: 晶 --*/
0xFF,0xFF,0xFF,0xFF,0x81,0xD5,0xD5,0xD5,0xD5,0xD5,0xD5,0x81,0xFF,0xFF,0xFF,0xFF,
0xFF,0x80,0xDA,0xDA,0xDA,0xDA,0x80,0xFF,0xFF,0x80,0xDA,0xDA,0xDA,0xDA,0x80,0xFF,
/*-- 文字: 显 --*/
0xFF,0xFF,0xFF,0xC1,0xD5,0x15,0xD5,0xD5,0xD5,0x15,0xD5,0xC1,0xFF,0xFF,0xFF,0xFF,
0xDF,0xDE,0xDD,0xD3,0xDF,0xC0,0xDF,0xDF,0xDF,0xC0,0xD7,0xDB,0xDC,0xDF,0xDF,0xFF,
/*-- 文字: 示 --*/
0xFF,0xDF,0xDF,0xDD,0xDD,0xDD,0xDD,0x1D,0xDD,0xDD,0xDD,0xDD,0xDD,0xDF,0xDF,0xFF,
0xEF,0xF7,0xFB,0xFC,0xFF,0xBF,0x7F,0x80,0xFF,0xFF,0xFE,0xFD,0xF3,0xE7,0xFF,0xFF,
/*-- 文字: 器 --*/
0xBF,0xBF,0xB0,0xB6,0xB6,0x36,0x30,0x8F,0x3F,0x30,0xB6,0xA6,0x96,0xB0,0xFF,0xFF,
0xFD,0xFD,0x81,0xBA,0xBA,0xBB,0x83,0xFF,0x83,0xBB,0xBA,0xBA,0x81,0xF9,0xFD,0xFF};
uchar code hz31[]={
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
/*-- 文字: G --*/
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,
/*-- 文字: o --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,
/*-- 文字: l --*/
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
/*-- 文字: d --*/
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,
/*-- 文字: e --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,
/*-- 文字: n --*/
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,
/*-- 文字: --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: P --*/
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,
/*-- 文字: T --*/
0xE7,0xF7,0xF7,0x07,0xF7,0xF7,0xE7,0xFF,0xFF,0xFF,0xDF,0xC0,0xDF,0xFF,0xFF,0xFF,
/*-- 文字: E --*/
0xF7,0x07,0x77,0x77,0x17,0xF7,0xEF,0xFF,0xDF,0xC0,0xDF,0xDF,0xDC,0xDF,0xE7,0xFF,
/*-- 文字: L --*/
0xF7,0x07,0xF7,0xFF,0xFF,0xFF,0xFF,0xFF,0xDF,0xC0,0xDF,0xDF,0xDF,0xDF,0xCF,0xFF,
/*-- 文字: : --*/
0xFF,0xFF,0xFF,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xCF,0xCF,0xFF,0xFF,0xFF,
/*-- 文字: 0 --*/
0xFF,0x1F,0xEF,0xF7,0xF7,0xEF,0x1F,0xFF,0xFF,0xF0,0xEF,0xDF,0xDF,0xEF,0xF0,0xFF,
/*-- 文字: 7 --*/
0xFF,0xC7,0xF7,0xF7,0x37,0xC7,0xF7,0xFF,0xFF,0xFF,0xFF,0xC0,0xFF,0xFF,0xFF,0xFF,
/*-- 文字: 5 --*/
0xFF,0x07,0xF7,0x77,0x77,0xF7,0xF7,0xFF,0xFF,0xE6,0xDE,0xDF,0xDF,0xEE,0xF1,0xFF,
/*-- 文字: 8 --*/
0xFF,0x8F,0x77,0xF7,0xF7,0x77,0x8F,0xFF,0xFF,0xE3,0xDD,0xDE,0xDE,0xDD,0xE3,0xFF};
uchar code hz32[]={
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
/*-- 文字: a --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,
/*-- 文字: l --*/
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
/*-- 文字: m --*/
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,
/*-- 文字: --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: T --*/
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,
/*-- 文字: E --*/
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,
/*-- 文字: C --*/
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,
/*-- 文字: H --*/
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,
/*-- 文字: - --*/
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
/*-- 文字: 2 --*/
0xFF,0x8F,0xF7,0xF7,0xF7,0x77,0x8F,0xFF,0xFF,0xCF,0xD7,0xDB,0xDD,0xDE,0xCF,0xFF,
/*-- 文字: 2 --*/
0xFF,0x8F,0xF7,0xF7,0xF7,0x77,0x8F,0xFF,0xFF,0xCF,0xD7,0xDB,0xDD,0xDE,0xCF,0xFF,
/*-- 文字: 6 --*/
0xFF,0x1F,0xEF,0x77,0x77,0xE7,0xFF,0xFF,0xFF,0xF0,0xEE,0xDF,0xDF,0xEE,0xF1,0xFF,
/*-- 文字: 3 --*/
0xFF,0xCF,0xF7,0x77,0x77,0xB7,0xCF,0xFF,0xFF,0xE7,0xDF,0xDF,0xDF,0xEE,0xF1,0xFF,
/*-- 文字: 8 --*/
0xFF,0x8F,0x77,0xF7,0xF7,0x77,0x8F,0xFF,0xFF,0xE3,0xDD,0xDE,0xDE,0xDD,0xE3,0xFF,
/*-- 文字: 5 --*/
0xFF,0x07,0xF7,0x77,0x77,0xF7,0xF7,0xFF,0xFF,0xE6,0xDE,0xDF,0xDF,0xEE,0xF1,0xFF,
/*-- 文字: 8 --*/
0xFF,0x8F,0x77,0xF7,0xF7,0x77,0x8F,0xFF,0xFF,0xE3,0xDD,0xDE,0xDE,0xDD,0xE3,0xFF};
uchar code tab31[]={
/*-- 调入了一幅图像:F:\梁\画图\GPTB.bmp --*/
/*-- 宽度x高度=32x32 --*/
0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x10,0x48,0xD4,0xB4,0x62,0xC2,0x82,0x02,
0x02,0x02,0x02,0x84,0xC4,0xE0,0xA0,0xE0,0x60,0x20,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFE,0x01,0x00,0x04,0x0D,0x1B,0x36,0x6D,0xDB,0xF6,0xED,0xFB,
0xFE,0xFE,0xFF,0x7F,0x1F,0x07,0x01,0x00,0x10,0x10,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x10,0x20,0x40,0x40,0x80,0x83,0xFF,0xFF,
0xFF,0xFF,0x83,0x40,0x40,0x20,0x10,0x08,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0x7C,0x44,0xEC,0x00,0x7C,0x44,0x7C,0x00,0x7C,0x40,0x40,0x00,0x7C,0x44,0x38,0x00,
0x7C,0x14,0x1C,0x00,0x78,0x24,0x78,0x00,0x7C,0x40,0x40,0x00,0x7C,0x18,0x18,0x7C};
uchar code tab32[]={
/*-- 调入了一幅图像:F:\梁\画图\GPTB2.bmp --*/
/*-- 宽度x高度=32x32 --*/
0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xBF,0xDF,0xEF,0xB7,0x2B,0x4B,0x9D,0x3D,0x7D,0xFD,
0xFD,0xFD,0xFD,0x7B,0x3B,0x1F,0x5F,0x1F,0x9F,0xDF,0xDF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x01,0xFE,0xFF,0xFB,0xF2,0xE4,0xC9,0x92,0x24,0x09,0x12,0x04,
0x01,0x01,0x00,0x80,0xE0,0xF8,0xFE,0xFF,0xEF,0xEF,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xFB,0xF7,0xEF,0xDF,0xBF,0xBF,0x7F,0x7C,0x00,0x00,
0x00,0x00,0x7C,0xBF,0xBF,0xDF,0xEF,0xF7,0xFB,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x83,0xBB,0x13,0xFF,0x83,0xBB,0x83,0xFF,0x83,0xBF,0xBF,0xFF,0x83,0xBB,0xC7,0xFF,
0x83,0xEB,0xE3,0xFF,0x87,0xDB,0x87,0xFF,0x83,0xBF,0xBF,0xFF,0x83,0xE7,0xE7,0x83};
uchar code tab5[]={
/*-- 调入了一幅图像:F:\梁\其它\COCK.bmp --*/
/*-- 宽度x高度=128x64 --*/
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,
0xC0,0xE0,0x70,0x00,0x00,0x80,0xC0,0xE0,0xF0,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,
0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xE0,0xF0,0x78,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,
0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,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,0xC0,0xE0,0xF0,0xFF,0xFE,0xFE,0xFC,0xCF,0xCF,
0xFF,0xFF,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x7E,0x7E,0x7F,0x3F,0x3F,0x3F,0x3E,
0x1E,0x1E,0x0E,0x0E,0x07,0x03,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,
0xF0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0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0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x3F,
0x3F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x3F,0x3F,0x1F,
0x1F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x07,
0x03,0x03,0x0F,0x10,0x00,0x00,0x00,0x3C,0x0F,0x07,0x07,0x07,0x03,0x00,0x00,0x1E,
0x07,0x07,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,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,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,0x80,0xC0,0x61,0x33,0x1F,0x1F,0x1F,0x73,0x80,0x80,0x01,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x49,0x39,0x13,0x13,0x0F,0x14,0x04,
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,
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,0x08,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x14,0x0C,0x04,
0x06,0x06,0x03,0x09,0x00,0x00,0x00,0x07,0x07,0x00,0x00,0x02,0x00,0x00,0x00,0x04,
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,
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
};
/*---------------延时子程序----------------*/
void delay (uint us)
{
while(us--);
}
void delay1 (uint ms)
{
uint i,j;
for(i=0;i<ms;i++)
for(j=0;j<1000;j++)
;
}
/*------------写数据或命令到LCD--------------*/
void wr_lcd (uchar dat_comm,uchar content)
{
chk_busy ();
di=dat_comm;
rw=0;
data_ora=content;
e=1;
;
e=0;
}
/*--------------读LCD数据---------------*/
uchar rd_lcd ()
{
uchar rddata;
chk_busy ();
di=1;
rw=1;
e=1;
;
rddata=data_ora;
e=0;
return rddata;
}
void chk_busy (void)
{
data_ora=0xff;
di=0;
rw=1;
;
e=1;
while(bf||res==1);
e=0;
}
/*--------------写点阵------------------*/
void lat_disp (uchar data1,uchar data2)
{
uchar i,j;
cs1=1;cs2=1;
wr_lcd (comm,disp_on);
for(j=0;j<8;j++)
{
wr_lcd (comm,disp_x+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y);
for(i=0;i<32;i++)
{
wr_lcd (dat,data1);
wr_lcd (dat,data2);
}
}
}
/*--------------显示图片----------------*/
void img_disp (uchar code *img)
{
uchar i,j;
for(j=0;j<8;j++)
{
cs1=1;cs2=0;
wr_lcd (comm,disp_on);
wr_lcd (comm,disp_x+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y);
for(i=0;i<64;i++)
wr_lcd (dat,img[j*128+i]);
cs1=0;cs2=1;
wr_lcd (comm,disp_on);
wr_lcd (comm,disp_x+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y);
for(i=64;i<128;i++)
wr_lcd (dat,img[j*128+i]);
}
}
/*---指定位置(x,y)显示row_xl行(每行row_yl个)汉字(大小8xl*yl)---*/
void chn_disp (uchar x,uchar y,uchar xl,uchar yl,uchar row_xl,uchar row_yl,uchar code *chn)
{
uchar i,j,k,l,a;
wr_lcd (comm,disp_on);
for(l=0;l<row_xl;l++)
{
for(k=0;k<row_yl;k++)
{
for(j=0;j<xl;j++)
{
wr_lcd (comm,disp_x+x+l*xl+j);
wr_lcd (comm,disp_z);
wr_lcd (comm,disp_y+y+k*yl);
a=l*xl*yl*row_yl+k*xl*yl+j*yl;
for(i=0;i<yl;i++)
wr_lcd (dat,chn[a+i]);
}
}
}
}
/*------------------初始化-----------------*/
void init_lcd (void)
{
rst=0;
delay(50);
rst=1;
cs1=1;cs2=1;
wr_lcd (comm,disp_off);
wr_lcd (comm,disp_on);
}
/*---------------显示1-----------------*/
void disp1 (void)
{
lat_disp(0x00,0x00);
cs1=1;cs2=0;
chn_disp (0,0,2,16,2,4,hz11);
cs1=0;cs2=1;
chn_disp (0,0,2,16,2,4,hz12);
cs1=1;cs2=0;
chn_disp (4,0,2,8,2,8,hz31);
cs1=0;cs2=1;
chn_disp (4,0,2,8,2,8,hz32);
}
/*---------------显示3-----------------*/
void disp3 (void)
{
cs1=1;cs2=1;
chn_disp (0,0,4,32,1,1,tab31);
chn_disp (0,32,4,32,1,1,tab32);
chn_disp (4,0,4,32,1,1,tab32);
chn_disp (4,32,4,32,1,1,tab31);
}
/*------------------主程序--------------------*/
void main ()
{
init_lcd ();
while (1)
{
disp1();
delay1(400);
lat_disp (0xff,0x00);
delay1(400);
disp3();
delay1(400);
lat_disp (0x33,0x33);
delay1 (400);
img_disp(tab5);
delay1 (400);
}
}
|