#include <reg51.h>
sbit RS=P3^5;
sbit RW=P3^4;
sbit EN=P3^7;
sbit CS1=P3^3;
sbit CS2=P3^2;
/* LCD指令 */
#define DISPON 0x3F // 开显示0x3f
#define DISPOFF 0x3E // 关显示0x3e
/* 定义MCU与LCD的接口 */
#define DATA_PORT P2 // 输出端口
#define CLR_DATA P2 = 0x00 // 清数据输出端口
#define SET_RS RS=1
#define CLR_RS RS=0
#define SET_RW RW=1
#define CLR_RW RW=0
#define SET_EN EN=1
#define CLR_EN EN=0
#define SET_CS1 CS1=1
#define CLR_CS1 CS1=0
#define SET_CS2 CS2=1
#define CLR_CS2 CS2=0
/*********************************************************************************/
//fm12864数字0~9点阵定义
//fm12864字符定义
code unsigned char Character[96][5]={
0x00,0x00,0x00,0x00,0x00, // - - 0
0x00,0x00,0x5F,0x00,0x00, // -!-
0x00,0x07,0x00,0x07,0x00, // -"-
0x14,0x7F,0x14,0x7F,0x14, // -#-
0x24,0x2E,0x7B,0x2A,0x12, // -$-
0x23,0x13,0x08,0x64,0x62, // -%-
0x36,0x49,0x56,0x20,0x50, // -&-
0x00,0x04,0x03,0x01,0x00, // -'-
0x00,0x1C,0x22,0x41,0x00, // -(-
0x00,0x41,0x22,0x1C,0x00, // -)-
0x22,0x14,0x7F,0x14,0x22, // -*-
0x08,0x08,0x7F,0x08,0x08, // -+-
0x40,0x30,0x10,0x00,0x00, // -,-
0x08,0x08,0x08,0x08,0x08, // ---
0x00,0x60,0x60,0x00,0x00, // -.-
0x20,0x10,0x08,0x04,0x02, // -/- 15
0x3E,0x51,0x49,0x45,0x3E, // -0- 16
0x00,0x42,0x7F,0x40,0x00, // -1-
0x62,0x51,0x49,0x49,0x46, // -2-
0x21,0x41,0x49,0x4D,0x33, // -3-
0x18,0x14,0x12,0x7F,0x10, // -4-
0x27,0x45,0x45,0x45,0x39, // -5-
0x3C,0x4A,0x49,0x49,0x31, // -6-
0x01,0x71,0x09,0x05,0x03, // -7-
0x36,0x49,0x49,0x49,0x36, // -8-
0x46,0x49,0x49,0x29,0x1E, // -9- 25
0x00,0x36,0x36,0x00,0x00, // -:- 26
0x40,0x36,0x36,0x00,0x00, // -;-
0x08,0x14,0x22,0x41,0x00, // -<-
0x14,0x14,0x14,0x14,0x14, // -=-
0x00,0x41,0x22,0x14,0x08, // ->-
0x02,0x01,0x59,0x05,0x02, // -?-
0x3E,0x41,0x5D,0x55,0x5E, // -@- 32
0x7C,0x12,0x11,0x12,0x7C, // -A- 33
0x7F,0x49,0x49,0x49,0x36, // -B-
0x3E,0x41,0x41,0x41,0x22, // -C-
0x7F,0x41,0x41,0x41,0x3E, // -D-
0x7F,0x49,0x49,0x49,0x41, // -E-
0x7F,0x09,0x09,0x09,0x01, // -F-
0x3E,0x41,0x51,0x51,0x72, // -G-
0x7F,0x08,0x08,0x08,0x7F, // -H-
0x00,0x41,0x7F,0x41,0x00, // -I-
0x20,0x40,0x41,0x3F,0x01, // -J-
0x7F,0x08,0x14,0x22,0x41, // -K-
0x7F,0x40,0x40,0x40,0x40, // -L-
0x7F,0x02,0x0C,0x02,0x7F, // -M-
0x7F,0x04,0x08,0x10,0x7F, // -N-
0x3E,0x41,0x41,0x41,0x3E, // -O-
0x7F,0x09,0x09,0x09,0x06, // -P-
0x3E,0x41,0x51,0x21,0x5E, // -Q-
0x7F,0x09,0x19,0x29,0x46, // -R-
0x26,0x49,0x49,0x49,0x32, // -S-
0x01,0x01,0x7F,0x01,0x01, // -T-
0x3F,0x40,0x40,0x40,0x3F, // -U-
0x1F,0x20,0x40,0x20,0x1F, // -V-
0x7F,0x20,0x18,0x20,0x7F, // -W-
0x63,0x14,0x08,0x14,0x63, // -X-
0x03,0x04,0x78,0x04,0x03, // -Y-
0x61,0x51,0x49,0x45,0x43, // -Z- 58
0x7F,0x7F,0x41,0x41,0x00, // -[- 59
0x02,0x04,0x08,0x10,0x20, // -\-
0x00,0x41,0x41,0x7F,0x7F, // -]-
0x04,0x02,0x7F,0x02,0x04, // -^-
0x08,0x1C,0x2A,0x08,0x08, // -_-
0x00,0x00,0x01,0x02,0x04, // -`- 64
0x24,0x54,0x54,0x38,0x40, // -a- 65
0x7F,0x28,0x44,0x44,0x38, // -b-
0x38,0x44,0x44,0x44,0x08, // -c-
0x38,0x44,0x44,0x28,0x7F, // -d-
0x38,0x54,0x54,0x54,0x08, // -e-
0x08,0x7E,0x09,0x09,0x02, // -f-
0x98,0xA4,0xA4,0xA4,0x78, // -g-
0x7F,0x08,0x04,0x04,0x78, // -h-
0x00,0x00,0x79,0x00,0x00, // -i-
0x00,0x80,0x88,0x79,0x00, // -j-
0x7F,0x10,0x28,0x44,0x40, // -k-
0x00,0x41,0x7F,0x40,0x00, // -l-
0x78,0x04,0x78,0x04,0x78, // -m-
0x04,0x78,0x04,0x04,0x78, // -n-
0x38,0x44,0x44,0x44,0x38, // -o-
0xFC,0x24,0x24,0x24,0x18, // -p-
0x18,0x24,0x24,0x24,0xFC, // -q-
0x04,0x78,0x04,0x04,0x08, // -r-
0x48,0x54,0x54,0x54,0x24, // -s-
0x04,0x3F,0x44,0x44,0x24, // -t-
0x3C,0x40,0x40,0x3C,0x40, // -u-
0x1C,0x20,0x40,0x20,0x1C, // -v-
0x3C,0x40,0x3C,0x40,0x3C, // -w-
0x44,0x28,0x10,0x28,0x44, // -x-
0x9C,0xA0,0xA0,0x90,0x7C, // -y-
0x44,0x64,0x54,0x4C,0x44, // -z- 90
0x08,0x36,0x41,0x00,0x00, // -{- 91
0x00,0x00,0x77,0x00,0x00, // -|-
0x00,0x00,0x41,0x36,0x08, // -}-
0x08,0x04,0x08,0x10,0x08 // -~- 95
};
//图片
code unsigned char pic[1024] = // 数据表
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,
0xC8,0x00,0x74,0x54,0x7C,0x54,0x7C,0x54,0x74,0x04,0x00,0x88,0x88,0xE8,0xA8,0xA8,
0xAC,0xA8,0xA8,0xE8,0x88,0x88,0x00,0x10,0xF0,0x1C,0xF0,0x10,0x10,0x10,0xFC,0x10,
0x10,0x10,0x00,0x10,0xF0,0x1C,0xF0,0x00,0xF8,0xA8,0xAC,0xA8,0xF8,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,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,0x40,0x40,0x40,0x80,0x80,
0x40,0x40,0x40,0x40,0xC0,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x80,0x80,0x80,
0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x1F,0x00,0x14,0x0D,0x05,0x15,0x1D,0x05,0x0D,0x14,0x00,0x11,0x10,0x08,0x06,0x02,
0x02,0x02,0x1E,0x10,0x10,0x1D,0x00,0x13,0x0A,0x04,0x0B,0x00,0x1F,0x11,0x11,0x11,
0x11,0x1F,0x00,0x10,0x0B,0x04,0x0B,0x00,0x1F,0x10,0x0B,0x04,0x0A,0x11,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x60,0x10,0x8C,0x82,0x41,0xA0,0x60,0x18,0x80,0x44,0x22,
0x22,0x44,0x80,0x01,0x84,0x42,0x22,0x24,0x40,0x8C,0x30,0x42,0x81,0x80,0x00,0x00,
0x00,0x07,0x78,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
0x91,0x55,0xF5,0x5D,0x57,0x55,0x55,0xD5,0x11,0x10,0x00,0x11,0x16,0xF0,0x04,0x14,
0x64,0x04,0x04,0xFF,0x04,0x04,0x00,0x20,0x22,0x2A,0xB2,0x62,0xFF,0x62,0xB2,0x2A,
0x22,0x20,0x00,0x00,0x1C,0x7E,0x7E,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0xF1,0x0C,0x02,0x01,0xE0,0x10,0x08,0x09,0x12,0x94,
0x97,0x2B,0x29,0x28,0x21,0x12,0x14,0x17,0x23,0xC1,0xE0,0x10,0x00,0x00,0x01,0x03,
0x0D,0xF2,0x02,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x00,0x07,0x05,0x05,0x05,0x05,0x07,0x00,0x80,0x80,0x84,0x02,0x01,0x02,0x84,
0x84,0x85,0x85,0x05,0x84,0x84,0x80,0x02,0x02,0x01,0x80,0x80,0x87,0x80,0x00,0x01,
0x02,0x02,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x84,0xC8,0xD0,0x55,0x2A,0x34,0x24,0x49,
0x49,0x90,0x90,0x93,0x93,0x48,0x48,0x64,0x53,0x40,0x20,0x21,0x50,0xD0,0xC8,0x8C,
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x21,0x4C,0x82,0x00,0x01,0x03,0x01,0x00,
0x80,0xC0,0x7F,0x21,0x4C,0x82,0x00,0x01,0x03,0x01,0x00,0x80,0xC0,0x61,0x3F,0x1E,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x38,0x3C,0x3E,0x37,0x23,0x00,0x07,0x08,0x17,0x2D,0x0D,0x07,
0x03,0x01,0x03,0x03,0x01,0x03,0x07,0x0D,0x0D,0x07,0x20,0x10,0x08,0x07,0x00,0x23,
0x37,0x3E,0x3C,0x38,0x