Problem reading 24FC1025 EEPROM with 18f14k22


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    I am running the Internal OSC at 16MHz. I did try slowing the clock down and it still didn't work. I am not sure if the Clock is whacked or if my Logic Analyzer is just too slow to capture it (500kHz is as fast as it will run on my computer for some reason).

    I am still leaning toward a bug in Picbasic Pro 2.60C (Not because it isn't working at all, but because the value being returned is directly related to to the binary value of the pin it is connected to). If I connect to pin ra.0 I get a return value of 1, ra.1 returns a value of 2, ra.2 = 4... This shouldn't be happening unless I either made some strange mistake with variable ussage, or if there is an internal bug in the compiler. I saw a similar wierd sort of incremental value on the 18f46k22 while reading ADC lines and it turnned out to be a bug in the complier (which got fixed with 2.60c).

    One other thing to note is that the EEPROM address on the Shiftin uses two byte variables while the I2Cread/write uses one 16-bit word variable for the address.

    Jim


    Quote Originally Posted by Demon View Post
    (Can't believe I have the PBP manual on my phone. lol )

    You don't mention the osc speed. The manual mentions up to 20MHz, the 18Fs can go much faster.

    Odd that your clock is whacked. What about pull-ups on your pins?

    Robert

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    This routine has worked for me just fine since PBP2.32 w/4 each 24LC1025's. Just exchange the I2CWRITE for I2CREAD and your done....

    CNTRL_BYTE CON $A0 'CONTROL BYTE FOR I2C EEPROM MEMORY (A0/A1 USED FOR CHIP SELECT)

    BLOCK VAR WORD '128 BYTE BLOCK ADDRESS
    ADDRESS VAR WORD 'ADDRESS WORD FOR SERIAL EEPROM
    CNTROL_BYTE VAR BYTE 'CONTROL BYTE TO SEND TO SERIAL EEPROM
    EEDEVICE VAR BYTE 'PHYSICAL DEVICE ADDRESS
    STOR_DATA VAR BYTE[128]'STORAGE DATA ARRAY

    EEDEVICE = BLOCK / 512 'SELECT WHICH PHYSICAL ADDRESS BOUNDRY & EEPROM
    ADDRESS = BLOCK << 7 'CALCULATE 12C ADDRESS TO STORE DATA TO
    CNTROL_BYTE = CNTRL_BYTE 'COPY CONTROL BYTE
    CNTROL_BYTE.1 = EEDEVICE.1 'SET LSB OF HARDWARE ADDRESS
    CNTROL_BYTE.2 = EEDEVICE.2 'SET MSB OF HARDWARE ADDRESS
    CNTROL_BYTE.3 = EEDEVICE.0 'SET 64K BLOCK BIT
    I2CWRITE SDA,SCL,CNTROL_BYTE,ADDRESS,[STR STOR_DATA\128] 'SAVE DATA TO 12C
    PAUSE 6 'ALLOW TIME FOR I2C WRITE ~5Ms.

    Also a MAXIMUM resistance on each SCL and SDA lines to VCC of 2.2k. The faster the bus speed the smaller the resistance.

    Dave Purola,
    Dave Purola,
    N8NTA
    EN82fn

Similar Threads

  1. 18F14k22 eTouch
    By warrier in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th July 2009, 05:20
  2. Problem reading 93c46 EEprom
    By dj.lambert in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th March 2009, 06:10
  3. Reading eeprom
    By Lotondo in forum Off Topic
    Replies: 1
    Last Post: - 21st February 2007, 17:37
  4. problem of reading eeprom 24lc515
    By mike12 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st January 2006, 17:36
  5. Writing / Reading EEPROM 24LC256 Problem
    By schmoddel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th February 2004, 18:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts