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

📄 mc_bldc_motor.ls

📁 STM8S105 BLDC源代码
💻 LS
📖 第 1 页 / 共 2 页
字号:
   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.9.10 - 10 Feb 2011
   3                     ; Generator (Limited) V4.3.6 - 15 Feb 2011
   4                     ; Optimizer V4.3.5 - 15 Feb 2011
  19                     	bsct
  20  0000               L3_sBLDC_Var:
  21  0000 01            	dc.b	1
  22  0001 00            	dc.b	0
  23  0002 0000          	dc.w	0
  24  0004 00c8          	dc.w	200
  25  0006 02c6          	dc.w	710
  26  0008 012c          	dc.w	300
  27  000a 0000          	dc.w	0
  28  000c 01            	dc.b	1
  29  000d 01            	dc.b	1
  30  000e 14            	dc.b	20
  31  000f 251c          	dc.w	9500
  32  0011 0000          	dc.w	0
  33  0013 00            	dc.b	0
  34  0014 00            	dc.b	0
  35  0015 00            	dc.b	0
  36  0016 00            	dc.b	0
  37  0017               L5_sPID_SPEED_Var:
  38  0017 0014          	dc.w	20
  39  0019 0014          	dc.w	20
  40  001b 0000          	dc.w	0
  41  001d 00000000      	dc.l	0
  42  0021 00000000      	dc.l	0
  43                     .const:	section	.text
  44  0000               L7_sPID_SPEED_Const:
  46  0000 0000          	dc.w	_PI_Regulator
  47  0002 0004          	dc.w	4
  48  0004 0008          	dc.w	8
  49  0006 0010          	dc.w	16
  50  0008 00c8          	dc.w	200
  51  000a 07d0          	dc.w	2000
  52  000c 000000c8      	dc.l	200
  53  0010 000000a0      	dc.l	160
  54  0014               L11_sPID_SPEED:
  55  0014 0017          	dc.w	L5_sPID_SPEED_Var
  56  0016 0000          	dc.w	L7_sPID_SPEED_Const
  57  0018               L31_sBLDC_Const:
  58  0018 02            	dc.b	2
  59  0019 0546          	dc.w	1350
  60  001b 4650          	dc.w	18000
  61  001d 05            	dc.b	5
  62  001e 0014          	dc.w	L11_sPID_SPEED
  63  0020 0708          	dc.w	1800
  64  0022 0000          	dc.w	0
  65  0024               L51_sBLDC_Struct:
  66  0024 0000          	dc.w	L3_sBLDC_Var
  67  0026 0018          	dc.w	L31_sBLDC_Const
  68  0028               L71_pBLDC_Struct:
  69  0028 0024          	dc.w	L51_sBLDC_Struct
  70  002a               L12_hArrPwmVal:
  71  002a 0378          	dc.w	888
 488                     ; 103 PBLDC_Struct_t Get_BLDC_Struct(void)
 488                     ; 104 {
 490                     	switch	.text
 491  0000               _Get_BLDC_Struct:
 495                     ; 105 	return pBLDC_Struct;
 497  0000 ae0024        	ldw	x,#L51_sBLDC_Struct
 500  0003 81            	ret	
 527                     ; 108 PBLDC_Var_t Get_BLDC_Var(void)
 527                     ; 109 {
 528                     	switch	.text
 529  0004               _Get_BLDC_Var:
 533                     ; 110 	return sBLDC_Struct.pBLDC_Var;
 535  0004 ae0000        	ldw	x,#L3_sBLDC_Var
 538  0007 81            	ret	
 565                     ; 113 PBLDC_Const_t Get_BLDC_Const(void)
 565                     ; 114 {
 566                     	switch	.text
 567  0008               _Get_BLDC_Const:
 571                     ; 115 	return sBLDC_Struct.pBLDC_Const;
 573  0008 ae0018        	ldw	x,#L31_sBLDC_Const
 576  000b 81            	ret	
 601                     ; 118 s16 BLDC_Get_Target_rotor_speed(void)
 601                     ; 119 {
 602                     	switch	.text
 603  000c               _BLDC_Get_Target_rotor_speed:
 607                     ; 120 	return sBLDC_Struct.pBLDC_Var->hTarget_rotor_speed;
 609  000c be04          	ldw	x,L3_sBLDC_Var+4
 612  000e 81            	ret	
 648                     ; 123 void BLDC_Set_Target_rotor_speed(s16 val)
 648                     ; 124 {
 649                     	switch	.text
 650  000f               _BLDC_Set_Target_rotor_speed:
 654                     ; 125 	sBLDC_Struct.pBLDC_Var->hTarget_rotor_speed = val;
 656  000f bf04          	ldw	L3_sBLDC_Var+4,x
 657                     ; 126 }
 660  0011 81            	ret	
 685                     ; 128 s16 BLDC_Get_Measured_rotor_speed(void)
 685                     ; 129 {
 686                     	switch	.text
 687  0012               _BLDC_Get_Measured_rotor_speed:
 691                     ; 130 	return sBLDC_Struct.pBLDC_Var->hMeasured_rotor_speed;
 693  0012 be02          	ldw	x,L3_sBLDC_Var+2
 696  0014 81            	ret	
 722                     	switch	.const
 723  002c               L22:
 724  002c 00000378      	dc.l	888
 725                     ; 133 u8  BLDC_Get_Duty_cycle(void)
 725                     ; 134 {	
 726                     	switch	.text
 727  0015               _BLDC_Get_Duty_cycle:
 731                     ; 135 	return (u8)((100*(u32)(sBLDC_Struct.pBLDC_Var->hDuty_cycle))/hArrPwmVal);
 733  0015 be06          	ldw	x,L3_sBLDC_Var+6
 734  0017 a664          	ld	a,#100
 735  0019 cd0000        	call	c_cmulx
 737  001c ae002c        	ldw	x,#L22
 738  001f cd0000        	call	c_ludv
 740  0022 b603          	ld	a,c_lreg+3
 743  0024 81            	ret	
 768                     ; 138 u16  BLDC_Get_Duty_cycle_cnt(void)
 768                     ; 139 {	
 769                     	switch	.text
 770  0025               _BLDC_Get_Duty_cycle_cnt:
 774                     ; 140 	return sBLDC_Struct.pBLDC_Var->hDuty_cycle;
 776  0025 be06          	ldw	x,L3_sBLDC_Var+6
 779  0027 81            	ret	
 816                     	switch	.const
 817  0030               L03:
 818  0030 00000064      	dc.l	100
 819                     ; 143 void  BLDC_Set_Duty_cycle(u8 val)
 819                     ; 144 {
 820                     	switch	.text
 821  0028               _BLDC_Set_Duty_cycle:
 825                     ; 145 	sBLDC_Struct.pBLDC_Var->hDuty_cycle = (u16)(((u32)(hArrPwmVal)*val)/100);
 827  0028 5f            	clrw	x
 828  0029 97            	ld	xl,a
 829  002a 90ae0378      	ldw	y,#888
 830  002e cd0000        	call	c_umul
 832  0031 ae0030        	ldw	x,#L03
 833  0034 cd0000        	call	c_ludv
 835  0037 be02          	ldw	x,c_lreg+2
 836  0039 bf06          	ldw	L3_sBLDC_Var+6,x
 837                     ; 146 }
 840  003b 81            	ret	
 876                     ; 148 void  BLDC_Set_Duty_cycle_cnt(u16 val)
 876                     ; 149 {
 877                     	switch	.text
 878  003c               _BLDC_Set_Duty_cycle_cnt:
 882                     ; 150 	sBLDC_Struct.pBLDC_Var->hDuty_cycle = (u16)val;
 884  003c bf06          	ldw	L3_sBLDC_Var+6,x
 885                     ; 151 }
 888  003e 81            	ret	
 913                     ; 153 u16 BLDC_Get_Current_reference(void)
 913                     ; 154 {
 914                     	switch	.text
 915  003f               _BLDC_Get_Current_reference:
 919                     ; 155 	return sBLDC_Struct.pBLDC_Var->hCurrent_reference/100;
 921  003f be08          	ldw	x,L3_sBLDC_Var+8
 922  0041 90ae0064      	ldw	y,#100
 923  0045 65            	divw	x,y
 926  0046 81            	ret	
 962                     ; 158 void  BLDC_Set_Current_reference(u16 val)
 962                     ; 159 {
 963                     	switch	.text
 964  0047               _BLDC_Set_Current_reference:
 968                     ; 160 	sBLDC_Struct.pBLDC_Var->hCurrent_reference = val * 100;
 970  0047 90ae0064      	ldw	y,#100
 971  004b cd0000        	call	c_imul
 973  004e bf08          	ldw	L3_sBLDC_Var+8,x
 974                     ; 161 }
 977  0050 81            	ret	
1002                     ; 163 u16 BLDC_Get_Current_measured(void)
1002                     ; 164 {
1003                     	switch	.text
1004  0051               _BLDC_Get_Current_measured:
1008                     ; 165 	return sBLDC_Struct.pBLDC_Var->hCurrent_measured;
1010  0051 be0a          	ldw	x,L3_sBLDC_Var+10
1013  0053 81            	ret	
1049                     ; 168 void  BLDC_Set_Current_measured(u16 val)
1049                     ; 169 {
1050                     	switch	.text
1051  0054               _BLDC_Set_Current_measured:
1055                     ; 170 	sBLDC_Struct.pBLDC_Var->hCurrent_measured = val;
1057  0054 bf0a          	ldw	L3_sBLDC_Var+10,x
1058                     ; 171 }
1061  0056 81            	ret	
1086                     ; 173 u8  BLDC_Get_Falling_Delay(void)
1086                     ; 174 {
1087                     	switch	.text
1088  0057               _BLDC_Get_Falling_Delay:
1092                     ; 175 	return sBLDC_Struct.pBLDC_Var->bFalling_Delay;
1094  0057 b60c          	ld	a,L3_sBLDC_Var+12
1097  0059 81            	ret	
1133                     ; 178 void  BLDC_Set_Falling_Delay(u8 val)
1133                     ; 179 {
1134                     	switch	.text
1135  005a               _BLDC_Set_Falling_Delay:
1139                     ; 181 		sBLDC_Struct.pBLDC_Var->bRising_Delay = val;
1141  005a b70d          	ld	L3_sBLDC_Var+13,a
1142                     ; 183 	sBLDC_Struct.pBLDC_Var->bFalling_Delay = val;
1144  005c b70c          	ld	L3_sBLDC_Var+12,a
1145                     ; 184 }
1148  005e 81            	ret	
1173                     ; 186 u8 	BLDC_Get_Rising_Delay(void)
1173                     ; 187 {
1174                     	switch	.text
1175  005f               _BLDC_Get_Rising_Delay:
1179                     ; 188 	return sBLDC_Struct.pBLDC_Var->bRising_Delay;
1181  005f b60d          	ld	a,L3_sBLDC_Var+13
1184  0061 81            	ret	
1220                     ; 191 void 	BLDC_Set_Rising_Delay(u8 val)
1220                     ; 192 {
1221                     	switch	.text
1222  0062               _BLDC_Set_Rising_Delay:
1226                     ; 194 		sBLDC_Struct.pBLDC_Var->bFalling_Delay = val;

⌨️ 快捷键说明

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