📄 init_lcd.lst
字号:
C51 COMPILER V6.12 INIT_LCD 07/06/2003 16:32:58 PAGE 1
C51 COMPILER V6.12, COMPILATION OF MODULE INIT_LCD
OBJECT MODULE PLACED IN init_lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE init_lcd.c DB OE
stmt level source
1 /*=========================================================================================
2 INITLCD RUTINE
3 ===========================================================================================
4 AHTH: GDY
5 DATE:
6 COMMENT:
7 ===========================================================================================*/
8 /*--------------------------------------INCLUDE--------------------------------------------*/
9 #include <c8051f020.h>
10 /*---------------------------------------FUCTION DECLARING---------------------------------*/
11 extern void set_xy(unsigned char x,unsigned char y);
12 extern void delay(int t);
13 unsigned char read_status();
14 unsigned char wcode(unsigned char c);
15 unsigned char wdata(unsigned char d);
16 /*---------------------------------------16BIT SFR DEFINE----------------------------------*/
17 sbit DINLCD=P1^0;
18 sbit RWLCD=P3^7;
19 sbit ESIG=P1^1;
20 /*---------------------------------------GLOBLE DEFINE OR DECLARING------------------------*/
21 extern unsigned char code zk[];
22 unsigned char read_status()
23 {
24 1 unsigned char status;
25 1 RWLCD=1;
26 1 // CSLCD=0;
27 1 DINLCD=0;
28 1 ESIG=1;
29 1 status=0;
30 1 ESIG=0;
31 1 return(status);
32 1 }
33
34 void init_lcd()
35 {
36 1 unsigned char status;
37 1 status=read_status()&0x80;
38 1 while(status)
39 1 status=read_status()&0x80;
40 1 wcode(0x3f);
41 1 status=read_status()&0x80;
42 1 while(status)
43 1 status=read_status()&0x80;
44 1 wcode(0xc0);
45 1 status=read_status()&0x80;
46 1 while(status)
47 1 status=read_status()&0x80;
48 1 wcode(0xb8);
49 1 status=read_status()&0x80;
50 1 while(status)
51 1 status=read_status()&0x80;
52 1 wcode(0x40);
53 1 }
54 /****************************************
55 THE BLOCK IS FOR WRITTING CODE
C51 COMPILER V6.12 INIT_LCD 07/06/2003 16:32:58 PAGE 2
56 WR=0
57 DI=0
58 and when the e's fall ,the code would be latched.
59 ****************************************/
60 unsigned char wcode(unsigned char c)
61 {
62 1 RWLCD=0;
63 1 delay(10);
64 1 // CSLCD=0;
65 1 DINLCD=0;
66 1 delay(10);
67 1 ESIG=1;
68 1 delay(10);
69 1 P2=c;
70 1 delay(10);
71 1 ESIG=0;
72 1 delay(10);
73 1 return(c);
74 1 }
75 /****************************************
76 THE BLOCK IS FOR WRITTING DATA
77 DI=1
78 RW=0
79 when e's falling ,the data would be latched
80 ****************************************/
81
82 unsigned char wdata(unsigned char d)
83 {
84 1 DINLCD=1;
85 1 delay(10);
86 1 // CSLCD=0;
87 1 RWLCD=0;
88 1 delay(10);
89 1 ESIG=1;
90 1 delay(10);
91 1 // delay(5);
92 1 P2=d;
93 1 delay(100);
94 1 ESIG=0;
95 1 delay(10);
96 1 return(d);
97 1 delay(10);
98 1 }
99 /****************************************
100 THE BLOCK IS FOR CLEARING
101 ****************************************/
102
103 void clear()
104 {
105 1 int i=0,x=0;
106 1 for(x=0;x<8;x++)
107 1 {
108 2 set_xy(x,0);
109 2 for(i=0;i<64;i++)
110 2 wdata(0x00);
111 2 }
112 1 }
113
114
MODULE INFORMATION: STATIC OVERLAYABLE
C51 COMPILER V6.12 INIT_LCD 07/06/2003 16:32:58 PAGE 3
CODE SIZE = 290 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 7
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 + -