Hello!
I'm not a PIC programmer, I use mostly MSP430 and ARM, so setting the I2C module
is probably different. However, this is basic programming and for sure there are myriads
of examples on how to do that. Did you try to google "pic 24C"? I would be surprised
if you don't find working sample code. You can even try to be more accurate with the
exact model for your pic and memory "pic18f4420 24C512".
If you don't find anything, then you can set earlier models, for example 24C128 or even
24C16, it's the same.
Dora.