?? bldc_ti.h
字號:
/* ==============================================================================
System Name: BLDC3_2
File Name: BLDC_TI.H
Description: Header file for Peripheral independent object for the
implementation of current controller for a three phase
brushless DC Motor.
Originator: Digital control systems Group - Texas Instruments
Target dependency: x240/1/2/3/07
To Select the target device see target.h file.
=====================================================================================
History:
-------------------------------------------------------------------------------------
9-15-2000 Release Rev 1.0
================================================================================= */
#ifndef __BLDC_TI_H__
#define __BLDC_TI_H__
#include <TARGET.H>
#include <mod6.h>
#include <pid2.h>
#include <impl.h>
#include <rmp2.h>
#include <rmp3.h>
#include <cmtn.h>
#ifndef TRUE
#define FALSE 0
#define TRUE 1
#endif
/*------------------------------------------------------------------------------
Define the structure of the BLDC Object. This object has all the data necessary
for one instance of a BLDC_TI algorithm.
------------------------------------------------------------------------------*/
typedef struct {
/*------------------------------------------------------------------------------
Declarations for the 'terminal variables' for the BLDC Algorithm. The framework
should communicate such quantities as current_set etc to the algorithm by
modifying these terminal variables. It is not recommended that the framework
directly modify the internal varibles of the algorithm.
------------------------------------------------------------------------------*/
int cmtn_period_target;
int cmtn_period_setpt;
int ramp_delay;
int I_loop_flg;
int D_func_desired;
int sp_up_done_flg;
int current_set;
int align_flag;
/*------------------------------------------------------------------------------
Declaration of Periodic Impulse Generator module The defaults are set in
IMPULSE.H
------------------------------------------------------------------------------*/
IMPULSE impl;
/*------------------------------------------------------------------------------
Declaration of Modulo 6 counter module The defaults are set in
MOD6.H
------------------------------------------------------------------------------*/
MOD6CNT mod6;
/*------------------------------------------------------------------------------
Declaration of Ramp3 control module The defaults are set in
RMP3.H
------------------------------------------------------------------------------*/
RMP3 rmp3;
/*------------------------------------------------------------------------------
Declaration of Commutation trigger module The defaults are set in
CMTN.H
------------------------------------------------------------------------------*/
CMTN cmtn;
/*------------------------------------------------------------------------------
Declaration of pid regulator2 module The defaults are set in
PID2.H
------------------------------------------------------------------------------*/
PID2 pid2;
/*------------------------------------------------------------------------------
Declaration of Ramp2 control module The defaults are set in
RMP2.H
------------------------------------------------------------------------------*/
RMP2 rmp2;
} BLDC_TI;
typedef BLDC_TI *BLDC_TI_handle;
/*------------------------------------------------------------------------------
Motor types
------------------------------------------------------------------------------*/
#define WJW 0x0001
#define KVB 0x0002
#define AUB 0x0003
#define ADS 0x0004
#define MOTOR KVB
/*------------------------------------------------------------------------------
Motor dependent parameters
------------------------------------------------------------------------------*/
#if (MOTOR == WJW )
#define ALIGN_DUTY 0X1500
/* For open loop speed ramp control */
#define CMTN_PERIOD_TARGET_VALUE 0x0300 /* Final ramp speed */
#define CMTN_PERIOD_SETPT_VALUE 0x0500 /* Initialize ramp starting point */
#define RAMP_DELAY_VALUE 0x0190 /* Set ramp rate */
/* For open loop D_func control */
#define I_LOOP_FLG_VALUE 0x0000 /* Start with open loop current */
#define D_FUNC_DESIRED_VALUE ALIGN_DUTY /* Set PWM duty cycle */
#endif /*( MOTOR == WJW */
#if (MOTOR == KVB )
#define ALIGN_DUTY 0X0C00
/* For open loop speed ramp control */
#define CMTN_PERIOD_TARGET_VALUE 0x0200 /* Final ramp speed */
#define CMTN_PERIOD_SETPT_VALUE 0x0500 /* Initialize ramp starting point */
#define RAMP_DELAY_VALUE 0x0190 /* Set ramp rate */
/* For open loop D_func control */
#define I_LOOP_FLG_VALUE 0x0000 /* Start with open loop current */
#define D_FUNC_DESIRED_VALUE ALIGN_DUTY /* Set PWM duty cycle */
#endif /*( MOTOR == KVB */
#if (MOTOR == AUB )
#define ALIGN_DUTY 0X0F00
/* For open loop speed ramp control */
#define CMTN_PERIOD_TARGET_VALUE 0x0200 /* Final ramp speed */
#define CMTN_PERIOD_SETPT_VALUE 0x0500 /* Initialize ramp starting point */
#define RAMP_DELAY_VALUE 0x0190 /* Set ramp rate */
/* For open loop D_func control */
#define I_LOOP_FLG_VALUE 0x0000 /* Start with open loop current */
#define D_FUNC_DESIRED_VALUE ALIGN_DUTY /* Set PWM duty cycle */
#endif /*( MOTOR == AUB */
#if (MOTOR == ADS )
#define ALIGN_DUTY 0X0F00
/* For open loop speed ramp control */
#define CMTN_PERIOD_TARGET_VALUE 0x0300 /* Final commutation period */
#define CMTN_PERIOD_SETPT_VALUE 0x0500 /* Initial commutation period */
#if (TARGET == F243)
#define RAMP_DELAY_VALUE 0x00C8 /* Set ramp rate */
#endif
#if (TARGET == F2407)
#define RAMP_DELAY_VALUE 0x03E8 /* Set ramp rate */
#endif
/* For open loop D_func control */
#define I_LOOP_FLG_VALUE 0x0000 /* Start with open loop current */
#define D_FUNC_DESIRED_VALUE ALIGN_DUTY
#endif /*( MOTOR == ADS */
/*------------------------------------------------------------------------------
Other parameters
------------------------------------------------------------------------------*/
#define SP_UP_DONE_FLG_VALUE 0x0000
#define CURRENT_SET_VALUE 0x0065
#define ALIGN_FLAG_VALUE 0x000F
#define BLDC_TI_INITVALS \
{ \
CMTN_PERIOD_TARGET_VALUE, \
CMTN_PERIOD_SETPT_VALUE, \
RAMP_DELAY_VALUE, \
I_LOOP_FLG_VALUE, \
D_FUNC_DESIRED_VALUE, \
SP_UP_DONE_FLG_VALUE, \
CURRENT_SET_VALUE, \
ALIGN_FLAG_VALUE, \
IMPULSE_DEFAULTS, \
MOD6CNT_DEFAULTS, \
RMP3_DEFAULTS, \
CMTN_DEFAULTS, \
PID2_DEFAULTS, \
RMP2_DEFAULTS \
}
/*------------------------------------------------------------------------------
Prototypes for functions implemented in BLDC_TI.C
------------------------------------------------------------------------------*/
void BLDC_TI_Init(BLDC_TI_handle);
void BLDC_TI_Run(BLDC_TI_handle);
#endif /* __BLDC_TI_H__ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -