Hi srigopal,
you can write and read 93c06 like these lines:
Code:
;This code will write to the first 128 memory allocation
;of an FM93C06 EEPROM 16x16-bit array
;===========================================
CS VAR PORTA.0 ;CS pin of 93c06 (usualy pin1)
CLK VAR PORTA.1 ;CLK (pin2)
DI VAR PORTA.2 ;DI (pin3)
DO VAR PORTA.3 ;DO(pin4)
Addr VAR BYTE
Value1 VAR BYTE
Value2 VAR BYTE
A VAR BYTE
CS=1 ;disable 93c06
start:
;let's write to eeprom
;====================
for a=0 to 128 step 2
Addr=a
Value1=a+100
Value2=Value1+1
GOSUB EEPROMWrite
next
;now read it and send to LCD
;==========================
for a=0 to 128 step 2
Addr=a
GOSUB EEPROMRead
LCDOUT $FE,1,"addr:",dec a,$fe,$c0,"V1:",dec Value1," V2:",dec value2
pause 500
next
goto start
EEPROMWrite:
CS = 0 ;enable eeprom
Shiftout DI, CLK, MSBFIRST, [%10011,0\4] ;write enable command+dummy clocks
pause 10
CS = 1 ; Disable to execute command
CS = 0
Shiftout DI, CLK, MSBFIRST, [%101\3, addr\6, Value1,Value2] ;Send Adress+data
pause 10
CS = 1
Return
EEPROMRead:
CS = 0
Shiftout DI, CLK, MSBFIRST, [%110\3, addr\6] ;read command+address
Shiftin DO, CLK, MSBPOST, [Value1,Value2] ;get data
CS = 1
Return
Bookmarks