Pic16F628A and 24LC256 EEPROM I2C


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2005
    Location
    US
    Posts
    4

    Arrow Pic16F628A and 24LC256 EEPROM I2C

    Is this hookup valid for I2C EEPROM storage of data?
    (see .JPG file)
    First EEPROM is Address $00 and the other Address $01

    Part of PicBASIC Pro program follows:

    ' **********************************************
    ' Using PIC16F628A and 24LC256 EEPROMs
    ' **********************************************
    SCLK VAR PORTB.6 ' Data Pin on I2C
    SDATA VAR PORTB.7 ' Clock Pin on I2C
    addr VAR WORD ' Memory location in EEPROM to use
    CntRec VAR WORD ' Value of count to store in EEPROM

    addr = %00000001 ' Location of memory to use
    CMCON = 7 ' PORTA digital

    ' if power is applied, want last count of data stored in EEPROM -
    ' Read EEPROM first to get last count

    I2CREAD SDATA,SCLK,$A0,addr,[CntRec]

    GOSUB LCD_Display01 : Display count from EEPROM
    ' Send CntRec out to Serial bus or LCD Display to display content

    Main:
    If DET_IN = 1 THEN ' any form of detector circuit
    CntRec = CntRec + 1 ' Increment count in EEPROM
    GOSUB LCD_Display01
    IF CntRec >= 255 THEN
    CntRec = 1
    GOSUB LCD_Display04 ' reset count
    EndIf
    EndIf

    I2CWRITE SDATA,SCLK,$A0,addr,[CntRec] ' Write new count

    GOTO Main ' continuous loop ....

    LCD_Display01:
    LCDOUT CMD, Line1, "* * * * * * * Detected Signal * * * * *"
    LCDOUT CMD, Line2, " Detect Total = " ,#CntRec, " "
    RETURN

    LCD_Display04:
    LCDOUT CMD, Line1, "* * * * * * * Reset Count * * * * * * *"
    LCDOUT CMD, Line2, " EEPROM = " ,#CntRec, " "
    PAUSE 5000 ' pause for 5 seconds
    RETURN
    Attached Images Attached Images  

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    1. Remove R22... connect directly to Vdd/+5v.

    2. Remove R23 & R24, connect directly to Vss/0v.

    3. Value of 10K is too high for R25 & R26. Drop it to 4K7.

    Merry Christmas (or Happy Holidays - whichever you prefer) to all...

  3. #3
    Join Date
    Nov 2005
    Location
    US
    Posts
    4


    Did you find this post helpful? Yes | No

    Arrow RE: SOLVED Pic16f628A and 24LC256 I2C

    Found problem with a connection to the 24LC256 chip.

    Apperently, the connection to the SCL (clock) line was not making contact to Pin 6 of the chips. After getting the connection to then, the circuit worked flawlessly.

    Originally my story was that I used to use the PIC16F628A internal EEPROM memory, but when a new chip was inserted (programmed ), the count was lost.

    So finally I relized that external Ram was the key.

    Hooking up the 24LC256 in a SOIC package, I used the wrong connection (unused wire) to put pull-up on clock signal. After connecting the proper line to the chips, the circuit worked.

    Here is a complete program and schematic for 24LC256:

    See Attachments

    Thank You
    Attached Images Attached Images  
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 2005
    Location
    US
    Posts
    4


    Did you find this post helpful? Yes | No

    Question RE: Pic16F628A and 24LC256

    I do not know the 24LC515 chip but post your PIC BASIC text file and I will look at it to see where your error might be.

    I need to know what is your clock frequency and PIC Chip Type ( 16FXXX ).

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