STM32F10xxx 正交编码器接口应用笔记

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

STM32F10xxxSTM32F10xxxAbstract---Thequadratureencoderwhichisverypopularinthemotorservocontrolapplication,knownasa2-channelincrementalencoder,convertslineardisplacementintoapulsesignal.Bymonitoringthenumberofpulsesandtherelativephaseofthetwosignalsyoucantracktheposition,thedirectionofrotationandspeed.Inddition,athirdchannel,orindexsignal,canbeusedtoresetthepositioncounter.STM3210xwhichistheMCUbasedonARMlatestcore-Cortex-M3,integratesthequadratureencoderinterface.AccordinglySTM3210xcanhandlestheencodersignalwithoutanyCPUoverheadwhichitispossibleforCPUtofocusonthevectorcontrol.,TM32F10xMCUMCUSTM32F10x1ABZAB+/-90°11/7STM32F10xxx2STM32F10xSTM32F10xTI1TI22.122.2TI2TIM1_SMCRSMS=001TI1SMS=010TI1TI2SMS=011TIM1_CCERCC1PCC2PTI1TI2TI1TI21(TIM1_CR1CEN=1)TI1FP1TI2FP2TI1FP1TI2FP2TI1TI2TI1FP1=TI1TI2FP2=TI2TIM1_CR1DIRTI1TI2TI1TI2(TI1TI2)DIR2/7STM32F10xxx0TIM1_ARR(0ARRARR0)TIM1_ARR21TI1TI2MCU2zCC1S=’01’(TIMx_CCMR1IC1FP1TI1)zCC2S=’01’(TIMx_CCMR2IC2FP2TI2)zCC1P=’0’(TIMx_CCERIC1FP1IC1FP1=TI1)zCC2P=’0’(TIMx_CCERIC2FP2IC2FP2=TI2)zSMS=’011’(TIMx_SMCR).zCEN=’1’(TIMx_CR1)3/7STM32F10xxx33IC1FP1(CC1P=’1’)4IC1FP133.14/7STM32F10xxxzFWLibSTM32F10xzProjectsourceinclude3.2ABMCUPA6PA7TIM3_CH1TIM3_CH2LCDTIM3-180~+18010.1Hz3.3zmain.czlcd.cLCDzstm32f10x_encoder.czstm32f10x_it.c2zstm32f10x_Timebase.cSysTick2main.cRCC_ConfigurationGPIO_ConfigurationGPIONVIC_ConfigurationNVICLcdShow_InitLCDTimer2LCDKEYS_InitKEYS_Read5/7STM32F10xxx3lcd.cConvertASCIILCDwrite_charLCDwrite_stringLCDint2char4stm32f10x_encoder.cENC_InitTimer3ENC_Get_Electrical_AngleENC_Clear_Speed_BufferENC_Calc_Rot_SpeedENC_Calc_Average_SpeedLCD_DisplayLCDTIM3_IRQHandlerTimer3Update5stm32f10x_it.cTIM2_IRQHandlerTimer2OCLCD6stm32f10x_Timebase.cTB_InitSysTickTB_Set_DisplayDelay_500usLCDTB_DisplayDelay_IsElapsedLCDSysTickHandlerSysTick3.4TM32F10xUpdatevoidTIM3_IRQHandler(void){/*Cleartheinterruptpendingflag*/TIM_ClearFlag(ENCODER_TIMER,TIM_FLAG_Update);if(hEncoder_Timer_Overflow!=U16_MAX){hEncoder_Timer_Overflow++;}}6/7STM32F10xxxCPUCPU400pulse/rev360º(4*400)º4STM32F10xzx4:10004000x2:A(B)“”:z/z360°60°,90°,…7/7

1 / 7
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功