EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #355 background imageLoading...
Page #355 background image
355
One Wire (OW) Interfacing DHT22 Hygrometer Sensor
Like DS18B20, DHT22 (a.k.a AM2302) digital relative humidity-temperature or hygrometer sensor uses
time-slotting principle over one wire to transfer data to its host controller. Apart from other technical
specs, these sensors differ in terms of time-slots and in the process of data exchanging and
communication bus arbitration. Since data is transferred digitally over one wire, there is no need for
such sensors to be present on board and close to the host MCU. Thus, such sensors can be placed
significantly far from the host micro. This is not so easily possible with analog sensors or with sensors
using multiple wires. This feature is what makes OW communication method an impressive one.
Code Example
DHT22.h
#include <msp430.h>
#include <delay.h>
#define DHT22_DIR P2DIR
#define DHT22_OUT_PORT P2OUT
#define DHT22_IN_PORT P2IN
#define DHT22_PIN BIT0
#define DHT22_DIR_OUT() do{DHT22_DIR |= DHT22_PIN;}while(0)
#define DHT22_DIR_IN() do{DHT22_DIR &= ~DHT22_PIN;}while(0)
#define DHT22_IN() (DHT22_IN_PORT & DHT22_PIN)
#define DHT22_OUT_LOW() do{DHT22_OUT_PORT &= ~DHT22_PIN;}while(0)
#define DHT22_OUT_HIGH() do{DHT22_OUT_PORT |= DHT22_PIN;}while(0)
#define TRUE 1
#define FALSE 0
extern unsigned char values[5];
void DHT22_init(void);
unsigned char DHT22_get_byte(void);
unsigned char DHT22_get_data(void);

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals