Double eeprom 24LC64


Results 1 to 7 of 7

Threaded View

  1. #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.

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