?? lcd12864應(yīng)用.lst
字號:
C51 COMPILER V8.05a LCD12864應(yīng)用 07/02/2009 21:25:19 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE LCD12864應(yīng)用
OBJECT MODULE PLACED IN LCD12864應(yīng)用.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE LCD12864應(yīng)用.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg51.h>
2 #include <string.h>
3 #include <math.h>
4
5 #define Disp_On 0x3f //顯示開
6 #define Disp_Off 0x3e //顯示關(guān)
7 #define Col_Add 0x40 //第一列
8 #define Page_Add 0xb8 //第一頁
9 #define Start_Line 0xc0 //從第0行開始顯示
10 #define Lcd_Bus P0 // MCU P0<------> LCM
11
12 sbit Mcs=P2^0; //Master chip enable CS1 左邊控制器
13 sbit Scs=P2^1; //Slave chip enable CS2 右邊控制器
14 sbit Enable=P2^4; //6800 mode Enable single E
15 sbit Di=P2^2; //Data or Instrument Select RS
16 sbit RW=P2^3; //Write or Read R/W
17 sbit Lcd_Rst=P2^5; //Lcm reset RST
18
19 char code ce[]={
20 0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00,
21 0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00
22 }; //“測”
23 char code shi[]={
24 0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,
25 0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00
26 }; //“試”
27 char code kai[]={
28 0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,
29 0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00
30 }; //“開”
31 char code shi3[]={
32 0x10,0x90,0x70,0x1F,0x12,0xF0,0x00,0x20,0x70,0x28,0x27,0x22,0x28,0x70,0x20,0x00,
33 0x40,0x21,0x12,0x0C,0x06,0x09,0x30,0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00
34 }; //“始”
35 char code wan[]={
36 0x00,0x90,0x8C,0xA4,0xA4,0xA4,0xA5,0xA6,0xA4,0xA4,0xA4,0xA4,0x94,0x8C,0x04,0x00,
37 0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x70,0x00,0x00
38 }; //“完”
39 char code bi[]={
40 0x00,0x00,0xFF,0x88,0x48,0x28,0x08,0x80,0x7F,0x88,0x88,0x88,0x84,0x84,0xE0,0x00,
41 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00
42 }; //“畢”
43 unsigned char code FirstPage[]={
44 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
45 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
46 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
47 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
48 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
49 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
50 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
51 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
52 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
53 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
54 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
55 0xFF,0x00,0x00,0x00,0x00,0xFF,0x41,0x41,0x41,0x41,0x41,0x41,0x00,0x00,0xFF,0x00,
C51 COMPILER V8.05a LCD12864應(yīng)用 07/02/2009 21:25:19 PAGE 2
56 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,
57 0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
58 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
59 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
60 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
61 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
62 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
63 0x3F,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x38,
64 0x30,0x30,0x20,0x30,0x30,0x3C,0x1F,0x00,0x00,0x00,0x1F,0x38,0x30,0x30,0x20,0x30,
65 0x30,0x3C,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
66 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
67 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
68 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
69 0x00,0x00,0x00,0x00,0xE0,0xF0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xE0,0x20,
70 0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xB0,0xE0,0x80,0x80,0xC0,0xC0,0xC0,0x80,0x80,
71 0xC0,0x60,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xB0,0xE0,0xE0,
72 0x80,0x80,0x80,0x80,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xC0,
73 0x00,0x00,0x00,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,
74 0x80,0x80,0x80,0xA0,0xE0,0xC0,0x80,0x80,0x80,0x80,0xC0,0x80,0x00,0x00,0x00,0x00,
75 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
76 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
77 0x30,0x18,0x0E,0xFF,0x13,0x98,0xD9,0xFB,0x87,0x87,0xFF,0x02,0x00,0x00,0xFF,0x00,
78 0x00,0x00,0x00,0x00,0x58,0xD9,0xDA,0xDE,0xF8,0xEF,0xEF,0x6C,0xEC,0xFF,0x08,0x0C,
79 0xFC,0x0C,0x0C,0x0C,0x00,0x00,0x00,0x00,0x8F,0x87,0x81,0xB5,0xE5,0xED,0x81,0xF1,
80 0xBF,0xC1,0xC1,0xC6,0xC3,0xC0,0x80,0x00,0x00,0x00,0x00,0x79,0x5F,0x41,0x7F,0xE3,
81 0x30,0xDC,0x17,0xF9,0x99,0x9B,0xEE,0x18,0x10,0x10,0x00,0x00,0x00,0x00,0x03,0x27,
82 0x36,0x3E,0x3E,0x76,0xF2,0x52,0x9A,0x9A,0xB3,0x33,0x01,0x00,0x00,0x00,0x00,0x00,
83 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
84 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
85 0x00,0x00,0x00,0x0F,0x0C,0x09,0x0B,0x0C,0x0F,0x00,0x01,0x08,0x18,0x30,0x7F,0x00,
86 0x00,0x00,0x00,0x00,0x08,0x06,0x0B,0x19,0x3F,0x00,0x31,0x1F,0x07,0x01,0x00,0x10,
87 0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x21,0x31,0x11,0x19,0x0D,0x06,0x03,0x03,
88 0x06,0x0C,0x0C,0x18,0x38,0x00,0x00,0x00,0x00,0x02,0x02,0x03,0x19,0x31,0x3F,0x07,
89 0x10,0x13,0x13,0x11,0x19,0x1F,0x19,0x18,0x18,0x00,0x00,0x00,0x00,0x10,0x10,0x1B,
90 0x1B,0x1B,0x19,0x19,0x1F,0x19,0x19,0x09,0x09,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
91 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
92 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
93 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
94 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
95 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
96 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
97 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
98 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
99 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
100 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
101 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
102 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
103 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
104 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
105 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
106 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
107 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
108 }; //顯示位圖的點(diǎn)陣
109
110 void delay(unsigned int t) //延時100us
111 {
112 1 unsigned int i,j;
113 1 for(i=0;i<t;i++)
114 1 for(j=0;j<10;j++);
115 1 }
116
117 void write_com(unsigned char cmdcode) //寫命令
C51 COMPILER V8.05a LCD12864應(yīng)用 07/02/2009 21:25:19 PAGE 3
118 {
119 1 Di=0;
120 1 RW=0;
121 1 Lcd_Bus=cmdcode;
122 1 delay(0); //延時20us
123 1 Enable=1;
124 1 delay(0);
125 1 Enable=0;
126 1 }
127
128 void write_data(unsigned char Dispdata) //寫數(shù)據(jù)
129 {
130 1 Di=1;
131 1 RW=0;
132 1 Lcd_Bus=Dispdata;
133 1 delay(0);
134 1 Enable=1;
135 1 delay(0);
136 1 Enable=0;
137 1 }
138
139 void frame() //畫一個方框
140 {
141 1 unsigned char i;
142 1 Mcs=0;Scs=0;delay(10); //有疑問 ???解答:因為Protues仿真模型的CS1和CS2都是低電平有效
143 1 write_com(Page_Add+0);
144 1 write_com(Col_Add+0);
145 1 for(i=0;i<64;i++) write_data(0x01);//畫一條水平線
146 1 write_com(Page_Add+7);
147 1 write_com(Col_Add+0);
148 1 for(i=0;i<64;i++) write_data(0x80);//畫一條水平線
149 1 for(i=0;i<8;i++)
150 1 {
151 2 Mcs=0;Scs=1;delay(10);
152 2 write_com(Page_Add+i);
153 2 write_com(Col_Add+63);
154 2 write_data(0xff); //畫一條垂直線
155 2 Mcs=1;Scs=0;delay(10);
156 2 write_com(Page_Add+i);
157 2 write_com(Col_Add+0);
158 2 write_data(0xff); //畫一條垂直線
159 2 }
160 1 }
161
162 void Clr_Scr() //清屏
163 {
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -