步进电机 插补算法stm.docx
- 文档编号:11142081
- 上传时间:2023-02-25
- 格式:DOCX
- 页数:8
- 大小:15.13KB
步进电机 插补算法stm.docx
《步进电机 插补算法stm.docx》由会员分享,可在线阅读,更多相关《步进电机 插补算法stm.docx(8页珍藏版)》请在冰豆网上搜索。
步进电机插补算法stm
#include""
#include""
#include""
#include<>
#include""
#include""
#include""
#include<>
voidRCC_Configuration(void);
voidGPIO_Configuration(void);
voidNVIC_Configuration(void);
voidTIM_Configuration(void);
voidUSART_Configuration(void);
intfputc(intch,FILE*f);
intfgetc(FILE*f);
floatMx=,My=;*Thisfileprovidestemplateforallexceptionshandlerand
*peripheralsinterruptserviceroutine.
******************************************************************************
*@copy
*
*THEPRESENTFIRMWAREWHICHISFORGUIDANCEONLYAIMSATPROVIDINGCUSTOMERS
*WITHCODINGINFORMATIONREGARDINGTHEIRPRODUCTSINORDERFORTHEMTOSAVE
*TIME.ASARESULT,STMICROELECTRONICSSHALLNOTBEHELDLIABLEFORANY
*DIRECT,INDIRECTORCONSEQUENTIALDAMAGESWITHRESPECTTOANYCLAIMSARISING
*FROMTHECONTENTOFSUCHFIRMWAREAND/ORTHEUSEMADEBYCUSTOMERSOFTHE
*CODINGINFORMATIONCONTAINEDHEREININCONNECTIONWITHTHEIRPRODUCTS.
*
*
©COPYRIGHT2009STMicroelectronics
*/
/*Includes------------------------------------------------------------------*/
#include""
#include""
#include""
#include""
#include""
#include""
#include<>
/**@addtogroupTemplate_Project
*@{
*/
/*Privatetypedef-----------------------------------------------------------*/
/*Privatedefine------------------------------------------------------------*/
/*Privatemacro-------------------------------------------------------------*/
/*Privatevariables---------------------------------------------------------*/
/*Privatefunctionprototypes-----------------------------------------------*/
/*Privatefunctions---------------------------------------------------------*/
/******************************************************************************/
/*Cortex-M3ProcessorExceptionsHandlers*/
/******************************************************************************/
/**
*@briefThisfunctionhandlesNMIexception.
*@paramNone
*@retval:
None
*/
voidNMI_Handler(void)
{
}
/**
*@briefThisfunctionhandlesHardFaultexception.
*@paramNone
*@retval:
None
*/
voidHardFault_Handler(void)
{
/*GotoinfiniteloopwhenHardFaultexceptionoccurs*/
*@paramNone
*@retval:
None
*/
voidMemManage_Handler(void)
{
/*GotoinfiniteloopwhenMemoryManageexceptionoccurs*/
while
(1)
{
}
}
/**
*@briefThisfunctionhandlesBusFaultexception.
*@paramNone
*@retval:
None
*/
voidBusFault_Handler(void)
{
/*GotoinfiniteloopwhenBusFaultexceptionoccurs*/
while
(1)
{
}
}
/**
*@briefThisfunctionhandlesUsageFaultexception.
*@paramNone
*@retval:
None
*/
voidUsageFault_Handler(void)
{
/*GotoinfiniteloopwhenUsageFaultexceptionoccurs*/
while
(1)
{
}
}
/**
*@briefThisfunctionhandlesSVCallexception.
*@paramNone
*@retval:
None
*/
voidSVC_Handler(void)
{
}
/**
*@briefThisfunctionhandlesDebugMonitorexception.
*@paramNone
*@retval:
None
*/
voidDebugMon_Handler(void)
{
}
/**
*@briefThisfunctionhandlesPendSVCexception.
*@paramNone
*@retval:
None
*/
voidPendSV_Handler(void)
{
}
/**
*@briefThisfunctionhandlesSysTickHandler.
*@paramNone
*@retval:
None
*/
externvoidTimingDelay_Decrement(void);
voidSysTick_Handler(void)
{
}
/******************************************************************************/
/*STM32F10xPeripheralsInterruptHandlers*/
/*AddheretheInterruptHandlerfortheusedperipheral(s)(PPP),forthe*/
/*availableperipheralinterrupthandler'snamepleaserefertothestartup*/
/*file.*/
/******************************************************************************/
/**
*@briefThisfunctionhandlesPPPinterruptrequest.
*@paramNone
*@retval:
None
*/
/*voidPPP_IRQHandler(void)
{
}*/
/**
*@}
*/
/*******************(C)COPYRIGHT2009STMicroelectronics*****ENDOFFILE****/
voidDMA1_Channel4_IRQHandler(void)
{
}
externintcounter;
externdoubletime;
externinta;
externintnumx,numy,a,tx,ty;
voidTIM2_IRQHandler(void)//catchx
{
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);
}
}
voidTIM6_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("%fus\n",time);
TIM_ClearITPendingBit(TIM6,TIM_FLAG_Update);
}
}
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 步进电机 插补算法stm 步进 电机 算法 stm