Skip to content

thalyssonbs/Pic16DHT22

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assembly instructions for serial communication between PIC16F877A and DHT22

The physical circuit assembled is shown by the figure below!

Hardware configuration

  • PIC16F877A 40 pins;
  • LCD Display 16x2 8 bit connection;
  • 4 MHz oscillator crystal;
  • 22 pF ceramic disc capacitors.

PIC Peripheral features used in this work

  • TIMER0 Module;
  • TIMER1 Module;

An Assembly source code was developed to establish a communication protocol between the sensor module DHT22 (AM2302) and the PIC16F877A Microchip microcontroller. The reading values are displayed on an LCD display, connected to the microcontroller throught an 8 bit connection, as shown by the figure below.

DHT22 Data Reading

The DHT22 module sensor sends the reading values after a 18ms low level signal sent by the microcontroller. The figure below shows the start signal sent by the microcontroller (orange line), followed by sensor response (blue line), which starts with two alternating bits of 80us each.

Alt text

After that, the reading values are sent by the sensor as 16-bits numbers in a 40-bits set, which contains the relative humidy, temperature, and an 8-bit number for checksum, respectively.

The figure below shows the bit sequence sent by the sensor, as well as the division of bytes. Alt text

Reading Sequence

The developed program reads the sent bytes through the logic represented by the flowchart in the figure below.

About

DHT22 assembly code for PIC16F877A

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published