When you say "communicate" what do you mean? Via a serial connection to the PIC -- from what? A PC, a terminal, a ???
When you say "ON and OFF relay" what do you mean? A relay that periodically cycles on and off, or a relay that energizes in response to some condition that is "communicated" to the PIC, or ???
You need to be more specific. Give some details about what it is that you want to achieve.
Also, it would help to know what C compiler you plan to use, as each handles initialization, fuse config. typedefed register names/mappings, and other such preliminaries differently.
I use MikroC Pro, so if you are using a different compiler, I can only give you generalities. You will need to "fill in the details" as befits that compiler's idiosyncrasies. Also, if what you have in mind is more than just a simple case, I may have to limit my shares to hints.