Dht11 - 16f877a


Results 1 to 15 of 15

Thread: Dht11 - 16f877a

Threaded View

  1. #10
    Join Date
    Mar 2014
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Dht11 - 16f877a

    Quote Originally Posted by EarlyBird2 View Post
    Publish the code you tested please.
    Hi, thank you for the response, code that tests are:
    Code:
    @ errorlevel-306
    INCLUDE "modedefs.bas"
    Define OSC 20 ' 20MHz 
    Define    ADC_BITS    10    ' Set number of bits in result
    Define    ADC_CLOCK    3    ' Set clock source (3=rc)
    Define    ADC_SAMPLEUS    50    ' Set sampling time in uS 
    
    dht var byte[32]
    humidite var byte
    haut var byte
    bas var byte
    temp var byte
    x var byte
    dht11 var portb.0
    
    start:
    TRISB.0 = 0 '
    high  dht11  
    pause 2000 ' wait 2 sec
    low dht11  : pause 18' send 20ms low
    high dht11  : pauseus 30 ' send 40us hi
    TRISB.0 = 0
    PulsIn PORTB.0, 1, haut 
    if haut < 15 then goto start
    for x = 31 to 0 step-1 
    PulsIn PORTB.0, 1, dht[x] ' 1
    next x
    For x = 31 to 0 step-1 
    if dht[x] > 9 then
    dht[x]=1 
    else
    dht[x]=0
    endif
    next x
    humidite=dht[31]*128+dht[30]*64+dht[29]*32+dht[28]*16+dht[27]*8+dht[26]*4+dht[25]*2+dht[24]*1
    temp=dht[15]*128+ dht[14]*64+dht[13]*32+dht[12]*16+dht[11]*8+dht[10]*4+dht[9]*2+dht[8]*1
    SEROUT2 PORTC.5,16468,["Humidite = ",#humidite,"% ",10 ,13]
    SEROUT2 PORTC.5,16468,["Temperature = ",#temp,"C ",10 ,13]
    goto start
    Last edited by Archangel; - 29th March 2015 at 00:20.

Similar Threads

  1. DHT11? Code/Schematics?
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th June 2013, 09:35
  2. DHT11 Temperature/Humidity sensor
    By mircogomiero in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th January 2013, 12:37
  3. 16F877a - Please Help
    By tarexpanda in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd April 2007, 08:28
  4. 16f877a
    By alaaodeh in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th February 2007, 23:38
  5. I need help with 16F877A
    By valerij in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th December 2006, 17:05

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