i2c communication with pic 18f452
Have you tried using UART? If you have a USB-TTL adapter, you could connect it to both your PIC and your PC. Alternatively, the PICKit you're probably using also offers UART comms with between your PC and the PIC. I don't know the compiler (or the libraries) you're using, though it looks like Mikro-C, which I've never used. Consult your compiler manuals on how to do the following. You will need to include the necessary header files needed for UART comms, initialize it with a baud rate and other settings, and then you can write a small function that basically accepts a string and prints it to the UART port, character by character, using functions from the UART library you will have imported. On your PC, you can use putty, or the PICKit interface, or even the Arduino serial monitor to view what you get from the PIC. This way, you can get the debug messages you need at every step. Or you could just use an LCD screen, of course ;).