📄 per.lst
字号:
527 // the seven row and eight line array such as MsgTrans[7][8].
528 //parameter: ModuleName---which module;ByteNumber---byte location of the data block
529 // value---specified byte value;
530 // BasePointer---the pointer pointing to the base address.
531 //return: none. |
532 //******************************************************************************
533
534 void set_byte1(unsigned char ModuleName,unsigned char ByteNumber,unsigned char value,unsigned char * BaseP
-ointer)
535 {
536 1 unsigned char char_v;
537 1 // ModuleName--;
538 1 char_v = (unsigned char)(ModuleName<<3) + ByteNumber;
539 1 BasePointer += char_v;
540 1 *BasePointer=value;
541 1 }
542
543 //******************************************************************************
544 //function: void set_feedback(unsigned char ModuleName,unsigned char FBNumber,unsigned char value
545 // unsigned char * BasePointer);
546 //description: thi function set the feedback value to the specified location
547 //
548 //parameter: ModuleName---which module;FBNumber---feedback location of the data block
549 // value---specified byte value;
C51 COMPILER V7.06 PER 10/23/2004 16:55:19 PAGE 10
550 // BasePointer---the pointer pointing to the base address.
551 //return: none. |
552 //******************************************************************************
553
554 void set_feedback(unsigned char ModuleName,unsigned char FBNumber,unsigned char value,unsigned char * Base
-Pointer)
555 {
556 1 unsigned char char_v;
557 1 // ModuleName--;
558 1 char_v = (unsigned char)(ModuleName<<3) + (unsigned char)(FBNumber>>2);
559 1 BasePointer += char_v;
560 1 while(FBNumber>=4) //1 byte include 4 feedback value
561 1 {
562 2 FBNumber-=4;
563 2 }
564 1 value=(unsigned char) (value & 0x03)<<(FBNumber * 2);
565 1 (*BasePointer)|=value;
566 1 }
567
568 //******************************************************************************
569 //function: unsigned char get_feedback(unsigned char ModuleName,unsigned char FBNumber,
570 // unsigned char * BasePointer);
571 //description: thi function get the feedback value from specified location
572 //parameter: ModuleName---which module;FBNumber---feedback location of the data block
573 // BasePointer---the pointer pointing to the base address.
574 //return: feedback value. |
575 //******************************************************************************
576 unsigned char get_feedback(unsigned char ModuleName,unsigned char FBNumber,
577 unsigned char * BasePointer)
578 {
579 1 unsigned char char_v;
580 1 unsigned char temp_value;
581 1 // ModuleName--;
582 1 char_v = (unsigned char)(ModuleName<<3) + (unsigned char)(FBNumber>>2);
583 1 BasePointer+=char_v;
584 1 while(FBNumber>=4) //1 byte include 4 feedback value
585 1 {
586 2 FBNumber-=4;
587 2 }
588 1 temp_value= (*BasePointer)>>(FBNumber*2) & 0x03;
589 1 return temp_value;
590 1 }
591
592
593 //**********************************************************************************
594 //fuction: unsigned char Sort_Port_Bit(bit d0,bit d1,bit d2,bit d3
595 // bit d4,bit d5,bit d6,bit d7);
596 //description: This function modify one memory unit by the given bit value,the
597 // parameter location correspond to the memory unit bit location.
598 //parameter: "d7,d6...d0" is the corresponging bit value which will be sort.
599 //return: unsigned char combinated by sorted bit.
600 //**********************************************************************************
601 unsigned char Sort_Port_Bit(bit d0,bit d1,bit d2,bit d3,
602 bit d4,bit d5,bit d6,bit d7)
603 {
604 1 unsigned char PortBuffer;
605 1 PortBuffer=(PortBuffer&0x7f)|((unsigned char)d7<<7);
606 1 PortBuffer=(PortBuffer&0xbf)|((unsigned char)d6<<6);
607 1 PortBuffer=(PortBuffer&0xdf)|((unsigned char)d5<<5);
608 1 PortBuffer=(PortBuffer&0xef)|((unsigned char)d4<<4);
609 1 PortBuffer=(PortBuffer&0xf7)|((unsigned char)d3<<3);
610 1 PortBuffer=(PortBuffer&0xfb)|((unsigned char)d2<<2);
C51 COMPILER V7.06 PER 10/23/2004 16:55:19 PAGE 11
611 1 PortBuffer=(PortBuffer&0xfd)|((unsigned char)d1<<1);
612 1 PortBuffer=(PortBuffer&0xfe)|((unsigned char)d0);
613 1 return(PortBuffer);
614 1 }
615 //**********************************************************************************
616 //fuction: unsigned char Sort_Port_Bit1(bit d0,bit d1,bit d2,bit d3
617 // bit d4,bit d5,bit d6,bit d7);
618 //description: This function modify one memory unit by the given bit value,the
619 // parameter location correspond to the memory unit bit location.
620 //parameter: "d7,d6...d0" is the corresponging bit value which will be sort.
621 //return: unsigned char combinated by sorted bit.
622 //**********************************************************************************
623 unsigned char Sort_Port_Bit1(bit d0,bit d1,bit d2,bit d3,
624 bit d4,bit d5,bit d6,bit d7)
625 {
626 1 unsigned char PortBuffer;
627 1 PortBuffer=(PortBuffer&0x7f)|((unsigned char)d7<<7);
628 1 PortBuffer=(PortBuffer&0xbf)|((unsigned char)d6<<6);
629 1 PortBuffer=(PortBuffer&0xdf)|((unsigned char)d5<<5);
630 1 PortBuffer=(PortBuffer&0xef)|((unsigned char)d4<<4);
631 1 PortBuffer=(PortBuffer&0xf7)|((unsigned char)d3<<3);
632 1 PortBuffer=(PortBuffer&0xfb)|((unsigned char)d2<<2);
633 1 PortBuffer=(PortBuffer&0xfd)|((unsigned char)d1<<1);
634 1 PortBuffer=(PortBuffer&0xfe)|((unsigned char)d0);
635 1 return(PortBuffer);
636 1 }
637 ///////////////////外部RAM或外设操作函数///////////////////////////////////////////////////
638 //***************************************************************************************
639 //fuction: void write_memory_bit(xp,n,value);
640 //description: modify one bit of the memory unit.
641 //parameter: xp---pointer on data or xdata; n---bit location;value---value to be write.
642 //return: none
643 //data: 2001-3-29
644 //***************************************************************************************
645
646 void write_memory_bit(xp,n,value) //write value "0" or "1" to a bit of extern ram
647 unsigned char * xp;
648 unsigned char n;
649 bit value;
650 {
651 1 if(value==1)
652 1 {
653 2 *xp=(*xp)|(unsigned char)(1<<n);
654 2 }
655 1 else
656 1 {
657 2 *xp=(*xp)&(~(unsigned char)(1<<n));
658 2 }
659 1 }
660
661 //***************************************************************************************
662 //fuction: void write_memory_bit1(xp,n,value);
663 //description: modify one bit of the memory unit.
664 //parameter: xp---pointer on data or xdata; n---bit location;value---value to be write.
665 //return: none
666 //data: 2001-3-29
667 //***************************************************************************************
668 /*
669 void write_memory_bit1(xp,n,value) //write value "0" or "1" to a bit of extern ram
670 unsigned char * xp;
671 unsigned char n;
672 bit value;
C51 COMPILER V7.06 PER 10/23/2004 16:55:19 PAGE 12
673 {
674 if(value==1)
675 {
676 *xp=(*xp)|(unsigned char)(1<<n);
677 }
678 else
679 {
680 *xp=(*xp)&(~(unsigned char)(1<<n));
681 }
682 }
683 */
684 //***************************************************************************************
685 //fuction: bit read_memory_bit(xp,n,value);
686 //description: read one bit from the memory unit.
687 //parameter: xp---pointer on data or xdata; n---bit location.
688 //return: bit value
689 //data: 2001-3-29
690 //***************************************************************************************
691
692 bit read_memory_bit(xp,n) //read one bit of the extern ram and retern the bit value
693 unsigned char * xp;
694 unsigned char n;
695 {
696 1 bit temp_bit;
697 1 if( ((unsigned char)((*xp)>>n) & 0x01)==0x01 )
698 1 {
699 2 temp_bit=1;
700 2 }
701 1 if( ((unsigned char)((*xp)>>n) & 0x01)==0x00 )
702 1 {
703 2 temp_bit=0;
704 2 }
705 1 return(temp_bit);
706 1 }
707
708 //***************************************************************************************
709 //fuction: bit read_memory_bit1(xp,n,value);
710 //description: read one bit from the memory unit.
711 //parameter: xp---pointer on data or xdata; n---bit location.
712 //return: bit value
713 //data: 2001-3-29
714 //***************************************************************************************
715 /*
716 bit read_memory_bit1(xp,n) read one bit of the extern ram and retern the bit value
717 unsigned char * xp;
718 unsigned char n;
719 {
720 bit temp_bit;
721 if( ((unsigned char)((*xp)>>n) & 0x01)==0x01 )
722 {
723 temp_bit=1;
724 }
725 if( ((unsigned char)((*xp)>>n) & 0x01)==0x00 )
726 {
727 temp_bit=0;
728 }
729 return(temp_bit);
730 }
731 */
732 //**********************************************************************************
733 //bit bit rain_fil0(MsgTrans[2][5]); added by lihx
734 //**********************************************************************************
C51 COMPILER V7.06 PER 10/23/2004 16:55:19 PAGE 13
735 //function: bit rain_fil0(MsgTrans[2][5]);
736 //description: read one bit of the extern memory unit,return a bit type value .
737 //parameter: MsgTrans[2][5]---the value to filter
738 //return: the bit value of rainscarft
739 //**********************************************************************************
740 bit rain_fil0(unsigned char rainfilter0,unsigned char rainfilter1)
741 {
742 1 bit rainfil0=0;
743 1 if((rainfilter0&&0x0c)==(rainfilter1&&0x0c))
744 1 {
745 2 rainfil0=(~rainfilter1&0x0c);
746 2 }
747 1 else
748 1 {
749 2 ;
750 2 }
751 1 return (rainfil0);
752 1 }
753
754 //**********************************************************************************
755 //bit bit rain_fil1(MsgTrans[2][5]); added by lihx
756 //**********************************************************************************
757 //function: bit rain_fil1(MsgTrans[2][5]);
758 //description: read one bit of the extern memory unit,return a bit type value .
759 //parameter: MsgTrans[2][5]---the value to be filter
760 //return: the bit value of rainscarft
761 //**********************************************************************************
762 bit rain_fil1(unsigned char rainfilter2,unsigned char rainfilter3)
763 {
764 1 bit rainfil1=0;
765 1 if((rainfilter2&&0x30)==(rainfilter3&&0x30))
766 1 {
767 2 rainfil1=(~rainfilter3&0x30);
768 2 }
769 1 else
770 1 {
771 2 ;
772 2 }
773 1 return (rainfil1);
774 1 }
775
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1710 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 62
IDATA SIZE = ---- ----
BIT SIZE = ---- 21
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -