I2C to AT24C512 eeprom not working


Results 1 to 1 of 1

Threaded View

  1. #1
    yourmomOS's Avatar
    yourmomOS Guest

    Default I2C to AT24C512 eeprom not working

    Hi, newb here, got a question about I2C and two-wire interface. I have been told that if a datasheet just says two-wire serial without a protocol, then it is probably I2C but they dont put it on there because of licensing issues. Is this true or not? Also, I have an AT24C512 that I can not seem to get data from. Here is the DATA SHEET: http://www.atmel.com/dyn/resources/prod_documents/doc1116.pdf#search='at24c512'

    I have left A0 and A1 floating. I have data and clock pulled high with 2.2k resistors. I have also tried 4.7 k as well. Here is my code:

    define OSC 20
    CMCON = 7
    Cont con %10100000
    x var byte
    x = 8
    serout2 PORTB.2, 84, [x]
    MAIN:
    high PORTB.0
    pause 1000
    i2cwrite PORTB.7, PORTB.6, cont, 1, [9]
    pause 1000
    i2cread PORTB.7, PORTB.6, cont, 1, [x]
    pause 1000
    serout2 PORTB.2, 84, [x]
    serout2 PORTB.2, 84, ["DONE"]
    low PORTB.0
    pause 1000
    GOTO main

    When I run the program I keep getting ascii character 128 interspersed with "DONE". I have tried changing Cont to $A0 with no luck. I have tried large pauses between reading and writing also. Can anyone tell me what I am doing wrong? Thanks in advance. PS...Pic is a 16f628.
    Last edited by yourmomOS; - 25th March 2006 at 19:25.

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. 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
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  5. Pic16F628A and 24LC256 EEPROM I2C
    By Mike96 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st January 2006, 03:13

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