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

📄 encoder.h

📁 Texas-Instrument C2000 Series DSP example programs
💻 H
字号:
/*==============================================================*/
/* Name:           ENCODER.H					*/
/* Project:        ENCODER                                      */
/* Originator:     Martin Staebler				*/
/* Description:    Header File for ENCODER.C			*/	
/*==============================================================*/
#ifndef  __ENCODER_H_
#define  __ENCODER_H_

/*===============================================================*/
/* USER SETTABLE ENCODER CONSTANTS                               */
/*===============================================================*/
/*---------------------------*/
/* 1) Incremental resolution */
/*---------------------------*/
#define QEP_ROLLOVER    8192      /* incremental counts          */
asm("QEP_ROLLOVER  .set 8192 ");  /* dito, assembler support     */
/* #define QEP_POWER2 */            /* undefine if incremental     */
                                  /*   count isn't a power of 2  */

/*-------------------------------------------------*/
/* 2) 'F240 ADC's input channel selection & offset */
/*-------------------------------------------------*/
/* Pin ADCIN5  (ADC0, channel 5)  selected for U0  */
/* Pin ADCIN13 (ADC1, channel 5)  selected for U90 */
#define ENC_U0_OFFSET   (0x8000 + 0)    /* U0  (sin) offset      */
#define ENC_U90_OFFSET  (0x8000 + 300)  /* U90 (-cos) offset     */


/*==================*/
/* OTHER CONSTANTS  */
/*==================*/
#define PI              32768
#define ENABLE		1
#define DISABLE		0


/*--------------------*/
/* Global Variables   */
/*--------------------*/
extern volatile unsigned encoder_position[2];

/*----------------------*/
/* Function Declaration */
/*----------------------*/
extern void Encoder_Init(unsigned rollover);
extern void Encoder_ZeroPosition(void);
extern void Encoder_MatchIncrPhase(void);
extern int  Encoder_CalcPhase(int sin,int ncos); 
extern unsigned Encoder_SamplePosition(void);
extern void Encoder_CalcPosition(unsigned qep_incr_sample);

#endif


⌨️ 快捷键说明

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