Jump to content

Recommended Posts


I've recently been attempting to use a 16F876A for I2C comms with an external EEPROM. I have used the examples posted in the links from this site by R S A Bear, for which I am much obliged. I've reduced the code to cut out the comms with the second PIC, leaving the EEPROM read and write routines. This example also uses the i2c_driver.h file in the boostc distribution.


However, I can't get my code to work properly, and I wonder if anyone else has used these examples, or has some ideas to point me in the right direction? I find that the eeprom write function is almost correct; by looking at the eeprom contents in a separate eeprom programmer the first two bytes written are always incorrect - the rest is fine. Which is a puzzle! I wondered if the SCL speed was too high at 100kHZ and tried reducing it to 50kHz, but this makes no difference.


The eeprom read function doesn't work at all, that is, totally corrupted data is returned. However, the returned data is always the same, which again is a puzzle. I am outputting the data to an LCD, but also viewing the SDA and SCL on a DSO and the waveforms look OK. At this stage I'm loathe to drag out the logic-state analyser, and I'm not convinced it would shed any light on my problem.


As this is my first encounter with I2C I get this funny feeling that I'm missing something really simple!




Share this post

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...