📄 com_def.h
字号:
/****************************************************************************/
/* */
/* constant definition */
/* */
/****************************************************************************/
/* motor */
/* control cycle */
#define CTRL_TS 6710 /* 1/car_freq * 2^25 */
/* A-D conversion ratio */
#define K_WR_AD_REF 10053 /* rotation A-D conversion ratio */ /* 2.45436926061703 12 */
#define Sft_WR_AD_REF 11
#define K_VDC_AD_V 11051 /* bus voltage A-D conversion ratio */ /* 0.67451171875 14 */
#define Sft_VDC_AD_V 9
/* start-up control */
#ifndef EXTINT4kHz_2 // houfei 2006-8-22 15:38
#define KIDO_Hz 104 //314 /* 12.5 rps */
#else
#define KIDO_Hz 209/*For EXTinterrupt*///314//262//209//419// /* start-up rotation */ /* 209.43951023932 1 */
#endif
#define Sft_KIDO_MODE1 15
#define KIDO_MODE1_TIME 1160 /* start-up time 1 */
/* phase angle definition */
#define THETA_15DEG 12
#define THETA_60DEG 2145 /* 60 degrees */ /* 1.0471975511966 11 */
#define THETA_360DEG 12868 /* 360 degrees */ /* 6.28318530717959 11 */
/* encorder speed conversion */
#define CNT_WR_ACT_4K 8 /* encoder frequency calculation cycle */ /* 8 0 */
#define CNT_WR_ACT_20K 4000
/* interrupt vector */
#define TB2_INT_VEC 28 /* TB2 interrupt vector No. */
/* bus voltage */
#define VDC_MAX 12800 /* maximum bus voltage */ /* 400 5 */
#define VDC_MIN 320 /* minimum bus voltage */ /* 10 5 */
#define K_VDC_INV 8388608 /* 2 22 */
/* other */
//#define F20MHz
#ifdef F20MHz
#define CARR_CNT_4K 4000
#else
#define CARR_CNT_4K 3200 //4000//3200 //4000 //5000//4000//800//1000 /* 1000 0 */
//#define CARR_CNT_20K 1000 /* 1000 0 */
#endif
/* moter control */
#define STOP_MODE 0 /* stop */
#define BOOTSTRAP_MODE 1
#define START_MODE 2 /* position mode */
#define KIDO_MODE 3 /* in operation */
#define TUJO_MODE 4 /* normal */
/* for trapezoidal wave control only */
#define INI_VOLT_120 2097152 /* trapezoidal wave start-up voltage */ /* 8 18 */
#ifdef EXTINT4kHz_2
#define INI_DUTY_120 650*2*2//330//350//300//250//1147 /* trapezoidal wave start-up DUTY */ /* 0.14 13 */
#endif
#ifdef SMPL_20kHz
#ifdef HITACHI
#define INI_DUTY_120 600*2*2
#endif
#ifdef TOSHIBA // houfei 2006-8-22 15:40
#define INI_DUTY_120 300*2*2//450*2*2//550*2*2
#endif
#ifdef SANYO
#define INI_DUTY_120 500*2*2 //--15A // 400*2*2 --20A ( 550*2*2------370*2*2 )
#endif
#endif
#define BOOTSTRAPDUTY 819*2*2//8192*2 * 10%
#define DLT_DUTY_120 8 /* DUTY for trapezoidal wave */ /* 0.001 13 */
#define Sft_DUTY_120_TIME 14+1 //+ 2
#define MAX_DUTY_120 7372*2*2 /* MAX DUTY for trapezoidal wave */ /* 7782 0.95 13 */ /*7472*2*2//*/
#define MIN_DUTY_120 82 *2 *2 /* MIN DUTY for trapezoidal wave */ /* 0.01 13 */
#define K_WR_ACT_120SL 251327 /* calculation coefficient for sensorless trapezoidal wave rotation */ /* 125663.706143592 1 */
/* main cycle */
#define MAIN_TIME 16 /* main cycle */ /* 16 0 */
/* output active */
#ifdef CHANGHONG
#define SET_ACTIVE 0x10 //0x00 /* output active */ /* 1 4 */
#endif
#ifdef RSBJ
#define SET_ACTIVE 0x00
#endif
/* motor lock detection */
#define E_MOT_LOCK_TIME 250 /* motor lock detection */ /* 250 0 */
#define RPM500_60DGREE_4K (0x444) /* 4kHz carfreq*/
#define RPM500_60DGREE_20K (3333)//(10000)(0x7fff) /* 20kHz carfreq(0x1544) */
#define POLESNUM (2)
#define RPMTORADFAC (6863) /* 2*PI/60 16 */
#define UP_PWM_DUTY (3062 - 900) /* to improve torque at high speed > 3000rpm */
#define INIperiod (( K_WR_ACT_120SL/ KIDO_Hz ) >> 1)
#ifdef EXTINT4kHz_2
#define NOPOSITION (0)
#define DEMAGNETIC (1)
#define COMMUTATION (2)
#ifndef F20MHz
#define K_WR_ACT (6283185) //2*2*PI*16000000/32
#else
#define K_WR_ACT (7853982) //2*2*PI*20000000/32
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -