; Orange programmer module v1.06 ; (c) 2003 Alex Plusov, Valentas ; CHIP=ST95010,256,ST95010.hpl ; Serial SPI EEPROM with Positive Clock Strobe 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 R2="Select block:",L,None,60h - FFh,40h - FFh,All [READ] HOLD=1 WP=0 CS=1 SCK=0 CS=0 R0=00000011b LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} LOOP=(7,0){SI=ADR[I],SCK=1,SCK=0} SI=1 LOOP=(7,0){SCK=1,DATA[I]=SO,SCK=0} CS=1 P=10 [READBLOCK] HOLD=1 WP=0 CS=1 SCK=0 CS=0 R0=00000011b LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} LOOP=(7,0){SI=ADR[I],SCK=1,SCK=0} SI=1 LOOP=($BLOCKSIZE){ LOOP=(7,0){SCK=1,DATA[I]=SO,SCK=0} ADR=+1 } CS=1 [_WAITWR] ; Wait for end write memory SCK=0 LOOP=(0,1000){ CS=0 R0=00000101b ; Read Status Register LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} SI=1 LOOP=(7,0){SCK=1,R3[I]=SO,SCK=0} CS=1 R3[0]?0{BREAK} ; WIP bit = 0 ? P=10 } [WRITEINIT] HOLD=1 WP=1 CS=1 SCK=0 CS=0 R0=00000110b ; Write enable LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} CS=1 P=20 CS=0 R0=00000001b ; Write Status Register LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} R0=00000000b ; Status Register LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} CS=1 _WAITWR [WRITE] HOLD=1 WP=1 SCK=0 CS=0 R0=00000110b ; Write enable LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} CS=1 P=20 CS=0,SI=0 R0=00000010b LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} LOOP=(7,0){SI=ADR[I],SCK=1,SCK=0} LOOP=(7,0){SI=DATA[I],SCK=1,SCK=0} CS=1 _WAITWR [WRITEBLOCK] HOLD=1 WP=1 SCK=0 CS=0 R0=00000110b ; Write enable LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} CS=1 P=20 CS=0,SI=0 R0=00000010b LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} LOOP=(7,0){SI=ADR[I],SCK=1,SCK=0} LOOP=($BLOCKSIZE){ LOOP=(7,0){SI=DATA[I],SCK=1,SCK=0} ADR=+1 } CS=1 _WAITWR ["Read Status"] R9=0 HOLD=1 WP=1 SCK=0 CS=1 CS=0 R0=00000101b ; Read Status Register LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} SI=1 LOOP=(7,0){SCK=1,R9[I]=SO,SCK=0} CS=1 P=10 R9=&0xF R9?0{PRINT=("Block write protection - ALL memory area free.")} R9?4{PRINT=("Block write protection - area from 60h to FFh.")} R9?8{PRINT=("Block write protection - area from 40h to FFh.")} R9?0xC{PRINT=("Block write protection - protect ALL memory area.")} R9?!0{R9?!4{R9?!8{R9?!0xC{PRINT=E("ERROR reading Status Register !")}}}} ["Write Status"] R2=0,R9=0 GET=("Select protection area",R2) ;PRINT=A("Change protection area to new ?") RA?0{EXIT} R2?0{R8=0},R2?1{R8=4},R2?2{R8=8},R2?3{R8=0xC} HOLD=1 WP=1 CS=1 SCK=0 CS=0 R0=00000110b ; Write enable LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} CS=1 P=20 CS=0 R0=00000001b ; Write Status Register LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} ; AREA : R2?0{R0=00000000b} ; none R2?1{R0=00000100b} ; uper 1/4 - from 60h - to FFh R2?2{R0=00001000b} ; uper 1/2 - from 40h - to FFh R2?3{R0=00001100b} ; all LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} CS=1 P=20000 HOLD=1 WP=1 SCK=0 CS=1 CS=0 R0=00000101b ; Read Status Register LOOP=(7,0){SI=R0[I],SCK=1,SCK=0} SI=1 LOOP=(7,0){SCK=1,R9[I]=SO,SCK=0} CS=1 P=1000 R9=&0xF VCC=0 R8?R9{PRINT=S("Status Register write OK !"),P=1000000,EXIT} R8?!R9{PRINT=E("Status Register write ERROR !")}