📄 lcd.lst
字号:
C51 COMPILER V7.50 LCD 09/05/2008 09:53:58 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN ..\output\output_bin\output_program\lcd.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\code\ap_main\src\lcd.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..\..\
-bsp\include;..\..\code\ap_main\src\include;..\..\code\global;..\..\code\include) DEFINE(CONFIG_ASIC,dynamic_load,FIRST)
-DEBUG OBJECTEXTEND PRINT(..\output\output_bin\output_program\lcd.lst) OBJECT(..\output\output_bin\output_program\lcd.obj
-)
line level source
1 #include <string.h>
2 #include "api.h"
3 //#include "mp3app.h"
4 #include "get_latin2.h"
5 #include "lcd.h"
6 #include "get_latin2.h"
7 #include"common.h"
8
9
10 #define MIN(a,b) ((a) < (b) ? (a) : (b))
11 #define MAX(a,b) ((a) > (b) ? (a) : (b))
12
13 UINT8 lcd_max_str;
14
15 #ifdef loop_show_file_name
INT8 sonename_loop_step;//john 070606
INT8 songname_Chinese_max;//john 070606
INT8 songname_English_max;//john 070606
#endif
20
21 UINT16 fg_color, bg_color;
22 UINT16 bg_pixel[SCREEN_WIDTH];
23 UINT16 pixel_buf[256];
24
25
26 void delay_1ms(void)
27 {
28 1 UINT16 n;
29 1
30 1 for(n = 420; n > 0; n--) {}
31 1 }
32
33 void delay(UINT16 n)
34 {
35 1 while(n--)
36 1 delay_1ms();
37 1 }
38
39 void writec(UINT8 cmd)
40 {
41 1 lcd_setcmd(cmd);
42 1 }
43 void writed(UINT8 lcddata)
44 {
45 1 lcd_setdata(lcddata);
46 1 }
47
48 void write2c(UINT8 i, UINT8 j)
49 {
50 1 writec(i);
51 1 writec(j);
52 1 }
C51 COMPILER V7.50 LCD 09/05/2008 09:53:58 PAGE 2
53
54 BOOLEAN lcd_put_data(UINT16 buf, UINT16 size)
55 {
56 1 return api_bLcdDataMove(buf,size);
57 1 }
58
59
60 void lcd_set_rw_area(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
61 {
62 1 api_vLcdPinSelect();
63 1
64 1 writec(0x43);
65 1 writec(x); // start x
66 1 writec(x + w - 1); // end x
67 1
68 1 writec(0x42);
69 1 writec(y+2); // start y
70 1 writec(y + h + 1 ); // end y
71 1 api_vLcdPinRecover();
72 1 }
73
74 void lcd_set_disply_mode(UINT8 disply_mode,UINT8 scan_direction )
75 {
76 1 api_vLcdPinSelect();
77 1 writec(0x40);
78 1 writec(disply_mode); //显示模式
79 1 writec(0x10);
80 1 writec(scan_direction); // 扫描方向 22 和 26相反
81 1 api_vLcdPinRecover();
82 1 }
83
84
85
86 void lcd_clear(void)
87 {
88 1 UINT8 i;
89 1
90 1 lcd_set_rw_area(0, 0, XRES, YRES);
91 1
92 1 memset(pixel_buf, 0x0, sizeof(pixel_buf));
93 1
94 1 for(i = 0; i < YRES; i++)
95 1 lcd_put_data((UINT16)pixel_buf, XRES << 1);
96 1 }
97 void lcd_clear_word(void)
98 {
99 1 UINT8 i;
100 1
101 1 lcd_set_rw_area(50, 74, 54, 80);
102 1
103 1 memset(pixel_buf, 0xF77F, sizeof(pixel_buf));
104 1
105 1 for(i = 96; i < 102; i++)
106 1 lcd_put_data((UINT16)pixel_buf, XRES << 1);
107 1 }
108
109 void lcd_set_brightness(UINT8 v)
110 {
111 1 #if 1
112 1 api_vLcdPinSelect();
113 1 writec(0x2a);
114 1 writec(0xce+v); //90 0xde c8
C51 COMPILER V7.50 LCD 09/05/2008 09:53:58 PAGE 3
115 1 delay(20);
116 1 writec(0x2b);
117 1 writec(0x44+v); //90 0x54 c8
118 1 api_vLcdPinRecover();
119 1 #else
api_vLcdPinSelect();
writec(0x2a);
writec(v*8); //90 0xde c8
delay(20);
writec(0x2b);
writec(v*8); //90 0x54 c8
api_vLcdPinRecover();
#endif
128 1 }
129
130 void lcd_init(void)
131 {
132 1 // CDIR = 1;
133 1 // Print("LCD Init\n");
134 1 api_vLcdInit(LCM_INTERFACE_8080);
135 1 api_vLcdPinSelect();
136 1 bLCD_PIN_RESET = 0;
137 1 delay(100);
138 1 bLCD_PIN_RESET = 1;
139 1
140 1 delay(100);
141 1 //-------------------------------------------------
142 1 writec(0x2C);
143 1 delay(20);
144 1 //-------------------------------------------------
145 1 writec(0x02);
146 1 writec(0x01);
147 1 delay(20);
148 1 //-------------------------------------------------
149 1 writec(0x26);
150 1 writec(0x01);
151 1 delay(20);
152 1 writec(0x26);
153 1 writec(0x09);
154 1 delay(20);
155 1 writec(0x26);
156 1 writec(0x0b);
157 1 delay(20);
158 1 writec(0x26);
159 1 writec(0x0f);
160 1 delay(20);
161 1 //------------------------------------------------
162 1 writec(0x10);
163 1 writec(0x23); // 21,25
164 1 delay(5);
165 1 //-------------------------------------------------
166 1 writec(0x20);
167 1 writec(0x03); //20
168 1 delay(20);
169 1 //-------------------------------------------------
170 1 writec(0x22);
171 1 writec(0x11);
172 1 delay(5);
173 1 //------------------------------------------------
174 1 writec(0x24);
175 1 writec(0x11); //00
176 1 delay(20);
C51 COMPILER V7.50 LCD 09/05/2008 09:53:58 PAGE 4
177 1 //-------------------------------------------------
178 1 writec(0x28);
179 1 writec(0x01);
180 1 delay(20);
181 1 /*******************对比度调节****************/
182 1 writec(0x2a);
183 1 writec(0xde); //90 0xde c8
184 1 delay(20);
185 1 writec(0x2b);
186 1 writec(0x54); //90 0x54 c8
187 1 delay(10);
188 1 /***************************************************/
189 1 writec(0x30);
190 1 writec(0x09); //0b
191 1 delay(20);
192 1 //------------------------------------------------
193 1 writec(0x32);
194 1 writec(0x0E);
195 1 delay(20);
196 1 //-----------------------------------------------
197 1 writec(0x34);
198 1 writec(0x08);//0d
199 1 delay(20);
200 1 //-------------------------------------------------
201 1 writec(0x36);
202 1 writec(0x00);
203 1 delay(20);
204 1 /*********************显示模式******************/
205 1 writec(0x40);
206 1 writec(0x00);//显示模式08和 00相反 竖屏
207 1 writec(0x10);
208 1 writec(0x22);//扫描方式22和26相反 横屏
209 1 delay(20);
210 1 /****************************************************/
211 1 writec(0x43);
212 1 writec(0x00);
213 1 writec(0x7F);
214 1 delay(20);
215 1 //------------------------------------------------
216 1 writec(0x42);
217 1 writec(0x00);
218 1 writec(0x9F);
219 1 delay(20);
220 1 //------------------------------------------------
221 1 writec(0x53);
222 1 writec(0x00);
223 1 delay(20);
224 1
225 1
226 1
227 1
228 1
229 1 //-------------------------------------------------
230 1 writec(0xEB);
231 1 delay(20);
232 1 //-------------------------------------------------
233 1 writec(0x45);
234 1 writec(0x00);
235 1 //-------------------------------------------------
236 1 writec(0x55);
237 1 writec(0x00);
238 1 delay(20);
C51 COMPILER V7.50 LCD 09/05/2008 09:53:58 PAGE 5
239 1 //------------------------------------------------
240 1 writec(0x5A);
241 1 writec(0x00);
242 1 delay(20);
243 1
244 1
245 1
246 1 //------------------------------------------------
247 1 writec(0x51);
248 1 delay(40);
249 1
250 1 api_vLcdPinRecover();
251 1 lcd_set_brightness(10);
252 1 }
253
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 623 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 773 9
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 + -