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 #356 background imageLoading...
Page #356 background image
356
DHT22.c
#include "DHT22.h"
unsigned char values[5];
void DHT22_init(void)
{
DHT22_DIR_IN();
delay_ms(1000);
}
unsigned char DHT22_get_byte(void)
{
unsigned char s = 8;
unsigned char value = 0;
DHT22_DIR_IN();
while(s > 0)
{
value <<= 1;
while(DHT22_IN() == FALSE);
delay_us(30);
if(DHT22_IN())
{
value |= 1;
}
while(DHT22_IN());
s--;
}
return value;
}
unsigned char DHT22_get_data(void)
{
unsigned char chk = FALSE;
unsigned char s = 0;
unsigned char check_sum = 0;
DHT22_DIR_OUT();
DHT22_OUT_HIGH();
DHT22_OUT_LOW();
delay_ms(1);
DHT22_OUT_HIGH();
delay_us(32);
DHT22_DIR_IN();

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