基于STM32控制舵机SG90实验

  • J3_333741
    了解作者
  • 2MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-27 02:45
    上传日期
基于STM32f103z按键控制舵机实验,内含超音波测距控制舵机转角,二者实验可以切换测试(keil4),实验结果可行.1要使用按键控制舵机,请停蔽超音波部分代码,2若用超音波控制度舵机,请停蔽按键
servo.rar
  • servo
  • App
  • inc
  • sys.h
    2.6KB
  • board.h
    315B
  • board.c
    804B
  • stm32f10x_it.c
    30.3KB
  • Board
  • inc
  • us.h
    527B
  • servo.h
    340B
  • systime.h
    320B
  • common.h
    596B
  • time.h
    407B
  • key.h
    683B
  • gpio.h
    351B
  • types.h
    891B
  • delay.h
    730B
  • pwm.h
    308B
  • pwm.c
    941B
  • key.c
    796B
  • systime.c
    2.1KB
  • servo.c
    459B
  • gpio.c
    3.1KB
  • delay.c
    378B
  • time.c
    4KB
  • us.c
    938B
  • Lib
  • inc
  • stm32f10x_conf.h
    6.6KB
  • core_cm3.h
    41.3KB
  • stm32f10x_usart.h
    14.1KB
  • stm32f10x_exti.h
    5.7KB
  • stm32f10x.h
    518.4KB
  • stm32f10x_gpio.h
    14.7KB
  • stm32f10x_sdio.h
    18.2KB
  • stm32f10x_rcc.h
    15.9KB
  • stm32f10x_dma.h
    18.3KB
  • stm32f10x_crc.h
    2KB
  • stm32f10x_tim.h
    47.6KB
  • stm32f10x_adc.h
    19.1KB
  • stm32f10x_can.h
    26.9KB
  • stm32f10x_fsmc.h
    16.9KB
  • misc.h
    4.8KB
  • stm32f10x_spi.h
    14.5KB
  • system_stm32f10x.h
    2.1KB
  • stm32f10x_flash.h
    14.1KB
  • stm32f10x_lib.h
    3.1KB
  • src
  • stm32f10x_flash.c
    25.7KB
  • stm32f10x_rcc.c
    33KB
  • stm32f10x_tim.c
    99.5KB
  • misc.c
    6.7KB
  • core_cm3.c
    15.9KB
  • stm32f10x_gpio.c
    17.5KB
  • Proj
  • main.d
    1KB
  • systime.crf
    296.3KB
  • stm32f10x_gpio.o
    331.4KB
  • servo.lnp
    448B
  • stm32f10x_tim.crf
    316.4KB
  • misc.o
    325.8KB
  • systime.o
    326.1KB
  • gpio.o
    324.9KB
  • stm32f10x_rcc.o
    336.3KB
  • main.o
    335KB
  • stm32f10x_it.d
    1.3KB
  • stm32f10x_it.o
    346.6KB
  • servo_uvopt.bak
    16.3KB
  • servo.uvopt
    16.3KB
  • servo.hex
    28KB
  • startup_stm32f10x_hd.s
    15.1KB
  • main.crf
    298KB
  • stm32f10x_rcc.d
    964B
  • stm32f10x_gpio.d
    987B
  • startup_stm32f10x_hd.o
    6.6KB
  • stm32f10x_flash.d
    1010B
  • servo.uvgui.Administrator
    141.1KB
  • servo.axf
    337.5KB
  • stm32f10x_tim.o
    360.4KB
  • pwm.crf
    296.3KB
  • core_cm3.o
    10.2KB
  • startup_stm32f10x_hd.lst
    47.9KB
  • key.o
    328.2KB
  • time.d
    758B
  • servo.uvgui_Administrator.bak
    141.2KB
  • servo.d
    780B
  • time.o
    326.6KB
  • board.d
    1.1KB
  • delay.crf
    719B
  • servo.uvproj
    17.8KB
  • servo.crf
    296.2KB
  • servo.map
    86.8KB
  • servo.tra
    1.7KB
  • servo.htm
    83.4KB
  • stm32f10x_tim.d
    964B
  • board.o
    334.5KB
  • core_cm3.d
    104B
  • stm32f10x_gpio.crf
    299.5KB
  • delay.d
    58B
内容介绍
/** ****************************************************************************** * @file stm32f10x_tim.c * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file provides all the TIM firmware functions. ****************************************************************************** * @copy * * 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 2009 STMicroelectronics</center></h2> */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_tim.h" #include "stm32f10x_rcc.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @defgroup TIM * @brief TIM driver modules * @{ */ /** @defgroup TIM_Private_TypesDefinitions * @{ */ /** * @} */ /** @defgroup TIM_Private_Defines * @{ */ /* ---------------------- TIM registers bit mask ------------------------ */ #define CR1_CEN_Set ((uint16_t)0x0001) #define CR1_CEN_Reset ((uint16_t)0x03FE) #define CR1_UDIS_Set ((uint16_t)0x0002) #define CR1_UDIS_Reset ((uint16_t)0x03FD) #define CR1_URS_Set ((uint16_t)0x0004) #define CR1_URS_Reset ((uint16_t)0x03FB) #define CR1_OPM_Reset ((uint16_t)0x03F7) #define CR1_CounterMode_Mask ((uint16_t)0x038F) #define CR1_ARPE_Set ((uint16_t)0x0080) #define CR1_ARPE_Reset ((uint16_t)0x037F) #define CR1_CKD_Mask ((uint16_t)0x00FF) #define CR2_CCPC_Set ((uint16_t)0x0001) #define CR2_CCPC_Reset ((uint16_t)0xFFFE) #define CR2_CCUS_Set ((uint16_t)0x0004) #define CR2_CCUS_Reset ((uint16_t)0xFFFB) #define CR2_CCDS_Set ((uint16_t)0x0008) #define CR2_CCDS_Reset ((uint16_t)0xFFF7) #define CR2_MMS_Mask ((uint16_t)0xFF8F) #define CR2_TI1S_Set ((uint16_t)0x0080) #define CR2_TI1S_Reset ((uint16_t)0xFF7F) #define CR2_OIS1_Reset ((uint16_t)0x7EFF) #define CR2_OIS1N_Reset ((uint16_t)0x7DFF) #define CR2_OIS2_Reset ((uint16_t)0x7BFF) #define CR2_OIS2N_Reset ((uint16_t)0x77FF) #define CR2_OIS3_Reset ((uint16_t)0x6FFF) #define CR2_OIS3N_Reset ((uint16_t)0x5FFF) #define CR2_OIS4_Reset ((uint16_t)0x3FFF) #define SMCR_SMS_Mask ((uint16_t)0xFFF8) #define SMCR_ETR_Mask ((uint16_t)0x00FF) #define SMCR_TS_Mask ((uint16_t)0xFF8F) #define SMCR_MSM_Reset ((uint16_t)0xFF7F) #define SMCR_ECE_Set ((uint16_t)0x4000) #define CCMR_CC13S_Mask ((uint16_t)0xFFFC) #define CCMR_CC24S_Mask ((uint16_t)0xFCFF) #define CCMR_TI13Direct_Set ((uint16_t)0x0001) #define CCMR_TI24Direct_Set ((uint16_t)0x0100) #define CCMR_OC13FE_Reset ((uint16_t)0xFFFB) #define CCMR_OC24FE_Reset ((uint16_t)0xFBFF) #define CCMR_OC13PE_Reset ((uint16_t)0xFFF7) #define CCMR_OC24PE_Reset ((uint16_t)0xF7FF) #define CCMR_OC13M_Mask ((uint16_t)0xFF8F) #define CCMR_OC24M_Mask ((uint16_t)0x8FFF) #define CCMR_OC13CE_Reset ((uint16_t)0xFF7F) #define CCMR_OC24CE_Reset ((uint16_t)0x7FFF) #define CCMR_IC13PSC_Mask ((uint16_t)0xFFF3) #define CCMR_IC24PSC_Mask ((uint16_t)0xF3FF) #define CCMR_IC13F_Mask ((uint16_t)0xFF0F) #define CCMR_IC24F_Mask ((uint16_t)0x0FFF) #define CCMR_Offset ((uint16_t)0x0018) #define CCER_CCE_Set ((uint16_t)0x0001) #define CCER_CCNE_Set ((uint16_t)0x0004) #define CCER_CC1P_Reset ((uint16_t)0xFFFD) #define CCER_CC2P_Reset ((uint16_t)0xFFDF) #define CCER_CC3P_Reset ((uint16_t)0xFDFF) #define CCER_CC4P_Reset ((uint16_t)0xDFFF) #define CCER_CC1NP_Reset ((uint16_t)0xFFF7) #define CCER_CC2NP_Reset ((uint16_t)0xFF7F) #define CCER_CC3NP_Reset ((uint16_t)0xF7FF) #define CCER_CC1E_Set ((uint16_t)0x0001) #define CCER_CC1E_Reset ((uint16_t)0xFFFE) #define CCER_CC1NE_Reset ((uint16_t)0xFFFB) #define CCER_CC2E_Set ((uint16_t)0x0010) #define CCER_CC2E_Reset ((uint16_t)0xFFEF) #define CCER_CC2NE_Reset ((uint16_t)0xFFBF) #define CCER_CC3E_Set ((uint16_t)0x0100) #define CCER_CC3E_Reset ((uint16_t)0xFEFF) #define CCER_CC3NE_Reset ((uint16_t)0xFBFF) #define CCER_CC4E_Set ((uint16_t)0x1000) #define CCER_CC4E_Reset ((uint16_t)0xEFFF) #define BDTR_MOE_Set ((uint16_t)0x8000) #define BDTR_MOE_Reset ((uint16_t)0x7FFF) /** * @} */ /** @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 8 to select the TIM peripheral. * @retval : None */ void TIM_DeInit(TIM_TypeDef* TIMx) { /* Check the parameters */ assert_param(IS_TIM_ALL_PERIPH(TIMx)); switch (*(uint32_t*)&TIMx) { case TIM1_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, DISABLE); break; case TIM2_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, DISABLE); break; case TIM3_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, DISABLE); break; case TIM4_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, DISABLE); break; case TIM5_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, DISABLE); break; case TIM6_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, DISABLE); break; case TIM7_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, DISABLE); break; case TIM8_BASE: RCC_APB2PeriphResetCmd(RCC_A
评论
    相关推荐
    • STM32 程序
      STM32一些自己写过的程序并应用过可以使用的,包括直流电机驱动,温度显示,oled显示,adc实验,PWM输出,定时器中断,全部都写在了main函数中,不过写的有一点乱。(pwm实验可以看我的博客)
    • STM32
      STM32
    • STM32
      STM32 该存储库用于容纳我的学习项目,以便使用STM32开发板进行嵌入式系统编程。
    • stm32 sim 7600
      stm32 ota sim 7600 stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600stm32 ota sim 7600...
    • STM32
      关于 ...用于存放学习STM32过程中相关的笔记 作者:nekonana 列表 ::: tip该列表为总体列表,包含已更新和待更新项目 有什么新的想法都会开个待更新项目开坑::: STM32开发环境选择 STM32资料库建立
    • stm32 pack
      keil5 中使用的 STM32包 其中包括 STM32F0 STM32F1 STM32F3 STM32L0 STM32L1
    • stm32cubemx
      stm32cubemx st的代码生成器,安装后可以进行图形化的代码生成,项目生成!
    • STM32CubeMX
      ST(意法半导体)公司为方便STM32的使用和学习,以及HAL库的推广,自行研发的可以通过配置,自动生成初始化代码的工具软件
    • STM32 JoyStickMouse
      今天终于把 STM32 的例程 JoyStickMouse 跑起来了,上传一份备忘。 注意要根据 stm32f10x_conf.h 中的注释去掉一些没用到的文件
    • stm32 demo
      stm32demo 内置adc采集 使用oled及串口显示,可以用于小型项目的demo。 及课程设计。