Tony Vilches wrote: > > I gather from your previous post that you are quite familiar with the I2C bus, > if so, could you post some code to enable a 16c84 to communicate with a 24lc64? > (just single byte read / writes will suffice). > I have tried modifying programs from two different sources and I > still can't get the two to talk. Which sources? Microchip's code is not very good. > If you can post some _tried and tested_ source code, > I will be able to modify it to fit my present pin configuration. I'm not a great programmer. I get by by being thorough, methodical, and tenacious. I started from Microchips flaky AN557 code, and have done a lot of work on it to get it to conform to the I2C spec. Things like getting the master PIC to wait when the slave holds SCL low (AN557 thinks this is an error!). I can't give you any guaranteed code because a. my project is not bug-free yet. b. I'm loathe to release unpolished code Unlike some chip makers! c. I'd have to ask my employers if this is okay since they've paid for it's development. I can hand out tips though. Tip 1: read the data sheet for the exact device you're using. I had some headaches when I started to use my 24LC02. It's not enough to know I2C. You need to know how the EEPROM behaves. For example, I'm told some want you to write erased values before you can over-write. Check how your chip responds when busy writing. You might think it would just hold SCL low, but the few milliseconds is a long time w.r.t. an I2C message. For my 24LC02, it just doesn't bother responding to its address until it has finished. So it effectively disappears for a while! I also found the 24LC02 insists you NACK the last byte before you STOP. The STOP condition doesn't reset all the internal logic, and this chip remembers the ACK bit. So when you next read data in a new message, it continues to send bytes from addresses immediately after those read by the last message. Even if you've re-written to the data pointer inside the EEPROM! > In the past I have managed to build my own dual unit 7seg LED (based > ...Check this chip out: MAXIM MAX7129. (or is that MAX7219 ?) RS part 311-473 GBP 4.93 p 3-575 > Any practical help would be greatly appreciated > (I suspect there are many others out there who > would also appreciate help with I2C). I need help with I2C myself. And psychiatric help soon I expect.