STM32 IO口模拟IIC接口程序.zip

  • 铜陵人
    了解作者
  • C/C++
    开发工具
  • 503KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 14
    下载次数
  • 2017-08-05 15:20
    上传日期
本程序基于stm32单片机 的io口模拟IIC,STM32单片机硬件复杂且不好用,使用本程序简洁明了。
STM32 IO口模拟IIC接口程序.zip
  • STM32 IO口模拟IIC接口程序
  • app
  • I2C_Driver.h
    864B
  • I2C_Driver.c
    6.2KB
  • interrupt
  • stm32f10x_it.c
    28.5KB
  • stm32f10x_it.h
    3.8KB
  • settings
  • Stm32I2c_Debug.jlink
    248B
  • Stm32I2c.dbgdt
    4.7KB
  • Stm32I2c.wsdt
    3.4KB
  • Stm32I2c.dni
    743B
  • Stm32I2c.cspy.bat
    2.5KB
  • library
  • inc
  • stm32f10x_lib.h
    3.1KB
  • stm32f10x_exti.h
    5.6KB
  • stm32f10x_fsmc.h
    18.1KB
  • stm32f10x_spi.h
    13.2KB
  • stm32f10x_type.h
    3.3KB
  • stm32f10x_wwdg.h
    2.6KB
  • stm32f10x_dbgmcu.h
    2.8KB
  • stm32f10x_map.h
    488.5KB
  • stm32f10x_sdio.h
    17.9KB
  • stm32f10x_crc.h
    1.8KB
  • stm32f10x_i2c.h
    15.2KB
  • stm32f10x_nvic.h
    18.7KB
  • stm32f10x_iwdg.h
    3.3KB
  • stm32f10x_gpio.h
    14.5KB
  • stm32f10x_adc.h
    18.4KB
  • cortexm3_macro.h
    2.2KB
  • stm32f10x_tim.h
    46.1KB
  • stm32f10x_pwr.h
    3.8KB
  • stm32f10x_dma.h
    17.6KB
  • stm32f10x_systick.h
    3.1KB
  • stm32f10x_bkp.h
    6.7KB
  • stm32f10x_dac.h
    9.4KB
  • stm32f10x_rcc.h
    14.4KB
  • stm32f10x_usart.h
    13.8KB
  • stm32f10x_flash.h
    13.7KB
  • stm32f10x_rtc.h
    3.5KB
  • stm32f10x_can.h
    12KB
  • src
  • stm32f10x_rtc.c
    11.9KB
  • stm32f10x_dac.c
    16.8KB
  • stm32f10x_sdio.c
    38.4KB
  • stm32f10x_usart.c
    43.2KB
  • stm32f10x_spi.c
    34.1KB
  • stm32f10x_pwr.c
    10.9KB
  • stm32f10x_dbgmcu.c
    5.1KB
  • stm32f10x_lib.c
    8.9KB
  • stm32f10x_wwdg.c
    7.3KB
  • stm32f10x_systick.c
    6.8KB
  • stm32f10x_flash.c
    31.9KB
  • stm32f10x_tim.c
    128KB
  • stm32f10x_gpio.c
    22KB
  • stm32f10x_crc.c
    4.5KB
  • stm32f10x_exti.c
    8.5KB
  • stm32f10x_fsmc.c
    40.3KB
  • stm32f10x_iwdg.c
    6.3KB
  • stm32f10x_adc.c
    57.2KB
  • stm32f10x_can.c
    30.9KB
  • stm32f10x_i2c.c
    46.7KB
  • stm32f10x_rcc.c
    42.8KB
  • stm32f10x_dma.c
    32.5KB
  • stm32f10x_bkp.c
    10.9KB
  • stm32f10x_nvic.c
    28.1KB
  • user
  • stm32f10x_conf.h
    6.2KB
  • main.c
    5.3KB
  • boot
  • cortexm3_macro.s
    10KB
  • stm32f10x_vector.c
    5.8KB
  • Debug
  • Obj
  • stm32f10x_spi.o
    42.1KB
  • stm32f10x_systick.o
    12.9KB
  • I2C_Driver.o
    28.8KB
  • stm32f10x_exti.o
    16.1KB
  • stm32f10x_dac.o
    22.6KB
  • stm32f10x_rtc.o
    24.3KB
  • stm32f10x_it.o
    95.1KB
  • cortexm3_macro.o
    2.3KB
  • stm32f10x_sdio.o
    48.7KB
  • stm32f10x_dma.o
    20.7KB
  • stm32f10x_nvic.o
    53.1KB
  • main.o
    17.5KB
  • stm32f10x_dbgmcu.o
    7.5KB
  • stm32f10x_wwdg.o
    14.7KB
  • Stm32I2c.pbd
    2.7KB
  • stm32f10x_usart.o
    48.8KB
  • stm32f10x_fsmc.o
    38.8KB
  • stm32f10x_vector.o
    7.4KB
  • stm32f10x_pwr.o
    17KB
  • stm32f10x_adc.o
    64.1KB
  • stm32f10x_i2c.o
    56.7KB
  • stm32f10x_crc.o
    11.7KB
  • stm32f10x_flash.o
    7.4KB
  • stm32f10x_gpio.o
    32.9KB
  • stm32f10x_iwdg.o
    11.8KB
内容介绍
/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : stm32f10x_tim.c * Author : MCD Application Team * Version : V2.0.3 * Date : 09/22/2008 * Description : This file provides all the TIM firmware functions. ******************************************************************************** * 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. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_tim.h" #include "stm32f10x_rcc.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ---------------------- TIM registers bit mask ------------------------ */ #define CR1_CEN_Set ((u16)0x0001) #define CR1_CEN_Reset ((u16)0x03FE) #define CR1_UDIS_Set ((u16)0x0002) #define CR1_UDIS_Reset ((u16)0x03FD) #define CR1_URS_Set ((u16)0x0004) #define CR1_URS_Reset ((u16)0x03FB) #define CR1_OPM_Reset ((u16)0x03F7) #define CR1_CounterMode_Mask ((u16)0x038F) #define CR1_ARPE_Set ((u16)0x0080) #define CR1_ARPE_Reset ((u16)0x037F) #define CR1_CKD_Mask ((u16)0x00FF) #define CR2_CCPC_Set ((u16)0x0001) #define CR2_CCPC_Reset ((u16)0xFFFE) #define CR2_CCUS_Set ((u16)0x0004) #define CR2_CCUS_Reset ((u16)0xFFFB) #define CR2_CCDS_Set ((u16)0x0008) #define CR2_CCDS_Reset ((u16)0xFFF7) #define CR2_MMS_Mask ((u16)0xFF8F) #define CR2_TI1S_Set ((u16)0x0080) #define CR2_TI1S_Reset ((u16)0xFF7F) #define CR2_OIS1_Reset ((u16)0x7EFF) #define CR2_OIS1N_Reset ((u16)0x7DFF) #define CR2_OIS2_Reset ((u16)0x7BFF) #define CR2_OIS2N_Reset ((u16)0x77FF) #define CR2_OIS3_Reset ((u16)0x6FFF) #define CR2_OIS3N_Reset ((u16)0x5FFF) #define CR2_OIS4_Reset ((u16)0x3FFF) #define SMCR_SMS_Mask ((u16)0xFFF8) #define SMCR_ETR_Mask ((u16)0x00FF) #define SMCR_TS_Mask ((u16)0xFF8F) #define SMCR_MSM_Reset ((u16)0xFF7F) #define SMCR_ECE_Set ((u16)0x4000) #define CCMR_CC13S_Mask ((u16)0xFFFC) #define CCMR_CC24S_Mask ((u16)0xFCFF) #define CCMR_TI13Direct_Set ((u16)0x0001) #define CCMR_TI24Direct_Set ((u16)0x0100) #define CCMR_OC13FE_Reset ((u16)0xFFFB) #define CCMR_OC24FE_Reset ((u16)0xFBFF) #define CCMR_OC13PE_Reset ((u16)0xFFF7) #define CCMR_OC24PE_Reset ((u16)0xF7FF) #define CCMR_OC13M_Mask ((u16)0xFF8F) #define CCMR_OC24M_Mask ((u16)0x8FFF) #define CCMR_OC13CE_Reset ((u16)0xFF7F) #define CCMR_OC24CE_Reset ((u16)0x7FFF) #define CCMR_IC13PSC_Mask ((u16)0xFFF3) #define CCMR_IC24PSC_Mask ((u16)0xF3FF) #define CCMR_IC13F_Mask ((u16)0xFF0F) #define CCMR_IC24F_Mask ((u16)0x0FFF) #define CCMR_Offset ((u16)0x0018) #define CCER_CCE_Set ((u16)0x0001) #define CCER_CCNE_Set ((u16)0x0004) #define CCER_CC1P_Reset ((u16)0xFFFD) #define CCER_CC2P_Reset ((u16)0xFFDF) #define CCER_CC3P_Reset ((u16)0xFDFF) #define CCER_CC4P_Reset ((u16)0xDFFF) #define CCER_CC1NP_Reset ((u16)0xFFF7) #define CCER_CC2NP_Reset ((u16)0xFF7F) #define CCER_CC3NP_Reset ((u16)0xF7FF) #define CCER_CC1E_Set ((u16)0x0001) #define CCER_CC1E_Reset ((u16)0xFFFE) #define CCER_CC1NE_Reset ((u16)0xFFFB) #define CCER_CC2E_Set ((u16)0x0010) #define CCER_CC2E_Reset ((u16)0xFFEF) #define CCER_CC2NE_Reset ((u16)0xFFBF) #define CCER_CC3E_Set ((u16)0x0100) #define CCER_CC3E_Reset ((u16)0xFEFF) #define CCER_CC3NE_Reset ((u16)0xFBFF) #define CCER_CC4E_Set ((u16)0x1000) #define CCER_CC4E_Reset ((u16)0xEFFF) #define BDTR_MOE_Set ((u16)0x8000) #define BDTR_MOE_Reset ((u16)0x7FFF) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ static void TI1_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection, u16 TIM_ICFilter); static void TI2_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection, u16 TIM_ICFilter); static void TI3_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection, u16 TIM_ICFilter); static void TI4_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection, u16 TIM_ICFilter); /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : TIM_DeInit * Description : Deinitializes the TIMx peripheral registers to their default * reset values. * Input : - TIMx: where x can be 1 to 8 to select the TIM peripheral. * Output : None * Return : None *******************************************************************************/ void TIM_DeInit(TIM_TypeDef* TIMx) { /* Check the parameters */ assert_param(IS_TIM_ALL_PERIPH(TIMx)); switch (*(u32*)&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_APB2Periph_TIM8, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, DISABLE); break; default: break; } } /*************
评论
    相关推荐
    • stm32模拟IIC控制RC522
      通过软件模拟IIC控制RC522实现读卡,写卡。读取IC卡号 通过软件模拟IIC控制RC522实现读卡,写卡。读取IC卡号 通过软件模拟IIC控制RC522实现读卡,写卡。读取IC卡号 通过软件模拟IIC控制RC522实现读卡,写卡。读取IC...
    • stm32 模拟iic工具代码
      STm32 iic模拟实现,简单高效,可以同时模拟多个iic接口,代码已经适用于多种芯片例如at24C32 ssd1306(淘宝上能买到的iic液晶)ds1307(iic实时时钟),并在多个iic器件挂载到同一条iic总线上时能够同时工作!...
    • STM32 模拟IIc
      stm32 操作 eeprom 模拟iic,各位看看相互学习提高吧
    • STM32 GPIO模拟IIC
      STM32 GPIO模拟实现IIC功能,相比STM32硬件IIC更加稳定。
    • STM32 IO模拟IIC
      STM32F103C8T6 使用IO口模拟IIC 测试过可以使用
    • stm32f103模拟IIC
      这是stm32f103的模拟IIC源码程序,当引脚IIC的引脚不够用时使用,已测试好用。
    • STM32模拟IIC
      STM32的硬件IIC非常不好用,有很多的问题,容易死在while里面 很多情况下都需要依靠模拟IIC来实现,这个例程已经在开发板上顺利测试通过,适合24C02~24C16,24C32以上本人没有测试过!
    • STM32模拟IIC代码
      STM32模拟IIC代码 void I2C_GPIO_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Configure I2C1 pins: SCL and SDA */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; GPIO_InitStructure.GPIO_...
    • stm32F4 模拟IIc
      stm32F4 模拟IIc 简单更改Io口,自己写的,经过多次测试没有问题 q-175-543-7233
    • MPU6050 模拟IIC STM32
      MPU6050 模拟IIC STM32,可直接使用