?? liquid_crystal.lst
字號(hào):
C51 COMPILER V7.08 LIQUID_CRYSTAL 04/23/2007 04:51:08 PAGE 1
C51 COMPILER V7.08, COMPILATION OF MODULE LIQUID_CRYSTAL
OBJECT MODULE PLACED IN liquid_crystal.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE liquid_crystal.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /*************************
2 名稱:12864液晶顯示
3
4 作者:dongpeiqin
5
6 修改時(shí)間:2007.4.23
7
8 功能: 陜西理工學(xué)院
9 電氣工程系
10 董佩欽
11 行勝于言!
12 *************************/
13 #include<reg51.h>
14 #include<intrins.h>
15 #include<absacc.h>
16
17 #define write_cmd_addr_1 XBYTE[0x8fff] //寫指令地址左
18 #define read_state_addr_1 XBYTE[0xafff] //讀狀態(tài)地址左
19 #define write_data_addr_1 XBYTE[0x9fff] //寫數(shù)據(jù)地址左
20 #define read_data_addr_1 XBYTE[0xbfff] //讀數(shù)據(jù)地址左
21
22 #define write_cmd_addr_2 XBYTE[0x4fff] //寫指令地址右
23 #define read_state_addr_2 XBYTE[0x6fff] //讀狀態(tài)地址右
24 #define write_data_addr_2 XBYTE[0x5fff] //寫數(shù)據(jù)地址右
25 #define read_data_addr_2 XBYTE[0x7fff] //讀數(shù)據(jù)地址右
26
27 #define Disp_On 0x3f//開顯示
28 #define Disp_Off 0x3e//關(guān)顯示
29 #define Col_Add 0x40//列地址
30 #define Page_Add 0xb8//頁(yè)地址
31 #define Start_line 0xc0//起始頁(yè)
32
33 /*****************************
34
35 字模,此字體下對(duì)應(yīng)的
36 點(diǎn)陣為:寬x高=16x16
37
38 *****************************/
39 unsigned char code Chinese_character[][32]=
40 {
41
42 {
43 /*-- 文字: 陜 --*/
44 0xFE,0x02,0x22,0x5A,0x86,0x28,0xC8,0x08,0xFF,0x08,0x88,0x48,0x28,0x08,0x00,0x00,
45 0xFF,0x00,0x04,0x48,0x47,0x21,0x11,0x0D,0x03,0x05,0x09,0x11,0x21,0x41,0x41,0x00//"陜",0
46 },
47
48 {
49 /*-- 文字: 西 --*/
50 0x02,0xF2,0x12,0x12,0x12,0xFE,0x12,0x12,0x12,0xFE,0x12,0x12,0x12,0xF2,0x02,0x00,
51 0x00,0x7F,0x28,0x24,0x22,0x21,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x7F,0x00,0x00//"西",1
52 },
53
54 {
55 /*-- 文字: 理 --*/
C51 COMPILER V7.08 LIQUID_CRYSTAL 04/23/2007 04:51:08 PAGE 2
56 0x44,0x44,0xFC,0x44,0x44,0x00,0xFE,0x92,0x92,0xFE,0x92,0x92,0x92,0xFE,0x00,0x00,
57 0x10,0x10,0x0F,0x08,0x48,0x40,0x45,0x44,0x44,0x7F,0x44,0x44,0x44,0x45,0x40,0x00//"理",2
58 },
59
60 {
61 /*-- 文字: 工 --*/
62 0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
63 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00//"工",3
64 },
65
66 {
67 /*-- 文字: 學(xué) --*/
68 0x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,
69 0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00//"學(xué)",4
70 },
71
72 {
73 /*-- 文字: 院 --*/
74 0xFE,0x02,0x32,0x4A,0x86,0x0C,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0x0C,0x04,0x00,
75 0xFF,0x00,0x02,0x04,0x83,0x41,0x31,0x0F,0x01,0x01,0x7F,0x81,0x81,0x81,0xF1,0x00//"院",5
76 },
77
78 {
79 /*-- 文字: 電 --*/
80 0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
81 0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00//"電",6
82 },
83
84 {
85 /*-- 文字: 氣 --*/
86 0x00,0x20,0x10,0x8C,0xA7,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x24,0x04,0x04,0x00,
87 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x30,0x40,0xF0,0x00//"氣",7
88 },
89
90 {
91 /*-- 文字: 工 --*/
92 0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
93 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00//"工",8
94 },
95
96 {
97 /*-- 文字: 程 --*/
98 0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,0xA1,0xA1,0xA1,0xA1,0xBF,0x80,0x00,0x00,
99 0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00//"程",9
100 },
101
102 {
103 /*-- 文字: 系 --*/
104 0x00,0x00,0x02,0x22,0xB2,0xAA,0x66,0x62,0x22,0x11,0x4D,0x81,0x01,0x01,0x00,0x00,
105 0x00,0x40,0x21,0x13,0x09,0x05,0x41,0x81,0x7F,0x01,0x05,0x09,0x13,0x62,0x00,0x00//"系",10
106 },
107
108 {
109 /*-- 文字: 董 --*/
110 0x02,0x22,0x2A,0xAA,0xAA,0xAF,0xAA,0xFA,0xAA,0xAF,0xAA,0xAA,0x2A,0x22,0x22,0x00,
111 0x80,0x80,0xA0,0xAF,0xAA,0xAA,0xAA,0xFF,0xAA,0xAA,0xAA,0xAF,0xA0,0x80,0x80,0x00//"董",11
112
113 },
114
115 {
116 /*-- 文字: 佩 --*/
117 0x40,0x20,0xF8,0x0F,0x02,0xFE,0xD2,0x52,0xF2,0x52,0xD2,0x02,0xFE,0x00,0x00,0x00,
C51 COMPILER V7.08 LIQUID_CRYSTAL 04/23/2007 04:51:08 PAGE 3
118 0x00,0x00,0x7F,0x20,0x1C,0x03,0x3F,0x00,0x7F,0x10,0x1F,0x00,0x1F,0x20,0x78,0x00//"佩",12
119 },
120
121 {
122 /*-- 文字: 欽 --*/
123 0x40,0x30,0xEF,0x24,0x24,0x24,0x04,0x40,0x38,0x17,0xF0,0x10,0x50,0x30,0x10,0x00,
124 0x01,0x01,0x7F,0x21,0x11,0x41,0x40,0x20,0x10,0x0C,0x03,0x0C,0x30,0x60,0x20,0x00//"欽",13
125 },
126
127 {
128 /*-- 文字: 行 --*/
129 0x10,0x08,0x84,0xC6,0x73,0x22,0x40,0x44,0x44,0x44,0xC4,0x44,0x44,0x44,0x40,0x00,
130 0x02,0x01,0x00,0xFF,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00//"行",14
131 },
132
133 {
134 /*-- 文字: 勝 --*/
135 0x00,0x00,0xFE,0x12,0x12,0xFE,0x20,0x1C,0x10,0x10,0xFF,0x10,0x10,0x10,0x00,0x00,
136 0x40,0x30,0x0F,0x21,0x41,0x3F,0x20,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x20,0x00//"勝",15
137 },
138
139 {
140 /*-- 文字: 于 --*/
141 0x40,0x40,0x42,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x00,
142 0x00,0x00,0x00,0x00,0x20,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00//"于",16
143 },
144
145 {
146 /*-- 文字: 言 --*/
147 0x00,0x04,0x04,0xA4,0xA4,0xA4,0xA5,0xA6,0xA4,0xA4,0xA4,0xA4,0x04,0x04,0x04,0x00,
148 0x00,0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0xFC,0x00,0x00,0x00,0x00//"言",17
149 }
150 };
151 unsigned char tanhao[]=
152 {
153 /*-- 文字: ! --*/
154 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00//"!",18
155 };
156 unsigned char qingping[]=
157 {
158 /*-- 清屏 --*/
159 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
160 };
161
162 /*********函數(shù)聲明***********/
163 void busy_check_1(void);
164 void busy_check_2(void);
165 void write_cmd_1(unsigned char command);
166 void write_cmd_2(unsigned char command);
167 void write_data_1(unsigned char dis_data);
168 void write_data_2(unsigned char dis_data);
169 void clear_1(void);
170 void clear_2(void);
171 void Chinese_disp_1(unsigned char pag,unsigned char col,unsigned char n);
172 void Chinese_disp_2(unsigned char pag,unsigned char col,unsigned char n);
173 void display(void);
174 void tanhao_disp(unsigned char pag,unsigned char col,unsigned char *chinese2);
175 void qingping_disp1(unsigned char pag,unsigned char col,unsigned char *chinese2);
176 void qingping_disp2(unsigned char pag,unsigned char col,unsigned char *chinese2);
177
178 /***********************
179
C51 COMPILER V7.08 LIQUID_CRYSTAL 04/23/2007 04:51:08 PAGE 4
180 檢測(cè)忙狀態(tài)左
181
182 ***********************/
183 void busy_check_1(void)
184 {
185 1 unsigned char busy;
186 1 while(busy&0x80)
187 1 {
188 2 busy=read_state_addr_1;
189 2 }
190 1 }
191 /***********************
192
193 檢測(cè)忙狀態(tài)右
194
195 ***********************/
196 void busy_check_2(void)
197 {
198 1 unsigned char busy;
199 1 while(busy&0x80)
200 1 {
201 2 busy=read_state_addr_2;
202 2 }
203 1
204 1 }
205 /***********************
206
207 寫命令左
208
209 ***********************/
210 void write_cmd_1(unsigned char command)
211 {
212 1 busy_check_1();
213 1 write_cmd_addr_1=command;
214 1 }
215 /***********************
216
217 寫命令右
218
219 ***********************/
220 void write_cmd_2(unsigned char command)
221 {
222 1 busy_check_2();
223 1 write_cmd_addr_2=command;
224 1 }
225 /***********************
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -