dht22 using bit field array and ext references


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383

    Default dht22 using bit field array and ext references

    I thought I would have a go at making a better dht reading routine , note this code uses a 64mhz clk that conveniently provides a 1uS increment with for a timer prescale of 16. if you choose a different clk then the timer prescale and or the timing limits will need adjusting.
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: dht22 using bit field array and ext references

    Hi Richard,

    Have you tested the length of cable/wire that can reliably be used with these sensors? And if you have, does it make a difference if the resistor is at the sensor or at the PIC?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: dht22 using bit field array and ext references

    Have you tested the length of cable/wire that can reliably be used with these sensors? And if you have, does it make a difference if the resistor is at the sensor or at the PIC?
    no not at all I have the unit mounted on the cpu pcb with no pull up resistor at all , just using wpub and a 3.3v rail. The data sheet (am2302) implies that 100m transmission is possible with a 1k pull up and shielded cable . not really sure why the pull up resistor location would make a difference assuming that the cable resistance is very low compared to the pull up value . my remote sensor (outside) is a wireless connection with a rfm69cw , so cable transmission is not something I have looked into

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: dht22 using bit field array and ext references

    Thanks Richard. I have used the DHT11 with 50 foot of wire and the resistor at the MCU. My boy is trying a DHT22 with the resistor at the module. He is getting strange readings. I have not seen his setup yet to figure out the problem.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: dht22 using bit field array and ext references

    with a little bit more code now it can do dht11 and dht22 sensors just by setting a var sens_type to 11 or 22

    see this thread for adjusting timers for a different fosc

    http://www.picbasic.co.uk/forum/showthread.php?t=19873
    Attached Files Attached Files

Similar Threads

  1. DHT22, AM2302 and pic18F2320
    By bitmaniac in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 15th November 2015, 01:42
  2. ShiftIn to array of bits using EXT modifier?
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th March 2011, 15:30
  3. Symbolic bit references for SFR's
    By khaynes in forum PBP Wish List
    Replies: 0
    Last Post: - 18th March 2008, 23:17
  4. Help with bit array
    By Dick M in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th August 2006, 18:31
  5. Problem with bit array
    By Dick M in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th May 2005, 18:03

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts