Which 1 wire eeprom to use


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Default Which 1 wire eeprom to use

    Hi All

    I want to experiment with a 1 wire eeprom but not sure which ones to order as there a lots of them about.
    Has anyone used them before ? How did they perform

    Regards
    Isaac

  2. #2
    Join Date
    May 2004
    Location
    brighton
    Posts
    149


    Did you find this post helpful? Yes | No

    Default

    i have ordered the DS2431 an would let you know how it goes

    Isaac

  3. #3
    Join Date
    May 2004
    Location
    brighton
    Posts
    149


    Did you find this post helpful? Yes | No

    Exclamation Help Writing/Reading 1 wire eeprom

    Hi All
    i received my DS2431 sample yesterday and i have being trying to find out how i can write/Read the device.
    i have only managed to read the 64bit Rom code of the device thanks to Bruce's example but cant get my head round writting to the scatchpad first before sending to eeprom
    if there is anyone out there that has used similar device i would love to hear from you .
    all i want to do is just write and read the first memory location.
    pointers to any examples would be very helpful

    Regards
    Isaac


    '************************************************* ***************
    '* Name : DS2431.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 28/08/2008 *
    '* Version : 1.0 *
    '* Notes : Used to read the 64bit rom code *
    '* : *
    '************************************************* ***************
    Define LOADER_USED 1
    Include "Modedefs.Bas"
    Define OSC 20
    ' Setup Hardware for uart
    DEFINE HSER_BAUD 9600
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_CLROERR 1

    TRISA=%00011011
    TRISB=%00000111
    TRISC=%10100101
    TRISD=%00000000
    TRISE.0=0
    TRISE.1=0
    TRISE.2=0

    CLEAR 'Clear all variables to Zero



    OPTION_REG.7 = 0 ' Enable PORTB pullups FOR 16F877A
    ADCON1 = 7 ' Make PORTA and PORTE digital
    DQ VAR Portb.0 ' One-wire data pin "DQ" on PortD.2
    ID VAR BYTE[8] ' Array storage variable for 64-bit ROM code
    result var byte
    mem var byte

    Begin:

    Start_Convert
    HSEROUT[" Sending Read ROM command",10,13]
    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"

    HSEROUT["Ser# = ",HEX2 ID[1],HEX2 ID[2],HEX2 ID[3],HEX2 ID[4],_
    HEX2 ID[5],HEX2 ID[6],"h",10,13]
    HSEROUT[" ROM Code Received",10,13]

    PAUSE 10000 ' 10-second pause
    GOTO Start_Convert

    END

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


    Did you find this post helpful? Yes | No

    Default Did you ever get any further with this ?

    I have just started with a DS2431 on a project that I want to use to store a single config Byte. I had run out of IO pins for an I2C eeprom, so went down the one wire path.

    I though I was managing to read the device OK, but writing to it is a whole different kettle of fish.

    I tried to follow the example in the data sheet for writing and reading from the device, but get a heap of FFs returned - including the memory locations where I wrote my config data (00h-05h)

    bill.

  5. #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 05: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, 07:31
  2. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  3. 32 bit square root
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 6th May 2009, 03:37
  4. one line led light make image
    By bioul in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 12:19
  5. HSERIN doesn´t work
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th July 2007, 14:23

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