en_drive.asm

来自「TI公司24X系列DSP控制永磁同步电机PMSM」· 汇编 代码 · 共 79 行

ASM
79
字号
********************************************************************
** File Name	: en_drive.asm						**
** Mudule names	: en_drive, dis_drive					**
** Initialization routine: drive_init					**
** Originator	: DSP Digital Control Systems Group			**
**			  Texas Instruments					**
** Description	: This program configures the I/O pins and 	**
**			  enables and disables the drive			**
** Target		: 'X24x/'X24xx, DMC1500/1000				**
**			  ('240 portion to be completed in the future)	**
********************************************************************

;=====================================================================================
; History:
;-------------------------------------------------------------------------------------
; 9-15-2000	Release	Rev 1.00


;*****************************************************
; Define Peripherals
;*****************************************************
		.include	"x24x_app.h"

;*****************************************************
; Global References and Definitions
;*****************************************************
		.def	EN_DRIVE		;
		.def	DIS_DRIVE		;
		.def	DRIVE_INIT		;

		.text
;******************************************************
; Start of main body of code
;******************************************************
DRIVE_INIT
		.if x240
		; IOPB3: strobe_; IOPB6: enable_
		;x240 code
		.endif
		.if x243|x2407
		; IOPB4: strobe_; IOPB6: enable_
		ldp	#OCRA>>7		;
		lacc	OCRA			;
		and	#0afffH		; config IOPB4&6 as IO
		sacl	OCRA			;
		lacc	PBDATDIR		;
		or	#05050h 		; config IOPB4 & IOPB6 as Outputs
		sacl	PBDATDIR		; and output "1" to disable drive
		.endif
		ret

EN_DRIVE
		.if x240
		;x240 code
		.endif
		.if x243|x2407
		ldp	#PBDATDIR>>7
		lacc	PBDATDIR		; Get Port B
		and	#0ffefh 		; IOPB4 low
		sacl	PBDATDIR		;
		or	#00010h 		; IOPB4 high
		sacl	PBDATDIR		;
		and	#0ffbfh 		; IOPB6 low
		sacl	PBDATDIR		;
		.endif
		ret

DIS_DRIVE
		.if x240
		;x240 code
		.endif
		.if x243|x2407
		ldp	#PBDATDIR>>7	;
		lacc	PBDATDIR		; Get Port B
		or	#05050h 		; IOPB4 & IOPB6 Output "1"
		sacl	PBDATDIR		;
		.endif
		ret

⌨️ 快捷键说明

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