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
Bookmarks