📄 osc3.lst
字号:
C51 COMPILER V7.06 OSC3 09/27/2005 14:37:42 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE OSC3
OBJECT MODULE PLACED IN E:\NEWMAC~1\050808\DRIVE\OSC3.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE E:\NEWMAC~1\050808\DRIVE\OSC3.C DB SB OE
stmt level source
1 #include <OSC.h>
2 sbit message_enable=P1^5;
3 sbit stop=P3^5;
4 sbit gate=P4^1;
5 sbit osc_dir=P4^5;
6 sbit osc_enable=P4^4;
7 sbit osc_out=P4^6;
8
9 xdata unsigned char rbuffer[55] _at_ 0x0200;
10 unsigned char S_ANSW,POINTER0,POINTER1,work,RSUM,SSUM,s_byte_nums,r_byte_nums,sbuffer[6],c_t1,
11 c_decrease,temp_c_decrease,share_decrease,osc_add,osc_dec,
12 share,nonce_sec,c_t42,c_t42_l,c_t42_r,err,p_sec,c_change,temp_c_change,cross_machine,
13 c_t2,temp_c_t2;
14 unsigned char COMM,SLA,FF,GET;
15 unsigned int delt_a41,*point,delt_out1,delt_out0;
16 xdata unsigned long const0,const1,const2,const3,const5,temp_out1,static_out1,temp_out0,static_out0,
17 out0_decrease,out1_decrease;
18 xdata unsigned int out0,out1,out2;
19 bit t_edge,osc_ok,decrease,decreased,stop_osc,new_sector,excursion_dir,
20 center_excursion,called,judge_ok,urgent_stop,in_sector,
21 start,over_i1,over_i2,resend,send,overtime,osc_l,osc_r,motor_stop,sec_change,
22 receive_p_out,receive_p_in,start_osc,ans,to_begin,decrease_ok,center_change,
23 need_para,osc_err,err_ok,breadth_add,breadth_dec,osc,osc_change,K4,sec_center,osc_started,
24 over_i_enable;
25 #define start_v 100;
26
27 void start_i2()
28 {
29 1 data unsigned int time;
30 1 P1_6=1; //SCL
31 1 P1_7=1; //SDA
32 1 S1CON=0x47; //ENS1=1 STA=0 STO=0 SI=0 AA=1
33 1 PS1=1;FF=0;
34 1 EA=1;
35 1 ES1=1;
36 1 STA=1;
37 1 time=0;
38 1 do
39 1 {
40 2 time++;
41 2 if(time>10000)
42 2 {
43 3 FF=1;
44 3 }
45 2 }while(FF==0);
46 1 FF=0;
47 1 ES1=0;
48 1 }
49
50 void start_t2()
51 {
52 1 TM2CON=0x81; //16位溢出,分频系数1,f/12
53 1 EA=1;
54 1 TM2IR=0;
55 1 }
C51 COMPILER V7.06 OSC3 09/27/2005 14:37:42 PAGE 2
56
57 void ini_sbuf(unsigned char a,b,c,d,e,f)
58 {
59 1 sbuffer[0]=a;
60 1 sbuffer[1]=b;
61 1 sbuffer[2]=c;
62 1 sbuffer[3]=d;
63 1 sbuffer[4]=e;
64 1 sbuffer[5]=f;
65 1 }
66
67 unsigned char get_byte_nums(unsigned char type)
68 {
69 1 unsigned char numbers;
70 1 switch(type)
71 1 {
72 2 case infor_sec:
73 2 case command:
74 2 case program:
75 2 case answer: numbers=4;
76 2 break;
77 2 case err_infor:
78 2 case parameter1: numbers=5;
79 2 break;
80 2 case parameter:
81 2 case infor: numbers=6;
82 2 break;
83 2 case parameter2: numbers=7;
84 2 break;
85 2 case call_result: numbers=8;
86 2 break;
87 2 case p_out_sec: numbers=55;
88 2 break;
89 2 case p_in_sec: numbers=24;
90 2 break;
91 2 case edit_sec: numbers=64;
92 2 break;
93 2 default: numbers=4;
94 2 break;
95 2 }
96 1 return numbers;
97 1 }
98
99 void TR_noans()
100 {
101 1 POINTER0=0;
102 1 SSUM=0;
103 1 send=1;
104 1 c_t1=0;
105 1 message_enable=0; //开发送使能
106 1 TR1=1;
107 1 while(POINTER0<s_byte_nums);
108 1 TR1=0;
109 1 message_enable=1; //关发送使能
110 1 }
111
112 void TR_ans()
113 {
114 1 ans=1;
115 1 REN=0;
116 1 POINTER1=0;
117 1 RSUM=0;
C51 COMPILER V7.06 OSC3 09/27/2005 14:37:42 PAGE 3
118 1 TB8=1;
119 1 POINTER0=0;
120 1 SSUM=0;
121 1 send=1;
122 1 c_t1=0;
123 1 message_enable=0; //开发送使能
124 1 TR1=1;
125 1 while(POINTER0<s_byte_nums);
126 1 TR1=0;
127 1 message_enable=1; //关发送使能
128 1
129 1 REN=1;
130 1 send=0;
131 1 c_t1=0;
132 1 // TR1=1;
133 1 while(POINTER1<r_byte_nums&&overtime==0);
134 1 TR1=0;
135 1 if(overtime==1)
136 1 {
137 2 err=3;
138 2 osc_err=1;
139 2 overtime=0;
140 2 }
141 1 ans=0;
142 1 }
143
144 void delay(int num)
145 {
146 1 data unsigned int i,j;
147 1 for(i=0;i<num;i++)
148 1 {
149 2 for(j=0;j<255;j++);
150 2 }
151 1 }
152
153 void read_8574 () //过流1或过流2
154 {
155 1 unsigned char temp_GET;
156 1 SLA=0x43;
157 1 start_i2();
158 1 temp_GET=GET;
159 1 temp_GET=temp_GET&0X01;
160 1 if(temp_GET==0)
161 1 over_i1=1;
162 1 temp_GET=GET;
163 1 temp_GET=temp_GET&0X02;
164 1 if(temp_GET==0)
165 1 over_i2=1;
166 1 }
167
168 void write_8574(unsigned char col) //出错显示
169 {
170 1 SLA=0x42;
171 1 COMM=col;
172 1 start_i2();
173 1 }
174
175 void com_type()
176 {
177 1 switch(rbuffer[2])
178 1 {
179 2 case com_calling: called=1;break;
C51 COMPILER V7.06 OSC3 09/27/2005 14:37:42 PAGE 4
180 2 case com_motor_stop: motor_stop=1;break;
181 2 case com_start: start=1;break; //启动
182 2 case com_decrease: {
183 3 if(osc_ok==1)
184 3 {
185 4 if(osc_add>=osc_dec)
186 4 {
187 5 delt_a41=pp.da41*(osc_add-osc_dec);
188 5 const1=const1+delt_a41;
189 5 }
190 4 else
191 4 {
192 5 delt_a41=pp.da41*(osc_dec-osc_add);
193 5 const1=const1-delt_a41;
194 5 }
195 4 if(in_sector==0)
196 4 {
197 5 const0=(unsigned long)(pp.v41)*(unsigned long)(pp.t17);
198 5 const3=(unsigned long)(120*const1);
199 5 const2=(unsigned long)(pp.t42_l)+(unsigned long)(pp.t42_r);
200 5 const2=const2*(unsigned long)(pp.v41);
201 5 const5=const3+const2;
202 5 }
203 4 else if(osc_ok==1)
204 4 {
205 5 const0=(unsigned long)(pp.x[nonce_sec][3])*(unsigned long)(pp.t17);
206 5 const3=(unsigned long)(120*const1);
207 5 const2=(unsigned long)(pp.x[nonce_sec][1])+(unsigned long)(pp.x[nonce_sec][2]);
208 5 const2=const2*(unsigned long)(pp.x[nonce_sec][3]);
209 5 const5=const3+const2;
210 5 }
211 4 c_decrease=(unsigned char)((const0+const5)/const5);
212 4 out1_decrease=out1;
213 4 out0_decrease=out0;
214 4 temp_c_decrease=1;
215 4 share_decrease=0;
216 4 IEN1=IEN1|0X01; //CT0
217 4 }
218 3 decrease=1;
219 3 }break;
220 2 case com_osc: start_osc=1;break; //启动CT0
221 2 case com_osc_l: {
222 3 if(work==0) //点动
223 3 {
224 4 if(osc_l==0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -