Another attempt for I2C eeprom, this time - 25C256.


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    C1, if you have the spare cash, I would recommend a cheap logic analyzer. Saelig sells one for (I think I paid) around $80 US. I haven't used mine in several years, as I now have a Pico Scope that does much more, and better. I am in the northeast US. If you're willing to cover shipping, you can have my old Saelig. It will help you to verify communication protocols and baud rates for situations like this. If interested, PM me & we can take it from there. You might be able to find one on eBay, Amazon, or Craigslist (or whatever local online sellers site you have) for next to nothing, and with cheaper or even no shipping.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    So what's wrong with 160? it is chip address, A0, and isn't that fixed?

    Regarding the logic analyzer. I have that saelae thing.
    I can't get it work as I understand it should work - run continuously, monitor bytes, like scope does. it only has "run", it runs, fills up buffer in couple of seconds and stops - that's all. For that purposes, I bought a scope with built-in logic analyzer, which can run infinitely - Hantek DSO2D10 - but was able it to work only very low speeds, for protocol decoding.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    it a constant , pbp constants are 16 bits , i2c address are 8 bit
    use your logic analyzer
    Warning I'm not a teacher

  4. #4
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    So what should I write instead of 160?

    I've searched this forum, and people do use plain numbers in I2C eeprom write/read?

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    Address var byte
    Address = 160
    Warning I'm not a teacher

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    Yeah, you really should spend some time getting that logic analyzer working and understand what it does. It's NOT an oscilloscope and although newer versions of the software does allow it to continously stream and display that's not really its intended purpose.

    Anyway, here's what I'd try (and I'd have the logic analyzer hooked up)
    Code:
    Chip_Address	VAR BYTE
    Mem_Address	VAR WORD
    sda		VAR portb.1
    scl		VAR portb.0
    
    Chip_Address = 160
    
    ' The chip address must be a BYTE, this is the 160 + whatever A0-A2 is set to.
    ' The memory address must be a WORD for the 24C256, this is the address of the byte to written (or read)
    ' The data to be written is, in this case, a BYTE but it does not have to be, you can write words or arrays - which are obviously just multiple bytes...
    
    FOR Mem_Address = 0 to 12
      '        I/O  I/O       BYTE        WORD             BYTE
      I2CWrite sda, scl, Chip_Address, Mem_Address, [Mem_Address.LOWBYTE]
    NEXT
    And I'd like to thank Richard for the primers on PBP I2C the last couple of days, much appreciated!

  7. #7
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    WOW! Finally it works!

    Code:
    x var word
    y var byte
    adr var byte
    sda var portc.0
    scl var portc.1
    lcdout $fe, $01, " "
    adr=160
    
    
    for X=0 to 5 
    I2CWrite sda, scl, adr, x, [x.lowbyte]
    lcdout $fe, $14, dec x
    
    
    pause 100
    next
    pause 500
    lcdout $fe, $1, "Complete:" 
    lcdout $fe, $c0, " "
    pause 500
    
    
    for x=0 to 5  
    i2cread sda, scl, adr, x, [y]
    lcdout $fe, $14, dec y
    pause 100
    next
    stop
    That's very good, this means now I can do a lot of LCD things!

    Thanks everyone!

    by the way, I tried to write 160 directly, instead of adr - also works.

Similar Threads

  1. i2c non-eeprom examples?
    By justDIY in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 22nd January 2010, 18:07
  2. Using eeprom for the first time- Help please
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th October 2009, 03:16
  3. Help with i2C eeprom
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 17th March 2006, 00:33
  4. Real Time Clock & Eeprom
    By smart_storm in forum General
    Replies: 8
    Last Post: - 17th February 2006, 19:03
  5. I2C EEPROM Programming
    By Rob in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd March 2005, 15:03

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