; Orange programmer module v1.10 ; (c) 2003 Alex Plusov, Valentas ; CHIP=ST95011,256,ST95011.hpl ; Serial SPI EEPROM with Negative Clock Strobe ;INFO="SINGLE SUPPLY VOLTAGE – 4.5V to 5.5V for ST950x0 and 2.5V to 5.5V for ST950x0W" SOCKET=4 ;"SPI" PINO=SCK,0 ; Serial Clock PINO=SI,1 ; Serial Data Input PINO=CS,2 ; Chip Select PINO=WP,3 ; Write Protect PINO=HOLD,4; Hold PINI=SO,1 ; Serial Data Output ;Power pins: ;PINO=Vss,0,4; Ground ;PINO=Vcc,0,8; Supply Voltage CDELAY=1 ; one set delay R9=STATUS,B8 R10="Protect",L,"None,Upper 1/4,Upper 1/2,All" [_SEND] LOOP=(7,0){SI=R0[I],SCK=N} [INIT] HOLD=1 R10=0 [READ] WP=0 CS=1 SCK=1 CS=0 _SEND(00000011b) LOOP=(7,0){SI=ADR[I],SCK=0,SCK=1} SI=1 LOOP=(7,0){SCK=0,DATA[I]=SO,SCK=1} CS=1 P=10 [READBLOCK] R1=1 HOLD=1 WP=0 CS=1 SCK=1 CS=0 _SEND(00000011b) LOOP=(7,0){SI=ADR[I],SCK=0,SCK=1} SI=1 LOOP=($BLOCKSIZE){ LOOP=(7,0){SCK=0,DATA[I]=SO,SCK=1} ADR=+1 } CS=1 [_WAITWR] ; Wait for end write memory SCK=1 LOOP=(0,1000){ CS=0 _SEND(00000101b) ; Read Status Register SI=1 LOOP=(7,0){SCK=0,R3[I]=SO,SCK=1} CS=1 R3[0]?0{BREAK}; WIP bit = 0 ? P=10 } [WRITEINIT] HOLD=1 WP=1 CS=1 SCK=1 CS=0 _SEND(00000110b) ; Write enable CS=1 P=20 CS=0 _SEND(00000001b) ; Write Status Register _SEND(00000000b) ; Status Register CS=1 _WAITWR [WRITE] HOLD=1 WP=1 SCK=1 CS=0 _SEND(00000110b) ; Write enable CS=1 P=20 CS=0,SI=0 _SEND(00000010b) LOOP=(7,0){SI=ADR[I],SCK=0,SCK=1} LOOP=(7,0){SI=DATA[I],SCK=0,SCK=1} CS=1 _WAITWR [WRITEBLOCK] R1=1 HOLD=1 WP=1 SCK=1 CS=0 _SEND(00000110b) ; Write enable CS=1 P=20 CS=0,SI=0 _SEND(00000010b) LOOP=(7,0){SI=ADR[I],SCK=0,SCK=1} LOOP=($BLOCKSIZE){ LOOP=(7,0){SI=DATA[I],SCK=0,SCK=1} ADR=+1 } CS=1 _WAITWR ["Read Status"] R9=0 HOLD=1 WP=1 SCK=1 CS=1 CS=0 _SEND(00000101b) ; Read Status Register SI=1 LOOP=(7,0){SCK=0,R9[I]=SO,SCK=1} CS=1 R9=/4,R9=&0x3,R10=R9 GET=("Protected area",R10) ["Write Status"] GET=("Select protection area",R10) RA?0{EXIT} R8=R10,R8=<<2 HOLD=1 WP=1 CS=1 SCK=1 CS=0 _SEND(00000110b) ; Write enable CS=1 P=20 CS=0 _SEND(00000001b) ; Write Status Register _SEND(R8) CS=1 P=20000 R9=0 SCK=1 CS=1 CS=0 _SEND(00000101b) ; Read Status Register SI=1 LOOP=(7,0){SCK=1,R9[I]=SO,SCK=0} CS=1 P=10 R9=&0xF VCC=0 R8?R9{PRINT=S("Status Register write OK !"),P=1000000,EXIT} R8?!R9{PRINT=E("Status Register write ERROR !")}