stm32 定时器中断算法

  • q8_431401
    了解作者
  • 9.1MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-14 01:56
    上传日期
stm32 定时器中断算法,s曲线七段法,可以根据自己应用实例进行更改
定时器中断法--S七段法.zip
  • 定时器中断法--S七段法
  • HARDWARE
  • CORE
  • core_cm3.h
    83.7KB
  • startup_stm32f10x_hd.s
    15.1KB
  • core_cm3.c
    16.9KB
  • startup_stm32f10x_md.s
    12.5KB
  • SYSTEM
  • sys
  • sys.c
    872B
  • sys.h
    2.7KB
  • delay
  • delay.c
    7.7KB
  • delay.h
    1.9KB
  • usart
  • usart.c
    4.4KB
  • usart.h
    654B
  • OBJ
  • main.d
    1.8KB
  • usart.crf
    347.1KB
  • stm32f10x_iwdg.crf
    340.4KB
  • stm32f10x_gpio.o
    397.4KB
  • tlc5615.o
    385.9KB
  • stm32f10x_i2c.o
    418.4KB
  • stm32f10x_wwdg.d
    1.9KB
  • stm32f10x_tim.crf
    362.3KB
  • misc.o
    377.1KB
  • stm32f10x_bkp.crf
    341.6KB
  • stm32f10x_exti.crf
    341.3KB
  • stm32f10x_rcc.o
    417.1KB
  • main.o
    380.2KB
  • stm32f10x_it.d
    1.8KB
  • stm32f10x_it.o
    381.4KB
  • stm32f10x_cec.crf
    342.2KB
  • spicon.crf
    352.7KB
  • remote.o
    390.6KB
  • remote.d
    1.8KB
  • stm32f10x_spi.crf
    344.6KB
  • s_curve.d
    1.8KB
  • stm32f10x_spi.o
    403.9KB
  • stm32f10x_sdio.o
    412KB
  • motor.o
    379.9KB
  • mpu6050.crf
    352.1KB
  • main.crf
    347.5KB
  • stm32f10x_spi.d
    1.9KB
  • stm32f10x_rcc.d
    1.9KB
  • stm32f10x_bkp.o
    386.9KB
  • spicon.o
    402.4KB
  • stm32f10x_gpio.d
    1.9KB
  • startup_stm32f10x_hd.o
    6.7KB
  • stm32f10x_adc.crf
    347.7KB
  • stm32f10x_usart.d
    1.9KB
  • inv_mpu.crf
    395KB
  • stm32f10x_pwr.o
    382.8KB
  • lcd.o
    451.3KB
  • stm32f10x_flash.d
    1.9KB
  • SPI.sct
    479B
  • SPI.axf
    318.7KB
  • stm32f10x_dac.d
    1.9KB
  • stm32f10x_fsmc.crf
    346.1KB
  • tlc5615.crf
    356.4KB
  • stm32f10x_tim.o
    503.3KB
  • stm32f10x_i2c.d
    1.9KB
  • stm32f10x_crc.crf
    340.3KB
  • oled.o
    417.7KB
  • core_cm3.o
    11KB
  • s_curve.crf
    356.1KB
  • stm32f10x_crc.o
    378.1KB
  • key.o
    391.7KB
  • oled.crf
    352.3KB
  • spi.crf
    342KB
  • inv_mpu.d
    2.2KB
  • tlc5615.d
    1.8KB
  • stm32f10x_iwdg.d
    1.9KB
  • timer.crf
    352KB
  • remote.crf
    348KB
  • delay.crf
    341.8KB
  • s_curve.o
    396.2KB
  • stm32f10x_dbgmcu.o
    374.1KB
  • inv_mpu_dmp_motion_driver.o
    468.3KB
  • spicon.d
    1.8KB
  • inv_mpu_dmp_motion_driver.crf
    403.1KB
  • stm32f10x_can.o
    409.3KB
  • led.o
    376.8KB
  • usart.o
    385.8KB
  • stm32f10x_rtc.d
    1.9KB
  • mpuiic.d
    1.7KB
  • usart.d
    1.7KB
  • stm32f10x_sdio.crf
    344.7KB
  • stm32f10x_dbgmcu.crf
    340.1KB
  • stm32f10x_pwr.d
    1.9KB
  • stm32f10x_wwdg.crf
    340.8KB
  • stm32f10x_rtc.o
    389.1KB
  • stm32f10x_tim.d
    1.9KB
  • core_cm3.d
    104B
  • SPI_SPI.dep
    63.5KB
  • flash.d
    1.7KB
  • stm32f10x_gpio.crf
    344.1KB
  • stm32f10x_dma.d
    1.9KB
  • mpu6050_dmp.d
    2.3KB
内容介绍
/** ****************************************************************************** * @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_OCInitStru
评论
    相关推荐
    • PID算法STM32实现
      PID算法STM32实现,包括纯C实现和PID参数的调节方法和图示等
    • STM32_PID算法源码
      基于STM32F103R8的PID算法例程,完整工程源码,PWM输出控制信号,ADC输入反馈信号,形成闭环控制。
    • 基于STM32的PID算法
      该资源为经典工业控制PID算法STM32源码及思想,详细的解释了PID算法思想及实现,非常适合新手学习,资源整理不易,同学务必珍惜。
    • STM32 PID算法
      PID算法
    • STM32巡线小车PID算法代码
      STM32F103C8T6为控制器,L298N驱动两个直流电机,通过3个反射式红外传感器采集数据,采用两节3.2V锂电池串联作为电源的巡线小车。车上搭在了其他模块,如:超声波测距模块、显示屏模块等。 程序为C语言编写。  ...
    • STM32 FFT算法实现
      在原子哥的开发板上实现的FFT算法和UCOS。全部资料均来自网络,谢谢原子哥,谢谢网络上无私的朋友
    • stm32加密算法.rar
      STM32加密算法库,包含常见的加密算法,AES、ARC4、ECC、HASH、RAND、RSA、TDES_DES等加密算法
    • stm32 风洞 pid算法程序
      stm32 风洞控制程序 PID
    • 基于stm32的血压算法
      基于stm32的血压算法,精度还可以,需要的话可以直接移植使用,方便大家。
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等