Skip to content

Commit 0ac890f

Browse files
MPAE-18704 added serial port output image. Fixed tables in readme. Fixed image not showing up in readme
1 parent d85be3a commit 0ac890f

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ The DHT22 Sensor is a temperature/humidity sensor that uses a custom single wire
5050
3. After another 50 microseconds, the sensor starts transmitting data
5151
<br>
5252
The sensor transmits each bit by pulling the data line low for 50 microseconds and then releasing the line. To transmit a `'0'` the sensor releases the line for 28 microseconds before transmitting the next bit. To transmit a `'1'`, the sensor releases the line for 70 microseconds before transmitting the next bit. The waveform below illustrates the transmission process.
53+
5354
<br><img src="images/DHT22_Signal.png">
5455

5556
## System Design
5657

5758
Using the SRPORT and CIPs, getting data from the DHT22 sensor can be done entirely in hardware with no software intervention. The first step to designing a state machine to read the DHT22 sensor is to define the necessary system states. This state machine will have six states, each of which can be encoded using a three bit number:
5859
<br><br>
5960
**DHT22 System States**
61+
6062
| State | Output | Binary Encoding |
6163
|:--------:|:--------------------------------------------:|:------------------:|
6264
| IDLE | Data line is released. No transaction on bus | `000` |
@@ -67,6 +69,7 @@ Using the SRPORT and CIPs, getting data from the DHT22 sensor can be done entire
6769
| RX | DHT22 is transmitting data bits | `101` |
6870

6971
The state machine will have three inputs:
72+
7073
| Input Label | Source | Description |
7174
|:-------------:|:-----------------:|:------------------------------------------------:|
7275
| U | Universal Timer B | Generates a 20ms low pulse to start transmission |
@@ -119,6 +122,7 @@ Once the state machine logic has been defined, the system can be implemented usi
119122
Once the peripherals are configured and code has been generated, all that is needed to start a transmission is to start Timer Counter B. Once Timer Counter B is started, the state machine in combination with the DMA and SPI modules will handle the reception of five bytes from the DHT22 sensor. An interrupt from the DMA alerts the application once all five bytes have been transferred. After the five bytes have been received, a checksum is performed in software to validate the data. If the checksum passes, the temperature and humidity readings are sent to the PC using one of the on-chip UARTs of the MCU and the Virtual Serial Port of the Curiosity HPC board.
120123

121124
**Pin Mapping**
125+
122126
| Signal | Pin |
123127
|:--------------:|:------:|
124128
| DHT22 | RD3 |
@@ -127,6 +131,10 @@ Once the peripherals are configured and code has been generated, all that is nee
127131
**Hardware**
128132
<br><img src="images/HPC_Board.png"><br>
129133

134+
**Serial Port Output**
135+
136+
<br><img src="images/terminal_output.png"><br>
137+
130138
## Summary
131139
The SR PORT allows for advanced interconnectivity between CIPs on PIC microcontrollers. It also has the ability to individually configure each bit as a flip-flop, which enable allows the SR PORT to act as a memory element in a hardware state machine. Using the SR PORT in combination with the CLCs makes it possible to build core-independent state machinces that can offload tasks from the CPU and greatly increase system performance. This code example shows how the SR PORT can be used to seamlessly connect the on-chip peripherals of PIC microcontrollers and use the flip-flop feature of the SR PORT to implement a hardware state machine that is useful in a real-world scenario.
132140

images/Mealy State Machine.png

62 Bytes
Loading

images/Moore State Machine.png

71 Bytes
Loading

images/terminal_output.png

37.7 KB
Loading

0 commit comments

Comments
 (0)