I2CWRITE on a 24LC512


Results 1 to 18 of 18

Threaded View

  1. #1
    Join Date
    Mar 2007
    Posts
    30

    Post I2CWRITE on a 24LC512

    Hi all,

    i've some problems writing with I2CWRITE to this EEPROM (24LC512), it's wired to the PIC and pulled up via two 4.7k res.

    The pic sometime write, sometime not, this is the code:

    'Dichiaro le variabili
    W0 VAR WORD 'Memorizzazione I2C
    SCL VAR PORTC.3 'Pin per la memoria I2C Clock
    SDA VAR PORTC.4 'Pin per la memoria I2C Data
    I VAR WORD 'Generica
    Control VAR BYTE 'Costante byte di controllo EEPROM

    Control = $A0 'Imposto il byte di controllo

    OPTION_REG = %11101111

    'Imposto la frequenza di oscillazione a 10 Mhz
    DEFINE OSC 10

    'Imposto le porte della PIC
    TRISA = %11111111 'PortA Tutti input
    TRISD = %11111111 'PortD Tutti input
    TRISB = %00000001 'PortB Tutti output a parte 0
    PORTB = %00000000 'PortB Tutti low
    TRISC = %00000000 'PortC Tutti output
    PORTC = %00000000 'PortC Tutti low

    'Inizializzo l'EEPROM
    EEPROMInit:
    W0 = $0
    for I = 0 to $18
    I2cwrite SDA,SCL,CONTROL,I,[W0]
    pause 10
    next

    in the initial state where all the addresses is FFFF, after i use this code i can see this state in the EEPROM:

    0000: 1100 00FF 0000 0000 | ........
    0008: 0000 FF11 0000 FF11 | ........
    0010: FFFF FFFF FFFF FFFF | ........
    0018: FFFF FFFF FFFF FFFF | ........
    0020: FFFF FFFF FFFF FFFF | ........
    0028: FFFF FFFF FFFF FFFF | ........
    0030: FFFF FFFF FFFF FFFF | ........

    Can you help me solving this problem?

    Thank you,

    Luca

    EDIT:
    I'm using a PIC16F877A
    Last edited by oslinux; - 21st March 2007 at 17:49. Reason: Forget to write the PIC i'm using

Similar Threads

  1. I2CRead & I2CWrite not working as expected
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 30
    Last Post: - 27th October 2021, 18:36
  2. PIC 18F4550 and MCP23017
    By DaveC3 in forum Code Examples
    Replies: 12
    Last Post: - 4th December 2010, 14:01
  3. Puzzling issue with I2CWRITE to 24LC512
    By aberco in forum General
    Replies: 4
    Last Post: - 22nd August 2008, 17:47
  4. My I2CWRITE - timings and tricks
    By FinchPJ in forum Code Examples
    Replies: 5
    Last Post: - 3rd March 2008, 21:40
  5. I2CWRITE and I2CREAD
    By Tomas in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd April 2004, 02:30

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