看到有人分享“MSP430 Launchpad SHT10传感器”,我也来分享下MSP430 Launchpad SI7021温湿度传感器。
IIC采用I/O口模拟,方便大家程序移植。
/*****************************Copyright (c)*************************************
** PP-DIY
**-----------------------------File Info----------------------------------------
** File name: SI7021
** Created by: P.P
** Last modified Date: 2014-10-3
** Descriptions: MSP430G2xx3演示板+SI7021温湿度传感器
** Online shopping: http://wsn-pp.taobao.com/
** QQ:44960120
********************************************************************************
** MSP430G2xx3 Demo - USCI_A0, 115200 UART Echo ISR, DCO SMCLK , Simulate IIC
** Description: Echo a received character, RX ISR used.
** USCI_A0 RX interrupt triggers TX Echo.
** Baud rate divider with 1MHz = 1MHz/9600 = ~104
** ACLK = n/a, MCLK = SMCLK = CALxxx_1MHZ = 1MHz
** SI7021_SDA=>1.4
** SI7021_CLK=>1.5
**
** MSP430G2xx3
** -----------------
** /|\| XIN|-
** | | |
** --|RST XOUT|-
** | |
** | P1.2/UCA0TXD|------------>
** | | 9600 - 8N1
** | P1.1/UCA0RXD|<------------
** | |
** LED--|P1.0 P1.4|<----->SI7021_SDA
** | | SI7021
** | P1.5|------>SI7021_CLK
** | |
** PP-DIY
** 3/10. 2014
** Built with IAR Embedded Workbench Version: 5.40 and MSP-EXP430G2 Version:1.5
** BoardaunchPad Mcu: M430G2553 Sensors:SI7021
** 项目文件6个:include.h/sys.h/io.h/SI7021.h/main.c/SI7021.c/
** 演示板每隔1S读取SI7021温湿度数据,通过串口P1.2发出如下格式信息:
** "SI7021:Temperature=27.3'C Humidity=68.9%"
*******************************************************************************/
复制代码
|