Writing to 1-wire EEPROM


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Red face EEPROM still not working

    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

  2. #2
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking At Last Working

    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

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Thumbs up

    WooHoo! There ya go.
    That looks much better.

    Tricky little 1's and 0's in the mode.

    Nice work!
    <br>
    DT

  4. #4
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking That's it Babe

    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

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Careful, that feeling of "Elation" is addictive.

    Code examples always welcome.
    http://www.picbasic.co.uk/forum/forumdisplay.php?f=11
    DT

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 : 0

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