Serial Comms and Crystals


Closed Thread
Results 1 to 40 of 43

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,666


    Did you find this post helpful? Yes | No

    Default Re: Serial Comms and Crystals

    does your program use interrupts ? if so how long does the isr take to execute ?
    the tolerance here is 10uS + or - so an interrupt can easily cause the timing tolerance to be exceeded
    possible solutions
    1. disable interrupts during dht read
    2. increase tolerance
    3. ignore bad reading and retry
    4. remove the noise test
    Code:
    t2con=0
     
    if ((tmr2>12)&&(tmr2<50)) then ' noise ?
     if (tmr2 >31 ) then
     dht.0[bits] = 1 
    
     endif 
    
     else
     goto badread ' noise ?
    
     endif
    5. use a faster chip

  2. #2
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Serial Comms and Crystals

    To get a better understanding what is going on, why don't you make a small change for debugging.

    Instead of this...
    Code:
    for bits =39 to 0 step -1
        tmr2=0
        while (!dht_data) 
        wend 
        t2con=6
        while ( dht_data) 
        wend 
        t2con=0
        if ((tmr2>12)&&(tmr2<50)) then ' noise ?
            if (tmr2 >31 ) then
                dht.0[bits] = 1 
            
            endif 
        
        else
            goto badread ' noise ?
        endif
    next
    Do this instead...
    Code:
     
     for bits =39 to 0 step -1
         tmr2=0
         while (!dht_data) 
         wend 
         t2con=6
         while ( dht_data) 
         wend 
         t2con=0
         if tmr2 <= 12 then goto tooshort
         if tmr2 => 50 then goto toolong
         if (tmr2 >31 ) then
            dht.0[bits] = 1 
         endif 
    
     next
    Then create the 2 subs, tooshort and toolong and have each print a different error message.
    Regards,
    TABSoft

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Serial Comms and Crystals

    TI and Silicon Labs have RH/Temperature devices with an I2C interface in the $5.00 single part range: Si7013, Si7020, Si7021 2%-4% accuracy TI HDC1000 and HDC1008 similar accuracy specification. Both are available at Digikey. Honeywell also has a device, HIH6130, but it is a bit more expensive, at $14.
    Tim Barr

  4. #4
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Serial Comms and Crystals

    Guys, thanks for the additional replies,

    @Tim, I'll check out those suggestions... cheers

Similar Threads

  1. PC Serial comms
    By Bill Legge in forum Serial
    Replies: 7
    Last Post: - 13th December 2009, 23:37
  2. Simple Serial Comms.
    By koossa in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd November 2007, 08:12
  3. Some comments on serial comms please.
    By muddy0409 in forum Schematics
    Replies: 1
    Last Post: - 15th June 2007, 09:53
  4. Serial Comms Buffer?
    By koossa in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd December 2005, 01:29
  5. Serial comms / Bootloader
    By koossa in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 30th October 2005, 18:48

Members who have read this thread : 0

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