📄 display.lst
字号:
344 1 {
345 2 case 3:
346 2 fun_support=FN03_SUP;
347 2 if(fun_support==1)
348 2 {
349 3 start_addr=ST_RD_03;
350 3 end_addr=EN_RD_03;
351 3 flg_read=1;
352 3 flg_analog=1;
353 3 flg_single=0;
354 3 }
355 2 else
356 2 {
357 3 flg_wrongfn=1;
358 3 }
359 2
360 2 break;
361 2
362 2 case 4:
363 2 fun_support=FN04_SUP;
364 2 if(fun_support==1)
365 2 {
C51 COMPILER V6.21 DISPLAY 02/20/2008 14:30:37 PAGE 7
366 3 start_addr=ST_RD_03;
367 3 end_addr=EN_RD_03;
368 3 flg_read=1;
369 3 flg_analog=1;
370 3 flg_single=0;
371 3 }
372 2 else
373 2 {
374 3 flg_wrongfn=1;
375 3 }
376 2 break;
377 2
378 2 break;
379 2
380 2
381 2 case 16:
382 2 fun_support=FN16_SUP;
383 2 if(fun_support==1)
384 2 {
385 3 start_addr=ST_WR_16;
386 3 end_addr=EN_WR_16;
387 3 flg_read=0;
388 3 flg_analog=1;
389 3 flg_single=0;
390 3 }
391 2 else
392 2 {
393 3 flg_wrongfn=1;
394 3 }
395 2 break;
396 2
397 2 default:
398 2 flg_wrongfn=1;
399 2 break;
400 2 }
401 1 if(flg_wrongfn==0)
402 1 {
403 2 rec_addr=DBYTE[rx_buff+2];
404 2 rec_addr=256*rec_addr;
405 2 temp1=DBYTE[rx_buff+3];
406 2 rec_addr=rec_addr+temp1;
407 2
408 2 if(flg_single==1)
409 2 {
410 3 rec_length=1;
411 3 }
412 2 else
413 2 {
414 3 rec_length=DBYTE[rx_buff+4];
415 3 rec_length=256*rec_length;
416 3 rec_length=rec_length+DBYTE[rx_buff+5];
417 3 }
418 2
419 2 if((rec_addr>=start_addr) && ((rec_addr+rec_length)<end_addr))
420 2 {
421 3 addr_offset = rec_addr - start_addr;
422 3 valid_ok=1;
423 3 }
424 2 else
425 2 {
426 3 exc_code=2;
427 3 }
C51 COMPILER V6.21 DISPLAY 02/20/2008 14:30:37 PAGE 8
428 2 }
429 1 else
430 1 {
431 2 exc_code=1;
432 2 }
433 1 if(valid_ok==0)
434 1 {
435 2 result=65535;
436 2 mod_txcnt=0;
437 2
438 2 DBYTE[tx_buff]=mod1_devid;
439 2 cal_crc(mod1_devid);
440 2 mod_txcnt++;
441 2
442 2 temp1=mod_fn+0x80;
443 2 DBYTE[tx_buff+1]=temp1;
444 2 cal_crc(temp1);
445 2 mod_txcnt++;
446 2
447 2 DBYTE[tx_buff+2]=exc_code;
448 2 cal_crc(exc_code);
449 2 mod_txcnt++;
450 2
451 2 crch=result & 0x00FF;
452 2 result=result & 0xFF00;
453 2 crcl=result>>8;
454 2
455 2 DBYTE[tx_buff+3]=crch;
456 2 mod_txcnt++;
457 2
458 2 DBYTE[tx_buff+4]=crcl;
459 2 mod_txcnt++;
460 2
461 2 }
462 1 }
463
464 void read_response(unsigned char rx_buff,unsigned char tx_buff,unsigned char data_buff)
465 {
466 1 switch(mod_fn)
467 1 {
468 2 case 3:
469 2 read3_4(rx_buff,tx_buff,data_buff);
470 2 break;
471 2
472 2 case 4:
473 2 read3_4(rx_buff,tx_buff,data_buff);
474 2 break;
475 2
476 2 default:
477 2
478 2 break;
479 2 }
480 1 }
481
482 void com1_txmode(void)
483 {
484 1 DIR=1;
485 1
486 1 }
487
488 void com1_tx(void)
489 {
C51 COMPILER V6.21 DISPLAY 02/20/2008 14:30:37 PAGE 9
490 1 SBUF=com1_txchar;
491 1 //P1_5=1;
492 1 }
493
494 void com1_rxmode(void)
495 {
496 1 DIR=0;
497 1
498 1 }
499
500 void cal_crc(unsigned char ch)
501 {
502 1 idata unsigned char i;
503 1 result=result^ch;
504 1 for (i=0;i<8;i++)
505 1 {
506 2 flag=result & 1;
507 2 result=result>>1;
508 2 if (flag==1)
509 2 {
510 3 result=result^poly;
511 3 }
512 2 }
513 1 }
514
515 void read3_4(unsigned char rx_buff,unsigned char tx_buff,unsigned char data_buff)
516 {
517 1 unsigned char temp1,temp2;
518 1 result=65535;
519 1 //mod_destaddr=MOD_TXBUFF;
520 1 mod_destaddr=tx_buff;
521 1 mod_txcnt=0;
522 1
523 1 DBYTE[mod_destaddr]=mod1_devid;
524 1 cal_crc(mod1_devid);
525 1 mod_txcnt++;
526 1 mod_destaddr++;
527 1
528 1 DBYTE[mod_destaddr]=mod_fn;
529 1 cal_crc(mod_fn);
530 1 mod_txcnt++;
531 1 mod_destaddr++;
532 1
533 1 mod_txlen=rec_length*2;
534 1 DBYTE[mod_destaddr]=mod_txlen;
535 1 cal_crc(mod_txlen);
536 1 mod_txcnt++;
537 1 mod_destaddr++;
538 1
539 1 //mod_srcaddr=MOD_DATABUFF;
540 1 mod_srcaddr=data_buff;
541 1 mod_srcaddr=mod_srcaddr+(addr_offset*2);
542 1 for(temp1=0;temp1<mod_txlen;temp1++)
543 1 {
544 2 temp2=DBYTE[mod_srcaddr];
545 2 mod_srcaddr++;
546 2 DBYTE[mod_destaddr]=temp2;
547 2 cal_crc(temp2);
548 2 mod_txcnt++;
549 2 mod_destaddr++;
550 2 }
551 1
C51 COMPILER V6.21 DISPLAY 02/20/2008 14:30:37 PAGE 10
552 1 crch=result & 0x00FF;
553 1 result=result & 0xFF00;
554 1 crcl=result>>8;
555 1
556 1
557 1 DBYTE[mod_destaddr]=crch;
558 1 mod_txcnt++;
559 1 mod_destaddr++;
560 1
561 1 DBYTE[mod_destaddr]=crcl;
562 1 mod_txcnt++;
563 1 mod_destaddr++;
564 1 }
*** WARNING C280 IN LINE 515 OF DISPLAY.C: 'rx_buff': unreferenced local variable
565
566 void store_data(unsigned char rx_buff,unsigned char tx_buff,unsigned char data_buff)
567 {
568 1 switch(mod_fn)
569 1 {
570 2 case 16:
571 2 //clear error flag
572 2 ndata = 1;
573 2 store16(rx_buff,tx_buff,data_buff);
574 2 break;
575 2
576 2 default:
577 2 break;
578 2 }
579 1
580 1 }
581
582 void store16(unsigned char rx_buff,unsigned char tx_buff,unsigned char data_buff)
583 {
584 1 unsigned char temp1,temp2;
585 1 mod_srcaddr=rx_buff+6;
586 1 rx_dbcnt=DBYTE[mod_srcaddr];//count
587 1 mod_srcaddr++;
588 1
589 1 mod_destaddr=data_buff;//data buf
590 1 //mod_destaddr=mod_destaddr+(addr_offset*2);
591 1
592 1 for(temp1=0; temp1<rx_dbcnt; temp1++)
593 1 {
594 2 temp2=DBYTE[mod_srcaddr];
595 2 mod_srcaddr++;
596 2 DBYTE[mod_destaddr]=temp2;
597 2 mod_destaddr++;
598 2 }
599 1 }
*** WARNING C280 IN LINE 582 OF DISPLAY.C: 'tx_buff': unreferenced local variable
600
601 void write_response(unsigned char rx_buff,unsigned char tx_buff)
602 {
603 1 unsigned char temp1;
604 1 result=65535;
605 1 mod_destaddr=tx_buff;
606 1 mod_srcaddr=rx_buff;
607 1
608 1 mod_txcnt=0;
609 1
610 1 DBYTE[mod_destaddr]=mod1_devid;
611 1 cal_crc(mod1_devid);
C51 COMPILER V6.21 DISPLAY 02/20/2008 14:30:37 PAGE 11
612 1 mod_txcnt++;
613 1 mod_destaddr++;
614 1
615 1 DBYTE[mod_destaddr]=mod_fn;
616 1 cal_crc(mod_fn);
617 1 mod_txcnt++;
618 1 mod_destaddr++;
619 1
620 1 temp1=DBYTE[mod_srcaddr+2];
621 1 DBYTE[mod_destaddr]=temp1;
622 1 cal_crc(temp1);
623 1 mod_txcnt++;
624 1 mod_destaddr++;
625 1
626 1 temp1=DBYTE[mod_srcaddr+3];
627 1 DBYTE[mod_destaddr]=temp1;
628 1 cal_crc(temp1);
629 1 mod_txcnt++;
630 1 mod_destaddr++;
631 1
632 1 temp1=DBYTE[mod_srcaddr+4];
633 1 DBYTE[mod_destaddr]=temp1;
634 1 cal_crc(temp1);
635 1 mod_txcnt++;
636 1 mod_destaddr++;
637 1
638 1 temp1=DBYTE[mod_srcaddr+5];
639 1 DBYTE[mod_destaddr]=temp1;
640 1 cal_crc(temp1);
641 1 mod_txcnt++;
642 1 mod_destaddr++;
643 1
644 1 crch=result & 0x00FF;
645 1 result=result & 0xFF00;
646 1 crcl=result>>8;
647 1
648 1
649 1 DBYTE[mod_destaddr]=crch;
650 1 mod_txcnt++;
651 1 mod_destaddr++;
652 1
653 1 DBYTE[mod_destaddr]=crcl;
654 1 mod_txcnt++;
655 1 mod_destaddr++;
656 1
657 1 }
658
659 void dly(unsigned int delay)
660 {
661 1 unsigned int dlycnt;
662 1 for(dlycnt=0;dlycnt<=delay;dlycnt++)
663 1 {
664 2 dummy=0;
665 2 }
666 1
667 1 }
668
669 void Output(unsigned char out)
670 {
671 1 LEN = 1;
672 1 dly(5);
673 1 P0 = out;
C51 COMPILER V6.21 DISPLAY 02/20/2008 14:30:37 PAGE 12
674 1 LEN = 0;
675 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1329 ----
CONSTANT SIZE = 16 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 5 8
IDATA SIZE = 58 2
BIT SIZE = 15 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 2 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -