步进电机插补算法stm

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

步进电机插补算法s t m 集团标准化工作小组 [Q8QX9QT-X8QQB8Q8-NQ8QJ8-M8QMN]
#include ""
#include ""
#include ""
#include <>
#include ""
#include ""
#include ""
#include <>
void RCC_Configuration(void); void GPIO_Configuration(void); void NVIC_Configuration(void); void TIM_Configuration(void); void USART_Configuration(void); int fputc(int ch,FILE *f);
int fgetc(FILE *f);
float Mx=,My=; * This file provides template for all exceptions handler and
* peripherals interrupt service routine.
************************************************************************ ******
* @copy
*
* THE PRESENT FIRMWARE 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 FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */
/* Includes ------------------------------------------------------------------*/
#include ""
#include ""
#include ""
#include ""
#include ""
#include ""
#include <>
/** @addtogroup Template_Project
* @{
*/
/* Private typedef -----------------------------------------------------
------*/
/* Private define ------------------------------------------------------
------*/
/* Private macro -------------------------------------------------------
------*/
/* Private variables ---------------------------------------------------
------*/
/* Private function prototypes -----------------------------------------
------*/
/* Private functions ---------------------------------------------------
------*/
/***********************************************************************
*******/
/* Cortex-M3 Processor Exceptions Handlers */
/*********************************************************************** *******/
/**
* @brief This function handles NMI exception.
* @param None
* @retval : None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval : None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
* @param None
* @retval : None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */ while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval : None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */ while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval : None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval : None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception. * @param None
* @retval : None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception. * @param None
* @retval : None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler. * @param None
* @retval : None
*/
extern void TimingDelay_Decrement(void);
void SysTick_Handler(void)
{
}
/***********************************************************************
*******/
/* STM32F10x Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for
the */
/* available peripheral interrupt handler's name please refer to the
startup */
/* file . */
/***********************************************************************
*******/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval : None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @}
*/
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
void DMA1_Channel4_IRQHandler(void)
{
}
extern int counter;
extern double time;
extern int a;
extern int numx,numy,a,tx,ty;
void TIM2_IRQHandler(void)//catch x
{
if(TIM_GetITStatus(TIM2,TIM_IT_CC3)==SET)
{
TIM_Cmd(TIM3, DISABLE);//X
// numx++;//走的步数
tx=0;
TIM_ClearITPendingBit(TIM2,TIM_IT_CC3); }
if(TIM_GetITStatus(TIM2,TIM_IT_CC4)==SET)
{
TIM_Cmd(TIM4, DISABLE);//y
// numy++;//走的步数
ty=0;
TIM_ClearITPendingBit(TIM2,TIM_IT_CC4); }
}
void TIM6_IRQHandler(void)
{
if(TIM_GetITStatus(TIM6, TIM_IT_Update)== SET)
{
a++;
// counter=TIM_GetCounter(TIM6);
// TIM_Cmd(TIM6, DISABLE);
// time=a*65536/+counter/;
// printf("%d \n",a);
// printf("%d \n",counter);
// printf("%f us\n",time);
TIM_ClearITPendingBit(TIM6 , TIM_FLAG_Update);
} }。

相关文档
最新文档