• LT32210529
    了解作者
  • C/C++
    开发工具
  • 246KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 41
    下载次数
  • 2019-08-17 10:56
    上传日期
STM32控制伺服电机,不错的学习资料,可以学习一下
STM32控制伺服电机.zip
  • STM32_Servo_Controller-master
  • cmsis_boot
  • startup
  • startup_stm32f10x_md_vl.c
    13.6KB
  • stm32f10x_conf.h
    3.1KB
  • system_stm32f10x.h
    1.9KB
  • stm32f10x.h
    610.9KB
  • system_stm32f10x.c
    34.6KB
  • STM32_Servo_Controller.elf.xcodeproj
  • project.pbxproj
    23.4KB
  • extruder
  • temp.h
    1.1KB
  • temp.c
    10.4KB
  • pinio
  • pinio.h
    10.2KB
  • pinio.c
    559B
  • clock
  • delay.h
    1.2KB
  • clock.c
    2.3KB
  • clock.h
    139B
  • delay.c
    1.1KB
  • cmsis
  • core_cm3.c
    16.1KB
  • core_cm3.h
    81.9KB
  • heater
  • heater.h
    837B
  • heater.c
    13.8KB
  • hrdw_cfg
  • isrs.c
    2KB
  • hrdw_cfg.h
    407B
  • hrdw_cfg.c
    13.4KB
  • dda
  • dda_maths.c
    1.6KB
  • dda.h
    9.1KB
  • dda_maths.h
    260B
  • dda_queue.c
    5.8KB
  • dda.c
    29KB
  • dda_queue.h
    925B
  • gcode
  • gcode_parse.c
    11.9KB
  • gcode_process.c
    22.1KB
  • gcode_parse.h
    2.3KB
  • gcode_process.h
    300B
  • serial
  • sermsg.h
    625B
  • sersendf.c
    3.5KB
  • sermsg.c
    2.1KB
  • serial.c
    6.8KB
  • serial.h
    765B
  • sersendf.h
    269B
  • syscalls
  • syscalls.c
    1.1KB
  • stdio
  • printf.c
    12KB
  • timer
  • timer.c
    6.5KB
  • timer.h
    714B
  • stm_lib
  • src
  • misc.c
    6.7KB
  • stm32f10x_tim.c
    103.8KB
  • stm32f10x_gpio.c
    22KB
  • stm32f10x_dma.c
    28.2KB
  • stm32f10x_adc.c
    44.8KB
  • stm32f10x_exti.c
    6.5KB
  • stm32f10x_usart.c
    36.4KB
  • stm32f10x_rcc.c
    48.6KB
  • inc
  • stm32f10x_adc.h
    20.7KB
  • stm32f10x_dma.h
    19.8KB
  • stm32f10x_exti.h
    6.5KB
  • stm32f10x_usart.h
    15.8KB
  • stm32f10x_rcc.h
    29KB
  • stm32f10x_gpio.h
    19.3KB
  • misc.h
    8.6KB
  • stm32f10x_tim.h
    50.1KB
  • home
  • home.c
    4.7KB
  • home.h
    241B
  • debug.c
    50B
  • .gitignore
    2KB
  • memory.ld
    702B
  • debug.config
    1KB
  • config.h
    22.8KB
  • build.xml
    3KB
  • link.ld
    1.2KB
  • .gitattributes
    483B
  • main.c
    684B
  • STM32VL-Discovery config.ioc
    208.4KB
  • STM32_Servo_Controller.cob
    1.1KB
  • debug.h
    431B
内容介绍
/** ****************************************************************************** * @file stm32f10x_tim.c * @author MCD Application Team * @version V3.5.0 * @date 11-March-2011 * @brief This file provides all the TIM firmware functions. ****************************************************************************** * @attention * * 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 2011 STMicroelectronics</center></h2> ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_tim.h" #include "stm32f10x_rcc.h" /** @addtogroup STM32F10x_StdPeriph_Driver * @{ */ /** @defgroup TIM * @brief TIM driver modules * @{ */ /** @defgroup TIM_Private_TypesDefinitions * @{ */ /** * @} */ /** @defgroup TIM_Private_Defines * @{ */ /* ---------------------- TIM registers bit mask ------------------------ */ #define SMCR_ETR_Mask ((uint16_t)0x00FF) #define CCMR_Offset ((uint16_t)0x0018) #define CCER_CCE_Set ((uint16_t)0x0001) #define CCER_CCNE_Set ((uint16_t)0x0004) /** * @} */ /** @defgroup TIM_Private_Macros * @{ */ /** * @} */ /** @defgroup TIM_Private_Variables * @{ */ /** * @} */ /** @defgroup TIM_Private_FunctionPrototypes * @{ */ static void TI1_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter); static void TI2_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter); static void TI3_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter); static void TI4_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter); /** * @} */ /** @defgroup TIM_Private_Macros * @{ */ /** * @} */ /** @defgroup TIM_Private_Variables * @{ */ /** * @} */ /** @defgroup TIM_Private_FunctionPrototypes * @{ */ /** * @} */ /** @defgroup TIM_Private_Functions * @{ */ /** * @brief Deinitializes the TIMx peripheral registers to their default reset values. * @param TIMx: where x can be 1 to 17 to select the TIM peripheral. * @retval None */ void TIM_DeInit(TIM_TypeDef* TIMx) { /* Check the parameters */ assert_param(IS_TIM_ALL_PERIPH(TIMx)); if (TIMx == TIM1) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, DISABLE); } else if (TIMx == TIM2) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, DISABLE); } else if (TIMx == TIM3) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, DISABLE); } else if (TIMx == TIM4) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, DISABLE); } else if (TIMx == TIM5) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, DISABLE); } else if (TIMx == TIM6) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, DISABLE); } else if (TIMx == TIM7) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, DISABLE); } else if (TIMx == TIM8) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, DISABLE); } else if (TIMx == TIM9) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM9, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM9, DISABLE); } else if (TIMx == TIM10) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM10, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM10, DISABLE); } else if (TIMx == TIM11) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM11, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM11, DISABLE); } else if (TIMx == TIM12) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM12, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM12, DISABLE); } else if (TIMx == TIM13) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM13, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM13, DISABLE); } else if (TIMx == TIM14) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM14, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM14, DISABLE); } else if (TIMx == TIM15) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM15, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM15, DISABLE); } else if (TIMx == TIM16) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM16, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM16, DISABLE); } else { if (TIMx == TIM17) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM17, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM17, DISABLE); } } } /** * @brief Initializes the TIMx Time Base Unit peripheral according to * the specified parameters in the TIM_TimeBaseInitStruct. * @param TIMx: where x can be 1 to 17 to select the TIM peripheral. * @param TIM_TimeBaseInitStruct: pointer to a TIM_TimeBaseInitTypeDef * structure that contains the configuration information for the * specified TIM peripheral. * @retval None */ void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct) { uint16_t tmpcr1 = 0; /* Check the parameters */ assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_TIM_COUNTER_MODE(TIM_TimeBaseInitStruct->TIM_CounterMode)); assert_param(IS_TIM_CKD_DIV(TIM_TimeBaseInitStruct->TIM_ClockDivision)); tmpcr1 = TIMx->CR1; if((TIMx == TIM1) || (TIMx == TIM8)|| (TIMx == TIM2) || (TIMx == TIM3)|| (TIMx == TIM4) || (TIMx == TIM5)) { /* Select the Counter Mode */ tmpcr1 &= (uint16_t)(~((uint16_t)(TIM_CR1_DIR | TIM_CR1_CMS))); tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_CounterMode; } if((TIMx != TIM6) && (TIMx != TIM7)) { /* Set the clock division */ tmpcr1 &= (uint16_t)(~((uint16_t)TIM_CR1_CKD)); tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_ClockDivision; } TIMx->CR1 = tmpcr1; /* Set the Autoreload value */ TIMx->ARR = TIM_TimeBaseInitStruct->TIM_Period ; /* Set the Prescaler value */ TIMx->PSC = TIM_TimeBaseInitStruct->TIM_Prescaler; if ((TIMx == TIM1) || (TIMx == TIM8)|| (TIMx == TIM15)|| (TIMx == TIM16) || (TIMx == TIM17)) { /* Set the Repetition Counter value */ TIMx->RCR = TIM_TimeBaseInitStruct->TIM_RepetitionCounter; } /* Generate an update event to reload the Prescaler and the Repetition counter values immediately */ TIMx->EGR = TIM_PSCReloadMode_Immediate; } /** * @brief Initializes the TIMx Channel1 according to the specified * parameters in the TIM_OCInitStruct. * @param TIMx: where x can be 1 to 17 except 6 and 7 to select the TIM peripheral. * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure * that contains the configuration information for the specified TIM peripheral. * @retval None */ void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) { uint16_t tmpccmrx = 0, tmpccer = 0, tmpc
评论
    相关推荐
    • STM32控制电机.rar
      stm32f10x 可用 Keil uVision4软件打开,控制步进电机
    • stm32电机FOC控制
      基于stm32电机FOC+svpwm控制程序,实测可用,希望能够帮到需要的人
    • stm32电机基础资料
      学习电机控制stm32的基本资料,没有的可以下载看看!~~~
    • STM32电机
      STM32电机控制库,十分有参考价值,ST官方提供的例程!
    • stm32步进电机
      stm32步进电机
    • STM32 电机库安装软件
      基于STM32系列的单片机电机控制库文件生成工具,如果用STM32任何系列单片机都必须的工具。可以直接生成源码
    • STM32 PWM电机
      利用STM32 芯片 控制直流电机的速度 控制电机的PWM
    • STM32电机测试实验例程
      亲自实验了本程序,可以准确测试电机转速。有效帮助初学者理解本程序。
    • stm32电机控制
      自己搜集的网上的资料,关于stm32电机控制的部分文件,很有参考意义,有做此方面的可以看看
    • STM32电机库2.0
      STM32电机库2.0,其它地方不好找到了,就把它传上来了。