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

📄 rmp_cntl.asm.txt

📁 此源码事有关DSP编程用的
💻 TXT
字号:
;=====================================================================
; Filename	:	RMP_CNTL.asm
; Module Name	: 	RAMP_CNTL
; Initialization Routine: RAMP_CNTL_INIT
; Description	:	This module implements a ramp up and ramp down function. 
;					The output flag variable s_eq_t_flg is set to 7FFFh when 
;					the output variable setpt_value equals the input variable 
;					target_value.
;
;							|~~~~~~~~~~~~~~~|
; target_value o------->	|				|----->o  setpt_value
;    						|   RAMP_CNTL	|
; 						|				|----->o  s_eq_t_flg
;							|______________	|
;=====================================================================
;(To use this Module, copy this section to main system file)
;		.ref	RAMP_CNTL, RAMP_CNTL_INIT		; function call
;		.ref	target_value 					; Inputs
;		.ref	setpt_value, s_eq_t_flg			; Outputs
;=====================================================================
;Module definitions for external reference.
		.def	RAMP_CNTL, RAMP_CNTL_INIT		; function call
		.def	target_value 					; Inputs
		.def	setpt_value, s_eq_t_flg			; Outputs
;===========================================================================
UPPER_LIMIT	.set	7500h
LOWER_LIMIT	.set	300h

RMP_DLY_MAX	.set	30			;30x100uS = 1.500 uS between steps.

target_value		.usect "rmp_cntl",1
setpt_value		.usect "rmp_cntl",1
s_eq_t_flg		.usect "rmp_cntl",1
rmp_delay_cntr	.usect "rmp_cntl",1


RAMP_CNTL_INIT:
		LDP		#setpt_value
		SPLK	#0h,setpt_value
		SPLK	#0h,rmp_delay_cntr
		RET

RAMP_CNTL:
		LDP		#target_value
		LACC	target_value
		SUB		setpt_value
		BCND	SET_FLG, EQ			; If Set point = target 
									; set s_eq_t_flg = 7FFFh then exit
		LACC	rmp_delay_cntr
		ADD		#1
		SACL	rmp_delay_cntr
		SUB		#RMP_DLY_MAX
		BCND	SRC_EXIT, LT

CHNG_VALUE:
		LACC	target_value
		SUB		setpt_value
		BCND	INC_VALUE, GT

DEC_VALUE	
LACC	setpt_value
		SUB		#1
		SACL	setpt_value
		SUB		#LOWER_LIMIT
		BCND	SRC_1, GEQ
		SPLK	#LOWER_LIMIT, setpt_value
		B		SRC_1

INC_VALUE	
LACC	setpt_value	   			;If max then Inc Frequency
		ADD		#1
		SACL	setpt_value
		SUB		#UPPER_LIMIT
		BCND	SRC_1, LEQ
		SPLK	#UPPER_LIMIT, setpt_value
SRC_1:
		SPLK	#0, rmp_delay_cntr

SRC_EXIT
		RET

SET_FLG
		SPLK	#7FFFh, s_eq_t_flg
		RET

⌨️ 快捷键说明

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