资源简介
STM32F103单片机, SHT30温湿度检测,从工程中抽出; 有相关资料,及原厂例程;连接图片,及工作中的小经验分享;

代码片段和文件信息
//==============================================================================
// S E N S I R I O N AG Laubisruetistr. 44 CH-8712 Staefa Switzerland
//==============================================================================
// Project : SHT3x Sample Code (V1.0)
// File : i2c_hal.c (V1.0)
// Author : RFU
// Date : 16-Jun-2014
// Controller: STM32F100RB
// IDE : 礦ision V4.71.2.0
// Compiler : Armcc
// Brief : I2C hardware abstraction layer
//==============================================================================
//-- Includes ------------------------------------------------------------------
#include “i2c_hal.h“
//-- Defines -------------------------------------------------------------------
// I2C IO-Pins /* -- adapt the defines for your uC -- */
// SDA on port B bit 14
#define SDA_LOW() (GPIOB->BSRR = 0x40000000) // set SDA to low
#define SDA_OPEN() (GPIOB->BSRR = 0x00004000) // set SDA to open-drain
#define SDA_READ (GPIOB->IDR & 0x4000) // read SDA
// SCL on port B bit 13 /* -- adapt the defines for your uC -- */
#define SCL_LOW() (GPIOB->BSRR = 0x20000000) // set SCL to low
#define SCL_OPEN() (GPIOB->BSRR = 0x00002000) // set SCL to open-drain
#define SCL_READ (GPIOB->IDR & 0x2000) // read SCL
//==============================================================================
void I2c_Init(void){ /* -- adapt the init for your uC -- */
//==============================================================================
RCC->APB2ENR |= 0x00000008; // I/O port B clock enabled
SDA_OPEN(); // I2C-bus idle mode SDA released
SCL_OPEN(); // I2C-bus idle mode SCL released
// SDA on port B bit 14
// SCL on port B bit 13
GPIOB->CRH &= 0xF00FFFFF; // set open-drain output for SDA and SCL
GPIOB->CRH |= 0x05500000; //
}
//==============================================================================
void I2c_StartCondition(void){
//==============================================================================
SDA_OPEN();
DelayMicroSeconds(1);
SCL_OPEN();
DelayMicroSeconds(1);
SDA_LOW();
DelayMicroSeconds(10); // hold time start condition (t_HD;STA)
SCL_LOW();
DelayMicroSeconds(10);
}
//==============================================================================
void I2c_StopCondition(void){
//==============================================================================
SCL_LOW();
DelayMicroSeconds(1);
SDA_LOW();
DelayMicroSeconds(1);
SCL_OPEN();
DelayMicroSeconds(10); // set-up time stop condition (t_SU;STO)
SDA_OPEN();
DelayMicroSeconds(10);
}
//==============================================================================
etError I2c_WriteByte(u8t txByte){
//==============================================================================
etError error
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 950847 2016-03-29 15:55 Sensirion_Humidity_SHT3x_DIS_Datasheet.pdf
目录 0 2018-03-09 21:11 sht30\
文件 6111 2014-06-17 15:50 sht30\i2c_hal.c
文件 3509 2014-06-17 15:51 sht30\i2c_hal.h
文件 6310 2016-03-30 09:49 sht30\main.c
文件 20877 2014-06-17 15:49 sht30\sht3x.c
文件 21703 2014-11-17 16:39 sht30\sht3x.h
文件 1183 2016-03-30 09:06 sht30\system.c
文件 1998 2016-03-29 18:01 sht30\system.h
文件 3156 2014-06-17 16:50 sht30\typedefs.h
文件 10013 2016-03-29 17:48 SHT3x_Sample_Code_V1_D2-原厂例程.7z
文件 236 2018-03-09 21:11 一定要看.txt
文件 5837 2016-03-29 16:17 接口.png
文件 737829 2015-08-17 12:06 温湿度敏感芯片传感器HTU21D.pdf
相关资源
- 基于stm32f103ve的程序——跑马灯实验
- 基于STM32RCT6的步进电机驱动程序
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- STM32蓝牙和串口程序
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- stm32f030 IAP Demo(原创)
- STM32基于rt_thread操作系统的SDHC卡文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
- STM32F103 CC2500完整驱动(模拟SPI)
- AD7606采集程序
- stm32 用SPI 方式读写 SDHC
- stm32通过DMA方式采集ADC数据
- 意法半导体STM全系列微控制器STM32ST
- 基于STM32芯片的SX1278 驱动 LORA.rar
- STM32的PCB封装库,以及原理图库,48
- SX1280.rar
评论
共有 条评论