📄 lcd.lst
字号:
C51 COMPILER V7.01 LCD 12/13/2006 21:40:33 PAGE 1
C51 COMPILER V7.01, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: C:\program files\Keil\C51\BIN\C51.EXE lcd.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include"group.h"
2
3 xdata unsigned char CW _at_ 0xf9fc; //液晶控制地址
4 xdata unsigned char CR _at_ 0xf9fc;
5 xdata unsigned char DW _at_ 0xf9fd;
6 xdata unsigned char DR _at_ 0xf9ff;
7
8
9 bit flag; //标志位
10 //-----------------------------------------------
11 extern unsigned char lc_read(void) //读液晶命令
12 {
13 1 unsigned char a;
14 1 delay(100);
15 1 a=CR;
16 1 return(a);
17 1 }
18 //-----------------------------------------------
19 extern void readbf(void) //读液晶忙
20 {
21 1 while(flag)
22 1 {
23 2 flag=(bit)(lc_read()&0x80);
24 2 }
25 1 }
26 //-----------------------------------------------
27 extern void lc_write(unsigned char a) //写液晶命令
28 {
29 1 delay(20);
30 1 CW=a;
31 1 delay(20);
32 1 }
33 //-----------------------------------------------
34 extern void ld_write(unsigned char a) //写液晶数据
35 {
36 1 delay(20);
37 1 DW=a;
38 1 delay(20);
39 1 }
40 //-----------------------------------------------
41 extern void lcd_init(void) //液晶初始化
42 {
43 1 readbf();
44 1 lc_write(0x38);
45 1 delay(500);
46 1 readbf();
47 1 lc_write(0x01); //0001显示清除
48 1 readbf();
49 1 delay(500);
50 1 lc_write(0x0c); //11XX整体显示 1111光标开/闪烁 1100光标关/无闪
51 1 readbf();
52 1 delay(500);
53 1 lc_write(0x06); //011X光标右移 010X光标左移 0111屏幕所有文字左/右移
54 1 delay(500);
55 1 }
C51 COMPILER V7.01 LCD 12/13/2006 21:40:33 PAGE 2
56 //-----------------------------------------------
57 extern void lc_pos(unsigned char posx,unsigned char posy) //设定显示位置
58 {
59 1 posx=posx&0xf;
60 1 posy=posy&0x1;
61 1 lc_write(posx|posy*0x40+0x80);
62 1 }
63 //---------------------------------------------
64 extern void display_char(unsigned char x,unsigned char y,unsigned char ch) //显示字符
65 {
66 1 readbf();
67 1 lc_pos(x,y);
68 1 ld_write(ch);
69 1
70 1 }
71 //--------------------------------------
72 extern void display_string(unsigned char x,unsigned char y,unsigned char code *string) //显示字符串
- //在指定点起显示一个字符串
73 {
74 1 unsigned length;
75 1 length=0;
76 1 readbf();
77 1 while(string[length]!='\0')
78 1 {
79 2 display_char(x,y,string[length++]);
80 2 x++;
81 2 }
82 1 }
83 //---------------------------------------
84 extern void lcdclear(void) //清屏
85 {
86 1 readbf();
87 1 lc_write(0x01);
88 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 244 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 11
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -