Thanks Darrel,
Does this mean that I don't have to use the CRC calculation system?
Regards
Chris
Thanks Darrel,
Does this mean that I don't have to use the CRC calculation system?
Regards
Chris
Hi,
I modified my program using the authorisation code but I still seem not to get my data back.
This is my latest version (for a 16F877A)
'************************************************* ***************
'* Name : eeprom.BAS *
'* ************************************************** ************
@ device hs_OSC, wdt_on, pwrt_on, protect_off
DEFINE OSC 20
ADCON1=7 ' Set all Ports to Digital I/O
OPTION_REG.7=0 ' Enable weak PullUps
TRISC.0=1
TRISC.1=1
TRISC.2=1
TRISB.0=0
iButton var PortD.2
MEM VAR BYTE
RESULT VAR BYTE[4]
Taddr var byte[2] 'target address 2 bytes
ES var byte 'ending offset data status
START:
SEROUT2 PORTB.0,16416,["START",10,13]
'WRITE TO EEPROM
OWOUT ibutton,1,[$CC,$0F,$00,$00] 'Write to scratchpad
OWOUT IBUTTON,0,[$54,$65,$73,$74] 'Write characters "test"
OWout IBUTTON,0,[$CC,$AA]
owin ibutton,0,[Taddr[0],Taddr[1],ES] 'read back the scratchpad to get the Authorisation code
owout ibutton,0,[$CC,$55] 'Write back the contents of the target address & E/S register
owin ibutton,0,[Taddr[0],Taddr[1],ES] 'to allow copy scratchpad to take place.
PAUSE 25
'READ FROM EEPROM
OWOUT ibutton,0,[$CC,$F0,$00,$00]
FOR MEM=1 TO 32
OWIN IBUTTON,0,[RESULT]
SEROUT2 PORTB.0,16416,[RESULT]
PAUSE 100
NEXT MEM
END
Where have I gone wrong?
Regards
Chris
Thanks Darrel,
I got it right, it is now send back the letters test with this code...
'WRITE TO EEPROM
OWOUT ibutton,1,[$CC,$0F,$00,$00] 'Write to scratchpad
OWOUT IBUTTON,0,[$54,$65,$73,$74] 'Write characters "test"
OWout IBUTTON,1,[$CC,$AA] 'get ready to read scratchpad
owin ibutton,0,[Taddr[0],Taddr[1],ES] 'read back the scratchpad to get the Authorisation code
owout ibutton,1,[$CC,$55] 'Write back the contents of the target address & E/S register
owout ibutton,0,[Taddr[0],Taddr[1],ES] 'to allow copy scratchpad to take place.
PAUSE 25
'READ FROM EEPROM
OWOUT ibutton,1,[$CC,$F0,$00,$00]
FOR MEM=1 TO 4
OWIN IBUTTON,0,[RESULT]
SEROUT2 PORTB.0,16416,[RESULT]
PAUSE 100
NEXT MEM
END
Thanks Chris
WooHoo! There ya go.
That looks much better.
Tricky little 1's and 0's in the mode.
Nice work!
<br>
DT
I am so proud of the code I wrote for the DS1994 REAL TIME CLOCK & DS1973 EEPROM I think I must post both as they work so well and finally are relatively simple and there seems to be no sample code on the net.
Where on the site is the place for Code Samples?
Regards
Chris
Careful, that feeling of "Elation" is addictive.
Code examples always welcome.
http://www.picbasic.co.uk/forum/forumdisplay.php?f=11
DT
Bookmarks