📄 f2407qep.h
字号:
/* ==================================================================================
File name: F2407QEP.H
Originator: Digital Control Systems Group
Texas Instruments
Description:
This file defines handy constants for register initializations
contains prototypes for the functions in F2407QEP1.C,
and has definitions of structs etc.
=====================================================================================
History:
-------------------------------------------------------------------------------------
09-15-2000 Release Rev 1.00
04-04-2001 Release Rev 1.10
---------------------------------------------------------------------------------- */
#ifndef __F2407QEP_H__
#define __F2407QEP_H__
#include <F2407BMSK.H>
/*------------------------------------------------------------------------------
Initialization states for T2CON and CAPCON
------------------------------------------------------------------------------*/
#define CAP_INIT_STATE 0xF004
#define TIMER_INIT_STATE (FREE_RUN_FLAG + \
TIMER_DIR_UPDN + \
TIMER_CLK_PRESCALE_X_1 + \
TIMER_ENABLE_BY_OWN + \
TIMER_ENABLE + \
TIMER_CLOCK_SRC_QEP + \
TIMER_COMPARE_LD_ON_ZERO)
/*-----------------------------------------------------------------------------
Define the structure of the QEP (Quadrature Encoder) Driver Object
-----------------------------------------------------------------------------*/
typedef struct {int dir_QEP; /* Output: Motor rotation direction (Q0) */
int cal_angle; /* Parameter: Encoder offset calibration (Q0) */
int theta_raw; /* Variable: Raw angle of timer value (Q0) */
int mech_scale; /* Parameter: Scaling factor for raw angle Q0->Q15 */
int theta_mech; /* Output: Motor Mechanical Angle (Q15) */
int polepairs; /* Parameter: No. of poles/2 of the motor (Q0) */
int theta_elec; /* Output: Motor Electrical Angle (Q15) */
int QEP_cnt_idx; /* Variable: Pulses count on encoder at index (Q0) */
int index_sync_flg; /* Output: Index sync status (Q0) */
int (*calc)(); /* Pointer to the calc funtion */
int (*init)(); /* Pointer to the init funcion */
int (*indexevent)(); /* Pointer to index event handler */
} QEP ;
/*-----------------------------------------------------------------------------
Prototypes for the functions in F2407QEP1.C and F2407QEP2.ASM
-----------------------------------------------------------------------------*/
int F2407_EV1_QEP_Init(QEP *);
int F2407_EV1_qep_theta_calc(QEP *);
int F2407_EV1_QEP_Index_Handle(QEP *);
/*-----------------------------------------------------------------------------
Default initializer for the QEP Object.
-----------------------------------------------------------------------------*/
/* -489 */
#define QEP_DEFAULTS { 0x0,-2365,0x0,16776,0x0,2,0x0,0x0,0x0, \
(int (*)(int))F2407_EV1_qep_theta_calc, \
(int (*)(int))F2407_EV1_QEP_Init, \
(int (*)(int))F2407_EV1_QEP_Index_Handle }
/*-----------------------------------------------------------------------------
Default initializer for the QEP Object for a 4000 line encoder.
-----------------------------------------------------------------------------*/
#define QEP_4000 { 0x0, 0x0,0x0,16384,0x0,2,0x0,0x0, \
(int (*)(int))F2407_EV1_qep_theta_calc, \
(int (*)(int))F2407_EV1_QEP_Init, \
(int (*)(int))F2407_EV1_QEP_Index_Handle }
#endif /* __F2407QEP_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -