📄 lcd12232.lst
字号:
229 2 tg12232e_wrins(0x3a); //NXSET 开图形显示,进入基本指令模式
230 2 for(count1=8 ;count1>0;count1--){
231 3 tg12232e_wrdata(*ppicture);
232 3 ppicture ++;
233 3 tg12232e_wrdata(*ppicture);
234 3 ppicture ++;
235 3 }
236 2 ROW ++;
237 2 }
238 1
239 1 COL = 0x08;
240 1 ROW = 0x00;
241 1 for(count2=32;count2>0;count2--){
C51 COMPILER V8.02 LCD12232 01/26/2007 11:12:41 PAGE 5
242 2 tg12232e_wrins(0x3e); //EXSET 开图形显示,进入扩展指令模式
243 2 tg12232e_wrins(ROW | 0x80);//SETB ACC.7 first write vertical address
244 2 tg12232e_wrins(COL | 0x80);//SETB ACC.7 second write horizontal address
245 2 tg12232e_wrins(0x3a); //NXSET 开图形显示,进入基本指令模式
246 2 for(count1=8 ;count1>0;count1--){
247 3 tg12232e_wrdata(*ppicture);
248 3 ppicture ++;
249 3 tg12232e_wrdata(*ppicture);
250 3 ppicture ++;
251 3 }
252 2 ROW ++;
253 2 }
254 1 }
255
256
257
258 //图形模式清屏子程序
259 void tg12232e_clear(unsigned char indata)
260 {
261 1 unsigned char ROW,COL,count1,count2;
262 1
263 1 ROW = 0x00;
264 1 COL = 0x00;
265 1 for(count2=32;count2>0;count2--){
266 2 tg12232e_wrins(0x3e); //EXSET
267 2 tg12232e_wrins(ROW | 0x80);//SETB ACC.7 first write vertical address
268 2 tg12232e_wrins(COL | 0x80);//SETB ACC.7 second write horizontal address
269 2 tg12232e_wrins(0x3a); //NXSET
270 2 for(count1=8;count1>0;count1--){
271 3 tg12232e_wrdata(indata);
272 3 tg12232e_wrdata(indata);
273 3 }
274 2 ROW ++;
275 2 }
276 1
277 1 ROW = 0x00;
278 1 COL = 0x08;
279 1 for(count2=32;count2>0;count2--){
280 2 tg12232e_wrins(0x3e); //EXSET
281 2 tg12232e_wrins(ROW | 0x80);//SETB ACC.7 first write vertical address
282 2 tg12232e_wrins(COL | 0x80);//SETB ACC.7 second write horizontal address
283 2 tg12232e_wrins(0x3a); //NXSET
284 2 for(count1=8;count1>0;count1--){
285 3 tg12232e_wrdata(indata);
286 3 tg12232e_wrdata(indata);
287 3 }
288 2 ROW ++;
289 2 }
290 1 }
291
292
293
294
295 //文本模式下写汉字&字符子程序
296 void tg12232e_text(unsigned char *ptext)
297 {
298 1 unsigned char count1;
299 1
300 1 tg12232e_wrins(0x38);
301 1 tg12232e_delay100us();
302 1
303 1 tg12232e_wrins(0x80);//SET FIRST ROW DDRAM ADDRESS
C51 COMPILER V8.02 LCD12232 01/26/2007 11:12:41 PAGE 6
304 1 for(count1=8;count1>0;count1--){
305 2 tg12232e_wrdata(*ptext);
306 2 ptext++;
307 2 tg12232e_wrdata(*ptext);
308 2 ptext++;
309 2 }
310 1
311 1 tg12232e_wrins(0x90);//SET SECOND ROW DDRAM ADDRESS
312 1 for(count1=8;count1>0;count1--){
313 2 tg12232e_wrdata(*ptext);
314 2 ptext++;
315 2 tg12232e_wrdata(*ptext);
316 2 ptext++;
317 2 }
318 1
319 1 tg12232e_wrins(0x88);//SET THIRD ROW DDRAM ADDRESS
320 1 for(count1=8;count1>0;count1--){
321 2 tg12232e_wrdata(*ptext);
322 2 ptext++;
323 2 tg12232e_wrdata(*ptext);
324 2 ptext++;
325 2 }
326 1
327 1 tg12232e_wrins(0x98);//SET FOURTH ROW DDRAM ADDRESS
328 1 for(count1=8;count1>0;count1--){
329 2 tg12232e_wrdata(*ptext);
330 2 ptext++;
331 2 tg12232e_wrdata(*ptext);
332 2 ptext++;
333 2 }
334 1 tg12232e_delay();
335 1 }
336
337 //文本模式下清屏子程序
338 void tg12232e_clear_text()
339 {
340 1 unsigned char count1;
341 1
342 1 tg12232e_wrins(0x38);
343 1 tg12232e_delay100us();
344 1 tg12232e_wrins(0x80); //SET DDRAM ADDRESS
345 1
346 1 for(count1=64;count1>0;count1--){
347 2 tg12232e_wrdata(0x20);
348 2 }
349 1 }
350
351 //初始化子程序
352 void tg12232e_initial()
353 {
354 1 unsigned char i;
355 1
356 1 bitCS = 0;
357 1 bitSID = 0;
358 1 bitSCLK = 0;
359 1 bitPSB = 0;
360 1
361 1 bitRESET = 0;
362 1 tg12232e_delay100us();
363 1 tg12232e_delay100us();
364 1 tg12232e_delay100us();
365 1 tg12232e_delay100us();
C51 COMPILER V8.02 LCD12232 01/26/2007 11:12:41 PAGE 7
366 1 tg12232e_delay100us();
367 1 bitRESET = 1;
368 1
369 1
370 1 tg12232e_wrins(0x38); //function set DL--8 bit MPU bus interface set
371 1 tg12232e_delay100us();
372 1 tg12232e_wrins(0x38); //function set RE--basic instruction set
373 1 tg12232e_delay100us();
374 1 tg12232e_wrins(0x38); //function set x
375 1 tg12232e_delay100us();
376 1
377 1 tg12232e_wrins(0x01); //display clear screen
378 1 for(i=0;i<100;i++) tg12232e_delay100us();
379 1
380 1 tg12232e_wrins(0x06); //entry mode set I/D=1
381 1 tg12232e_delay100us();
382 1 tg12232e_wrins(0x0c); //display on
383 1 tg12232e_delay100us();
384 1 }
385
386
387 void main()
388 {
389 1 unsigned char dat,count1;
390 1
391 1 while(1){
392 2 tg12232e_initial();
393 2
394 2
395 2
396 2
397 2 tg12232e_tuxing(picture2);
398 2 tg12232e_delay();
399 2
400 2 tg12232e_tuxing(picture1);
401 2 tg12232e_delay();
402 2
403 2 tg12232e_clear(0x00);
404 2 tg12232e_delay();
405 2
406 2 tg12232e_wrins(0x38);
407 2 tg12232e_delay100us();
408 2 tg12232e_wrins(0x80); //SET DDRAM ADDRESS
409 2 dat = 0x41;
410 2 for(count1=64;count1>0;count1--) tg12232e_wrdata(dat++);
411 2 tg12232e_delay();
412 2
413 2 tg12232e_text(textlist);
414 2 tg12232e_delay();
415 2
416 2 tg12232e_text(gb);
417 2 tg12232e_delay();
418 2
419 2 tg12232e_clear_text();
420 2 tg12232e_delay();
421 2
422 2 tg12232e_clear(0x00);
423 2 tg12232e_delay();
424 2
425 2 tg12232e_clear(0xaa);
426 2 tg12232e_delay();
427 2
C51 COMPILER V8.02 LCD12232 01/26/2007 11:12:41 PAGE 8
428 2 tg12232e_clear(0x55);
429 2 tg12232e_delay();
430 2
431 2 tg12232e_clear(0xff);
432 2 tg12232e_delay();
433 2
434 2 tg12232e_clear(0x00);
435 2 tg12232e_delay();
436 2
437 2 tg12232e_clear(0x80);
438 2 tg12232e_delay();
439 2
440 2 tg12232e_clear(0x00);
441 2
442 2 tg12232e_delay();
443 2
444 2 tg12232e_clear(0xff);
445 2 tg12232e_delay();
446 2 }
447 1 }
448
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 598 ----
CONSTANT SIZE = 1096 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 4
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 + -