📄 misc.ls
字号:
1 ; C Compiler for ST7 (COSMIC Software)
2 ; Generator V4.4a - 17 Dec 2001
3 ; Optimizer V4.2g - 21 Dec 2001
402 switch .data
403 0000 _Current_Target_Freq:
404 0000 0000 dc.w 0
405 0002 _Target_Speed:
406 0002 0000 dc.w 0
407 0004 _SpdVarPeriod:
408 0004 32 dc.b 50
443 ; 122 void ST7_IntPrioritySetUp(void)
443 ; 123 {
444 .text: section .text,new
445 0000 _ST7_IntPrioritySetUp:
448 ; 126 ITSPR0 = MCES_LVL_3 + MCC_SI_LVL_1 + EXT_IT0_LVL_1 + EXT_IT1_LVL_1;
450 0000 a657 ld a,#87
451 0002 b700 ld _ITSPR0,a
452 ; 131 ITSPR1 = EXT_IT2_LVL_1 + MTC_U_CL_SO_LVL_2 + MTC_R_Z_LVL_3 + MTC_C_D_LVL_3;
454 0004 a6f1 ld a,#241
455 0006 b700 ld _ITSPR1,a
456 ; 135 ITSPR2 = SPI_LVL_1 + TIMER_A_LVL_1 + TIMER_B_LVL_1 + SCI_LVL_2;
458 0008 a615 ld a,#21
459 000a b700 ld _ITSPR2,a
460 ; 139 ITSPR3 = AVD_LVL_1 + PWMART_LVL_1;
462 000c a605 ld a,#5
463 000e b700 ld _ITSPR3,a
464 ; 141 }
467 0010 81 ret
501 ; 151 void Wait(u8 time)
501 ; 152 {
502 .text: section .text,new
504 xref.b _Wait$L
505 0000 _Wait:
508 ; 154 while (timer_10ms != 0);
511 0000 c70000 ld _timer_10ms,a
513 0003 L362:
516 0003 c60000 ld a,_timer_10ms
517 0006 26fb jrne L362
518 ; 155 }
521 0008 81 ret
555 ; 157 void Wait100us(void)
555 ; 158 {
556 .text: section .text,new
558 xref.b _Wait100us$L
559 0000 _Wait100us:
562 ; 161 for (i=0; i<18; i++) Wait1us();
564 0000 3fff clr _Wait100us$L-1
565 0002 L503:
569 0002 9d nop
570 0003 9d nop
571 0004 9d nop
572 0005 9d nop
573
577 0006 3cff inc _Wait100us$L-1
580 0008 b6ff ld a,_Wait100us$L-1
581 000a a112 cp a,#18
582 000c 25f4 jrult L503
583 ; 162 }
587 000e 81 ret
621 ; 164 void Wait1ms(void)
621 ; 165 {
622 .text: section .text,new
624 xref.b _Wait1ms$L
625 0000 _Wait1ms:
628 ; 168 for (i=0; i<180; i++) Wait1us();;
630 0000 3fff clr _Wait1ms$L-1
631 0002 L133:
635 0002 9d nop
636 0003 9d nop
637 0004 9d nop
638 0005 9d nop
639
643 0006 3cff inc _Wait1ms$L-1
646 0008 b6ff ld a,_Wait1ms$L-1
647 000a a1b4 cp a,#180
648 000c 25f4 jrult L133
649 ; 169 }
654 000e 81 ret
680 ; 181 void Chk_Power_Motor_Status(void)
680 ; 182 {
681 .text: section .text,new
682 0000 _Chk_Power_Motor_Status:
685 ; 183 if (timer_CL_10ms ==0) ClrBit(Power_Motor_Status,OverCurrent);
687 0000 c60000 ld a,_timer_CL_10ms
688 0003 2609 jrne L743
691 0005 c60000 ld a,_Power_Motor_Status
692 0008 a4fd and a,#253
693 000a c70000 ld _Power_Motor_Status,a
696 000d 81 ret
697 000e L743:
698 ; 184 else if (timer_CL_10ms <= 10) MIMR |= CLIM_MSK; // re-validate CL Int. after 200 ms
700 000e c60000 ld a,_timer_CL_10ms
701 0011 a10b cp a,#11
702 0013 2402 jruge L153
705 0015 1858 bset _MIMR,#4
706 0017 L153:
707 ; 185 }
710 0017 81 ret
737 ; 195 void Change_Speed(void)
737 ; 196 {
738 .text: section .text,new
739 0000 _Change_Speed:
742 ; 197 if (Target_Speed != Current_Target_Freq)
744 0000 c60003 ld a,_Target_Speed+1
745 0003 c10001 cp a,_Current_Target_Freq+1
746 0006 2606 jrne L02
747 0008 ce0002 ld x,_Target_Speed
748 000b c30000 cp x,_Current_Target_Freq
749 000e L02:
750 000e 2737 jreq L563
751 ; 199 if (Timer_SpdVarPeriodElapsed() == TRUE)
753 0010 cd0000 call _Timer_SpdVarPeriodElapsed
755 0013 a101 cp a,#1
756 0015 2630 jrne L563
757 ; 201 if (Target_Speed > Current_Target_Freq) Current_Target_Freq += 10;
759 0017 c60001 ld a,_Current_Target_Freq+1
760 001a c00003 sub a,_Target_Speed+1
761 001d c60000 ld a,_Current_Target_Freq
762 0020 c20002 sbc a,_Target_Speed
763 0023 c60001 ld a,_Current_Target_Freq+1
764 0026 240c jruge L173
767 0028 ab0a add a,#10
768 002a c70001 ld _Current_Target_Freq+1,a
769 002d c60000 ld a,_Current_Target_Freq
770 0030 a900 adc a,#0
772 0032 200a jra L373
773 0034 L173:
774 ; 202 else Current_Target_Freq -= 10;
776 0034 a00a sub a,#10
777 0036 c70001 ld _Current_Target_Freq+1,a
778 0039 c60000 ld a,_Current_Target_Freq
779 003c a200 sbc a,#0
780 003e L373:
781 003e c70000 ld _Current_Target_Freq,a
782 ; 203 Timer_SetSpdVarPeriod(SpdVarPeriod); // 0.5 Sec delay
784 0041 c60004 ld a,_SpdVarPeriod
785 0044 cd0000 call _Timer_SetSpdVarPeriod
787 0047 L563:
788 ; 206 }
791 0047 81 ret
814 ; 216 void Inc_TargetSpeed(void)
814 ; 217 {
815 .text: section .text,new
816 0000 _Inc_TargetSpeed:
819 ; 218 Target_Speed += Pole_Pair_Num * 10;
821 0000 c60003 ld a,_Target_Speed+1
822 0003 ab14 add a,#20
823 0005 c70003 ld _Target_Speed+1,a
824 0008 c60002 ld a,_Target_Speed
825 000b a900 adc a,#0
826 000d c70002 ld _Target_Speed,a
827 ; 219 }
830 0010 81 ret
853 ; 221 void Dec_TargetSpeed(void)
853 ; 222 {
854 .text: section .text,new
855 0000 _Dec_TargetSpeed:
858 ; 223 Target_Speed -= Pole_Pair_Num * 10;
860 0000 c60003 ld a,_Target_Speed+1
861 0003 a014 sub a,#20
862 0005 c70003 ld _Target_Speed+1,a
863 0008 c60002 ld a,_Target_Speed
864 000b a200 sbc a,#0
865 000d c70002 ld _Target_Speed,a
866 ; 224 }
869 0010 81 ret
892 ; 233 u16 Get_TargetSpeed(void)
892 ; 234 {
893 .text: section .text,new
894 0000 _Get_TargetSpeed:
897 ; 235 return(Target_Speed);
899 0000 c60003 ld a,_Target_Speed+1
900 0003 ce0002 ld x,_Target_Speed
903 0006 81 ret
937 ; 238 void Set_TargetSpeed(u8 Speed)
937 ; 239 {
938 .text: section .text,new
940 xref.b _Set_TargetSpeed$L
941 0000 _Set_TargetSpeed:
944 ; 240 Target_Speed = (Speed/2) * 10 * Pole_Pair_Num;
946 0000 5f clr x
947 0001 57 sra x
948 0002 46 rrc a
949 0003 3f00 clr c_y
950 0005 90ae0a ld y,#10
951 0008 cd0000 call c_imul
953 000b 48 sll a
954 000c 59 rlc x
955 000d c70003 ld _Target_Speed+1,a
956 0010 cf0002 ld _Target_Speed,x
957 ; 241 }
960 0013 81 ret
984 ; 243 u16 Get_CurrentTargetSpeed(void)
984 ; 244 {
985 .text: section .text,new
986 0000 _Get_CurrentTargetSpeed:
989 ; 245 return(Current_Target_Freq);
991 0000 c60001 ld a,_Current_Target_Freq+1
992 0003 ce0000 ld x,_Current_Target_Freq
995 0006 81 ret
1030 ; 247 void Set_CurrentTargetSpeed(u16 Speed)
1030 ; 248 {
1031 .text: section .text,new
1033 xref.b _Set_CurrentTargetSpeed$L
1034 0000 _Set_CurrentTargetSpeed:
1037 ; 249 Current_Target_Freq = Speed;
1039 0000 c70001 ld _Current_Target_Freq+1,a
1040 0003 cf0000 ld _Current_Target_Freq,x
1041 ; 250 }
1044 0006 81 ret
1078 ; 251 void Set_SpdVarPeriod(u8 Period)
1078 ; 252 {
1079 .text: section .text,new
1081 xref.b _Set_SpdVarPeriod$L
1082 0000 _Set_SpdVarPeriod:
1085 ; 253 SpdVarPeriod = (u8)(Period * 10);
1087 0000 ae0a ld x,#10
1088 0002 42 mul x,a
1089 0003 c70004 ld _SpdVarPeriod,a
1090 ; 254 }
1093 0006 81 ret
1135 xdef _SpdVarPeriod
1136 xdef _Target_Speed
1137 xdef _Current_Target_Freq
1138 xref _Timer_SpdVarPeriodElapsed
1139 xref _Timer_SetSpdVarPeriod
1140 xref _timer_CL_10ms
1141 xref _timer_10ms
1142 xdef _Set_SpdVarPeriod
1143 xdef _Set_TargetSpeed
1144 xdef _ST7_IntPrioritySetUp
1145 xdef _Set_CurrentTargetSpeed
1146 xdef _Get_CurrentTargetSpeed
1147 xdef _Get_TargetSpeed
1148 xdef _Dec_TargetSpeed
1149 xdef _Inc_TargetSpeed
1150 xdef _Change_Speed
1151 xdef _Chk_Power_Motor_Status
1152 xdef _Wait1ms
1153 xdef _Wait100us
1154 xdef _Wait
1155 xref _Power_Motor_Status
1156 xref.b _ITSPR3
1157 xref.b _ITSPR2
1158 xref.b _ITSPR1
1159 xref.b _ITSPR0
1160 xref.b c_y
1179 xref c_imul
1180 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -