📄 gg.lst
字号:
C51 COMPILER V8.05a GG 10/04/2007 17:46:28 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE GG
OBJECT MODULE PLACED IN gg.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE gg.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg51.h>
2 #include <intrins.h>
3 #include <ADC0808.c>
4 sbit DI=P2^2; // 数据\指令 选择
5 sbit RW=P2^1; // 读\写 选择
6 sbit E=P2^0; // 读\写使能
7 sbit CS1=P2^4; // 片选1
8 sbit CS2=P2^3; // 片选2
9 sbit busy=P1^7;
10 sbit jia=P3^7;
11 sbit jian=P3^3;
12 sbit jia1=P3^0;
13 sbit jian1=P3^1;
14 unsigned int i;
15 unsigned char ye,lei,shu;
16 unsigned char a[91];
17 char code t[]={
18
19
20 0x00,0x00,0x08,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x40,0x60,0x80,0x00,0x7F,0xFF, //小
21 0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x06,0x00,0x00,0x00,0x00,0x00,
22
23 0x00,0x80,0x00,0x80,0x00,0x82,0x00,0x82,0x00,0x82,0x40,0x82,0x80,0x82,0x7F,0xE2, //子
24 0x00,0xA2,0x00,0x92,0x00,0x8A,0x00,0x86,0x00,0x80,0x00,0xC0,0x00,0x80,0x00,0x00,
25
26 0x00,0x40,0x00,0x60,0x3F,0x5E,0x01,0x48,0x01,0x48,0xFF,0xFF,0x11,0x48,0x21,0x4C, //制
27 0x1F,0x68,0x00,0x40,0x07,0xF8,0x40,0x00,0x80,0x00,0x7F,0xFF,0x00,0x00,0x00,0x00,
28
29 0x00,0x80,0x00,0x40,0x00,0x20,0xFF,0xF8,0x00,0x87,0x00,0x40,0x00,0x30,0x00,0x0F, //作
30 0xFF,0xF8,0x08,0x88,0x08,0x88,0x08,0xC8,0x0C,0x88,0x08,0x0C,0x00,0x08,0x00,0x00,
31 };
32
33
34
35 void checkstate()
36 {
37 1 DI=0;
38 1 RW=1;
39 1 do
40 1 {
41 2 E=1;
42 2 E=0;
43 2 //仅当第7位为0时才可操作(判别busy信号)
44 2 }while(busy==1);
45 1 }
46 void writecommand(unsigned char command) //写命令
47 {
48 1 checkstate();
49 1 DI=0;
50 1 RW=0;
51 1 P1=command;
52 1 E=1;
53 1 E=0;
54 1 }
55 void writedate(unsigned char date) //写数据
C51 COMPILER V8.05a GG 10/04/2007 17:46:28 PAGE 2
56 {
57 1 checkstate();
58 1 DI=1;
59 1 RW=0;
60 1 P1=date;
61 1 E=1;
62 1 E=0;
63 1 }
64
65 void pianxuan(unsigned int i)
66 {
67 1 if(i==1)
68 1 CS1=0,CS2=1;
69 1 if(i==2)
70 1 CS1=1,CS2=0;
71 1 if(i==3)
72 1 CS1=0,CS2=0;
73 1 }
74 void shuju()
75 {
76 1 pianxuan(i);
77 1 writecommand(ye);
78 1 writecommand(lei);
79 1 writedate(shu);
80 1 }
81 void cleanscreen() //清屏
82 {
83 1 unsigned char page,i;
84 1 pianxuan(3);
85 1 for(page=0xb8;page<=0xbf;page++)
86 1 {
87 2 writecommand(page);
88 2 writecommand(0x40);
89 2 for(i=0;i<64;i++)
90 2 writedate(0x00);
91 2
92 2 }
93 1 pianxuan(1);
94 1 lei=0x40;
95 1 for(ye=0xb8;ye<0xbf;ye++)
96 1 {
97 2 shu=0xff;
98 2 shuju();
99 2 }
100 1 ye=0xb8;
101 1 for(lei=0x40;lei<=0x7f;lei++)
102 1 {
103 2 shu=0x80;
104 2 shuju();
105 2 }
106 1 ye=0xbf;
107 1 for(lei=0x40;lei<=0x7f;lei++)
108 1 {
109 2 shu=0x01;
110 2 shuju();
111 2 }
112 1 pianxuan(2);
113 1 ye=0xb8;
114 1 for(lei=0x40;lei<=0x5b;lei++)
115 1 {
116 2 shu=0x80;
117 2 shuju();
C51 COMPILER V8.05a GG 10/04/2007 17:46:28 PAGE 3
118 2 }
119 1 ye=0xbf;
120 1 for(lei=0x40;lei<=0x5b;lei++)
121 1 {
122 2 shu=0x01;
123 2 shuju();
124 2 }
125 1 lei=0x5b;
126 1 for(ye=0xb9;ye<=0xbe;ye++)
127 1 {
128 2 shu=0xff;
129 2 shuju();
130 2 }
131 1
132 1 }
133 void init(void) //开显示,起始行0行
134 {
135 1 writecommand(0xc0);
136 1 writecommand(0x3f);
137 1 }
138 void delay_50us(uint t)
139 {
140 1 uchar j;
141 1 for(;t>0;t--)
142 1 for(j=19;j>0;j--);
143 1 }
144
145 void qing()
146 {
147 1 uchar i;
148 1 for(i=0xb9;i<=0xbe;i++)
149 1 {
150 2 ye=i;
151 2 shu=0x00;
152 2 shuju();
153 2 }
154 1 }
155 void main()
156 {
157 1
158 1
159 1 uint r,j,g=0,q,dianya=1,k,p;
160 1 uchar m,l;
161 1 //pianxuan(3);
162 1 cleanscreen();
163 1 init();
164 1 pianxuan(2);
165 1 l=0xb8;
166 1 for(k=0;k<4;k++,l=l+0x02)
167 1 {
168 2 ye=l;
169 2 lei=0x70;
170 2 for(r=0;r<16;r++)
171 2 {
172 3 shu=t[2*r+1+32*k];
173 3 shuju();
174 3 lei++;
175 3 }
176 2 ye=l+0x01;
177 2 lei=0x70;
178 2 for(r=0;r<16;r++)
179 2 {
C51 COMPILER V8.05a GG 10/04/2007 17:46:28 PAGE 4
180 3 shu=t[2*r+32*k];
181 3 shuju();
182 3 lei++;
183 3 }
184 2 }
185 1 while(1)
186 1 {
187 2 uchar d1,d2,d3,d4,d5,d6;
188 2 while(jia==0)
189 2 {
190 3 while(jia==0);
191 3 g=g+1;
192 3 }
193 2 while(jian==0)
194 2 {
195 3 while(jian==0);
196 3 if(g!=0) g=g-1;
197 3 }
198 2 while(jia1==0)
199 2 {
200 3 while(jia1==0);
201 3 dianya=dianya+1;
202 3 }
203 2 while(jian1==0)
204 2 {
205 3 while(jian1==0);
206 3 if(dianya!=1) dianya=dianya-1;
207 3 }
208 2 for(j=0;j<90;j++) //AD采样最大值
209 2 {
210 3 adc();
211 3 a[j]=AD;
212 3 if(a[j]>a[91])
213 3 {
214 4 a[91]=a[j];
215 4 }
216 3 delay_50us(g);
217 3 }
218 2
219 2 while(AD!=a[91])
220 2 {
221 3 adc();
222 3 }
223 2 for(j=0;j<90;j++) //AD采样
224 2 {
225 3 adc();
226 3 a[j]=AD;
227 3 delay_50us(g);
228 3 }
229 2 lei=0x41;
230 2 for(r=0,j=0;r<90;r++,j++)
231 2 {
232 3 if(j<63) i=1;
233 3 if(j==63) lei=0x40;
234 3 if(j>=63)i=2;
235 3 qing();
236 3 if(a[j>=127])//正电压
237 3 {
238 4 AD=(a[j]-127)*0.196/dianya; //计算在12864的电压值
239 4 if(AD<=7) ye=0xbb,shu=(0x80>>AD);
240 4 else if(AD<=15) ye=0xba,shu=(0x80>>(AD-8));
241 4 else if(AD<=23) ye=0xb9,shu=(0x80>>(AD-16));
C51 COMPILER V8.05a GG 10/04/2007 17:46:28 PAGE 5
242 4 else if(AD<=31) ye=0xb9,shu=(0x80>>(AD-24));
243 4 }
244 3 if(a[j]<127)//负电压
245 3 {
246 4 AD=(127-a[j])*0.196/dianya;
247 4 if(AD<=7) ye=0xbc,shu=(0x01<<(AD));
248 4 else if(AD<=15) ye=0xbd,shu=(0x01<<(AD-8));
249 4 else if(AD<=23) ye=0xbe,shu=(0x01<<(AD-16));
250 4 else if(AD<=31) ye=0xbe,shu=(0x01<<(AD-24));
251 4 }
252 3 if(r==0)
253 3 {
254 4 d1=shu;
255 4 d2=ye;
256 4 }
257 3 if(r!=0)
258 3 {
259 4 d3=shu;
260 4 d4=ye;
261 4 if(ye==d2)
262 4 {
263 5 if(shu>d1)
264 5 {
265 6 d5=shu;
266 6 d5=d5>>1;
267 6 while(d5!=d1)
268 6 {d5=d5>>1;
269 7 shu=shu|(shu>>1);}
270 6 }
271 5 if(shu<d1)
272 5 {
273 6 d5=shu;
274 6 d5=d5<<1;
275 6 while(d5!=d1)
276 6 {d5=d5<<1;shu=shu|(shu<<1);}
277 6 }
278 5 }
279 4
280 4 if(ye<d2)
281 4 {
282 5 for(q=0;q<7;q++)
283 5 {
284 6 shu=shu|(shu<<1);
285 6 }
286 5 shuju();
287 5 ye++;
288 5 while(ye<d2) {shu=0xff,shuju(),ye++;}
289 5 if(ye==d2){
290 6 shu=0x01;
291 6 if(shu<d1)
292 6 {
293 7 d5=shu;
294 7 d5=d5<<1;
295 7 while(d5!=d1)
296 7 {d5=d5<<1;shu=shu|(shu<<1);}
297 7 }
298 6 }
299 5 }
300 4 if(ye>d2)
301 4 {
302 5 for(q=0;q<7;q++)
303 5 {
C51 COMPILER V8.05a GG 10/04/2007 17:46:28 PAGE 6
304 6 shu=shu|(shu>>1);
305 6 }
306 5 shuju();
307 5 ye--;
308 5 while(ye>d2) {shu=0xff,shuju(),ye--;}
309 5 if(ye==d2){
310 6 shu=0x80;
311 6 if(shu>d1)
312 6 {
313 7 d5=shu;
314 7 d5=d5>>1;
315 7 while(d5!=d1)
316 7 {d5=d5>>1;shu=shu|(shu>>1);}
317 7 }
318 6 }
319 5 }
320 4 }
321 3 if(r!=0)
322 3 {
323 4 d1=d3;
324 4 d2=d4;
325 4 }
326 3 shuju();
327 3 if(lei!=0x7f) lei++;
328 3 }
329 2 }
330 1 }
*** WARNING C280 IN LINE 187 OF GG.C: 'd6': unreferenced local variable
*** WARNING C280 IN LINE 159 OF GG.C: 'p': unreferenced local variable
*** WARNING C280 IN LINE 160 OF GG.C: 'm': unreferenced local variable
331
332
333
334
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1551 ----
CONSTANT SIZE = 128 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 98 19
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 3 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -