📄 f243bldcpwm2.asm
字号:
;=====================================================================================================================
; File name: F243BLDCPWM2.ASM
;
; Originator: Digital Control Systems Group
; Texas Instruments
; Description:
; This file contains source for the Full Compare PWM drivers for the F243
; Applicability of these functions is indicated in the Table 1
;=====================================================================================
; History:
;-------------------------------------------------------------------------------------
; 9-15-2000 Release Rev 1.0
;================================================================================
; T A B L E 1
;================================================================================
; Function Name | Applicability
;================================================================================
; | F240 | F241| F243 | LF2402 | LF2406 | LF2407
; | | | | | |
; F243_BLDC_PWM_Update | Y | Y | Y | | |
;================================================================================
;================================================================================
; Routine Name: PWM Update Routine Routine Type: C Callable
;
; Description:
;
; C prototype : int F243_BLDC_PWM_Update(PWMGEN *p)
;================================================================================
; History: Created August 22, 2000
;
; Definition of the argument structure.
; typedef struct {
; int cmtn_ptr_bd;
; int mfunc_p ;
; int period_max;
; int d_func ;
; int (*init)();
; int (*update)();
; } PWMGEN;
;
;================================================================================
.include ..\include\x24x.h
POINT_EV .macro
LDP #0E8h
.endm
ACTIVE_HI .set 1 ;Select ACTIVE_HI or ACTIVE_LO by setting
ACTIVE_LO .set 0 ;the corresponding parameter to 1. Set the other
;parameter to 0.
;This setting depends on Power devices. ACTIVE_HI implies the power device turns
;ON with a HIGH gate signal. ACTIVE_LO implies the power device turns
;ON with a LOW gate signal. This polarity definition is not the same as the PWM
;polarity(Active High/Active Low) defined by the ACTR
;register in x24x/x24xx. The setting chosen here is applicable only when ACTR
;is configured to generate Active High PWM.
MAXPERIOD .set 7fffh
;================================================================================
; Frame Usage Details:
; | a
;____________|______________________________________
; FR0 | |
; FR1 | (1) temp_var1, (2) period |
; FR2 | temp_var2 |
;================================================================================
.def _F243_BLDC_PWM_Update
;================================================================================
_F243_BLDC_PWM_Update:
;--------------------------------------------------------------------------
__F243_BLDC_PWM_Update_framesize .set 0003h
;================================================================================
; ARP=AR1
; AR1 is stack pointer (SP)
; AR0 is frame pointer (FP)
POPD *+ ; Save the return address from hardware
; stack into the software stack
; ARP = AR1
SAR AR0,*+ ; Push AR0(FP).ARP = AR1
SAR AR1,* ; *SP = SP.ARP = AR1.
LAR AR0, #__F243_BLDC_PWM_Update_framesize
; AR0 = size of frame. ARP = AR1
LAR AR0,*0+,AR2
; Allocate frame. ARP = AR2.
; AR0 = AR1 + AR0.
; AR1 is the Stack Pointer (SP)
; AR0 is the Frame Pointer (FP)
;================================================================================
LAR AR2,#-3 ; AR2 = -3.
; ARP = AR2.
;-------------------------------------------------------------------------------
MAR *0+ ; AR2 = AR0 - 3. AR2 -> passed parameter
;(i.e. pointer to PWMGEN structure).
; ARP = AR2.
;--------------------------------------------------------------------------------
LAR AR3,*,AR3
; AR3 points to the first structure member.
; (i.e. AR3 -> cmtn_ptr_bd).
; ARP = AR3.
;--------------------------------------------------------------------------
LACC #_COMMUTATION_TBL
; Accumulator = COMMUTATION_TBL.
; ARP = AR3. AR3 -> cmtn_ptr_bd.
;--------------------------------------------------------------------------
ADD *+,AR2 ; Accumulator = Accumulator + cmtn_ptr_bd.
; AR3 -> mfunc_p.
; ARP = AR2.
;--------------------------------------------------------------------------
LAR AR2,#1 ; AR2 = 1.
; AR3 -> mfunc_p.
; ARP = AR2.
;--------------------------------------------------------------------------
MAR *0+ ; AR2 = AR0 + 1.
; AR2-> FR1(i.e. temp_var1).
; AR3 -> mfunc_p.
; ARP = AR2
;--------------------------------------------------------------------------
TBLR * ; Load program address in data memory.
; ARP = AR2.
; AR2-> FR1(i.e. temp_var1).
; AR3 -> mfunc_p.
;--------------------------------------------------------------------------
LACC *,AR3 ; Load state address in accumulator.
; ARP = AR3. AR3 -> mfunc_p.
; AR2-> FR1(scope of temp_var1 is over).
;--------------------------------------------------------------------------
BACC ; Branch to the state specified
; by accimulator.
; ARP = AR3. AR3 -> mfunc_p.
; AR2-> FR1.
;================================================================================
__PWM_state_anb: ; Input current path Phase A
POINT_EV ; Output Current Path Phase B
SPLK #00C2h,ACTR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -