Double eeprom 24LC64


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2008
    Posts
    22

    Default Double eeprom 24LC64

    Hi, I have a small problem...Programming one 24LC64 with a 16f84a is everything ok but two 24LC64 in series on the same bus it doesn't work me.
    Following the 24LC64 datasheet indications, to make you to work needs to put to +5 a pin or various combinations up to form at the most a group from 8 eeproms, I have chosen the A0 and street software, if I have understood well, modified the second eeprom to 1 the 2° right bit, in practice:

    "I skip the whole code before and later for simplicity"
    -----------------------------------------------
    WRITING:
    FOR I = 0 TO 10
    ADDR = THE: _WRITE = THE: ADDR2 = THE: _WRITE2 = THE
    I2CWRITE SDA, SCL,% 10100000, ADDR, [_WRITE] 'First EEPROM
    Breaks 10
    I2CWRITE SDA, SCL,% 10100010, ADDR2, [_WRITE2] 'Second EEPROM
    Breaks 10
    _WRITE2 = _WRITE2 * 3
    GOSUB LETTURA
    NEXT I
    -----------------------------------------------
    Where is the error?
    Thanks
    chip_x

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


    Did you find this post helpful? Yes | No

    Default

    obviously you don't use Melabs PicBasic.... or the Breaks 10 is part of your comments?

    You should have a PAUSE 10-50 after each I2CWRITE

    Maybe a copy/paste error... but there shouldn't be any space between % and the ControlByte value in your I2CWRITE lines. I suggest you to use Constant variable instead.

    ADDRx variable have to be WORD sized one.

    When you say it doesn't work.. you mean? If you remove the first EEPROM, will the second one work? Same thing if you remove the second one, will the first one work? If so, you should reduce the Pull-up resistors. Usually 1.8K work in most cases.
    Steve

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

  3. #3
    Join Date
    Mar 2008
    Posts
    22


    Did you find this post helpful? Yes | No

    Default eeprom

    Hi Steve, "breaks" it is an error of copy. It is "pause 10." The space "% "there is not. ADDR is "word."
    I use the PicBasic 2.50.
    You as you would resolve the problem? Do I want to say as you write the code to identify the second eeprom on the same bus?
    The first eeprom works.
    thx
    chip_s

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


    Did you find this post helpful? Yes | No

    Default

    Maybe you'll find some good info at the following
    http://www.picbasic.co.uk/forum/showthread.php?t=1453&

    Just make sure your pull-ups are ~=1.8K
    all EEPROMs A<2:0> pins goes somewhere
    all EEPROMs WP pins are connected to GND, and it should work.

    I just tried something like this with a 16F88 and 2 X 24LC64
    Code:
    <font color="#000000">        <font color="#000080">ASM
                LIST  W=-207
                cfg1 = _INTRC_IO &amp; _WDT_OFF &amp; _PWRTE_ON &amp; _MCLR_ON &amp; _BODEN_ON &amp; _LVP_OFF &amp; _CCP1_RB0
                cfg2 = _CP_OFF  &amp; _CPD_OFF &amp; _WRT_PROTECT_OFF &amp; _DEBUG_OFF 
                
                __CONFIG    _CONFIG1, cfg1 &amp; cfg2</font>		    		 
                
                <font color="#008000">;    Program Configuration Register 2
                </font><font color="#000080">__CONFIG    _CONFIG2, _IESO_OFF &amp; _FCMEN_OFF
            ENDASM
            
            </font>OSCCON=%01110000 <font color="#008000">' 8mhZ
            </font><font color="#000080">DEFINE </font>OSC 8
            
            PORTA = 0
            PORTB = 0
            TRISB = 0
            TRISA = 0
            ANSEL = 0
            CMCON = 7
                    
            <font color="#000080">DEFINE </font>HSER_RCSTA 90h <font color="#008000">' Enable serial port &amp; continuous receive
            </font><font color="#000080">DEFINE </font>HSER_TXSTA 20h <font color="#008000">' Enable transmit, BRGH = 0
            </font><font color="#000080">DEFINE </font>HSER_SPBRG 12  <font color="#008000">' 9600 Baud @ 8MHz, 0.16%
            </font><font color="#000080">DEFINE </font>HSER_CLROERR 1 <font color="#008000">' Clear overflow automatically
            
            </font>SCL     <font color="#000080">VAR </font>PORTB.0
            SDA     <font color="#000080">VAR </font>PORTB.1
            
            EEP1    <font color="#000080">CON </font>%10100000 <font color="#008000">' First EEPROM A&lt;2:0&gt;=Gnd
            </font>EEP2    <font color="#000080">CON </font>%10100010 <font color="#008000">' Second EEPROM, A&lt;2:1&gt;=Gnd, A0=Vcc
            
            </font>Addr    <font color="#000080">VAR WORD
            </font>ByteA   <font color="#000080">VAR BYTE
            </font>ByteB   <font color="#000080">VAR BYTE
            
            PAUSE </font>50
         
            <font color="#000080">HSEROUT </font>[&quot;Programming...&quot;,13,10]
            <font color="#000080">FOR </font>Addr=0 <font color="#000080">TO </font>10
                ByteA=Addr
                <font color="#000080">I2CWRITE </font>SDA,SCL,EEP1,Addr,[ByteA]
                <font color="#000080">PAUSE </font>10
                
                ByteA=Addr+20
                <font color="#000080">I2CWRITE </font>SDA,SCL,EEP2,Addr,[ByteA]
                <font color="#000080">PAUSE </font>10
                <font color="#000080">NEXT
                
           HSEROUT </font>[&quot;ADDR    EEP1    EEP2&quot;, 13,10]
           <font color="#000080">FOR </font>Addr=0 <font color="#000080">TO </font>10
                <font color="#000080">I2CREAD </font>SDA,SCL,EEP1,Addr,[ByteA]     
                <font color="#000080">I2CREAD </font>SDA,SCL,EEP2,Addr,[ByteB]                 
                <font color="#000080">HSEROUT </font>[<font color="#000080">DEC </font>Addr,&quot;        &quot;,_
                         <font color="#000080">DEC </font>ByteA,&quot;        &quot;,_
                         <font color="#000080">DEC </font>ByteB,13,10]
                <font color="#000080">NEXT
        
            </font>@ <font color="#000080">GOTO </font>$
    and the output is...
    Code:
    Programming...
    ADDR    EEP1    EEP2
    0        0        20
    1        1        21
    2        2        22
    3        3        23
    4        4        24
    5        5        25
    6        6        26
    7        7        27
    8        8        28
    9        9        29
    10        10        30
    Last edited by mister_e; - 26th March 2008 at 14:05.
    Steve

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

  5. #5
    Join Date
    Mar 2008
    Posts
    22


    Did you find this post helpful? Yes | No

    Default replay

    Hi, I have used, for the data and the clock 2 resistors from 4.7k.
    I have tried to complile your program and me from an error:

    Error[118] c:\eeprom\16f88.asm 70: Overwriting previous address contents(2007)


    chip_s

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


    Did you find this post helpful? Yes | No

    Default

    Well, that's easy to fix once you know how to and why. The following link will teach it to you. Read at least POST#1 to 5.

    Presetting Configuration Fuses (PIC Defines) into your Program
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Steve

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

  7. #7
    Join Date
    Mar 2008
    Posts
    22


    Did you find this post helpful? Yes | No

    Default THX mister

    Thanks mister_e you have been me of great help. Hi and good day.
    chip_x

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. How to define constants that specify eeprom addresses
    By DwayneR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th December 2009, 04:07
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. 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
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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