I don't know what PIC you are using, so I can't promise anything, but I've attached a file containing some portions of code I have used with the hardware I2C on a PIC 18F4620.
The file is a compilation of cut and past from a few include files, and has only been minimally "cleaned up" for public viewing. It has 4 sections:
1) Basic PIC and HSEROUT setup (mostly to reinforce what pic and how it's configured)
2) The meat of the I2C commands
3) Samples of Large Block Reading/Writing to an EEPROM
4) Samples of Reading/Writing to an RTC
Hopefully this will get you started.
Best of luck,
Steve B
Disclaimer: Looking a little closer I recall this being one of my first PBP-ASM items I tackled. It worked, and with other things pressing, I haven't gone back and cleaned things up, like unused variables (DelayCtr1 and DelayCtr2) and rements of HSEROUT commands used to debug.
Bookmarks