📄 lcd.lst
字号:
C51 COMPILER V7.02a LCD 07/10/2007 16:25:36 PAGE 1
C51 COMPILER V7.02a, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lcd.c ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <REG52.H>
2 #include <lcd1602.h>
3
4
5 void delay1(uchar i)
6 {
7 1 while(--i);
8 1 }
9
10
11 void CheckBusy()
12 { uchar a;
13 1 while(1)
14 1 {
15 2 Enable=0;
16 2 Rw=1;
17 2 Rs=0;
18 2 Enable=1;
19 2 a=DB;
20 2 delay1(3);
21 2 Enable=0;
22 2 if((a&0x80)==0)break;
23 2 }
24 1
25 1 }
26
27
28 void WriteInstruction(uchar ins)
29 {
30 1 CheckBusy();
31 1 Enable=0;
32 1 Rs=0;
33 1 Rw=0;
34 1 Enable=1;
35 1 DB=ins;
36 1 delay1(3);
37 1 Enable=0;
38 1 }
39
40 void WriteLCDData(uchar *a)
41 {
42 1 while(*(a))
43 1 {
44 2 CheckBusy();
45 2 Enable=0;
46 2 Rs=1;
47 2 Rw=0;
48 2 Enable=1;
49 2 DB=*a;
50 2 delay1(3);
51 2 Enable=0;
52 2 delay1(2);a++;
53 2 }
54 1 }
55
C51 COMPILER V7.02a LCD 07/10/2007 16:25:36 PAGE 2
56 void Cls()
57 {
58 1 WriteInstruction(1);
59 1 }
60
61 void Initial()
62 {
63 1 WriteInstruction(0x38); //rs rw 7 6 5 4 3 2 1 0
64 1 WriteInstruction(0x0c); //0 0 0 0 1 dl n f * *
65 1 WriteInstruction(0x6); // 功能识别码 / 长度,1=8,0=4 /行数1=2||4,0=1 点阵
66 1 }
67 // 0 0 0 0 1 D C B
68 // ON/OFF 及 光标 识别码 1=显字符 光标 1=光标闪
69
70 // 0 0 0 0 0 1 I/D S
71 // 模 式 指 令 识 别 码 1=AC+1光标右移 全移
72 void LCD_Write(uchar x,uchar y,uchar *a)
73 {unsigned char address;
74 1 if (y == 0) address = 0x80 + x;
75 1 else
76 1 address = 0xc0 + x;
77 1 WriteInstruction(address);
78 1 WriteLCDData(a);
79 1 }
80
81 /*main()
82 { uchar *a="But to see her" ;
83 Initial();
84 WriteInstruction(0x81);
85 WriteLCDData(a);
86 WriteInstruction(0xc1);
87 a="was to love her";
88 WriteLCDData(a);
89 delay();
90 Cls();
91 LCD_Write(3,0,"this is a test!");
92 WriteInstruction(0x81);
93 a="Love but her";
94 WriteLCDData(a);
95 WriteInstruction(0xc0);
96 a="And love forever!";
97 WriteLCDData(a);
98 a=" " ;
99 delay();
100 WriteLCDData(a);
101 while(1){
102 }
103 }
104
105 */
106
107
108
109
110
111
112
113
114
115
116
117
C51 COMPILER V7.02a LCD 07/10/2007 16:25:36 PAGE 3
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 132 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -