?? encoder.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 + -