📄 allsubfun.lst
字号:
229 1 if(wait)
230 1 {
231 2 while(ISDEOM == 1 )
232 2 ;
233 2
234 2 while(ISDEOM == 0 )
235 2 ;
236 2 }
237 1 return ;
238 1 }
239
240 void isdrecord(void)
C51 COMPILER V7.20 ALLSUBFUN 05/31/2006 22:36:00 PAGE 5
241 {
242 1 bit over;
243 1 over = 0 ;
244 1 ISDPD = 1 ;
245 1 delay(10000); /*10ms复位*/
246 1 ISDPD = 0 ;
247 1
248 1 ISDCE = 1 ;
249 1 ISDSEND(ISD15);
250 1 ISDPR = 0 ;
251 1 delay(5);
252 1 ISDCE = 0 ;
253 1
254 1 resettime();
255 1 SETMTDATAPORT;
256 1 for(;;)
257 1 {
258 2 if(MTDATA == MT0 )
259 2 {
260 3 while(MTDATA == MT0 )
261 3 {
262 4 if(count > 300)
263 4 goto end;
264 4 }
265 3
266 3 if( count > 40 || count < 3 )
267 3 {
268 4 break;
269 4 }
270 3 else
271 3 {
272 4 if(MTDATA == MTJ)
273 4 goto end;
274 4 }
275 3 }
276 2
277 2 if(count > 300)
278 2 break;
279 2 }
280 1
281 1
282 1 end:ISDCE = 1 ;
283 1 ISDPR = 1 ;
284 1
285 1 ISDPD = 1 ;
286 1 delay(10000); /*10ms复位*/
287 1 ISDPD = 0 ;
288 1 }
289
290 void stoprecord()
291 {
292 1 ISDCE = 1 ;
293 1 ISDPR = 1 ;
294 1 }
295 void stopisd(void)
296 {
297 1 ISDPD = 1 ;
298 1 delay(1000); /*1ms*/
299 1 }
300
301 /******************* 24C01读写**********************/
302
C51 COMPILER V7.20 ALLSUBFUN 05/31/2006 22:36:00 PAGE 6
303 void w24c01(uchar adress,uchar * byte,uchar num) /*写入多个字节*/
304 {
305 1 while(num--)
306 1 {
307 2 Start_I2c();
308 2 SendByte(AT24C01A);
309 2 SendByte(adress);
310 2 SendByte(*byte);
311 2 Stop_I2c();
312 2 delay(10000);
313 2 byte++;
314 2 adress++ ;
315 2 }
316 1 }
317
318 void r24c01(uchar adress,uchar * byte,uchar num) /*读入多个字节*/
319 {
320 1 while(num--)
321 1 {
322 2 Start_I2c();
323 2 SendByte(AT24C01A);
324 2 SendByte(adress);
325 2
326 2 Start_I2c();
327 2 SendByte(AT24C01A+1);
328 2 *(byte) = RcvByte();
329 2 Ack_I2c(1);
330 2 Stop_I2c();
331 2 byte++ ;
332 2 adress++ ;
333 2 }
334 1 }
335 /************************密码检查***********************/
336
337 bit getmima(uchar * where)
338 {
339 1 uchar i,j,temp;
340 1 bit flag ;
341 1
342 1 flag = 1 ;
343 1 i = 10 ;
344 1 j = 0 ;
345 1 temp =0 ;
346 1 where[0] = 0;
347 1 where[1] = 0;
348 1 where[2] = 0;
349 1 where[3] = 0;
350 1 where[4] = 0;
351 1
352 1
353 1 while( ( (temp = get8870()) != MTJ ) && (i != 0) )
354 1 {
355 2 if(temp == 16)
356 2 return 0 ;
357 2
358 2 if(flag)
359 2 {
360 3 where[j] = (temp << 4) & 0xf0 ;
361 3 flag = 0 ;
362 3 }
363 2 else
364 2 {
C51 COMPILER V7.20 ALLSUBFUN 05/31/2006 22:36:00 PAGE 7
365 3 where[j] = ( where[j] & 0xf0 ) | ( temp & 0x0f) ;
366 3 flag = 1 ;
367 3 j++ ;
368 3 }
369 2
370 2 i-- ;
371 2 }
372 1 return 1 ;
373 1 }
374
375
376
377
378
379 uchar mimatest(void)
380 {
381 1 uchar j ;
382 1
383 1 if(getmima(mimain) == 0)
384 1 return 3;
385 1
386 1 r24c01(0x00,mimasave,5);
387 1 for(j = 0 ; j < 5; j++)
388 1 {
389 2 if(mimain[j] != mimasave[j])
390 2 return 0 ;
391 2 }
392 1
393 1 return 1 ;
394 1
395 1 }
396
397 uchar mimachang(void)
398 {
399 1 uchar j;
400 1
401 1
402 1 if( getmima(mimatemp) == 0 )
403 1 return 3;
404 1
405 1 isdplay(10,1);
406 1
407 1 if(getmima(mimain) == 0 )
408 1 return 3;
409 1
410 1 for(j = 0 ; j < 5 ; j++ )
411 1 {
412 2 if(mimatemp[j] != mimain[j])
413 2 {
414 3 return 0 ;
415 3 }
416 2 }
417 1 w24c01(0x00,mimain,5);
418 1 return 1 ;
419 1
420 1 }
421
422
423
424
425 /******************* 远程菜单 **************************/
426
C51 COMPILER V7.20 ALLSUBFUN 05/31/2006 22:36:00 PAGE 8
427 void telnetmenu(void)
428 {
429 1 uchar what;
430 1 uchar temp;
431 1
432 1 for(;;)
433 1 {
434 2 isdplay(3,0);
435 2 switch(isdwait8870())
436 2 {
437 3
438 3 /*************家电控制**********************************/
439 3 case MT1 :
440 3 isdplay(4,0);
441 3
442 3 switch(isdwait8870())
443 3 {
444 4 case MT1: what = 0 ;
445 4 break ;
446 4 case MT2: what = 1 ;
447 4 break ;
448 4 case MT3: what = 2 ;
449 4 break;
450 4 case 16 :return;
451 4 default : goto error;
452 4 }
453 3
454 3 isdplay(5,0);
455 3
456 3 switch(isdwait8870())
457 3 {
458 4 case MT1:sethome(what,0xffff);
459 4 goto show;
460 4 case MT2:sethome(what, 0);
461 4 goto show;
462 4 case MT3: if( dingshi(what) == 3)
463 4 return;
464 4 case MT4:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -