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

📄 f243_qep.h

📁 TI的digital motor control lib的源代码。了解TI的编程规范
💻 H
字号:
/* ==================================================================================
File name:        F243_QEP.H                     
                    
Originator:	Digital Control Systems Group
			Texas Instruments
Description:  
This file defines handy constants for register initializations  
contains prototypes for the functions in F243_QEP.C,            
and has definitions of structs etc.                             
=====================================================================================
 History:
-------------------------------------------------------------------------------------
 9-15-2000	Release	Rev 1.0                                                  
---------------------------------------------------------------------------------- */

#include "..\include\F243BMSK.H"

/*------------------------------------------------------------------------------
Initialization states for T2CON and CAPCON 
------------------------------------------------------------------------------*/
#define CAP_INIT_STATE    0xf044
#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 theta_elec;     /* Motor Electrical Angle, Q15, Output   */
                int theta_mech;     /* Motor Mechanical Angle  Q15, Output   */
                int QepDir;         /* Motor rotation direction Q0, Output   */
                int dwn_cnt_offset; /* Encoder offset 65533- #lines Q0,Input */
                int theta_raw;      /* Raw angle  Q0, Internal, Output       */
                int mech_scaler;    /* Scaler for conv'n to Q15 Q15,Parameter*/
                int pole_pairs;     /* # of poles/2 for the motor, Q0 Input  */
                int rev_counter;    /* # of index events, Q0, Output+History */
                int pulse_count;    /* Pulses on encoder at index- Output-Q0 */
                int index_flag ;    /* Index sync status Q0 output+History   */
                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 F243_CAP.C                                 
-----------------------------------------------------------------------------*/

int F243_QEP_Init(QEP *);                                              
int F243_qep_theta_calc(QEP *);
int F243_QEP_Index_Handle(QEP *);

/*-----------------------------------------------------------------------------
Default initializer for the QEP Object.
-----------------------------------------------------------------------------*/

#define QEP_DEFAULTS { 0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, \
                (int (*)(int))F243_qep_theta_calc,               \
                (int (*)(int))F243_QEP_Init,                     \
                (int (*)(int))F243_QEP_Index_Handle }

/*-----------------------------------------------------------------------------
Default initializer for the QEP Object for a 4000 line encoder.
-----------------------------------------------------------------------------*/
#define QEP_4000 { 0x0, 0x0,0x0,0x0,0x0,16384,2,0x0,0x0,0x0, \
                (int (*)(int))F243_qep_theta_calc,           \
                (int (*)(int))F243_QEP_Init,                 \
                (int (*)(int))F243_QEP_Index_Handle }

⌨️ 快捷键说明

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