📄 s6b33bd.lst
字号:
C51 COMPILER V8.05a S6B33BD 10/13/2008 21:39:07 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE S6B33BD
OBJECT MODULE PLACED IN S6B33BD.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE S6B33BD.c BROWSE DEBUG OBJECTEXTEND
line level source
1
2 #include <AT89X52.H>
3 #include <intrins.h>
4 #define CS1 P3_5
5 #define RST P3_4
6 sbit SDA=P3^0;
7 sbit SCK=P3^1;
8
9 sbit SET=P1^2;
10
11
12
13 void Delay(unsigned int n)
14 {
15 1 while(n--);
16 1 return;
17 1 }
18
19 #pragma disable
20 void Write_Data(unsigned char dat)
21 {
22 1 unsigned char idata i;
23 1 SCK=0;
24 1 Delay(1);
25 1 SDA=1;
26 1 _nop_();
27 1 SCK=1;
28 1 _nop_();
29 1 for(i=0;i<8;i++)
30 1 {
31 2 SCK=0;
32 2 SDA=dat&0x80;
33 2 dat=dat<<1;
34 2 SCK=1;
35 2 }
36 1 return;
37 1 }
38
39 #pragma disable
40 void Write_Instruction(unsigned char idata cmd)
41 {
42 1 unsigned char idata i;
43 1 SCK=0;
44 1 _nop_();
45 1 SDA=0;
46 1 _nop_();
47 1 SCK=1;
48 1 _nop_();
49 1 for(i=0;i<8;i++)
50 1 {
51 2 SCK=0;
52 2 _nop_();
53 2 SDA=cmd&0x80;
54 2 cmd=cmd<<1;
55 2 _nop_();
C51 COMPILER V8.05a S6B33BD 10/13/2008 21:39:07 PAGE 2
56 2 SCK=1;
57 2 _nop_();
58 2 }
59 1 return;
60 1 }
61
62 void OTP(unsigned char dat)
63 {
64 1 RST=0;
65 1 Delay(200);
66 1 RST=1;
67 1 Delay(10000);
68 1 Write_Instruction(0x10);// sleep in
69 1
70 1 Write_Instruction(0xd0);// set otp mode
71 1 Write_Data(0x03);//0x00 0ff 0x03 on
72 1
73 1 Write_Instruction(0xd3);// set otp data
74 1 Write_Data(dat);//
75 1
76 1 Write_Instruction(0xd1);// set otp address
77 1 Write_Data(0x00);//0x00 elctronic volume 0x01 id2
78 1
79 1 Write_Instruction(0xd2);// otp write
80 1 Write_Data(0x01);//0x00 disable 0x01 enable
81 1
82 1 Delay(65000);
83 1 Delay(65000);
84 1
85 1 Write_Instruction(0xd2);// otp write
86 1 Write_Data(0x00);//0x00 disable 0x01 enable
87 1
88 1 RST=1;
89 1 Delay(10000);
90 1
91 1 return;
92 1 }
93
94 #pragma disable
95 void Initial(void)
96 {
97 1 Write_Instruction(0x11);// sleep out
98 1
99 1 Write_Instruction(0x13);// normal diaplay mode on
100 1 // Write_Instruction(0x23);// all pixel on
101 1
102 1 Write_Instruction(0x25);// write contrast
103 1 Write_Data(0x2f);//0x4f def:3f nor:2f
104 1
105 1 Write_Instruction(0x29);// display on
106 1
107 1 Write_Instruction(0x2a);// column address set
108 1 Write_Data(0x00);
109 1 Write_Data(0x61);
110 1 Write_Instruction(0x2b);// page address set
111 1 Write_Data(0x00);
112 1 Write_Data(0x45);
113 1
114 1 Write_Instruction(0x36);// meory adta access control
115 1 Write_Data(0x00);
116 1
117 1 // Write_Instruction(0x38);//idle mode off
C51 COMPILER V8.05a S6B33BD 10/13/2008 21:39:07 PAGE 3
118 1
119 1 Write_Instruction(0x3a);// interface pixel format
120 1 Write_Data(0x05);
121 1
122 1 }
123
124
125
126 /*
127 void Display_Grid(unsigned char value_first,unsigned char value_second)
128 {
129 unsigned char i,j;
130
131 Initial_Dispay_Line(0x40);
132 for(i=0;i<0x06;i++)
133 {
134 Set_Page_Address(i);
135 Set_Column_Address(0x00);
136 for(j=0;j<96;j++)
137 {
138 Write_Data(value_first);
139 Write_Data(value_second);
140 }
141 }
142 return;
143 }
144 */
145 void Display_Picture(unsigned char pic[])
146 {
147 1 register unsigned char i,j;
148 1 register unsigned int tmp1=0;
149 1 Write_Instruction(0x2c); // memory write
150 1 for(j=0;j<0x8c;j++)
151 1 {
152 2 for(i=0;i<0x62;i+=2)
153 2 {
154 3 Write_Data(pic[tmp1]);
155 3 Write_Data(pic[tmp1+1]);
156 3 tmp1+=2;
157 3 }
158 2 }
159 1 return;
160 1 }
161
162 void Display_Color(unsigned char dat1,unsigned char dat2)
163 {
164 1 register unsigned char i,j;
165 1 Write_Instruction(0x2c); // memory write
166 1 for(i=0;i<0x46;i++)
167 1 {
168 2 for(j=0;j<0x62;j++)
169 2 {
170 3 Write_Data(dat1);
171 3 Write_Data(dat2);
172 3 }
173 2 }
174 1 return;
175 1 }
176
177 void main(void)
178 {
179 1 unsigned char tmp1=0x00;
C51 COMPILER V8.05a S6B33BD 10/13/2008 21:39:07 PAGE 4
180 1 unsigned char tmp2=0x00;
181 1 unsigned char tmp=0x00;
182 1 Delay(1000);
183 1 CS1=0;
184 1
185 1 Initial();
186 1 Display_Picture(pic);
*** ERROR C202 IN LINE 186 OF S6B33BD.C: 'pic': undefined identifier
187 1 Delay(1000);
188 1
189 1 while(SET==1)
190 1 {
191 2 P1=0xff;
192 2 if (P1_0==0)
193 2 {
194 3 Delay(6000);
195 3 if (P1_0==0)
196 3 {
197 4 while(P1_0==0);
198 4 if (tmp1<=0x0e) tmp1++;
199 4 Write_Instruction(0x25);
200 4 Write_Data(0x2f+(tmp1-tmp2)*2);
201 4 }
202 3 }
203 2 if (P1_1==0)
204 2 {
205 3 Delay(6000);
206 3 if (P1_1==0)
207 3 {
208 4 while(P1_1==0);
209 4 if (tmp2<=0x0e) tmp2++;
210 4 Write_Instruction(0x25);
211 4 Write_Data(0x2f+(tmp1-tmp2)*2);
212 4 }
213 3 }
214 2
215 2 }
216 1
217 1 if (tmp1>tmp2) tmp=tmp1-tmp2;
218 1 if (tmp1<tmp2) tmp=tmp2-tmp1+0x10;
219 1 if (tmp1==tmp2) tmp=0x00;
220 1
221 1 OTP(tmp);
222 1
223 1 Initial();
224 1 while(1)
225 1 {
226 2 Display_Picture(pic);
*** ERROR C202 IN LINE 226 OF S6B33BD.C: 'pic': undefined identifier
227 2 Delay(65000);
228 2 Delay(65000);
229 2
230 2 Display_Color(0xf8,0x00);
231 2 Delay(65000);
232 2 Delay(65000);
233 2
234 2 Display_Color(0x07,0xe0);
235 2 Delay(65000);
236 2 Delay(65000);
237 2
238 2 Display_Color(0x00,0x1f);
239 2 Delay(65000);
C51 COMPILER V8.05a S6B33BD 10/13/2008 21:39:07 PAGE 5
240 2 Delay(65000);
241 2
242 2 Display_Color(0xff,0xff);
243 2 Delay(65000);
244 2 Delay(65000);
245 2 }
246 1
247 1 }
C51 COMPILATION COMPLETE. 0 WARNING(S), 2 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -