📄 lcddrive.lst
字号:
C51 COMPILER V7.09 LCDDRIVE 06/23/2005 19:46:47 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE LCDDRIVE
OBJECT MODULE PLACED IN lcddrive.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lcddrive.c DEBUG OBJECTEXTEND
line level source
1 //#include <lcddrive.h>
2 #include <absacc.h>
3 #define unchar unsigned char
4 //-----------------------------------
5 //the lcd driver based on t9636c
6 //write by liujianwei
7 //-----------------------------------
8 #define LCD_DATA_PORT 0x8000
9 #define LCD_CMD_PORT 0x8001
10 #define LCD_STATUS_PORT 0x8001
11 //--------------------------------------
12 // data type declare
13 //-----------------------------------------
14 //#define unchar unsigned char
15 //#include <ABSACC.H>
16 //----------------------------------
17 // write data to the lcd
18 //----------------------------------
19 void WriteData(unchar Dat)
20 {
21 1 while ((XBYTE[LCD_STATUS_PORT]&3)!=3);
22 1 XBYTE[LCD_DATA_PORT]=Dat;
23 1 }
24 //---------------------------------------
25 // write command to the lcd
26 //---------------------------------------
27 void WriteCmd(unchar Cmd)
28 {
29 1 while((XBYTE[LCD_STATUS_PORT]&3)!=3);
30 1 XBYTE[LCD_CMD_PORT]=Cmd;
31 1 }
32 //----------------------------------------
33 //adress pointer set
34 //-----------------------------------------
35 void AdressPointSet(unchar x,unchar y)
36 {
37 1 WriteData(x);
38 1 WriteData(y);
39 1 WriteCmd(0x24);
40 1 }
41 //------------------------------------------
42 // text area home adress set
43 //------------------------------------------
44 void TxtHomeAdresSet(unchar x,unchar y)
45 {
46 1 WriteData(x);
47 1 WriteData(y);
48 1 WriteCmd(0x40);
49 1 }
50 //-------------------------------------------
51 //text area width set bytes number per line
52 //-----------------------------------------------
53 void TxtWidthSet(unchar x)
54 {
55 1 WriteData(x);
C51 COMPILER V7.09 LCDDRIVE 06/23/2005 19:46:47 PAGE 2
56 1 WriteData(0);
57 1 WriteCmd(0x41);
58 1 }
59 //---------------------------------------------
60 //graphic area home adrress set
61 //---------------------------------------------
62 void GraphicHomeAdressSet(unchar x,unchar y)
63 {
64 1 WriteData(x);
65 1 WriteData(y);
66 1 WriteCmd(0x42);
67 1 }
68 //-------------------------------------------
69 //graphic area width set bytes number per line
70 //-----------------------------------------------
71 void GraphicWidthSet(unchar x)
72 {
73 1 WriteData(x);
74 1 WriteData(0);
75 1 WriteCmd(0x43);
76 1 }
77
78 //---------------------------------------------------
79 // display model set
80 // logic or,logic xor,logic and
81 // text special set
82 // ------------------------------------------------
83 void DisplayModelOr() //or model and use the cgrom in the lcd
84 {
85 1 WriteCmd(0x80);
86 1 }
87
88 //-----------------------------------------------
89 void displayModelXor() // xor model
90 {
91 1 WriteCmd(0x81);
92 1 }
93 //-----------------------------------------------
94 void displayModelAnd() //and model
95 {
96 1 WriteCmd(0x83);
97 1 }
98
99 //-----------------------------------------------
100 void TxtSpecialSet() //
101 {
102 1 WriteCmd(0x84);
103 1 }
104
105
106
107 //-----------------------------------------------------
108 // display turn on and turn off set
109 //---------------------------------------------------------
110 void CursorFlashOn()
111 {
112 1 WriteCmd(0x91);
113 1 }
114
115 void CursorFlashOff()
116 {
117 1 WriteCmd(0x90);
C51 COMPILER V7.09 LCDDRIVE 06/23/2005 19:46:47 PAGE 3
118 1 }
119
120 void CursorOn()
121 {
122 1 WriteCmd(0x92);
123 1 }
124
125 void CursorOff()
126 {
127 1 WriteCmd(0x90);
128 1 }
129
130 void TxtDisplayOn()
131 {
132 1 WriteCmd(0x94);
133 1 }
134
135 void TxtDisplayOff()
136 {
137 1 WriteCmd(0x98);
138 1 }
139
140 //-----------------------------------------------------
141 //cursor shape set
142 //----------------------------------------------------
143 void CursorShapeSet(unchar shape) //the shape my be 0xA0----0xA7
144 {
145 1 WriteCmd(shape);
146 1 }
147
148 //----------------------------------------------------------
149 // data auto read or write set
150 //----------------------------------------------------------
151 void DataAutoWrite()
152 {
153 1 WriteCmd(0xb0);
154 1 }
155 //----------------------------------------------------------
156 void DataAutoRead()
157
158 {
159 1 WriteCmd(0xb1);
160 1 }
161 //---------------------------------------------------------
162 void OverAutoWrite()
163 {
164 1 WriteCmd(0xb2);
165 1 }
166
167 void OverAutoRead()
168 {
169 1 WriteCmd(0xb3);
170 1
171 1 }
172 //--------------------------------------------------------------
173 // display a string at current point
174 //--------------------------------------------------------------
175 void DisplayString(unchar *string)
176 {
177 1 unchar i;
178 1 i=0;
179 1 DataAutoWrite();
C51 COMPILER V7.09 LCDDRIVE 06/23/2005 19:46:47 PAGE 4
180 1 while (string[i]!=0)
181 1 {
182 2 WriteData(string[i]-0x20);
183 2
184 2 i++;
185 2 }
186 1 OverAutoWrite();
187 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 200 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 3
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 + -