📄 f281xqep_no_index.h
字号:
/* ==================================================================================
File name: F281XQEP_NO_INDEX.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 F281XQEP_NO_INDEX.C.
Target: TMS320F281x family
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005 Version 3.20: Using DSP281x v. 1.00 or higher
----------------------------------------------------------------------------------*/
#ifndef __F281X_QEP_NO_INDEX_H__
#define __F281X_QEP_NO_INDEX_H__
#include "f281xbmsk.h"
/*------------------------------------------------------------------------------
Initialization states for T2CON and CAPCON
------------------------------------------------------------------------------*/
#define QEP_CAP_INIT_STATE 0x9004
#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 {int16 MechTheta; // Output: Motor Mechanical Angle (Q15)
int16 OutputTheta; // Output: Output Mechanical Angle (Q15)
Uint16 DirectionQep; // Output: Motor rotation direction (Q0)
Uint16 QepCountIndex; // Variable: Encoder counter index = 4*pulse_per_rev (Q0)
Uint16 RawTheta; // Variable: Raw angle from Timer 2 (Q0)
Uint32 OutputRawTheta; // Variable: Raw angle for output position (Q0)
Uint32 MechScaler; // Parameter: 0.9999/total count for motor (Q30)
Uint32 OutputMechScaler; // Parameter: 0.9999/total count for output (Q30)
Uint16 LineEncoder; // Parameter: Number of line encoder (Q0)
Uint16 PreScaler; // Parameter: A ratio of motor revolution to output revolution (Q0)
Uint16 Counter; // Variable: Counter for revolution of motor (Q0)
void (*init)(); // Pointer to the init function
void (*calc)(); // Pointer to the calc function
void (*isr)(); // Pointer to the isr function
} QEP;
/*-----------------------------------------------------------------------------
Define a QEP_handle
-----------------------------------------------------------------------------*/
typedef QEP *QEP_handle;
/*-----------------------------------------------------------------------------
Default initializer for the QEP Object.
-----------------------------------------------------------------------------*/
// Applied-motion PMSM motor: 24-v, 8-pole, 2000 line encoder
// MechScaler = 1/8000 = 0x00020C4A (Q30)
// Sensormatic PM DC-motor: 12-v, 512 line encoder
// MechScaler = 1/(4*512) = 1/2048 = 0x00080000 (Q30)
// Edges for output : 2048*256 = 524288, Note: 2^8 = 256
// OutputMechScaler = 1/(4*512*256) = 1/524288 = 0x00000800 (Q30)
#define QEP_DEFAULTS { 0x0,0x0,0x0,2048,0x0,0x0,0x00080000,0x00000800,512,256,0x0, \
(void (*)(Uint32))F281X_EV1_QEP_NO_INDEX_Init, \
(void (*)(Uint32))F281X_EV1_QEP_NO_INDEX_Calc, \
(void (*)(Uint32))F281X_EV1_QEP_NO_INDEX_Isr }
/*-----------------------------------------------------------------------------
Prototypes for the functions in F281XQEP_NO_INDEX.C
-----------------------------------------------------------------------------*/
void F281X_EV1_QEP_NO_INDEX_Init(QEP_handle);
void F281X_EV1_QEP_NO_INDEX_Calc(QEP_handle);
void F281X_EV1_QEP_NO_INDEX_Isr(QEP_handle);
#endif // __F281X_QEP_NO_INDEX_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -