📄 main.lst
字号:
809 4 // 只保留零点记录标志
810 4 MotorStatus[4].Status &= ZERO_RECORD_MASK;
811 4 MotorStatus[4].Dir = 0;
812 4
813 4 // 关定时器0
814 4 TR0 = 0;
815 4 ET0 = 0;
816 4 Timer[0].MotorIdx = 0;
817 4 PUL4 = 1;
*** ERROR C202 IN LINE 817 OF MAIN.C: 'PUL4': undefined identifier
818 4 break;
819 4 }
820 3 }
821 2
822 2 // 改变输出电平
823 2 PUL4 = ~PUL4;
*** ERROR C202 IN LINE 823 OF MAIN.C: 'PUL4': undefined identifier
824 2
825 2 // 增减脉冲总数量
826 2 tmpptr = (BYTE idata*)&MotorStatus[4].TotalPluseCnt + LSB;
C51 COMPILER V7.04 MAIN 01/23/2007 12:25:24 PAGE 15
827 2 if ( DIR4 )
*** ERROR C202 IN LINE 827 OF MAIN.C: 'DIR4': undefined identifier
828 2 DWordDec( );
829 2 else
830 2 DWordInc( );
831 2
832 2 // 当前脉冲减
833 2 tmpptr = (BYTE idata*)&Timer[0].CurPluseNum + LSB;
834 2 DWordDec( );
835 2
836 2 // 零位检测
837 2 if ( MotorStatus[4].Status & ZERO_CHECK_MASK )
838 2 {
839 3 // 零位到达
840 3 if ( !LastTimer0ST && ST4 )
*** ERROR C202 IN LINE 840 OF MAIN.C: 'P3_4': undefined identifier
841 3 {
842 4 MotorStatus[4].Status |= MOTOR_STOP_CMD_MASK;
843 4 MotorStatus[4].Status |= ZERO_RECORD_MASK;
844 4 MotorStatus[4].TotalPluseCnt = 0;
845 4 break;
846 4 }
847 3 LastTimer0ST = ST4;
*** ERROR C202 IN LINE 847 OF MAIN.C: 'P3_4': undefined identifier
848 3 }
849 2
850 2 // 脉冲数未完
851 2 if ( Timer[0].CurPluseNum )
852 2 break;
853 2
854 2 if ( (MotorStatus[4].Dir & DIR_FLAG_MASK) == DIR_FLAG_MASK )
855 2 {
856 3 DIR4 = ~DIR4;
*** ERROR C202 IN LINE 856 OF MAIN.C: 'DIR4': undefined identifier
857 3 Timer[0].CurPluseNum = MotorStatus[4].CmdPluseNum;
858 3 }
859 2 else
860 2 {
861 3 // 停止
862 3 MotorStatus[4].Status |= MOTOR_STOP_CMD_MASK;
863 3 }
864 2 break;
865 2
866 2 // 电机5
867 2 case 6:
868 2 if ( MotorStatus[5].Status & MOTOR_STOP_CMD_MASK )
869 2 {
870 3 if ( (MotorStatus[5].Dir & DIR_FLAG_MASK) == DIR_FLAG_MASK )
871 3 {
872 4 if ( Timer[0].CenrerPluse == (WORD)MotorStatus[5].TotalPluseCnt )
873 4 {
874 5 // 只保留零点记录标志
875 5 MotorStatus[5].Status &= ZERO_RECORD_MASK;
876 5 MotorStatus[5].Dir = 0;
877 5
878 5 // 关定时器0
879 5 TR0 = 0;
880 5 ET0 = 0;
881 5 Timer[0].MotorIdx = 0;
882 5 break;
883 5 }
884 4 }
C51 COMPILER V7.04 MAIN 01/23/2007 12:25:24 PAGE 16
885 3 else
886 3 {
887 4 // 只保留零点记录标志
888 4 MotorStatus[5].Status &= ZERO_RECORD_MASK;
889 4 MotorStatus[5].Dir = 0;
890 4
891 4 // 关定时器0
892 4 TR0 = 0;
893 4 ET0 = 0;
894 4 Timer[0].MotorIdx = 0;
895 4 PUL5 = 1;
*** ERROR C202 IN LINE 895 OF MAIN.C: 'PUL5': undefined identifier
896 4 break;
897 4 }
898 3 }
899 2
900 2 // 改变输出电平
901 2 PUL5 = ~PUL5;
*** ERROR C202 IN LINE 901 OF MAIN.C: 'PUL5': undefined identifier
902 2
903 2 // 增减脉冲总数量
904 2 tmpptr = (BYTE idata*)&MotorStatus[5].TotalPluseCnt + LSB;
905 2 if ( DIR5 )
*** ERROR C202 IN LINE 905 OF MAIN.C: 'DIR5': undefined identifier
906 2 DWordDec( );
907 2 else
908 2 DWordInc( );
909 2
910 2 // 当前脉冲减
911 2 tmpptr = (BYTE idata*)&Timer[0].CurPluseNum + LSB;
912 2 DWordDec( );
913 2
914 2 // 零位检测
915 2 if ( MotorStatus[5].Status & ZERO_CHECK_MASK )
916 2 {
917 3 // 零位到达
918 3 if ( !LastTimer0ST && ST5 )
*** ERROR C202 IN LINE 918 OF MAIN.C: 'P3_5': undefined identifier
919 3 {
920 4 MotorStatus[5].Status |= MOTOR_STOP_CMD_MASK;
921 4 MotorStatus[5].Status |= ZERO_RECORD_MASK;
922 4 MotorStatus[5].TotalPluseCnt = 0;
923 4 break;
924 4 }
925 3 LastTimer0ST = ST5;
*** ERROR C202 IN LINE 925 OF MAIN.C: 'P3_5': undefined identifier
926 3 }
927 2
928 2 #if (SCH_PCB_VERSION == 1)
929 2 // 工作零位检测
930 2 if ( MotorStatus[5].Status & WORK_ZERO_CHECK_MASK )
931 2 {
932 3 // 零位到达
933 3 if ( !LastTimer0WST && WST5 )
*** ERROR C202 IN LINE 933 OF MAIN.C: 'WST5': undefined identifier
934 3 {
935 4 MotorStatus[5].Status |= MOTOR_STOP_CMD_MASK;
936 4 break;
937 4 }
938 3 LastTimer0WST = WST5;
*** ERROR C202 IN LINE 938 OF MAIN.C: 'WST5': undefined identifier
939 3 }
C51 COMPILER V7.04 MAIN 01/23/2007 12:25:24 PAGE 17
940 2 #endif
941 2 // 脉冲数未完
942 2 if ( Timer[0].CurPluseNum )
943 2 break;
944 2
945 2 if ( (MotorStatus[5].Dir & DIR_FLAG_MASK) == DIR_FLAG_MASK )
946 2 {
947 3 DIR5 = ~DIR5;
*** ERROR C202 IN LINE 947 OF MAIN.C: 'DIR5': undefined identifier
948 3 Timer[0].CurPluseNum = MotorStatus[5].CmdPluseNum;
949 3 }
950 2 else
951 2 {
952 3 // 停止
953 3 MotorStatus[5].Status |= MOTOR_STOP_CMD_MASK;
954 3 }
955 2 break;
956 2 }
957 1 }
958
959 void timer_1(void) interrupt 3 using 2
960 {
961 1 TimerEndTmpFlag = 0;
962 1 if ( Timer1EndIntFlag )
963 1 {
964 2 Timer[1].IntCnt = 0;
965 2 TimerEndTmpFlag = 1;
966 2 if ( Timer[1].SecConstFlag )
967 2 {
968 3 Timer[1].TimerConstCntH = Timer[1].SecTimerConstCntH;
969 3 Timer[1].TimerConstH = Timer[1].SecTimerConstH;
970 3 Timer[1].TimerConstL = Timer[1].SecTimerConstL;
971 3 Timer[1].SecConstFlag = 0;
972 3 }
973 2 }
974 1
975 1 TR1 = 0;
976 1 if ( Timer[1].IntCnt == Timer[1].TimerConstCntH )
977 1 {
978 2 Timer1EndIntFlag = 1;
979 2
980 2 TL1 += Timer[1].TimerConstL;
981 2 TH1 = Timer[1].TimerConstH;
982 2 }
983 1 else
984 1 {
985 2 Timer1EndIntFlag = 0;
986 2 }
987 1 TR1 = 1;
988 1 Timer[1].IntCnt++;
989 1
990 1 if ( !TimerEndTmpFlag )
991 1 return;
992 1
993 1 if ( Timer[1].UpDwonCnt )
994 1 Timer[1].UpDwonCnt--;
995 1
996 1 switch( Timer[1].MotorIdx )
997 1 {
998 2 // 电机0
999 2 case 1:
1000 2 if ( MotorStatus[0].Status & MOTOR_STOP_CMD_MASK )
C51 COMPILER V7.04 MAIN 01/23/2007 12:25:24 PAGE 18
1001 2 {
1002 3 if ( (MotorStatus[0].Dir & DIR_FLAG_MASK) == DIR_FLAG_MASK )
1003 3 {
1004 4 if (
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -