⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mtc.ls

📁 该程序是ST7MC驱动BLDC120
💻 LS
📖 第 1 页 / 共 5 页
字号:
 691  0118 2c            	dc.b	44
 692  0119 2a            	dc.b	42
 693  011a               _Falling_Table:
 694  011a 96            	dc.b	150
 695  011b 94            	dc.b	148
 696  011c 92            	dc.b	146
 697  011d 90            	dc.b	144
 698  011e 8e            	dc.b	142
 699  011f 8c            	dc.b	140
 700  0120 8a            	dc.b	138
 701  0121 8a            	dc.b	138
 702  0122 88            	dc.b	136
 703  0123 88            	dc.b	136
 704  0124 86            	dc.b	134
 705  0125 86            	dc.b	134
 706  0126 86            	dc.b	134
 707  0127 86            	dc.b	134
 708  0128 84            	dc.b	132
 709  0129 82            	dc.b	130
 710  012a 82            	dc.b	130
 711  012b 80            	dc.b	128
 712  012c 80            	dc.b	128
 713  012d 7e            	dc.b	126
 714  012e 7c            	dc.b	124
 715  012f 78            	dc.b	120
 716  0130 77            	dc.b	119
 717  0131 76            	dc.b	118
 718  0132 74            	dc.b	116
 719  0133 72            	dc.b	114
 720  0134 6e            	dc.b	110
 721  0135 6c            	dc.b	108
 722  0136 68            	dc.b	104
 723  0137 66            	dc.b	102
 724  0138 62            	dc.b	98
 725  0139 60            	dc.b	96
 726  013a 5e            	dc.b	94
 727  013b 5a            	dc.b	90
 728  013c 5a            	dc.b	90
 729  013d 58            	dc.b	88
 730  013e 54            	dc.b	84
 731  013f 52            	dc.b	82
 732  0140 50            	dc.b	80
 733  0141 4e            	dc.b	78
 734  0142 4a            	dc.b	74
 735  0143 48            	dc.b	72
 736  0144 46            	dc.b	70
 737  0145 42            	dc.b	66
 738  0146 40            	dc.b	64
 739  0147 3c            	dc.b	60
 740  0148 3c            	dc.b	60
 741  0149 3c            	dc.b	60
 742  014a 3c            	dc.b	60
 743  014b 3a            	dc.b	58
 744  014c 38            	dc.b	56
 745  014d 38            	dc.b	56
 746  014e 38            	dc.b	56
 747  014f 38            	dc.b	56
 748  0150 36            	dc.b	54
 749  0151 34            	dc.b	52
 750  0152 32            	dc.b	50
 751  0153 32            	dc.b	50
 752  0154 30            	dc.b	48
 753  0155 2f            	dc.b	47
 754  0156 5a            	dc.b	90
 755  0157 58            	dc.b	88
 756  0158 58            	dc.b	88
 757  0159 56            	dc.b	86
 758  015a 56            	dc.b	86
 759  015b 56            	dc.b	86
 760  015c 56            	dc.b	86
 761  015d 54            	dc.b	84
 762  015e 54            	dc.b	84
 763  015f 54            	dc.b	84
 764  0160 54            	dc.b	84
 765  0161 52            	dc.b	82
 766  0162 52            	dc.b	82
 767  0163 52            	dc.b	82
 768  0164 52            	dc.b	82
 769  0165 52            	dc.b	82
 770  0166 50            	dc.b	80
 771  0167 4e            	dc.b	78
 772  0168 4c            	dc.b	76
 773  0169 4c            	dc.b	76
 774  016a 4a            	dc.b	74
 775  016b 46            	dc.b	70
 776  016c 46            	dc.b	70
 777  016d 44            	dc.b	68
 778  016e 44            	dc.b	68
 779  016f 42            	dc.b	66
 780  0170 40            	dc.b	64
 781  0171 3e            	dc.b	62
 782  0172 3c            	dc.b	60
 783  0173 3c            	dc.b	60
 784  0174 3a            	dc.b	58
 785  0175 36            	dc.b	54
 786  0176 32            	dc.b	50
 787  0177 32            	dc.b	50
 788  0178 30            	dc.b	48
 789  0179 30            	dc.b	48
 790  017a 2e            	dc.b	46
 791  017b 2e            	dc.b	46
 792  017c 2c            	dc.b	44
 793  017d 2c            	dc.b	44
 794  017e 2a            	dc.b	42
 795                     	switch	.data
 796  0000               _Freq_Motor:
 797  0000 0000          	dc.w	0
 798  0002               _Ki:
 799  0002 28            	dc.b	40
 800  0003               _Kp:
 801  0003 1e            	dc.b	30
 802  0004               _Rising_bemf:
 803  0004 78            	dc.b	120
 804  0005               _Falling_bemf:
 805  0005 c8            	dc.b	200
 806  0006               _MotorCmd:
 807  0006 00            	dc.b	0
 838                     ; 328 void MTC_ResetPeripheral(void)
 838                     ; 329 {
 839                     .text:	section	.text,new
 840  0000               L752_MTC_ResetPeripheral:
 843                     ; 330 	SetBit(MCFR,RST); 
 845  0000 1c5f          	bset	_MCFR,#6
 846                     ; 331 	ClrBit(MCFR,RST);
 848  0002 1d5f          	bres	_MCFR,#6
 849                     ; 332 }
 852  0004 81            	ret	
 889                     ; 345 void RefreshBootstrap(void)
 889                     ; 346 {
 890                     .text:	section	.text,new
 892                     	xref.b	L352_RefreshBootstrap$L
 893  0000               L352_RefreshBootstrap:
 896                     ; 348 	for (i=0; i<3; i++)
 898  0000 3fff          	clr	L352_RefreshBootstrap$L-1
 899  0002               L513:
 900                     ; 350 		MPHST = BOOT_REFRESH[i];	// switch ON one low side switch
 902  0002 beff          	ld	x,L352_RefreshBootstrap$L-1
 903  0004 d60000        	ld	a,(_BOOT_REFRESH,x)
 904  0007 b75d          	ld	_MPHST,a
 905                     ; 351 		Wait1ms();
 907  0009 cd0000        	call	_Wait1ms
 909                     ; 352 		Wait1ms();
 911  000c cd0000        	call	_Wait1ms
 913                     ; 353 		MPHST = 0;					// Switch OFF all switches
 915  000f 3f5d          	clr	_MPHST
 916                     ; 354 		Wait1ms();
 918  0011 cd0000        	call	_Wait1ms
 920                     ; 355 		Wait1ms();
 922  0014 cd0000        	call	_Wait1ms
 924                     ; 348 	for (i=0; i<3; i++)
 926  0017 3cff          	inc	L352_RefreshBootstrap$L-1
 929  0019 b6ff          	ld	a,L352_RefreshBootstrap$L-1
 930  001b a103          	cp	a,#3
 931  001d 25e3          	jrult	L513
 932                     ; 357 	MPHST = 0;	// All switches OFF
 934  001f 3f5d          	clr	_MPHST
 935                     ; 358 	Wait100us();	// This is to avoid any short circuit conditions
 938                     ; 359 }
 941  0021 cc0000        	jp	_Wait100us
 980                     ; 372 void AlignRotor(void)
 980                     ; 373 {
 981                     .text:	section	.text,new
 983                     	xref.b	L552_AlignRotor$L
 984  0000               L552_AlignRotor:
 987                     ; 378 switch (AlignState)
 989  0000 c60001        	ld	a,_AlignState
 991  0003 2747          	jreq	L523
 992                     ; 380 	case ALIGN_NEXT:
 992                     ; 381 	default:
 992                     ; 382 		#if (DRIVING_MODE == VOLTAGE_MODE)
 992                     ; 383 	   		Step_Duty = ((u16)(Align_MCPUL+(u16)(Align_MCPUH<<8)))/(ALIGN_STEP_NUM-1);
 992                     ; 384 	
 992                     ; 385 			ToCMPxL(MCPUL,(u16)(Align_Index*Step_Duty));  // increase current (linear curve)
 992                     ; 386 			ToCMPxH(MCPUH,(u16)(Align_Index*Step_Duty));
 992                     ; 387 		#else
 992                     ; 388 			Step_Duty = ((u16)(Align_MCPVL+(u16)(Align_MCPVH<<8)))/(ALIGN_STEP_NUM-1);
 994  0005 a62d          	ld	a,#45
 995  0007 b7ff          	ld	L552_AlignRotor$L-1,a
 996  0009 3ffe          	clr	L552_AlignRotor$L-2
 997                     ; 389 			ToCMPxL(MCPVL,(u16)(Align_Index*Step_Duty));  // increase current (linear curve)
 999  000b c60003        	ld	a,L152_Align_Index
1000  000e beff          	ld	x,L552_AlignRotor$L-1
1001  0010 42            	mul	x,a
1002  0011 48            	sll	a
1003  0012 59            	rlc	x
1004  0013 48            	sll	a
1005  0014 59            	rlc	x
1006  0015 48            	sll	a
1007  0016 59            	rlc	x
1008  0017 b766          	ld	_MCPVL,a
1009                     ; 390 			ToCMPxH(MCPVH,(u16)(Align_Index*Step_Duty));
1011  0019 c60003        	ld	a,L152_Align_Index
1012  001c 5f            	clr	x
1013  001d 90befe        	ld	y,L552_AlignRotor$L-2
1014  0020 90bf00        	ld	c_y,y
1015  0023 90beff        	ld	y,L552_AlignRotor$L-1
1016  0026 cd0000        	call	c_imul
1018  0029 54            	srl	x
1019  002a 46            	rrc	a
1020  002b 54            	srl	x
1021  002c 46            	rrc	a
1022  002d 54            	srl	x
1023  002e 46            	rrc	a
1024  002f 54            	srl	x
1025  0030 46            	rrc	a
1026  0031 54            	srl	x
1027  0032 46            	rrc	a
1028  0033 b765          	ld	_MCPVH,a
1029                     ; 392             	Align_Index++;
1031  0035 c60003        	ld	a,L152_Align_Index
1032  0038 4c            	inc	a
1033  0039 c70003        	ld	L152_Align_Index,a
1034                     ; 393 		if (Align_Index == ALIGN_STEP_NUM-1) Status_Start = INIT_SWITCHED_MODE;
1036  003c a118          	cp	a,#24
1037  003e 2605          	jrne	L153
1040  0040 a602          	ld	a,#2
1041  0042 c70002        	ld	_Status_Start,a
1042  0045               L153:
1043                     ; 394         	AlignState = WAIT_FOR_C;
1045  0045 4f            	clr	a
1046  0046 c70001        	ld	_AlignState,a
1047                     ; 395 		MISR = 0;				// Reset all pending bits
1049  0049 3f59          	clr	_MISR
1050                     ; 396 	break;
1053  004b 81            	ret	
1054  004c               L523:
1055                     ; 398 	case WAIT_FOR_C:
1055                     ; 399 		if (MISR & CI_MSK) AlignState = ALIGN_NEXT;
1057  004c 015905        	btjf	_MISR,#0,L743
1060  004f a601          	ld	a,#1
1061  0051 c70001        	ld	_AlignState,a
1062  0054               L743:
1063                     ; 402 }
1066  0054 81            	ret	
1089                     ; 414 u8 GetMotorStatus(void)
1089                     ; 415 {
1090                     .text:	section	.text,new
1091  0000               _GetMotorStatus:
1094                     ; 416 	return(MotorStatus);
1096  0000 b609          	ld	a,_MotorStatus
1099  0002 81            	ret	
1133                     ; 430 void SetMotorStatus(u8 status)
1133                     ; 431 {
1134                     .text:	section	.text,new
1136                     	xref.b	_SetMotorStatus$L
1137  0000               _SetMotorStatus:
1140                     ; 432 	MotorStatus = (u8)(status);
1142  0000 b709          	ld	_MotorStatus,a
1143                     ; 433 }
1146  0002 81            	ret	
1192                     ; 446 void MTC_InitPeripheral(void)
1192                     ; 447 {
1193                     .text:	section	.text,new
1194  0000               _MTC_InitPeripheral:
1197                     ; 449 	MTC_ResetPeripheral();
1199  0000 cd0000        	call	L752_MTC_ResetPeripheral
1201                     ; 452 	SET_MTC_PAGE(1);
1203  0003 1e5f          	bset	_MCFR,#7
1204                     ; 453 	MCONF = mem_MCONF;
1206  0005 a602          	ld	a,#2
1207  0007 b753          	ld	_MCONF,a
1208                     ; 454 	MPWME = (u8)(mem_MPWME);     // enable PWMV output 
1210  0009 a623          	ld	a,#35
1211  000b b752          	ld	_MPWME,a
1212                     ; 456 	MPOL = ALL_ACTIVE_HIGH;				// Switch driver input polarity (L6386D)
1214  000d a63f          	ld	a,#63
1215  000f b751          	ld	_MPOL,a
1216                     ; 460     MDTG = mem_MDTG; //reset PCN and write the delay value
1218  0011 a61f          	ld	a,#31
1219  0013 b750          	ld	_MDTG,a
1220                     ; 461     MDTG = (u8)(mem_MDTG&(0x40));  // disable the complementary PWM mode
1222  0015 3f50          	clr	_MDTG
1223                     ; 463 	MPAR = OUTPUT_PARITY;				// Define Odd/Even MCOx outputs
1225  0017 a62a          	ld	a,#42
1226  0019 b754          	ld	_MPAR,a
1227                     ; 465     MZFR = mem_MZFR;
1229  001b a610          	ld	a,#16
1230  001d b755          	ld	_MZFR,a
1231                     ; 466     MSCR = mem_MSCR;
1233  001f 3f56          	clr	_MSCR
1234                     ; 469 	SET_MTC_PAGE(0);	
1236  0021 1f5f          	bres	_MCFR,#7
1237                     ; 471 	MPCR = mem_MPCR;
1239  0023 3f61          	clr	_MPCR
1240                     ; 473 	MCP0L = mem_MCPOL; 
1242  0025 3f6a          	clr	_MCP0L
1243                     ; 474 	MCP0H = mem_MCPOH;
1245  0027 a60a          	ld	a,#10
1246  0029 b769          	ld	_MCP0H,a
1247                     ; 476 	MCRA = mem_MCRA;
1249  002b a608          	ld	a,#8
1250  002d b75a          	ld	_MCRA,a

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -