PDA

View Full Version : Which 1 wire eeprom to use



isaac
- 20th August 2008, 18:57
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

isaac
- 21st August 2008, 10:37
i have ordered the DS2431 an would let you know how it goes

Isaac

isaac
- 28th August 2008, 16:35
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

bcd
- 6th September 2009, 06:27
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.

bcd
- 8th September 2009, 05:57
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