📄 mmm.lst
字号:
789 1 RemainRec[Numptr][1]=inttem.chrX[1];
790 1 Numptr++;
791 1 }
792 //******************************************************
793 bit CheckNum(unsigned int num)
794 {
795 1 unsigned char i;
C51 COMPILER V7.05 MMM 07/08/2005 11:42:13 PAGE 14
796 1 for(i=0;i<Numptr;i++)
797 1 {
798 2 inttem.chrX[0]=RemainRec[i][0];
799 2 inttem.chrX[1]=RemainRec[i][1];
800 2 if((inttem.intX&0x3fff)==num)
801 2 return 1;
802 2 }
803 1 return 0;
804 1 }
805 //******************************************************
806 void SetWingNum(unsigned int num)
807 {
808 1 unsigned char i;
809 1 for(i=0;i<Numptr;i++)
810 1 {
811 2 inttem.chrX[0]=RemainRec[i][0];
812 2 inttem.chrX[1]=RemainRec[i][1];
813 2 if((inttem.intX&0x3fff)==num)
814 2 {
815 3 inttem.intX=inttem.intX|0x4000 ;
816 3 RemainRec[i][0]=inttem.chrX[0];
817 3 RemainRec[i][1]=inttem.chrX[1];
818 3 }
819 2 }
820 1
821 1 }
822 //******************************************************
823 void ClrWingNum(unsigned int num)
824 {
825 1 unsigned char i;
826 1 for(i=0;i<Numptr;i++)
827 1 {
828 2 inttem.chrX[0]=RemainRec[i][0];
829 2 inttem.chrX[1]=RemainRec[i][1];
830 2 if((inttem.intX&0x3fff)==num)
831 2 {
832 3 inttem.intX= num;
833 3 RemainRec[i][0]=inttem.chrX[0];
834 3 RemainRec[i][1]=inttem.chrX[1];
835 3 }
836 2 }
837 1
838 1 }
839 //******************************************************************
840 void DelNum(unsigned int num)
841 {
842 1 unsigned char i,j;
843 1 for(i=0;i<Numptr;i++)
844 1 {
845 2 inttem.chrX[0]=RemainRec[i][0];
846 2 inttem.chrX[1]=RemainRec[i][1];
847 2 if((inttem.intX&0x3fff)==num)
848 2 break;
849 2 }
850 1 if(i<Numptr)
851 1 {
852 2 for(j=i;j<Numptr;j++)
853 2 {
854 3 RemainRec[j][0]= RemainRec[j+1][0];
855 3 RemainRec[j][1]= RemainRec[j+1][1];
856 3
857 3 }
C51 COMPILER V7.05 MMM 07/08/2005 11:42:13 PAGE 15
858 2 Numptr--;
859 2 }
860 1 }
861 /***************
862 void test(void)
863 {
864 unsigned char x;
865 while(1)
866 {
867 addNum(x);
868 x++;
869 if( CheckNum(8))
870 {
871 DelNum(7);
872 }
873 }
874 }*/
875 //**************************************************************************
876 void main(void)
877 {
878 1 unsigned int idata xx=0;//,bcc;
879 1
880 1 unsigned char idata i=0,ttt;
881 1 unsigned long idata yyy=0;
882 1 unsigned int numtem=0;
883 1 //unsigned char xdata ccc[6]={0x00,0x18,0x00,0x1e,0x00,0x00};
884 1
885 1 // numtem=cal_crc3964(ccc,6);//16);
886 1 TX_EN=0;
887 1 rest_delay=0;
888 1 En485 = RECV;
889 1 //Delay100ms(1);
890 1 TX_EN=1;
891 1 init_com();
892 1 InitREG();
893 1 UartInit();
894 1 Test_led=!Test_led;
895 1 Delay100ms(1);
896 1 Comm_Off();
897 1 PWR_UP=1;
898 1 Test_led=!Test_led;
899 1 EA=1;
900 1 Numptr=0;
901 1 Init_X25045(0x00);
902 1
903 1
904 1
905 1 for(i=0;i++;i<200)//clr
906 1 {
907 2 RemainRec[i][0]=0; RemainRec[i][1]=0;
908 2 }
909 1 if((ByteRead_Check(20)==0x00)||(ByteRead_Check(20)==0xff))ADDR=0XD2;
910 1 else
911 1 ADDR=ByteRead_Check(20);
912 1 // ADDR=0xd2;
913 1 if(ADDR%2)
914 1 {
915 2 CS=0;
916 2 }
917 1 else
918 1 {
919 2 CS=1;
C51 COMPILER V7.05 MMM 07/08/2005 11:42:13 PAGE 16
920 2 }
921 1 CS=1;
922 1
923 1 Watch_dog();
924 1 for(i=0;i<8;i++)Call_id[i]=0;
925 1
926 1
927 1
928 1
929 1 while(1)
930 1 {
931 2 /*init_com();
932 2 InitREG();
933 2 UartInit(); */
934 2 TX_EN=1;
935 2 Watch_dog();
936 2 if(rest_delay>750)while(1);
937 2
938 2 if (Cmdok) //通讯
939 2 {
940 3
941 3 rest_delay=0;
942 3 Watch_dog();
943 3 Cmdok = FALSE;
944 3 Waring=0; //报警清掉
945 3 RecvReady = FALSE;
946 3 SendReady = FALSE;
947 3 cmd_execution();
948 3 SendReady = TRUE ; //发起始字
949 3 TI = 1;
950 3
951 3 }
952 2
953 2 for(i=1;i<201;i++)
954 2 {
955 3 if((i==1)||(i==150)||(i==50)||(i==100))Check_call();
956 3 if(rest_delay>750)while(1);
957 3 Watch_dog();
958 3 if (Cmdok) //通讯
959 3 {
960 4
961 4 Waring=0;
962 4 rest_delay=0;
963 4 Cmdok = FALSE;
964 4 RecvReady = FALSE;
965 4 SendReady = FALSE;
966 4 cmd_execution();
967 4 SendReady = TRUE ; //发起始字
968 4 TI = 1;
969 4 Test_led=!Test_led;
970 4 }
971 3 Watch_dog();
972 3 ttt=Find(i,0);
973 3 if(ttt)
974 3 {
975 4 Card_id[i]=3;//循环监测的次数
976 4 Test_led=!Test_led;//在区域
977 4 if(!CheckNum(i))
978 4 {
979 5 numtem=i;
980 5 if(ttt==2)
981 5 {
C51 COMPILER V7.05 MMM 07/08/2005 11:42:13 PAGE 17
982 6 numtem=numtem|0x4000;
983 6 /* for(j=0;j<10;j++)
984 6 { Delay1ms(50);
985 6 Test_led=!Test_led;
986 6 }*/
987 6 }
988 5 addNum(numtem); //加入
989 5 }
990 4 else
991 4 {
992 5 if(ttt==2)
993 5 {
994 6 numtem=i;
995 6 SetWingNum(numtem);
996 6 /*for(j=0;j<10;j++)
997 6 { Delay1ms(50);
998 6 Test_led=!Test_led;
999 6 }*/
1000 6 }
1001 5 else
1002 5 {
1003 6 if(!Waring) //已经取走
1004 6 {
1005 7 numtem=i;
1006 7 ClrWingNum(numtem);
1007 7 }
1008 6 }
1009 5 }
1010 4 }
1011 3 else //不再区域
1012 3 {
1013 4 if(CheckNum(i)) //如果原来就存在
1014 4 {
1015 5 ttt=Find(i,0); //再次查找
1016 5 if(ttt==0)
1017 5 {
1018 6 Card_id[i]--;
1019 6 if( Card_id[i]==0)
1020 6 {
1021 7 DelNum(i);
1022 7 }
1023 6 }
1024 5 }
1025 4 else //原来就不在
1026 4 {
1027 5 if(!Waring) //没有报警信息
1028 5 {
1029 6 DelNum(i);
1030 6 }
1031 5 }
1032 4
1033 4 }
1034 3
1035 3 }
1036 2 }
1037 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2377 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 643 ----
C51 COMPILER V7.05 MMM 07/08/2005 11:42:13 PAGE 18
PDATA SIZE = ---- ----
DATA SIZE = 25 8
IDATA SIZE = 12 10
BIT SIZE = 9 1
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -