Help with DS18B20 program


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    With it being that close I'm quite certain that is the source of your problems. Any little bit of heat and the sensor will find it.

  2. #2
    Join Date
    May 2012
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: Help with DS18B20 program

    hello dears..
    May anyone helps me to get the code of the ds18b20 on proton ide that will show me the temperature on a graphical lcd?I used this one but it's not working can anyone find the error in this code??

    Device 16F877
    XTAL
    =4
    Declare
    LCD_DTPORT PORTB
    Declare LCD_RSPIN PORTC.7
    Declare
    LCD_RWPIN PORTC.6
    Declare
    LCD_ENPIN PORTC.5
    Declare
    LCD_CS1PIN PORTC.4
    Declare
    LCD_CS2PIN PORTC.3
    Declare
    LCD_TYPE GRAPHIC
    GLCD_CS_INVERT On
    INTERNAL_FONT On
    FONT_ADDR
    =0
    Declare
    ADIN_RES 10
    Declare
    ADIN_TAD 2_FOSC
    Declare
    ADIN_STIME 50
    ADCON1 = %10000000
    TRISA = $ff
    TRISB = $00
    TRISC =%11000000
    TRISD =%11000000
    DelayMS 200
    Dim SPTemperature As Word
    ' scratchpad temperature storage
    Dim Reserved0 As Byte ' scratchpad reserved variable
    Dim Reserved1 As Byte ' scratchpad reserved variable
    Dim Reserved2 As Byte ' scratchpad reserved variable
    Dim Reg_TH As Byte ' scratchpad TH register or User Byte 1
    Dim Reg_TL As Byte ' scratchpad TL register or User Byte 2
    Dim Reg_Config As Byte ' scratchpad configuration register
    Dim CRC As Byte ' scratchpad CRC register
    Dim Temperature As Float ' temperature result
    Symbol DQ = PORTD.1 ' one-wire data pin
    While 1=1
    OWrite DQ, 1, [$CC, $44]
    ' skip ROM search And start temperature conversion
    While ORead DQ, 4 = 0 ' check for still busy converting
    Wend

    OWrite
    DQ, 1, [$CC, $BE] ' skip ROM search And read the temperature
    ORead DQ, 0, [SPTemperature.LowByte, SPTemperature.HighByte, Reg_TH,Reg_TL,Reg_Config,Reserved0,Reserved1,Reser ved2,CRC]
    Temperature = 0.0625 * SPTemperature
    ' convert to degrees C
    Print At 1,1,@Temperature, "C",
    Wend
    End

    Many thanks

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Replies: 1
    Last Post: - 23rd May 2009, 09:22
  3. Compile and Program help using PICKit2
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th March 2009, 14:51
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. PIC16F684 Program question
    By Nicholas in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th December 2006, 14:30

Members who have read this thread : 2

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