步进电机 插补算法stm.docx

上传人:b****3 文档编号:5061811 上传时间:2023-05-08 格式:DOCX 页数:8 大小:15.13KB
下载 相关 举报
步进电机 插补算法stm.docx_第1页
第1页 / 共8页
步进电机 插补算法stm.docx_第2页
第2页 / 共8页
步进电机 插补算法stm.docx_第3页
第3页 / 共8页
步进电机 插补算法stm.docx_第4页
第4页 / 共8页
步进电机 插补算法stm.docx_第5页
第5页 / 共8页
步进电机 插补算法stm.docx_第6页
第6页 / 共8页
步进电机 插补算法stm.docx_第7页
第7页 / 共8页
步进电机 插补算法stm.docx_第8页
第8页 / 共8页
亲,该文档总共8页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

步进电机 插补算法stm.docx

《步进电机 插补算法stm.docx》由会员分享,可在线阅读,更多相关《步进电机 插补算法stm.docx(8页珍藏版)》请在冰点文库上搜索。

步进电机 插补算法stm.docx

步进电机插补算法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);

}

}

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2