📄 lcd.lst
字号:
C51 COMPILER V7.50 LCD 10/02/2007 11:16:02 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN .\LCD.obj
COMPILER INVOKED BY: D:\Program Files\Keil\C51\BIN\C51.EXE D:\LCD PROG\LCD.c BROWSE DEBUG OBJECTEXTEND PRINT(.\LCD.lst)
-OBJECT(.\LCD.obj)
line level source
1 /*******************Describtion************************
2 LCD:RT320240A
3 Controller: SED1335
4 Timing mode: 8080
5 Compiler: keil c51
6 Designer: SUN
7 ********************IO Configure************************
8 SED1335 MCU
9 1. VSS
10 2. VDD
11 3. V0
12 4. WR------------P36(WR)
13 5. RD------------P37(RD)
14 6. CS------------P27
15 7. A0------------P25
16 8. RES-----------P26
17 9. D0------------P10
18 | |
19 16.D7------------P17
20 17.NC
21 18.VOUT
22 19.LEDK
23 20.LEDA
24
25 /*******************Include Files***********************/
26 #include<reg51.h>
27 /***********************Command List*********************/
28 #define system_set 0x40
29 #define sleep_in 0x53
30 #define disp_on 0x59
31 #define disp_off 0x58
32 #define scroll 0x44
33 #define scrform 0x5d
34 #define cgram_adr 0x5c
35 #define csrdir_right 0x4c
36 #define csrdir_left 0x4d
37 #define csrdir_up 0x4e
38 #define csrdir_down 0x4f
39 #define hdot_scr 0x5a
40 #define ovlay 0x5b
41 #define csrw 0x46
42 #define csrr 0x47
43 #define mwrite 0x42
44 #define mread 0x43
45
46 /*****Pin Define******/
47 #define databus P1
48 sbit a0=P2^5;
49 sbit read=P3^7;
50 sbit write=P3^6;
51 sbit cs=P2^7;
52 sbit rst=P2^6;
53
54 /********************Parameter List*****************/
C51 COMPILER V7.50 LCD 10/02/2007 11:16:02 PAGE 2
55 unsigned char code system_set_ini[8]={0x34,0x87,0x07,0x27,0x4a,0xf0,0x28,0x00};
56 unsigned char code scroll_ini1[6]={0x00,0x00,0xef,0x60,0x09,0xf0};
57 unsigned char code scroll_ini2[6]={0xb0,0x04,0x1e,0x60,0x09,0xf0};
58 unsigned char code scrform_ini[2]={0x07,0x86};
59 unsigned char code hdot_scr_ini[2]={0x00,0x0b};
60 unsigned char code ovlay_ini[1]={0x01};
61 unsigned char code disp_on_ini[1]={0x16};
62 unsigned char code disp_off_ini[1]={0x00};
63 unsigned char code cur_set_ini[2]={0x28,0x00};
64 unsigned char code cur_set_ini1[2]={0x00,0x00};
65 unsigned char code cur_set_ini2[2]={0xb8,0x04};
66 unsigned char code cur_set_ini3[2]={0x60,0x09};
67
68 unsigned char code word2[8]={0x20,0x41,0x4e,0x44,0x4f,0x52,0x49,0x4e};
69 unsigned char code word3[]={0x00};
70 unsigned char code null[1]={0x00};
71
72 unsigned char code hex1[1]={0xaa};
73 unsigned char code hex2[1]={0x55};
74 unsigned char code hex3[1]={0x20};
75 unsigned char code fill[1]={0Xff};
76 unsigned char code kright[1]={0X01};
77 unsigned char code kleft[1]={0x80};
78
79 unsigned char code an[];
80 unsigned char code de[];
81 unsigned char code li[];
82 unsigned char code guang[];
83 unsigned char code dian[];
84 unsigned char code ke[];
85 unsigned char code ji[];
86
87
88 void delay(int t)
89 {
90 1 int i=0;
91 1 for(i=0;i<t;i++);
92 1 }
93
94 void long_delay(int t)
95 {
96 1 int i=0;
97 1 int n;
98 1 for(i=0;i<t;i++)
99 1 {
100 2 for(n=0;n<1000;n++);
101 2 }
102 1 }
103
104 /**************Write Command&Parameter*************/
105 void sed1335_write(char commandcode, unsigned char code *parameter,int n)
106 {
107 1 int i=0;
108 1
109 1 a0=1;
110 1 read=1;
111 1 databus=commandcode;
112 1 write=0;
113 1 write=1;
114 1
115 1 for(i=0;i<n;i++)
116 1 {
C51 COMPILER V7.50 LCD 10/02/2007 11:16:02 PAGE 3
117 2 a0=0;
118 2 read=1;
119 2 databus=parameter[i];
120 2 write=0;
121 2 write=1;
122 2 }
123 1 }
124
125 //在图形层写一个汉字//
126 void sed1335_write1(char commandcode,char low,int high)
127 {
128 1 a0=1;
129 1 read=1;
130 1 databus=commandcode;
131 1 write=0;
132 1 write=1;
133 1
134 1 a0=0;
135 1 read=1;
136 1 databus=low;
137 1 write=0;
138 1 write=1;
139 1
140 1 a0=0;
141 1 read=1;
142 1 databus=high;
143 1 write=0;
144 1 write=1;
145 1
146 1 }
147
148 /*写任何大小的一块, i为高度,j*8为宽度*/
149 wr_any(int low,int high, char word[],int i,int j)
150 {
151 1 int k=0;
152 1 for( k=0;k<j;k++)
153 1 {
154 2 sed1335_write1(csrw,low,high);
155 2 sed1335_write(csrdir_down,null,1);
156 2 sed1335_write(mwrite,word+i*k,i);
157 2 low=low+1;
158 2 if(low==0xff+1)
159 2 {low=0;high=high+1;}
160 2 }
161 1 }
162
163 void clr_scr()
164 {
165 1 int i=0;
166 1
167 1 sed1335_write(csrdir_right,null,1);
168 1 sed1335_write(csrw,cur_set_ini1,2);
169 1 a0=1;
170 1 read=1;
171 1 databus=mwrite;
172 1 write=0;
173 1 write=1;
174 1
175 1 for(i=0;i<28800;i++)
176 1 {
177 2 a0=0;
178 2 read=1;
C51 COMPILER V7.50 LCD 10/02/2007 11:16:02 PAGE 4
179 2 databus=0x00;
180 2 write=0;
181 2 write=1;
182 2 }
183 1 sed1335_write(csrw,cur_set_ini1,2);
184 1 }
185
186 /*清除图形层*/
187 clrgrp_scr()
188 {
189 1 int j=0;
190 1 sed1335_write(csrw,cur_set_ini3,2);
191 1 for(j=0;j<9600;j++)
192 1 {
193 2 sed1335_write(mwrite,word3,1);
194 2 }
195 1 }
196
197 wr_word(int low,int high, char word[],int i,int j)
198 {
199 1 int k=0;
200 1 for( k=0;k<j;k++)
201 1 {
202 2 sed1335_write1(csrw,low,high);
203 2 sed1335_write(csrdir_down,null,1);
204 2 sed1335_write(mwrite,word+i*k,i);
205 2 low=low+1;
206 2 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -