📄 plc64i32.lst
字号:
151 2 case 0x8a :
152 2 outp_buf[2] = status;
153 2 break;
154 2 case 0x8b :
155 2 outp_buf[3] = status;
156 2 }
157 1 }
158 //=================================
159 void _reserve_outpbuf(void)
160 {
161 1 outp_buf[4]=outp_buf[0];
162 1 outp_buf[5]=outp_buf[1];
163 1 outp_buf[6]=outp_buf[2];
164 1 outp_buf[7]=outp_buf[3];
165 1
166 1 }
167 //======================
168 void _reload_outpbuf(void)
169 {
170 1 if(outp_buf[4]>>5)
171 1 {
172 2 outp_buf[0]=outp_buf[4]&0x1f;
173 2 _set_delay(150);
174 2 }
175 1 outp_buf[0]=outp_buf[4];
176 1 outp_buf[1]=outp_buf[5];
177 1 outp_buf[2]=outp_buf[6];
178 1 outp_buf[3]=outp_buf[7];
179 1
180 1 }
181 //-------------------------------------------------------------------------
182 char _inp_bit (char num)
183 {
184 1 char stus_bit = 0x01;
185 1 char in_stus;
186 1 char chanel;
187 1 for (chanel=0;num>8;chanel++){
188 2 num -= 8;}
189 1 in_stus = inp_buf[chanel];
190 1 stus_bit <<= num-1;
191 1 in_stus &= stus_bit;
192 1 return in_stus? ON:OFF;
193 1 }
194 //-------------------------------------------------------------------------
195 bit _outp_stus (char num)
196 {
197 1 char chanel;
198 1 char out_stus;
199 1 unsigned char stus_bit = 0x80;
200 1 for (chanel=0;num>8;chanel++){
201 2 num -= 8;}
202 1 out_stus = outp_buf[chanel];
203 1 stus_bit >>= num-1;
204 1 out_stus &= stus_bit;
205 1 return out_stus? ON:OFF;
C51 COMPILER V7.06 PLC64I32 01/26/2004 20:24:41 PAGE 5
206 1 }
207 //-------------------------------------------------------------------------
208 void _outp_bit (char num, char status)
209 {
210 1 char chanel;
211 1 char out_stus;
212 1 unsigned char stus_bit = 0x80;
213 1 for (chanel=0;num>8;chanel++){
214 2 num -= 8;}
215 1 out_stus = outp_buf[chanel];
216 1 stus_bit >>= num-1;
217 1 status &= 0x01;
218 1 if (status == ON)
219 1 out_stus |= stus_bit;
220 1 else
221 1 out_stus &= ~stus_bit;
222 1 outp_buf[chanel] = out_stus;
223 1 }
224 //-------------------------------------------------------------------------
225 /*
226 unsigned _read_eepword (unsigned xdata* ptr)
227 {
228 unsigned val;
229 WMCON = 0x0a; // set read eeprom enable
230 val = *ptr; // read eeprom value
231 WMCON = 0x02; // clear eeprom RDY/-BSY = 1
232 return val;
233 }
234 //-------------------------------------------------------------------------
235 void _write_eepword (unsigned xdata* ptr,unsigned val)
236 {
237 WMCON = 0x1a; // set write eeprom & WDT enable
238 while(!(WMCON & 0x02));
239 *ptr = val;
240 while (!(WMCON & 0x02));
241 WMCON = 0x02; // disenable WDT
242 }
243 */
244 unsigned char _read_eepbyte (unsigned char xdata* ptr)
245 {
246 1 unsigned char val;
247 1 WMCON = 0x0a; // set read eeprom enable
*** ERROR C202 IN LINE 247 OF PLC64I32.C: 'WMCON': undefined identifier
248 1 val = *ptr; // read eeprom value
249 1 WMCON = 0x02; // clear eeprom RDY/-BSY = 1
*** ERROR C202 IN LINE 249 OF PLC64I32.C: 'WMCON': undefined identifier
250 1 return val;
251 1 }
252 //-------------------------------------------------------------------------
253 void _write_eepbyte (unsigned char xdata* ptr,unsigned char val)
254 {
255 1 WMCON = 0x1a; // set write eeprom & WDT enable
*** ERROR C202 IN LINE 255 OF PLC64I32.C: 'WMCON': undefined identifier
256 1 while(!(WMCON & 0x02));
*** ERROR C202 IN LINE 256 OF PLC64I32.C: 'WMCON': undefined identifier
257 1 *ptr = val;
258 1 while (!(WMCON & 0x02));
*** ERROR C202 IN LINE 258 OF PLC64I32.C: 'WMCON': undefined identifier
259 1 WMCON = 0x02; // disenable WDT
*** ERROR C202 IN LINE 259 OF PLC64I32.C: 'WMCON': undefined identifier
260 1 }
261
C51 COMPILER V7.06 PLC64I32 01/26/2004 20:24:41 PAGE 6
262 //-------------------------------------------------------------------------
263 // Power on Delay for ISP serial port
264 //-------------------------------------------------------------------------
265 void _powon_delay (void)
266 {
267 1 unsigned char timer_ref = 200;
268 1 unsigned char delay_time = 50;
269 1 while (delay_time--){
270 2 while (timer_ref--);
271 2 }
272 1 }
273 //-------------------------------------------------------------------------
274 void _init_system(void)
275 {
276 1 ENOUTPUT = OFF; // set output enable
*** ERROR C202 IN LINE 276 OF PLC64I32.C: 'ENOUTPUT': undefined identifier
277 1 // setup timer0 interrupt initalization
278 1 tick_clock = OFF;
279 1 TH0 = MSB_PERIOD; // set timer0 period
*** ERROR C202 IN LINE 279 OF PLC64I32.C: 'TH0': undefined identifier
280 1 TL0 = LSB_PERIOD;
*** ERROR C202 IN LINE 280 OF PLC64I32.C: 'TL0': undefined identifier
281 1 TMOD |= 0x01; // select mode 1 16 counter
*** ERROR C202 IN LINE 281 OF PLC64I32.C: 'TMOD': undefined identifier
282 1 TR0 = ON; // start timer0
*** ERROR C202 IN LINE 282 OF PLC64I32.C: 'TR0': undefined identifier
283 1 ET0 = ON; // enable timer0 interrupt
*** ERROR C202 IN LINE 283 OF PLC64I32.C: 'ET0': undefined identifier
284 1 EA = ON; // global interrupt enable
*** ERROR C202 IN LINE 284 OF PLC64I32.C: 'EA': undefined identifier
285 1 // Power On delay for SPI progrmming port
286 1 _powon_delay ();
287 1 }
288 //-------------------------------------------------------------------------
289 // Timer0 interrupt service function
290 // Executes each 10ms @24MHZ Crystal clock
291 //-------------------------------------------------------------------------
292 timer0() interrupt 1 using 2 // Int Vector at 000BH, Reg Bank 2
293 {
294 1 TH0 = MSB_PERIOD; // re-load timer0 period
*** ERROR C202 IN LINE 294 OF PLC64I32.C: 'TH0': undefined identifier
295 1 TL0 = LSB_PERIOD;
*** ERROR C202 IN LINE 295 OF PLC64I32.C: 'TL0': undefined identifier
296 1 tick_clock++;
297 1 _send_outport();
298 1 _scand_inport();
299 1 if (++inc_ref == 10){
300 2 ref_100ms++;
301 2 inc_ref = OFF;
302 2 }
303 1 if(spray_time==tick_clock)
304 1 spray_end=1;
305 1
306 1 if(blow_time==tick_clock)
307 1 blow_end=1;
308 1
309 1 if(heat1_time==tick_clock)
310 1
311 1 {
312 2 heat1_end=1;
313 2 _outp_bit(INDUCTIN1,OFF);
314 2 _outp_bit(MAGFRCE1,OFF);
C51 COMPILER V7.06 PLC64I32 01/26/2004 20:24:41 PAGE 7
315 2 }
316 1 if(heat2_time==tick_clock)
317 1 {
318 2 heat2_end=1;
319 2 _outp_bit(INDUCTIN2,OFF);
320 2 _outp_bit(MAGFRCE2,OFF);
321 2 }
322 1 if(run_time==tick_clock)
323 1 alarm_flag=1;
324 1 if(comm_load_time==tick_clock)
325 1 comm_load_end=1;
326 1 }
327 //-------------------------------------------------------------------------
C51 COMPILATION COMPLETE. 1 WARNING(S), 50 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -