I have a few DHT11 sensors and a couple psoc 4's and a psoc 3 030 dev kit. I found some discussions, questions, and posted projects on this forum which did not work and finally I found this project online. I need to build it and test it and will soon.
I'm trying to get the DHT11 to work with either / both my psoc 4 and psoc 3 devices. There are a couple approaches to do this. The first is to do it all in code like the arduino guys do and the online project mentioned above where you set the chip to "CYEnterCriticalSection()" for timing and increment a variable as a reference count and compare the chip signals to that reference and determine if it is a 1 or a 0 and build the bytes. I think that is a pretty clever solution, but it defeats the purpose of psoc which is to use the analog and digital peripheral capabilities.
My intent here with this post isn't to get you to do work for me. I want to understand how to make the chip do my bidding and right now I simply "don't get it." I'm not going to post a complete project at first for you to fix and send back. I'd really like a description of how I should approach the problem so next time I'm not running back here for someone to do it for me again.
Specifics: DHT11 uses a 1 wire communication that is pulled high. The user pulls the data pin low for 18 ms, then releases it and the chip responds with a 80 uSec low pulse, an 80 uSec high pulse and then a 40 bit data stream. Each bit is prefaced with a 50 us low section followed by a "high" bit of either 26 us or 70 us to indicate a 0 or 1 respectively.
My attempt with the timer component:
measure this 26 uSec or 70 uSec high signal on the pin using a timer component
clock it at 1 mhz, period at 200 for a (200 us)
reset with a 0 and enable it in software after pulling pin low for 18 ms while the pin is high
wire the data input pin (set as bidirectional) to both the trigger and capture inputs
trigger on the rising edge and capture on the falling edge
Enable in software
I don't have a scope to see any of this, so I don't know if it works, but I bought 4, so I'm pretty sure one should work.
1. Can you use the same line to trigger and capture in a timer component?
2. How do you set up the ISR so you don't miss the next pulse? It needs to clear the ISR and determine if the pulse time is > 30 uSec to store a 1. What needs to be serviced in the ISR so it keeps running? I understand it counts down from the period max, in this case 200.
3. Am I even on the right track here? Is the software method in the online example the best way to do this or is there an even better way that is simpler and more efficient?
4. What does the tc output and interrupt output do on the top design timer block? I don't think I need those.
5. Should I use a shift register component to feed in the 1's 0's and build the bytes for the measured value?
Thanks for any perspective or information you can offer.