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

📄 mc_encoder_param.h

📁 ARM_CORTEX-M3应用实例开发详解光盘
💻 H
字号:
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
* File Name          : MC_encoder_param.h
* Author             : IMS Systems Lab 
* Date First Issued  : 21/11/07
* Description        : Contains the list of project specific parameters related
*                      to the encoder speed and position feedback.
********************************************************************************
* History:
* 21/11/07 v1.0
* 29/05/08 v2.0
* 22/07/08 v2.0.1
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* THIS SOURCE CODE IS PROTECTED BY A LICENSE.
* FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED
* IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.
*******************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MC_ENCODER_PARAM_H
#define __MC_ENCODER_PARAM_H

#include "STM32F10x_MCconf.h"

/* PERIPHERAL SET-UP ---------------------------------------------------------*/
#if ((defined ENCODER)||(defined VIEW_ENCODER_FEEDBACK))
/* Define here the 16-bit timer chosen to handle encoder feedback */
/*TIMER 2 is the mandatory selection when using STM32MC-KIT */
#define TIMER2_HANDLES_ENCODER
//#define TIMER3_HANDLES_ENCODER	// TIM3 HAS BEED USED BY MCDAC FUCTION
//#define TIMER4_HANDLES_ENCODER
#endif  // ENCODER


#if defined(TIMER2_HANDLES_ENCODER)
#define ENCODER_TIMER         TIM2          // Encoder unit connected to TIM2
#elif defined(TIMER3_HANDLES_ENCODER)
#define ENCODER_TIMER         TIM3          // Encoder unit connected to TIM3
#else // TIMER4_HANDLES_ENCODER
#define ENCODER_TIMER         TIM4          // Encoder unit connected to TIM4
#endif

/*****************************  Encoder settings ******************************/
#define ENCODER_PPR           (u16)(1000)   // number of pulses per revolution

/* Define here the absolute value of the application minimum and maximum speed 
                                                                   in rpm unit*/
#define MINIMUM_MECHANICAL_SPEED_RPM  (u32)0   //rpm
#define MAXIMUM_MECHANICAL_SPEED_RPM  (u32)36000 //rpm

/* Define here the number of consecutive error measurement to be detected 
   before going into FAULT state */
#define MAXIMUM_ERROR_NUMBER (u8)100
/* Computation Parameter*/
//Number of averaged speed measurement
#define SPEED_BUFFER_SIZE   8   // power of 2 required to ease computations

/*************************** Alignment settings *******************************/
//Alignemnt duration
#define T_ALIGNMENT           (u16) 200    // Alignment time in ms

#define ALIGNMENT_ANGLE       (u16) 90 //Degrees [0..359]  
//  90

⌨️ 快捷键说明

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