📄 f28xqep.h
字号:
/* ==================================================================================
File name: F28XQEP.H
Originator: Digital Control Systems Group
Texas Instruments
Description:
Header file containing data type and object definitions and
initializers. Also contains prototypes for the functions in F28XQEP.C.
=====================================================================================
History:
-------------------------------------------------------------------------------------
05-15-2002 Release Rev 1.0
----------------------------------------------------------------------------------*/
#ifndef __F28X_QEP_H__
#define __F28X_QEP_H__
//#include "IQmathLib.h"
#include "DSP28_Device.h"
#include "f28xbmsk.h"
/*------------------------------------------------------------------------------
Initialization states for T4CON and CAPCON
------------------------------------------------------------------------------*/
#define QEP_CAP_INIT_STATE 0x9004
#define QEP_TIMER_INIT_STATE (FREE_RUN_FLAG + \
TIMER_DIR_UPDN + \
TIMER_CLK_PRESCALE_X_128 + \
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 QEP_cnt_idx; /* Variable: Encoder counter index (Q0) */
int index_sync_flag; /* Output: Index sync status (Q0) */
int QEP_cnt;
int QEP_cnt_old;
int dir_speed;
_iq delta_cnt;
_iq speed;
_iq wc;/*the time constant of the rotor*/
_iq Tc;/* Sampling Period,for the filter*/
void (*init)(); /* Pointer to the init funcion */
void (*calc)(); /* Pointer to the calc funtion */
void (*isr1)(); /* Pointer to the isr funtion */
void (*isr2)(); /* Pointer to the isr funtion */
} QEP;
/*-----------------------------------------------------------------------------
Define a QEP_handle
-----------------------------------------------------------------------------*/
typedef QEP *QEP_handle;
/*-----------------------------------------------------------------------------
Default initializer for the QEP Object.
-----------------------------------------------------------------------------*/
#define QEP_DEFAULTS { 0,0,0,0,0,0,0,0,0,0,\
(void (*)(long))F28X_EV2_QEP_Init, \
(void (*)(long))F28X_EV2_QEP_Calc, \
(void (*)(long))F28X_EV2_QEP_Isr1, \
(void (*)(long))F28X_EV2_QEP_Isr2 }
/*-----------------------------------------------------------------------------
Prototypes for the functions in F28XQEP.C
-----------------------------------------------------------------------------*/
void F28X_EV2_QEP_Init(QEP_handle);
void F28X_EV2_QEP_Calc(QEP_handle);
void F28X_EV2_QEP_Isr1(QEP_handle);
void F28X_EV2_QEP_Isr2(QEP_handle);
#endif /* __F28X_QEP_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -