PDA

View Full Version : Problem reading 93c46 EEprom



dj.lambert
- 25th March 2009, 16:04
Hi All
I have a problem reading from AT93c46 eeproms

when i use the code below (hopefully) the first few locations come back as random garbage but the rest come back as values i expect..also the number of garbage locations change with each read.. I am more than a little confused.. any ideas as to the cause of this would be greatly appreciated,(although i have probably done something stupid with my code that i can't see)
thanks in advance

<code>
@ device pic16F877, HS_osc, wdt_on, pwrt_on, protect_off


define osc 16
define shift_pauseus 500

CS var portb.1
SCK var portb.2
SI var portb.4
SO var portb.5

trisb=%11101101

B0 var byte
B1 var byte
addr var byte

cs=0
pause 1000

for addr = 0 to 32

cs=1
pauseus 10
shiftout sI,sck,1,[%110\3,addr\6]
shiftin so,sck,2,[b0,b1]
serout portd.7,2, [b1,b0]
cs=0

next
serout portd.7,2, [10,13]

end
<\code>

mister_e
- 26th March 2009, 01:25
Assuming your data is already written in your EEPROM, try




@ device pic16F877, HS_osc, wdt_on, pwrt_on, protect_off


define OSC 16

CS var portb.1
SCK var portb.2
SI var portb.4
SO var portb.5

trisb=%11101101

B0 var byte
B1 var byte
addr var byte

cs=0
HIGH PORTD.7
pause 5000
addr = $01
CS = 1
Shiftout DI, CLK, MSBFIRST, [%100\3, addr\6]
CS = 0
pause 50

for addr = 0 to 32

cs=1
shiftout sI,sck,1,[%110\3,addr\6]
shiftin so,sck,2,[b0,b1]
CS=0
serout portd.7,2, [b1,b0]

next

serout portd.7,2, [10,13]

STOP
end

If you want to write data to your eeprom, then you'll need to add another pice of code

dj.lambert
- 26th March 2009, 06:40
Thanks for the help

i will try the new code during the day and let you know how it works..

yes the eeproms are already programmed they are calibration factors for power analyser shunts...

and i will need to program them later but first i need to find the format of the stored data hence i need to read them first....

i quess i used the wrong code tags as well :-(

dj.lambert
- 27th March 2009, 06:10
it does now work :-)

thanks again for the help..

dj.lambert