Skip to main content
Visitor II
March 16, 2004
Question

Need a lil helping hand on accessing the EEPROM on a ST6260

  • March 16, 2004
  • 2 replies
  • 780 views
Posted on March 16, 2004 at 04:39

Need a lil helping hand on accessing the EEPROM on a ST6260

    This topic has been closed for replies.

    2 replies

    Visitor II
    March 15, 2004
    Posted on March 15, 2004 at 10:50

    Hier a lil routine that works propper on the Epromversion

    of the ST6260B.

    The same routine does not work on the OTA version of

    the 6260C.

    Please, I am happy for any hint.

    setAD LDI DWDR,0FFh ;

    JRS E2BUSY,EECTL,setAD ;

    LDI EECTL,00h ;

    doAD LDI DWDR,0FFh ;

    JRS E2BUSY,EECTL,doAD ;

    LDI DRBR,00000001b ;

    LD A,SData ;

    ANDI A,00001111b ;

    SET E2ENA,EECTL ;

    doAD1 LDI DWDR,0FFh ;

    JRS E2BUSY,EECTL,doAD1 ;

    LD EEDat,A ;

    goonAD LDI DWDR,0FFh ;

    JRS E2BUSY,EECTL,goonAD ;

    RES E2ENA,EECTL ;

    getAD LDI DWDR,0FFh ;

    JRS E2BUSY,EECTL,getAD ;

    LDI DRBR,00000001b ;

    LDI EECTL,00h ;

    getAD0 LDI DWDR,0FFh ;

    JRS E2BUSY,EECTL,getAD0 ;

    LD A,EEDat ;

    ANDI A,00001111b ;

    LD EAdress,A ;

    SET E2off,EECTL ;

    RET ;

    Note: EEDat = 10h

    greetinx

    Joker

    [ This message was edited by: JRN-Joker on 15-03-2004 15:23 ]
    Visitor II
    March 16, 2004
    Posted on March 16, 2004 at 04:39

    hi, sorry for bad english

    not use set o res in to route for read or write e2prom, but use only LDI eectl,xx

    This route work very well on the ST62E65C, first use this route disable all interrupts

    rde2p ld a,e2p_id ;adress e2prom

    ld x,a

    ldi xcount,8

    ldi y,dato0 ;adress ram when save the buytes read

    ldi drbr,01h ;Select the EEPROM page 0

    ldi eectl,00h ;Enable the EEPROM

    rde2p1 ldi wdr,0ffh

    jrs 1,eectl,$

    ld a,(x)

    ld (y),a

    inc x

    inc y

    dec xcount

    jrnz rde2p1

    ldi wdr,0ffh

    ldi eectl,40h ;Disable the EEPROM (Low comsuption)

    ret

    wre2p ld a,e2p_id ;adress e2prom

    ld x,a ;adress -> X

    ldi xcount,8 ;number byte to save

    ldi y,dato0 ;adress ram byte to save

    ldi drbr,01h ;Select the EEPROM page 0

    ldi eectl,05h ;Enable EEPROM parallel writing mode

    ldi wdr,0ffh

    jrs 1,eectl,$ ;check that e2pron not busy

    wre2p1 ld a,(y)

    ld (x),a

    inc x

    inc y

    dec xcount ;decrement counter

    jrz wre2p2

    jp wre2p1

    wre2p2 ldi wdr,0ffh

    ldi eectl,0dh ;Start parallel writing (5ms typical)

    jrs 1,eectl,$ ;wait end procedure

    ldi eectl,40h ;Disable the EEPROM (Low comsuption)

    ldi wdr,0ffh

    ret