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

📄 pi.h

📁 本程序为ad的dsp21990控制芯片程序,其功能是通过传统的PI控制算法来实现对电源的控制,控制程序可以采用.asm也可以采用.C。程序的具体算法和介绍在软件压缩
💻 H
字号:
/***************************************************************************************
*                                                                                      *
* Library: PI Control                            *
*                                                                                      *
* File: pi.h                                                                       *
*                                                                                      *
* Description: PI include file                                                     *
* Purpose    : PI Control Routines             *
*                                                                                      *
* Author     : JC                                                                      *
* Version    : 1.0                                                                     *
* Date       : Dec 2001                                                            *
* Modification History:    None                                                        *
*                                                                                      *
* Embedded Control Systems                                                             *
* Analog Devices Inc.                                                                  *
***************************************************************************************/

/***************************************************************************************
*                                                                                      *
* Constants that need to be defined in main.h:                                         *
*                                                                                      *
* None																	        *
***************************************************************************************/

/***************************************************************************************
*                                                                                      *
* Other Libraries Required by this code:                                             *
*                                                                                      *
* None                                                                                 *
***************************************************************************************/

#ifndef PI_INCLUDED
#define PI_INCLUDED

/***************************************************************************************
* Routines Defined  in this code                                                     *
***************************************************************************************/
.extern PI32_Ctrl_; 


/***************************************************************************************
* Global Variables Defined                                               *
***************************************************************************************/

/* None */

/***************************************************************************************
*                                                                                      *
* Type:  Macro                                                                        *
*                                                                                      *
* Call: PI32_Init(Delay_line, Initial_value);                                            *
*                                                                                      *
* Sets the initial value of the integrator (resets PI if initial_value is zero)    *
*                                                                                      *
* Inputs  :   	Delay_line: Delay line buffer                        *
* 				Initial_value: Initial value of integrator in 1.15                        *
*                                                                                      *
* Ouputs  :	None                                                                   *
*                                                                                      *
* Modified:	I3, L3, ar, B3, M3				                                          *
*                                                                                      *
***************************************************************************************/
#define PI32_Init(Delay_line, Initial_value) \
	I3=Delay_line;			/*buffer's base address*/\
	L3=length(Delay_line);	/*buffer's length*/\
	ar=I3;					/*load address to data register*/\
	REG(B3)=ar;\
	M3=1;					/*post modify I3 by 1*/\
	ar=pass 0;\
	DM(I3,M3)=ar;\
	ar=Initial_value;\
	DM(I3,M3)=ar;\
	ar=pass 0;\
	DM(I3,M3)=ar


/***************************************************************************************
*                                                                                      *
* Type:  Macro                                                                        *
*                                                                                      *
* Call: PI32(Delay_line,Coefficients, Scale_Shift);                                            *
*                                                                                      *
* Calculates the current output of the PI from the input error 
* The integrator consitis of 16 bits
*                                                                                      *
* Inputs  :   	Delay_line: Delay line buffer  
*				Coefficients: Coefficient buffer
* 				Scale factor: number of shifts to the left in the barrel shifter
*				ar: input error value in 1.15 format
*                                                                                      *
* Ouputs  :	sr1: Output value in 1.15 format                                                                   *
*                                                                                      *
* Modified:	I3, L3, ax0, B3, M3, I7, L7, ay0, mx1, mx0, mr1, mr0, ar, se, sr, my0				                                          *
*                                                                                      *
***************************************************************************************/
#define PI32(Delay_line, Coefficients, Scale_Shift)\
	I3=Delay_line;			/*buffer's base address*/\
	L3=length(Delay_line);	/*buffer's length*/\
	ax0=I3;					/*load address to data register*/\
	REG(B3)=ax0;\
	M3=1;					/*post modify I3 by 1*/\
	I7=Coefficients;\
	L7=length(Coefficients);\
	ax0=I7;\
	REG(B7)=ax0;\
	M7=1;\
	ay0=Scale_Shift;\
	call PI32_Ctrl_
#endif

⌨️ 快捷键说明

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