📄 avc2.lst
字号:
C51 COMPILER V7.06 AVC2 06/29/2005 10:04:08 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE AVC2
OBJECT MODULE PLACED IN D:\程序05~1\DRIVE\AVC2.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE D:\程序05~1\DRIVE\AVC2.C DB SB OE
stmt level source
1 #include <AVC.h>
2 #define start_v51 46
3 sbit message_enable=P1^5;
4 sbit stop=P3^5;
5 sbit gate=P4^1;
6 sbit avc_dir=P4^5;
7 sbit avc_enable=P4^4;
8 sbit temp_voltage=P4^2;
9 sbit externel_voltage=P4^3;
10
11 xdata unsigned char rbuffer[55],sbuffer[6];
12 unsigned char S_ANSW,POINTER0,POINTER1,work,RSUM,
13 SSUM,c_t1,nonce_sector,cross_machine,SENS,s_byte_nums,r_byte_nums,
14 nonce_sec,v51,c_sample,err,p_sec,out1;
15 unsigned int adl,adh,ad,delt_a41,U51,out0,*point,temp_avc,temp_u51_p,temp_u51_b,c_lift;
16 unsigned long AD1,AD2,AD3,AD4,AD5,da;
17 unsigned char COMM,SLA,FF,GET;
18 bit decrease,ad_finish,pulse_base,new_circle,called,avc,
19 lift,avc_ok,urgent_stop,pgj,in_sector,new_sector,start,lift_complete,over_i1,
20 over_i2,resend,send,overtime,avc_up,avc_down,motor_stop,receive_p_out,
21 receive_p_in,demand,start_avc,stop_avc,ans,to_begin,need_para,
22 ask_lift_ok,lift_ok,avc_err,err_ok;
23
24 void start_i2()
25 {
26 1 data unsigned int time;
27 1 P1_6=1; //SCL
28 1 P1_7=1; //SDA
29 1 S1CON=0x47; //ENS1=1 STA=0 STO=0 SI=0 AA=1
30 1 PS1=1;FF=0;
31 1 EA=1;
32 1 ES1=1;
33 1 STA=1;
34 1 time=0;
35 1 do
36 1 {
37 2 time++;
38 2 if(time>10000)
39 2 {
40 3 FF=1;
41 3 }
42 2 }while(FF==0);
43 1 FF=0;
44 1 ES1=0;
45 1 }
46
47 void start_t2()
48 {
49 1 TM2CON=0x81; //16位溢出,分频系数1,f/12
50 1 EA=1;
51 1 TM2IR=0;
52 1 }
53
54 void ini_sbuf(unsigned char a,b,c,d,e,f)
55 {
C51 COMPILER V7.06 AVC2 06/29/2005 10:04:08 PAGE 2
56 1 sbuffer[0]=a;
57 1 sbuffer[1]=b;
58 1 sbuffer[2]=c;
59 1 sbuffer[3]=d;
60 1 sbuffer[4]=e;
61 1 sbuffer[5]=f;
62 1 }
63
64 unsigned char get_byte_nums(unsigned char type)
65 {
66 1 unsigned char numbers;
67 1 switch(type)
68 1 {
69 2 case infor_sec:
70 2 case command:
71 2 case program:
72 2 case answer: numbers=4;
73 2 break;
74 2 case err_infor:
75 2 case parameter1: numbers=5;
76 2 break;
77 2 case parameter:
78 2 case infor: numbers=6;
79 2 break;
80 2 case parameter2: numbers=7;
81 2 break;
82 2 case call_result: numbers=8;
83 2 break;
84 2 case p_out_sec: numbers=55;
85 2 break;
86 2 case p_in_sec: numbers=24;
87 2 break;
88 2 case edit_sec: numbers=64;
89 2 break;
90 2 default: break;
91 2 }
92 1 return numbers;
93 1 }
94
95 void TR_noans()
96 {
97 1 POINTER0=0;
98 1 SSUM=0;
99 1 send=1;
100 1 c_t1=0;
101 1 message_enable=0; //开发送使能
102 1 TR1=1;
103 1 while(POINTER0<s_byte_nums);
104 1 TR1=0;
105 1 message_enable=1; //关发送使能
106 1 }
107
108 void TR_ans()
109 {
110 1 ans=1;
111 1 REN=0;
112 1 POINTER1=0;
113 1 RSUM=0;
114 1 TB8=1;
115 1 POINTER0=0;
116 1 SSUM=0;
117 1 send=1;
C51 COMPILER V7.06 AVC2 06/29/2005 10:04:08 PAGE 3
118 1 c_t1=0;
119 1 message_enable=0; //开发送使能
120 1 TR1=1;
121 1 while(POINTER0<s_byte_nums);
122 1 TR1=0;
123 1 message_enable=1; //关发送使能
124 1
125 1 REN=1;
126 1 send=0;
127 1 c_t1=0;
128 1 TR1=1;
129 1 while(POINTER1<r_byte_nums);
130 1 TR1=0;
131 1 if(overtime==1)
132 1 {
133 2 err=3;
134 2 avc_err=1;
135 2 overtime=0;
136 2 }
137 1 ans=0;
138 1 }
139
140 void delay(int num)
141 {
142 1 data unsigned int i,j;
143 1 for(i=0;i<num;i++)
144 1 {
145 2 for(j=0;j<255;j++);
146 2 }
147 1 }
148
149 void read_8574 () //过流1或过流2
150 {
151 1 unsigned char temp_GET;
152 1 SLA=0x43;
153 1 start_i2();
154 1 temp_GET=GET;
155 1 temp_GET=temp_GET&0X01;
156 1 if(temp_GET==0)
157 1 over_i1=1;
158 1 temp_GET=GET;
159 1 temp_GET=temp_GET&0X02;
160 1 if(temp_GET==0)
161 1 over_i2=1;
162 1 }
163
164 void write_8574(unsigned char col) //出错显示
165 {
166 1 SLA=0x42;
167 1 COMM=col;
168 1 start_i2();
169 1 }
170
171 /*
172 void get_SENS()
173 {
174 switch(pp.sens)
175 {
176 case 1: {
177 out0=8000; //500HZ
178 out1=4; //2p,0.0075mm
179 }break;
C51 COMPILER V7.06 AVC2 06/29/2005 10:04:08 PAGE 4
180 case 2: {
181 out0=8000; //500HZ
182 out1=10; //5p,0.01875mm 0.1v
183 }break;
184 case 3: {
185 out0=8000; //500HZ
186 out1=20; //10p,0.0375mm 0.2v
187 }break;
188 case 4: {
189 out0=6757; //592hz
190 out1=32; //0.06mm 0.3v
191 }break;
192 case 5: {
193 out0=5141; //778hz
194 out1=42; //0.08mm 0.4v
195 }break;
196 case 6: {
197 out0=4000; //1000hz
198 out1=54; //0.1mm 0.5v
199 }break;
200 case 7: {
201 out0=3376; //1185hz
202 out1=64; //0.12mm 0.6v
203 }break;
204 case 8: {
205 out0=2843; //1407hz
206 out1=76; //0.14mm 0.7v
207 }break;
208 case 9: {
209 out0=2299; //1740hz
210 out1=94; //0.16mm 0.8v
211 }break;
212 case 10:{
213 out0=2000; //2000hz
214 out1=104; //0.2mm 1v
215 }break;
216 }
217 }
218 */
219 void com_type()
220 {
221 1 switch(rbuffer[2])
222 1 {
223 2 case com_calling: called=1;break;
224 2 case com_motor_stop: { //停止点动
225 3 if(motor_stop==0)
226 3 motor_stop=1;
227 3 }break;
228 2 case com_start: start=1;break; //启动
229 2 case com_decrease: decrease=1;break;
230 2 case com_avc: start_avc=1;break;
231 2 case com_avc_up: if(avc_up==0)
232 2 avc_up=1;break;
233 2 case com_avc_down: if(avc_down==0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -