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
Bookmarks