TeoYX WROTE:when i write #include "i2c.c" and #include "i2c_rtc.c", below error come out:
Error [192] C:\Users\Teo Yu Xiang\VIP\PIC Program Testing\i2c.c; 116.8 undefined identifier "RW"
Error [192] C:\Users\Teo Yu Xiang\VIP\PIC Program Testing\i2c.c; 235.8 undefined identifier "RW"
Is that the proper way to use i2c.c instead of i2c.h? Any related post about this error when using real time IC? Please help. Thanks a lot.
OK, when you include in your main C file, you should be writting:
#include "i2c.h"
#include "i2c_rtc.h"
NOT the i2c.c file.
What I worry is you din not include the necessary files under project window. Project window is small window at the right top corner of MPLAB IDE which show what is the files (.c) being included under Source Files, and .h files under Header Files. Print screen and show it to us.
RW is a bit name under SSPCON1 or SSPCON2 for I2C. New Hitech compiler change the name to R_W. Don't ask me why they change it, I am sure about it

Anyway, as highlighted by Allen and Brian. Your code is too large, that is very obvious. Try comments some of the blocks (functions or statement) in your code. Is very difficult to debug a code which you integrate very thing at once. Even it can compiled, I am sure it is not what you want when you load into hardware, you will get problem troubleshooting it as you are not sure where is causing problem. We normally write code parts by parts, verifying a small portion of code working correctly and further add in new code, load into hardware check and verify the small portion of new code is working as we wanted. if it is not working we know the new added code is the problem, debug that portion only, not the whole code. Hope you get what I mean.
