📄 lcd_driver.lst
字号:
173 void lcd_zh(int x, int y, unsigned char mat[16][2])
174 {
C51 COMPILER V7.50 LCD_DRIVER 01/11/2007 16:46:40 PAGE 4
175 1 int row, col;
176 1
177 1 x -= x0;
178 1 y -= y0;
179 1
180 1 col = x / 16;
181 1
182 1 if(y > 31)
183 1 {
184 2 y -= 32;
185 2 col += 8;
186 2 }
187 1
188 1 if(y <= 16)
189 1 for(row = 0; row < 16; row++)
190 1 {
191 2 lcd_write_instruction(0x3e);
192 2 lcd_write_instruction(row + y | 0x80);
193 2 lcd_write_instruction(col | 0x80);
194 2 lcd_write_instruction(0x3a);
195 2 lcd_write_data(mat[row][0]);
196 2 lcd_write_data(mat[row][1]);
197 2 }
198 1 else
199 1 {
200 2 x = 0;
201 2 for(row = 0; row < 32 - y; row++)
202 2 {
203 3 lcd_write_instruction(0x3e);
204 3 lcd_write_instruction(row + y | 0x80);
205 3 lcd_write_instruction(col | 0x80);
206 3 lcd_write_instruction(0x3a);
207 3 lcd_write_data(mat[x][0]);
208 3 lcd_write_data(mat[x][1]);
209 3 x++;
210 3 }
211 2
212 2 for(row = 0; row < y - 16; row++)
213 2 {
214 3 lcd_write_instruction(0x3e);
215 3 lcd_write_instruction(row | 0x80);
216 3 lcd_write_instruction(col + 8 | 0x80);
217 3 lcd_write_instruction(0x3a);
218 3 lcd_write_data(mat[x][0]);
219 3 lcd_write_data(mat[x][1]);
220 3 x++;
221 3 }
222 2 }
223 1 }
224
225 /*
226 现在无需使用外部的hzk16字库以及sigma本身的字符字库。直接
227 将汉字和字符的内码送过来即可。如果当前字节最高位为1,则表
228 明当前字节和下一字节联合表示一个汉字,直接调用lcd_zh函数。
229 如果当前字节小于0x7f,则表示当前字节是英文半角字符,那么
230 将其填入参数ch[0],在调用lcd_char之前先判断下一个字节是否
231 大于0x7f,如果是,则参数的ch[1]填入0x20,否则ch[1]填入下
232 一个字节的值。
233 */
234
235 /*void lcd_char(int x, int y, unsigned char ch[2])
236 {
C51 COMPILER V7.50 LCD_DRIVER 01/11/2007 16:46:40 PAGE 5
237 unsigned char coor;
238
239 if (y != prevY)
240 {
241 isCharacter = 0;
242 myX = 0;
243 prevY = y;
244 }
245
246 //x -= x0;
247 y -= y0;
248
249 x = myX / 16;
250 y /= 16;
251
252 if(y > 3)
253 return;
254
255 coor = coordinate[y] + x;
256
257 lcd_write_instruction(coor);
258 if(isCharacter)
259 {
260 lcd_write_data(prevchar);
261 lcd_write_data(ch[0]);
262 isCharacter = 0;
263 myX += 8;
264 }
265 else
266 {
267 lcd_write_data(ch[0]);
268 lcd_write_data(ch[1]);
269 prevchar = ch[0];
270 isCharacter = 1;
271 myX += 8;
272 }
273
274 }
275
276 void lcd_zh(int x, int y, unsigned char mat[2])
277 {
278 unsigned char coor;
279
280 if(isCharacter)
281 myX += 8;
282
283 if (y != prevY)
284 {
285 myX = 0;
286 prevY = y;
287 }
288 //x -= x0;
289 y -= y0;
290
291 x = myX / 16;
292 y /= 16;
293
294 if(y > 3)
295 return;
296
297 coor = coordinate[y] + x;
298
C51 COMPILER V7.50 LCD_DRIVER 01/11/2007 16:46:40 PAGE 6
299 lcd_write_instruction(coor);
300 lcd_write_data(mat[0]);
301 lcd_write_data(mat[1]);
302
303 isCharacter = 0;
304 myX += 16;
305 }*/
306
307 void lcd_clear(void)
308 {
309 1
310 1 int i, j;
311 1 for(i = 0; i < 32; i++)
312 1 {
313 2 lcd_write_instruction(0x3e);
314 2 lcd_write_instruction(i | 0x80);
315 2 lcd_write_instruction(0 | 0x80);
316 2 lcd_write_instruction(0x3a);
317 2 for(j = 0; j < 8; j++)
318 2 {
319 3 lcd_write_data(0);
320 3 lcd_write_data(0);
321 3 }
322 2 }
323 1
324 1 for(i = 0; i < 32; i++)
325 1 {
326 2 lcd_write_instruction(0x3e);
327 2 lcd_write_instruction(i | 0x80);
328 2 lcd_write_instruction(8 | 0x80);
329 2 lcd_write_instruction(0x3a);
330 2 for(j = 0; j < 8; j++)
331 2 {
332 3 lcd_write_data(0);
333 3 lcd_write_data(0);
334 3 }
335 2 }
336 1
337 1 // lcd_write_instruction(0x01);
338 1 Delay(80);
339 1 }
340
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1409 ----
CONSTANT SIZE = 4 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 49 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 5 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -