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

📄 f280xqep_no_index.h

📁 DSP280X芯片的编程简单例子
💻 H
字号:
/* ==================================================================================
File name:        F280XQEP_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 F280XQEP_NO_INDEX.C.

Target: TMS320F280x family
              
=====================================================================================
History:
-------------------------------------------------------------------------------------
 04-15-2005	Version 3.20: Using DSP280x v. 1.10 or higher 
------------------------------------------------------------------------------------*/

#ifndef __F280X_QEP_NO_INDEX_H__
#define __F280X_QEP_NO_INDEX_H__

#include "f280xbmsk.h"

/*-----------------------------------------------------------------------------
    Initialization states for EQEP Decode Control Register
------------------------------------------------------------------------------*/
#define  QDECCTL_INIT_STATE    ( XCR_X2 + QSRC_QUAD_MODE )

/*-----------------------------------------------------------------------------
    Initialization states for EQEP Control Register
------------------------------------------------------------------------------*/
#define QEPCTL_INIT_STATE      ( QEP_EMULATION_FREE + \
                                 PCRM_POSMAX + \
                                 QPEN_ENABLE + \
                                 QCLM_TIME_OUT + \
                                 UTE_ENABLE )  

/*-----------------------------------------------------------------------------
    Initialization states for EQEP Position-Compare Control Register
------------------------------------------------------------------------------*/
#define QPOSCTL_INIT_STATE      PCE_DISABLE

/*-----------------------------------------------------------------------------
    Initialization states for EQEP Capture Control Register
------------------------------------------------------------------------------*/
#define QCAPCTL_INIT_STATE     ( UPPS_X32 + \
                                 CCPS_X128 + \
                                 CEN_ENABLE )

/*-----------------------------------------------------------------------------
Define the structure of the QEP (Quadrature Encoder) Driver Object 
-----------------------------------------------------------------------------*/
typedef struct {int32 MechTheta;         // Output: Motor Mechanical Angle (Q24)  
                int32 OutputTheta;       // Output: Output Mechanical Angle (Q24)  
                Uint16 DirectionQep;     // Output: Motor rotation direction (Q0) 
                Uint16 QepPeriod;        // Output: Capture period of Qep signal in number of eQEP capture timer (QCTMR) period  (Q0)
                Uint16 QepCountIndex;    // Variable: Encoder counter index = 4*pulse_per_rev (Q0)  
                Uint32 RawTheta;         // Variable: Raw angle from EQep Postiion counter (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
                }  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,0x0,0x0,0x0,0x0,0x00080000,0x00000800,0x0,256,0x0,  \
                (void (*)(Uint32))F280X_QEP_NO_INDEX_Init,            \
                (void (*)(Uint32))F280X_QEP_NO_INDEX_Calc }

/*-----------------------------------------------------------------------------
Prototypes for the functions in F280XQEP_NO_INDEX.C                                 
-----------------------------------------------------------------------------*/
void F280X_QEP_NO_INDEX_Init(QEP_handle);                                              
void F280X_QEP_NO_INDEX_Calc(QEP_handle);

#endif // __F280X_QEP_NO_INDEX_H__

⌨️ 快捷键说明

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