Which 1 wire eeprom to use


Results 1 to 5 of 5

Threaded View

  1. #5
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126


    Did you find this post helpful? Yes | No

    Default Got it working !

    Here is the secret to get it working. I did some debugging with my Salae Logic debugging tool and watched the data coming back and forth - very cool debugging tool.

    Here is the snippet of the code than handles the reading and writing of the values. In the write section I added 7 dummy bytes as the unit can only write an 8 byte minimum. I used 'bcd' for my dummy bytes as it is my company initials, but you could use h00.

    <code>
    ' this is where we write the value to the one wire eeprom
    ' first off we write to the scratchpad
    OWOUT DQ,1,[$CC,$0F,$00,$00,mode,$bc,$db,$cd,$bc,$db,$cd,$BC] ' write the mode data and 7 dummy bytes.
    OWIN DQ,0,[OnewROM, oneWROM] ' read back the two CRC bytes (we don't care about them so they go into a generic bucket)
    ' then we read it back to get a memory access key
    OWOUT DQ,1,[$CC,$AA] ' read back the memory code and data
    OWIN DQ,0,[TA1,TA2,ES,OneWrom1,OneWrom2,OneWrom3,OneWrom4,One Wrom5,OneWrom6,OneWrom7,OneWrom8,OneWRom, OneWRom]
    ' debug "Returned Data:", hex2 TA1, hex2 TA2, hex2 ES, hex2 OneWrom1, hex2 OneWrom2, hex2 OneWrom3, hex2 OneWrom4, hex2 OneWrom5, hex2 OneWrom6, hex2 OneWrom7, hex2 OneWrom8, 10
    ' I added this so I could see in terminal what came back.

    ' then we write again using the key to put the data into memory

    OWOUT DQ,1,[$CC,$55,TA1,TA2,ES] ' Commit the scratchpad to memory using the TA1 and 2 and ES value the EEPROM gave us
    high dq
    pause 20 ' wait for the data to be written
    OWIN DQ,0,[OnewROM] ' this will return $AA if the data was sucessfully written
    </code>

    Hope this is useful to someone.

    Attached is what part of the transaction looks like in the Logic data analyser app.



    bill
    Attached Images Attached Images  
    Last edited by bcd; - 8th September 2009 at 06:59. Reason: edited to correct my bad grammer

Similar Threads

  1. Thermo 7 segments - little problem
    By fratello in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 27th July 2013, 08:31
  2. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 14:35
  3. 32 bit square root
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 6th May 2009, 04:37
  4. one line led light make image
    By bioul in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 13:19
  5. HSERIN doesn´t work
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th July 2007, 15:23

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