📄 3510lcd.lst
字号:
ARM COMPILER V2.50a, 3510LCD 03/05/06 03:04:54 PAGE 1
ARM COMPILER V2.50a, COMPILATION OF MODULE 3510LCD
OBJECT MODULE PLACED IN 3510LCD.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe 3510LCD.c THUMB BROWSE DEBUG TABS(4)
stmt level source
1 /**********************************************************************************************
2 3510LCD.c file
3
4 作者:Computer-lov
5 建立日期:2006-5-2
6 修改日期:2006-5-3
7 版本:V1.0
8 版权所有,盗版必究。
9 任何技术问题可到我的博客上留言: http://computer00.21ic.org
10 Copyright(C) Computer-lov 2006-2016
11 All rights reserved
12 **********************************************************************************************/
13
14 #include <ADuC7027.H>
15 #include "My_type.h"
16 #include "3510LCD.h"
17
18
19 /*********************************************************************************************/
20 void LcdPortInit(void)
21 {
22 1 GP2CON &=~(uint32)(0x0F<<(LCD_RST*4));
23 1 GP2DAT |=1<<(LCD_RST+24);
24 1 GP2CON &=~(uint32)(0x0F<<(LCD_CS*4));
25 1 GP2DAT |=1<<(LCD_CS+24);
26 1 GP1CON &=~(uint32)(0x0F<<(LCD_SDATA*4));
27 1 GP1DAT &=~(uint32)(1<<(LCD_SDATA+24));
28 1 GP1CON &=~(uint32)(0x0F<<(LCD_SCLK*4));
29 1 GP1DAT |=1<<(LCD_SCLK+24);
30 1 SetLcdRst();
31 1 SetLcdCs();
32 1 SetLcdSclk();
33 1 }
34 ///////////////////////////////////////////////////////////////////////////////////////////////
35
36 /*********************************************************************************************/
37 void LcdReset(void)
38 {
39 1 ClrLcdRst();
40 1 DelayXms(5);
41 1 SetLcdRst();
42 1 DelayXms(5);
43 1 }
44 ///////////////////////////////////////////////////////////////////////////////////////////////
45
46 /*********************************************************************************************/
47 void LcdSendCommand(uint8 cmd)
48 {
49 1 uint8 i;
50 1 SetSdataOut();
51 1 ClrLcdCs();
52 1 ClrLcdSclk();
53 1 ClrLcdSdata();
54 1 SetLcdSclk();
55 1
56 1 for(i=0;i<8;i++)
57 1 {
58 2 ClrLcdSclk();
59 2 if(cmd & 0x80)
ARM COMPILER V2.50a, 3510LCD 03/05/06 03:04:54 PAGE 2
60 2 {
61 3 SetLcdSdata();
62 3 }
63 2 else
64 2 {
65 3 ClrLcdSdata();
66 3 }
67 2 SetLcdSclk();
68 2 cmd<<=1;
69 2 }
70 1 }
71 ///////////////////////////////////////////////////////////////////////////////////////////////
72
73 /*********************************************************************************************/
74 void LcdSendData(uint32 Data)
75 {
76 1 uint32 i;
77 1 SetSdataOut();
78 1 ClrLcdCs();
79 1 ClrLcdSclk();
80 1 SetLcdSdata();
81 1 SetLcdSclk();
82 1
83 1 for(i=0;i<8;i++)
84 1 {
85 2 ClrLcdSclk();
86 2 if(Data & 0x80)
87 2 {
88 3 SetLcdSdata();
89 3 }
90 2 else
91 2 {
92 3 ClrLcdSdata();
93 3 }
94 2 SetLcdSclk();
95 2 Data<<=1;
96 2 }
97 1 }
98 ///////////////////////////////////////////////////////////////////////////////////////////////
99
100 /*********************************************************************************************/
101 void LcdReadDummy(void)
102 {
103 1 SetSdataIn();
104 1 ClrLcdCs();
105 1 ClrLcdSclk();
106 1 SetLcdSclk();
107 1 }
108 ///////////////////////////////////////////////////////////////////////////////////////////////
109
110 /*********************************************************************************************/
111 uint16 LcdReadData(void)
112 {
113 1 uint16 r = 0;
114 1 uint8 i;
115 1
116 1 SetSdataIn();
117 1
118 1 ClrLcdCs();
119 1
120 1 for(i=0;i<12;i++)
121 1 {
122 2 ClrLcdSclk();
123 2 SetLcdSclk();
124 2 r<<=1;
125 2 if(LCD_SDATA_IN)
ARM COMPILER V2.50a, 3510LCD 03/05/06 03:04:54 PAGE 3
126 2 {
127 3 r++;
128 3 }
129 2 }
130 1 return r;
131 1 }
132 ///////////////////////////////////////////////////////////////////////////////////////////////
133
134 /*********************************************************************************************/
135 void LcdInit(void)
136 {
137 1 uint8 i;
138 1 LcdPortInit();
139 1
140 1 LcdReset();
141 1 LcdSendCommand(0x01); //soft reset
142 1 SetLcdCs();
143 1
144 1 DelayXms(5);
145 1 LcdSendCommand(0xc6); //initial escape
146 1 SetLcdCs();
147 1
148 1 LcdSendCommand(0xb9); //refresh set
149 1 LcdSendData(0x00);
150 1 SetLcdCs();
151 1
152 1 LcdSendCommand(0xb6); //display control
153 1 LcdSendData(0x80);
154 1 LcdSendData(0x80);
155 1 LcdSendData(0x81);
156 1 LcdSendData(84);
157 1 LcdSendData(69);
158 1 LcdSendData(82);
159 1 LcdSendData(67);
160 1 SetLcdCs();
161 1
162 1 LcdSendCommand(0xb3); //gray scale position set
163 1 LcdSendData(1);
164 1 LcdSendData(2);
165 1 LcdSendData(4);
166 1 LcdSendData(8);
167 1 LcdSendData(16);
168 1 LcdSendData(30);
169 1 LcdSendData(40);
170 1 LcdSendData(50);
171 1 LcdSendData(60);
172 1 LcdSendData(70);
173 1 LcdSendData(80);
174 1 LcdSendData(90);
175 1 LcdSendData(100);
176 1 LcdSendData(110);
177 1 LcdSendData(127);
178 1 SetLcdCs();
179 1
180 1 LcdSendCommand(0xb5); //gamma curve set
181 1 LcdSendData(0x01);
182 1 SetLcdCs();
183 1
184 1 LcdSendCommand(0xbd); //common driver output select
185 1 LcdSendData(0x00);
186 1 SetLcdCs();
187 1
188 1 LcdSendCommand(0xbe); //power control
189 1 LcdSendData(0x04);
190 1 SetLcdCs();
191 1
ARM COMPILER V2.50a, 3510LCD 03/05/06 03:04:54 PAGE 4
192 1 LcdSendCommand(0x11); //sleep out
193 1 SetLcdCs();
194 1
195 1 LcdSendCommand(0xba); //voltage control
196 1 LcdSendData(127);
197 1 LcdSendData(3);
198 1 SetLcdCs();
199 1
200 1 LcdSendCommand(0xb7); //temperature gradient set
201 1 for(i=0; i<14; i++)
202 1 {
203 2 LcdSendData(0x00);
204 2 }
205 1 SetLcdCs();
206 1
207 1 LcdSendCommand(0x29); //display ON
208 1 SetLcdCs();
209 1
210 1 LcdSendCommand(0x03); //booster voltage ON
211 1 SetLcdCs();
212 1 DelayXms(5);
213 1
214 1 LcdSendCommand(0x20); //display inversion OFF
215 1 SetLcdCs();
216 1
217 1 LcdSendCommand(0x25); //write contrast
218 1 LcdSendData(62);
219 1 SetLcdCs();
220 1 }
221
222 void LcdClr(void)
223 {
224 1 uint8 x, y;
225 1 LcdSendCommand(0x2a); //column address set
226 1 LcdSendData(0);
227 1 LcdSendData(97);
228 1 SetLcdCs();
229 1
230 1 LcdSendCommand(0x2b); //page address set
231 1 LcdSendData(0);
232 1 LcdSendData(66);
233 1 SetLcdCs();
234 1
235 1 LcdSendCommand(0x2c); //memory write
236 1 for(y=0;y<67;y++)
237 1 {
238 2 for(x=0;x<98;x+=2)
239 2 {
240 3 LcdSendData(0);
241 3 LcdSendData(0);
242 3 LcdSendData(0);
243 3 }
244 2 }
245 1 SetLcdCs();
246 1 }
247 ///////////////////////////////////////////////////////////////////////////////////////////////
248
249
250 /*********************************************************************************************/
251 void LcdBlockWrite(uint8 x1, uint8 y1, uint8 x2, uint8 y2, uint8 *b)
252 {
253 1 uint32 x, y;
254 1 LcdSendCommand(0x2a); //column address set
255 1 LcdSendData(x1);
256 1 LcdSendData(x2);
257 1 SetLcdCs();
ARM COMPILER V2.50a, 3510LCD 03/05/06 03:04:54 PAGE 5
258 1
259 1 LcdSendCommand(0x2b); //page address set
260 1 LcdSendData(y1);
261 1 LcdSendData(y2);
262 1 SetLcdCs();
263 1
264 1 LcdSendCommand(0x2c); //memory write
265 1 for(y=y1;y<=y2;y++)
266 1 {
267 2 for(x=x1;x<=x2;x+=2)
268 2 {
269 3 LcdSendData(*(b++));
270 3 LcdSendData(*(b++));
271 3 LcdSendData(*(b++));
272 3 }
273 2 }
274 1 SetLcdCs();
275 1 }
276 ///////////////////////////////////////////////////////////////////////////////////////////////
ARM COMPILER V2.50a, 3510LCD 03/05/06 03:04:54 PAGE 6
ASSEMBLY LISTING OF GENERATED OBJECT CODE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -