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

📄 qep.h

📁 TI2812DSP芯片采用EVA(事件管理器)产生SVPWM例程
💻 H
字号:
#ifndef ___QEP_H__
#define ___QEP_H__

#include "f28xbmsk.h"

/*------------------------------------------------------------------------------
Initialization states for T2CON and CAPCON 
------------------------------------------------------------------------------*/
#define QEP_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 theta_elec;     /* Output: Motor Electrical angle (Q15)  */
                int theta_mech;     /* Output: Motor Mechanical Angle (Q15)  */
                int dir_QEP;        /* Output: Motor rotation direction (Q0) */
                int theta_raw;      /* Variable: Raw angle from Timer 2 (Q0)             */
                int mech_scaler;    /* Parameter: 0.9999/total count, total count = 4000 (Q26) */
                int pole_pairs;     /* Parameter: Number of pole pairs (Q0)  */
                int cal_angle;      /* Parameter: Raw angular offset between encoder and phase a (Q0) */
                void (*init)();     /* Pointer to the init funcion           */
                void (*calc)();     /* Pointer to the calc funtion           */
               }  QEP;


/*-----------------------------------------------------------------------------
Define a QEP_handle
-----------------------------------------------------------------------------*/
typedef QEP *QEP_handle;

/*-----------------------------------------------------------------------------
Default initializer for the QEP Object.
-----------------------------------------------------------------------------*/
#define QEP_DEFAULTS { 0x0, 0x0,0x0,0x0,16776,2,-2365,  \
                (void (*)(long))qep_init,                \
                (void (*)(long))qep_calc,                \
                }
/*-----------------------------------------------------------------------------
Prototypes for the functions in F28XQEP.C                                 
-----------------------------------------------------------------------------*/
void qep_init(QEP_handle);                                              
void qep_calc(QEP_handle);
#endif /*  __QEP_H__ */




⌨️ 快捷键说明

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