Using Multiple EEPROMs


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Exclamation Sending but no data comes back from Ext. EEPROM

    OK - I have the EEPROMS setup per what has been described, and we can compile and it LOOKS like it sends data to the chips, but I cant' see anything coming back.. I read in 1000 values from 0 to 999 in an 'x' loop, then read them back, and all I see are '0's... Help! I think my naming of the chips is wrong..

    Chip is an 16F876A.

    I have two chips 24LC515 512k .. I have given them names:

    DPIN var PortA.2 ' I2C data
    CPIN var PortA.1 ' I2C clock
    address var byte
    value var byte

    Chip1 con %10100000 ' address of chip1
    Chip2 con %10100100 ' address of chip2

    Init:
    PORTA = %00000 'Initialize PortA to all zeros - all output
    TRISA = %00000 'All port A output
    PORTB = %00000101 'Initialize PortB - port 2 for data, port 0 for button interrupt
    TRISB = %00000101 'Port 2 inputs are 0 and 2
    T1CON = %01000000 'Timer1 1:1 prescale(?). Timer1 off
    ----------------------------------------------------------------------

    I read and write to them like this: For this demo I only will write 1000 records in each chip.


    storedata:
    for x = 0 to 1000
    i2cwrite dpin,cpin,chip1,x,x
    pause 10
    serout2 Apinout, 16468, [I,CLR]
    serout2 Apinout, 16468, [I,L1_C1]
    serout2 Apinout, 16468, ["Writing: C1 ",#x]
    Next x

    for x = 0 to 1000
    i2cwrite dpin,cpin,chip2,x,x
    pause 10
    serout2 Apinout, 16468, [I,CLR]
    serout2 Apinout, 16468, [I,L1_C1]
    serout2 Apinout, 16468, ["Writing: C2 ",#x]
    Next x

    ...
    ...
    Readitback:
    ' read memory contents to screen.
    serout2 Apinout, 16468, [I,CLR]
    serout2 Apinout, 16468,[I,L1_C1]
    Serout2 AGPSout, 16572, ["Memory Dump Chip 1: ", 10,13]
    Address =0
    p=0
    x=0
    For p = 1 to 29 ' total sentences storable in memory
    serout2 AGPSout, 16572, ["SS ",#p,": "]
    for address = X to (X+34)
    I2Cread Dpin,Cpin,Chip1, address, value
    serout2 AGPSout, 16572, [",",#value]
    next address
    serout2 AGPSout, 16572, [10,13]
    X=X+34
    next p

    serout2 Apinout, 16468, [I,CLR]
    serout2 Apinout, 16468,[I,L1_C1]
    Serout2 AGPSout, 16572, ["Memory Dump Chip 2: ", 10,13]
    Address =0
    p=0
    x=0
    For p = 1 to 29 ' total sentences storable in 1k
    serout2 AGPSout, 16572, ["SS ",#p,": "]
    for address = X to (X+34)
    I2Cread Dpin,Cpin,Chip2, address, value
    serout2 AGPSout, 16572, [",",#value]
    next address
    serout2 AGPSout, 16572, [10,13]
    X=X+34
    next p

    Return

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


    Did you find this post helpful? Yes | No

    Default

    fast overlook... did you read caefully your EEPROM datasheet??? Try to use a WORD sized variable for your address.. also look how many bits must be shift for address + control word and how.
    Steve

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

  3. #3
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Thumbs up

    Working now... It was simply a mis-wired A2 pin. With everything neatly in place, resistors in line, etc. We have both chips working fine. I was also off in the chip 2 definitin by a bit. Now it works great. Thanks for the help!

    Chip1 con %10100000 ' address of chip1
    Chip2 con %10100010 ' address of chip2

    TG

Similar Threads

  1. Multiple PICS from Same Crystal?
    By WOZZY-2010 in forum General
    Replies: 2
    Last Post: - 6th February 2010, 16:18
  2. Multiple RETURNS within a single subroutine
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st June 2009, 17:43
  3. Multiple EEPROM 24LC
    By alik in forum General
    Replies: 3
    Last Post: - 4th February 2008, 11:24
  4. Problems controlling multiple pics
    By gandora in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 29th May 2007, 09:59
  5. Multiple PIC's with 1 crystal
    By puma in forum Schematics
    Replies: 11
    Last Post: - 20th March 2007, 18:02

Members who have read this thread : 0

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