Problem reading 93c46 EEprom


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2008
    Posts
    14

    Default Problem reading 93c46 EEprom

    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>

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Assuming your data is already written in your EEPROM, try
    Code:
    
    	@ 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
    Last edited by mister_e; - 26th March 2009 at 01:30.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Oct 2008
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Thanks

    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 :-(

  4. #4
    Join Date
    Oct 2008
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Thanks again

    it does now work :-)

    thanks again for the help..

    dj.lambert

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  3. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  4. problem of reading eeprom 24lc515
    By mike12 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st January 2006, 17:36
  5. Writing / Reading EEPROM 24LC256 Problem
    By schmoddel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th February 2004, 18:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts