iButton


Closed Thread
Results 1 to 6 of 6

Thread: iButton

  1. #1
    menze's Avatar
    menze Guest

    Question iButton

    Hello. I want to make a simple program that can write some code to a ibutton, then read it again, and then, store it in EEPROM, so I can check that the code has been programed ok. I have already spent a lot of time trying to make it work, but it doesnt. My ibutton is DS1993. Here is the code:

    -------------------------------------------------


    DEVICE 16F628
    SYMBOL DQ = PORTB.2
    DIM B1 AS BYTE
    DIM HighAddress AS BYTE
    DIM LowAddress AS BYTE
    DIM EndAddress AS BYTE
    DIM ReadIN[32] AS BYTE
    B1 = $23
    HighAddress = $00
    LowAddress = $00
    EndAddress = $0F

    HIGH PORTA.4
    DELAYMS 500
    LOW PORTA.4
    DELAYMS 1000
    OWRITE DQ, 1, [$CC] ' Send Reset & Skip ROM command
    OWRITE DQ, 0, [$0F] ' Send Write scratchpad command
    OWRITE DQ, 0, [HighAddress] ' Send Start address. i.e.(14h)
    OWRITE DQ, 0, [LowAddress] ' Send Start address. i.e.(00h), address=0014h

    OWRITE DQ, 0, [B1,B1,B1,B1,B1,B1,B1,B1] ' Send No reset, 1st 8 bytes
    OWRITE DQ, 0, [B1,B1,B1,B1,B1,B1,B1,B1] ' Send No reset, 2nd 8 bytes
    OWRITE DQ, 0, [B1,B1,B1,B1,B1,B1,B1,B1] ' Send No reset, 3rd 8 bytes
    OWRITE DQ, 2, [B1,B1,B1,B1,B1,B1,B1,B1] ' Send 4th 8 bytes & Reset


    ' Copy Data from scratchpad to page
    OWRITE DQ, 1, [$CC] ' Send Reset & Skip ROM command
    OWRITE DQ, 0, [$55] ' Send copy scratchpad command
    OWRITE DQ, 0, [HighAddress] ' Send Start address. i.e.(14h)
    OWRITE DQ, 0, [LowAddress] ' Send Start address. i.e.(00h), address=0014h
    OWRITE DQ, 2, [EndAddress] ' Send E/S. (Last address written to) & Reset

    OWRITE DQ, 1, [$CC] ' Send Reset & Skip ROM command
    OWRITE DQ, 0, [$F0] ' Send Read memory command


    OWRITE DQ, 0, [HighAddress] ' Send Start address. i.e.(14h)
    OWRITE DQ, 0, [LowAddress] ' Send Start address. i.e.(00h), address=0014h
    OREAD DQ, 2, [ STR ReadIN\32 ] ' Read 1st 32 Bytes & Reset
    EWRITE 0, [READIN[0], READIN[1], READIN[2], READIN[3], READIN[4], READIN[5], READIN[6], READIN[7], READIN[8], READIN[9], READIN[10], READIN[11], READIN[12], READIN[13], READIN[14], READIN[15]]

    HIGH PORTA.4
    END

    -------------------------------------------------


    Thanks.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Big thread on DS1994 iButton here...

    http://www.picbasic.co.uk/forum/showthread.php?t=250

    It's possible some code may be useful to you...

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    but unfortunately, it's not going to be a pure copy/paste solution, you'll have to do some code modification to make it work with the compiler you use
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    menze's Avatar
    menze Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    but unfortunately, it's not going to be a pure copy/paste solution, you'll have to do some code modification to make it work with the compiler you use

    Thanks for all the info. I have no idea how to modiy the code because that code is used to read an ibutton cloik, but i need to read and write all the pages.
    If you have some info, please send it to me.
    Thanks again
    Menze

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    well i can't really tell you how about because i no longer use the PROTON compiler as i feel you use just by seeing your variable declaration, the way you write to EEPROM and the DelayMS statement.

    maybe the PROTON forum will be handy for you
    www.picbasic.org/forum
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    menze's Avatar
    menze Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    well i can't really tell you how about because i no longer use the PROTON compiler as i feel you use just by seeing your variable declaration, the way you write to EEPROM and the DelayMS statement.

    maybe the PROTON forum will be handy for you
    www.picbasic.org/forum
    Thanks for the info!!!
    Menze

Similar Threads

  1. Efficient comparison on data (iButton)
    By enigma in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th August 2010, 13:37
  2. Writing & Reading to iButton EEPROM
    By crhomberg in forum Code Examples
    Replies: 2
    Last Post: - 6th October 2008, 19:40
  3. Dallas IButton 1990 Presence pulse
    By enigma in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th August 2008, 22:04
  4. How to calculate CRC16 checksum for iButton
    By ashwini kotwal in forum General
    Replies: 13
    Last Post: - 17th March 2008, 19:48
  5. DS1920 IButton
    By scottl in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd November 2007, 00:39

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