📄 drive2.asm
字号:
;=====================================================================================================================
; File name: DRIVE2.ASM
;
; Originator: Digital Control Systems Group
; Texas Instruments
; Description:
; This file contains source for the implementing the gate enable and
; disable of PWM signals on DMC1500 inverter.
;=====================================================================================
; History:
;-------------------------------------------------------------------------------------
; 04-09-2001 Release Rev 1.0
;================================================================================
; Applicability: F240x/F243. (Peripheral dependant).
;
;================================================================================
; Routine Name: F24xx_drive_drv_calc Routine Type: C Callable
;
; Description:
;
; C prototype : int F24xx_drive_drv_calc(DRIVE *p)
;================================================================================
; Definition of the DRIVE structure is as follows:
;
;typedef struct { int enable_flg; /* Input: Enable drive flag: 1=enable, 0=disable */
; int (*init)(); /* Pointer to the init function */
; int (*calc)(); /* Pointer to the calc function */
; } DRIVE;
;
;================================================================================
.include ..\include\x240x.h
;================================================================================
.def _F24xx_drive_drv_calc
;================================================================================
__F24xx_drive_drv_calc_framesize .set 0001h
;================================================================================
_F24xx_drive_drv_calc:
POPD *+ ; Keep return address
SAR AR0,*+ ; Keep old frame pointer (FP)
SAR AR1,* ; Keep old stack pointer (SP)
LARK AR0,__F24xx_drive_drv_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->enable_flg, AR2->enable_flg
;--------------------------------------------------------------------------------
ADRK #3 ; ARP=AR0, AR0->FR0, AR2->enable_flg
;--------------------------------------------------------------------------------
MAR *,AR2 ; ARP=AR2, AR0->FR0, AR2->enable_flg
;----------------------------------------------------------------------------------
SETC SXM ; Turn sign extension mode on
; ARP=AR2, AR0->FR0, AR2->enable_flg
;--------------------------------------------------------------------------------
LACC *,AR3 ; ACC = enable_flg
; ARP=AR2, AR0->FR0, AR2->enable_flg, ARP=AR3
;--------------------------------------------------------------------------------
BCND ENABLE_DRIVE,NEQ ; Branch to ENABLE_DRIVE if enable_flg != 0
; ARP=AR3, AR0->FR0, AR2->enable_flg
;--------------------------------------------------------------------------------
DISABLE_DRIVE ; ARP=AR3, AR0->FR0, AR2->enable_flg
;--------------------------------------------------------------------------------
LAR AR3,#PBDATDIR ; Point AR3 to PBDATDIR
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
LACC * ; ACC = (PBDATDIR)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
OR #05050h ; ACC = (PBDATDIR) | 05050h
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
SACL *,AR1 ; PBDATDIR = PBDATDIR | 05050h
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR, ARP=AR1
;--------------------------------------------------------------------------------
B DRIVE_END ; ARP=AR1, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
ENABLE_DRIVE ; ARP=AR3, AR0->FR0, AR2->enable_flg
;--------------------------------------------------------------------------------
LAR AR3,#PBDATDIR ; Point AR3 to PBDATDIR
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
LACC * ; ACC = (PBDATDIR)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
AND #0FFEFh ; ACC = (PBDATDIR) & 0FFEFh (IOPB4 low)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
SACL * ; PBDATDIR = PBDATDIR & 0FFEFh (IOPB4 low)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
OR #00010h ; ACC = (PBDATDIR) | 0010h (IOPB4 high)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
SACL * ; PBDATDIR = PBDATDIR | 0010h (IOPB4 high)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
AND #0FFBFh ; ACC = (PBDATDIR) & 0FFBFh (IOPB6 low)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
SACL *,AR1 ; PBDATDIR = PBDATDIR & 0FFBFh (IOPB6 low)
; ARP=AR3, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR, ARP=AR1
;--------------------------------------------------------------------------------
DRIVE_END ; ARP=AR1, AR0->FR0, AR2->enable_flg, AR3->PBDATDIR
;--------------------------------------------------------------------------------
_F24xx_drive_drv_calc_end:
;;MAR *,AR1 ; can be removed if this condition is met on
;; ; every path to this code. (i.e., ARP=AR1 here)
SBRK #(__F24xx_drive_drv_calc_framesize+1)
LAR AR0,*-
PSHD *
RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -