After helping out others a few times here on the forum implementing DHT series Humidity/Temperature sensors,
I thought I might put together a DHT Sensor support library for PBP and hopefully others can benefit from it.

I must give a huge thank you to "Scampy" on this forum, as he was key to this library getting completed.
He provided great improvement suggestions and did the vast majority of the real world testing of the library in its various versions.

A Note of caution when using this library.
Retrieving data from these sensors is time sensitive since once initiated the sensor streams all of the data bits until it's finished.
Because of this fact, if you are using Interrupts you may want to disable them during the Sensor read sequences.
This information is highlighted in the source code at the points where an Interrupt may cause issues.

The DHT family of sensors uses a proprietary 1-wire interface where the data sent by the sensor is a time-driven high pulse.
The sensor sends a "0" as a high pulse of 26-28us long and a "1" as a high pulse of 70us long.
So some means of measuring the duration of a High signal is required for accurate use.

There are many ways to communicate with and retrieve data from these sensors and measuring the pulses, from using
PIC HW timers to using pure PBP software commands, each with its own benefits.
While HW timers are very accurate, it does require the Timer HW module of the PIC.
Using the Timer module to aid in the communication with the sensor can limit the ease of implementation of a library.
Once you settle on a Timer to use, surely someone will not be able to use that Timer module for one reason or another.
This will lead to customization of the library by the user, so I have opted for a software approach instead.

The consistent stumbling block with reading the data from the sensor, that I noticed, was the manual computation of
timing/count values to determine data "0s" and "1s" coming from the sensor for various oscillator speeds.

So this lead me to the primary goal of a library that would automatically compute these values.

With the primary goal established, I came up with following objectives for the library that I believe to have accomplished.

Code:
1. Software Implementation
    * (not bound to PIC hardware modules)
    * Use any available Digital Input Pin on the PIC
    * Facilitate portability across various PIC MCUs and User Apps
    % Achieved
        - Similar to a "Function" call 
2. Standard PBP Commands
    * Stay away from ASM (for the most part)
    * Support for PBP v2.6 and higher
    % Achieved with PULSIN (and a small amount of ASM for ease of use)
3. Consistent Interface Supporting Multiple Sensor Types
    * All parameters passed and data returned from the library consistent for all Sensor Types supported
    % Achieved 
        - Supports DHT11, DHT21, DHT22, AM2302 sensors (uniform parameters)
        - All data returned is consistently formatted 
4. Support for Multiple Concurrent Sensors
    * Support scalability from 1 to many sensors
    % Achieved - Currently has 4 sensors but can be scaled up or down 
5. Ease of Use
    * As few "knobs" to manually turn as possible
    * Make it an Include file
    % Achieved 
        - (3) Statements to invoke: Sensor Number=, Sensor Type=, Gosub DHT_READ
        - (1) Alias for each sensor used, (1) Constant for MAX Sensors, (1) DEFINE for PULSIN_MAX, (1) Standard DEFINE OSC x
        - Variability of internal settings computed automatically at compile time
        - Single Include File
6. Quick Response Time
    * Return the data or errors as fast as possible
    % Achieved 
        - User parameters, Comms Initialization and Timeout errors are checked
        - Short-circuit logic returns to calling program upon errors
7. Support a Wide Selection of MCU Speeds
    * Support as many, if not all of the supported PBP "DEFINE OSC" values
    % Achieved
        - Supports 8,10,12,16,20,24,25,32,33,40,48 & 64 MHz OSC values. 
        - (3 & 4 MHz not supported in this library) 
8. Robust Error Checking/Reporting
    * Error-check user and sensor data
    * Return Error values for user evaluation
    % Achieved
        - Alarms and Messages during compile time
        - Returns an Error byte with (8) error conditions for user evaluation
        - Returns both received and computed checksum of sensor data
I believe the source code is well commented, so it should be fairly easy to use and understand.
I have included Notes and Warnings within the code to call attention to how to use the library effectively.

I hope you find this library beneficial.

BTW:

For those who are interested, I do have a PBP v3 only library that makes the use simpler, in my opinion.
Use:
The same as before. (3) Statements

Setup:
(1) Alias for each sensor used
(1) #Define to enable each sensor used
(1) #Define for the Oscillator Speed (This is additional to the standard PBP Define OSC x statement which is required)

This structure allows the compilation process to use #ifdef statements to select and compile only code for the sensors used,
and to select the proper PULSEIN_MAX value among other things.
This eliminates manually commenting out code for unused sensors to ensure more compact compiled code.

PBP_DHT_LIB:PBP_DHT_LIB.zip