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

📄 rmp3cntl.asm

📁 无刷直流电机的无传感器控制TI程序
💻 ASM
字号:
;===========================================================================
; File Name:	rmp3cntl.asm
;
; Module Name: 	RMP3CNTL				  
;
; Initialization Routine: RMP3CNTL_INIT
;
; Originator:	Digital Control Systems Group
;			Texas Instruments
;
; Description:	This module implements a ramp down function. The output
;		flag variable rmp3_done_flg is set to 7FFFh when the output 
;		variable rmp3_out equals the input variable rmp3_desired.
;
;				|~~~~~~~~~~~~~~~~~|
;  				|		  |
;  rmp3_desired  o----------- ->| RMP3CNTL        |----->o rmp3_out
;				|		  |----->o rmp3_done_flg
;				|_________________|	
;
;
;
;
;=====================================================================================
; History:
;-------------------------------------------------------------------------------------
; 9-15-2000	Release Rev 1.0	
;===========================================================================
;(To use this Module, copy this section to main system file)
;		.ref	RMP3CNTL, RMP3CNTL_INIT			;function call
;		.ref	rmp3_desired, rmp3_dly			;Inputs
;		.ref	rmp3_out, rmp3_done_flg			;Outputs
;		.ref	rmp3_min
;===========================================================================
;Module definitions for external reference.
		.def	RMP3CNTL, RMP3CNTL_INIT			;function call
		.def	rmp3_desired, rmp3_dly			;Inputs
		.def	rmp3_out, rmp3_done_flg			;Outputs
		.def	rmp3_min
;===========================================================================
		.include	x24x_app.h
;===========================================================================
;Variable Definitions for rmp3cntl module
;---------------------------------------------------------------------------

rmp3_min	.usect	"rmp3cntl",1	;Min ramp output
rmp3_delay_cntr	.usect	"rmp3cntl",1	;Counter for ramp3 delay 
rmp3_dly	.usect	"rmp3cntl",1	;Ramp3 delay expressed in number of
					;system sampling time period.
rmp3_desired	.usect	"rmp3cntl",1	;Desired ramp input for ramp3
rmp3_out	.usect	"rmp3cntl",1	;Ramp3 output
rmp3_done_flg	.usect	"rmp3cntl",1	;Ramp3 done flag


;======================================================================
RMP3CNTL_INIT:
;======================================================================
		LDP	#rmp3_out
		SPLK	#0h, rmp3_delay_cntr
		SPLK	#0h, rmp3_done_flg 
		SPLK	#50h, rmp3_min		;Default min for rmp3         
		RET

;======================================================================
RMP3CNTL:
;======================================================================
		LDP	#rmp3_out
		LACC	rmp3_desired
		SUB	rmp3_out
		BCND	SET_RMP3_FLG, EQ	;If Set point = target 
						;set rmp3_done_flg = 7FFFh then exit
		LACC	rmp3_delay_cntr
		ADD	#1
		SACL	rmp3_delay_cntr
		SUB	rmp3_dly		
		BCND	SRC_EXIT, LT   
		

dec_rmp3	LACC	rmp3_out 	
		SUB	#1
		SACL	rmp3_out
		SUB	rmp3_min
		BCND	SRC_1, GEQ
		LACC	rmp3_min
		SACL	rmp3_out
SRC_1:
		SPLK	#0, rmp3_delay_cntr

SRC_EXIT
		RET

SET_RMP3_FLG
		SPLK	#7FFFh, rmp3_done_flg
		RET    



⌨️ 快捷键说明

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