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

📄 volt_cal.asm

📁 变频器程序
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;=====================================================================================
; File name:        VOLT_CAL.ASM                       
;                    
; Originator:	Digital Control Systems Group
;			Texas Instruments
;
; Description:                                 
; Calculates the 3 Phase Motor voltages and stationary 
; dq-axis voltages based on the PWM modulating function 
; & DC bus voltage measurement.
;=====================================================================================
; History:
;-------------------------------------------------------------------------------------
; 9-15-2000	Release	Rev 1.00
;================================================================================
; Applicability: F240,F241,C242,F243,F24xx.  (Peripheral Independent).
;================================================================================
; Routine Name: phase_voltage_calc                      Routine Type: C Callable
;  
;  C prototype : void phase_voltage_calc(struct PHASEVOLTAGE *p);
;
;        The struct object is defined in the header file "volt_cal.h" as follows:
;
;  	typedef struct 	{ int  DC_bus;		/* Input: DC-bus voltage (Q15) */ 
;					  int  Mfunc_V1;  	/* Input: Modulation voltage phase A (Q15) */ 
;				  	  int  Mfunc_V2;	/* Input: Modulation voltage phase B (Q15) */ 	
;				   	  int  Mfunc_V3;	/* Input: Modulation voltage phase C (Q15) */ 
;			  	  	  int  Vphase_A;	/* Output: Phase voltage phase A (Q15) */ 
;				   	  int  Vphase_B;	/* Output: Phase voltage phase B (Q15) */ 
;				  	  int  Vphase_C;	/* Output: Phase voltage phase C (Q15) */ 
;				  	  int  Vdirect;		/* Output: Stationary d-axis phase voltage (Q15) */ 
;				  	  int  Vquadra;  	/* Output: Stationary q-axis phase voltage (Q15) */
;  				  	  int  (*calc)();	/* Pointer to calculation function */ 
;					} PHASEVOLTAGE;	
;							 		 
;        Frame Usage Details:
;     step   |      a      |      b       |      c      |     d     
;____________|_____________|______________|_____________|_____________
;     FR0  	 | one_third   |    sqrt3inv  |             |     
;
;================================================================================
                .def        _phase_voltage_calc
;================================================================================
__phase_voltage_calc_framesize 	.set 0001h
;----------------------------------------------------------------------------------
out_of_phase_	.set	1			; set 1 for the out of phase correction if
									;  - Mfunc_V1 is out of phase with PWM1,
									;  - Mfunc_V2 is out of phase with PWM3,
									;  - Mfunc_V3 is out of phase with PWM5
									; otherwise, set 0 if their phases are correct. 
; Important!! Note that the default out_of_phase_ is 1, if it is neccessary to be changed, the 
; module library (e.g., clib_011.lib) must be rebuilt to take the effect.  
;================================================================================
_phase_voltage_calc:
 													; Assume now ARP=AR1
     	POPD	*+									; Keep return address
       	SAR  	AR0,*+								; Keep old frame pointer (FP)
       	SAR   	AR1,*								; Keep old stack pointer (SP)
       	LARK  	AR0,__phase_voltage_calc_framesize 	; Load AR0 with frame size	
       	LAR   	AR0,*0+,AR0							; AR0->FP0 (new FP), ARP=AR0

;================================================================================
		SBRK	#3		; ARP=AR0, AR0->FR0-3 (1st argument)		
;----------------------------------------------------------------------------------
		LAR		AR2,*	; ARP=AR0, AR0->DC_bus, AR2->DC_bus			
;----------------------------------------------------------------------------------
		ADRK	#3		; ARP=AR0, AR0->FR0, AR2->DC_bus 
;----------------------------------------------------------------------------------
		MAR		*,AR2  	; ARP=AR2, AR0->FR0, AR2->DC_bus 
;----------------------------------------------------------------------------------
		SETC	SXM		; Turn sign extension mode on
						; ARP=AR2, AR0->FR0, AR2->DC_bus 
;----------------------------------------------------------------------------------
		SETC	OVM		; Set overflow mode
						; ARP=AR2, AR0->FR0, AR2->DC_bus
;----------------------------------------------------------------------------------
 		SPM     0       ; Reset product mode
       					; ARP=AR2, AR0->FR0, AR2->DC_bus 
;---------------------------------------------------------------------------------- 		       	
       	.if (out_of_phase_) ; ARP=AR2, AR0->FR0, AR2->DC_bus
;---------------------------------------------------------------------------------- 		
		ADRK	#1		; ARP=AR2, AR0->FR0, AR2->Mfunc_V1
;---------------------------------------------------------------------------------- 
		LACC	*		; ACC = Mfunc_V1
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V1
;---------------------------------------------------------------------------------- 		
		NEG		        ; ACC = -Mfunc_V1   
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V1
;---------------------------------------------------------------------------------- 		
		SACL	*+		; Mfunc_V1 = -Mfunc_V1 (phase corrected)
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V2 
;---------------------------------------------------------------------------------- 		
		LACC	* 		; ACC = Mfunc_V2
		                ; ARP=AR2, AR0->FR0, AR2->Mfunc_V2
;---------------------------------------------------------------------------------- 
		NEG		        ; ACC = -Mfunc_V2   
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V2
;---------------------------------------------------------------------------------- 
		SACL	*+		; Mfunc_V2 = -Mfunc_V2 (phase corrected)
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V3  		
;---------------------------------------------------------------------------------- 
		LACC	*		; ACC = Mfunc_V3
		                ; ARP=AR2, AR0->FR0, AR2->Mfunc_V3	
;---------------------------------------------------------------------------------- 
		NEG		        ; ACC = -Mfunc_V3 
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V3
;---------------------------------------------------------------------------------- 		
		SACL	*		; Mfunc_V3 = -Mfunc_V3 (phase corrected)
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V3 	
;---------------------------------------------------------------------------------- 
		SBRK	#3		; ARP=AR2, AR0->FR0, AR2->DC_bus	
;---------------------------------------------------------------------------------- 
		.endif
;---------------------------------------------------------------------------------- 					
		LT		*+		; TREG = DC_bus
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V1
;----------------------------------------------------------------------------------
		MPY		*		; PREG = DC_bus*Mfunc_V1
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V1
;----------------------------------------------------------------------------------
		PAC				; ACC = DC_bus*Mfunc_V1
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V1 
;----------------------------------------------------------------------------------
		SACH	*+,1	; Mfunc_V1 = DC_bus*Mfunc_V1
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V2 
;----------------------------------------------------------------------------------
		MPY		*		; PREG = DC_bus*Mfunc_V2
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V2
;----------------------------------------------------------------------------------
		PAC				; ACC = DC_bus*Mfunc_V2
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V2 
;----------------------------------------------------------------------------------
		SACH	*+,1	; Mfunc_V2 = DC_bus*Mfunc_V2
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V3 
;----------------------------------------------------------------------------------
		MPY		*		; PREG = DC_bus*Mfunc_V3
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V3
;----------------------------------------------------------------------------------
		PAC				; ACC = DC_bus*Mfunc_V3
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V3 
;----------------------------------------------------------------------------------
		SACH	*-,1	; Mfunc_V3 = DC_bus*Mfunc_V3
						; ARP=AR2, AR0->FR0, AR2->Mfunc_V2
;----------------------------------------------------------------------------------
		MAR		*-,AR0	; ARP=AR2, AR0->FR0, AR2->Mfunc_V1, ARP=AR0 

⌨️ 快捷键说明

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