You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -50,13 +50,15 @@ The DHT22 Sensor is a temperature/humidity sensor that uses a custom single wire
50
50
3. After another 50 microseconds, the sensor starts transmitting data
51
51
<br>
52
52
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
+
53
54
<br><imgsrc="images/DHT22_Signal.png">
54
55
55
56
## System Design
56
57
57
58
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:
| 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
119
122
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.
120
123
121
124
**Pin Mapping**
125
+
122
126
| Signal | Pin |
123
127
|:--------------:|:------:|
124
128
| DHT22 | RD3 |
@@ -127,6 +131,10 @@ Once the peripherals are configured and code has been generated, all that is nee
127
131
**Hardware**
128
132
<br><imgsrc="images/HPC_Board.png"><br>
129
133
134
+
**Serial Port Output**
135
+
136
+
<br><imgsrc="images/terminal_output.png"><br>
137
+
130
138
## Summary
131
139
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.
0 commit comments