one wire


Results 1 to 8 of 8

Thread: one wire

Threaded View

  1. #3
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Thanks, that actually helped a LOT, even though it threw me at first and I had to read it several times...

    IF I've got what your saying right, the code to use a standard 4 line lcd module becomes this?
    Code:
    '****************************************************************
    '*  Name    : 1-Wire-ID.Bas                                     *
    '*  Author  : Bruce Reynolds, modified by Me!                   *
    '*  Date    : 18/16/2008                                        *
    '*  Version : 1.1                                               *
    '*  Notes   : 1-Wire Identifier                                 *
    '*          ; Identifies & Prints 1-Wire Device Information     *
    '*          : Uses 20 x 4 PARELLEL LCD for Display              *
    '****************************************************************
    DEFINE  LOADER_USED 1   ' Boot loader is being used
    DEFINE  OSC 4           ' We're using a 4 MHz oscillator
    DQ      VAR PortC.0	' One-wire data pin "DQ" on PortC.0
    
    ID      VAR BYTE[8]     ' Array storage variable for 64-bit ROM code
    
    Begin:
        PAUSE 500           ' Wait .5 second
        lcdout $fe, 1       ' Clear LCD on power-up
        
    Start_Convert
        OWOUT DQ, 1, [$33]  ' Issue Read ROM command
    
    ID_Loop:
        OWIN DQ, 0, [STR ID\8]' Read 64-bit device data into the 8-byte array "ID"
        lcdout $FE, $80 "Family Code = ",HEX2 ID[0],"h"
        lcdout $FE, $C0"Ser# = ",HEX2 ID[1],HEX2 ID[2],HEX2 ID[3],HEX2 ID[4],HEX2 ID[5],HEX2 ID[6],"h"
        lcdout $FE, $94  "CRC Value = ",HEX2 ID[7],"h"
    ID_Device:
        IF ID[0] = $5 THEN
           lcdout $FE, $D4, "Device = Switch     "
        ENDIF
        IF (ID[0] = $28) OR (ID[0] = $22) THEN
           lcdout $FE, $D4 "Device = Temp Sensor"
        ENDIF
        IF ID[0] = $01 THEN
           lcdout $FE, $D4 "Device = Serial #   "
        ENDIF
        PAUSE 10000         ' 10-second pause
        GOTO Start_Convert 
        
        END
    And follow the schematic, POT and all (several seem to not use the pot and wonder why it will not work, some LCDs will not require it, but when in doubt...)
    POT??? Didn't actually see a schematic. I'm assuming you mean the pot to vary the contrast of the lcd?

    Oh sorry 2 other things
    I assume this can be used with most small pic's ?
    2nd one
    Using a DS2405 switch, am I right in thinking that once I've sent a command to either turn it on or off then it stays latched in that state untill it's addressed again and told to do something else?

    Just seen another problem.
    Code:
     
    OWOUT DQ, 1, [$55,$05,$C5,$C3,$08,$00,$00,$00,$CD]' Match ROM, byte-sized, reset before
    I understand the $55 is Match rom BUT it says
    Code:
    The red hexadecimal number $55 is the command for Match ROM. 
    The blue hexadecimal numbers $05,$C5,$C3,$08,$00,$00,$00,$CD 
    are the unique 64-bit ROM code numbers inside the specific DS2405 
    addressable 1-wire switch we're trying to communicate with.
    The problem I have is the hex code for the device
    Using his device ID routine (above) it comes back with an example but only shows 6 sets of 2digit Hex numbers but above addressing the 1wire units, it shows the address as 8 sets of 2 digits

    UNLESS? in his example aboe the $05 is the family code, and the $CD at the end is the CRC code??
    So any device I want to address I'd put the Family code first then the 64bit address then finish it with the CRC code?
    Last edited by karenhornby; - 18th June 2008 at 13:46.

Similar Threads

  1. 1 Wire Search Routine
    By Dave in forum Code Examples
    Replies: 3
    Last Post: - 4th March 2016, 07:39
  2. Need Single wire serial LCD converter example
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 16th December 2009, 02:30
  3. how can I make 1 wire between two pic 16f877
    By povulon in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 30th July 2008, 14:44
  4. Oscillator stops when touching with a wire
    By Wilbert Ingels in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 25th April 2008, 08:51
  5. RPM with wire and PIC
    By Dwayne in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th December 2004, 20:42

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