CCS was the first to release a C compiler for the PIC ® MCU. For over 25 years CCS has provided proven and reliable PIC ® MCU development tools trusted by a multitude of industries. C Compilers - V 5.104. Include pro-level optimization, built-in functions, and ready-to-run example programs. Easily migrate between all Microchip PIC ® MCU.
This is a small example shows how to use PIC16F877A UART module using CCS PIC C compiler.
PIC16F877A UART connection circuit schematic:
Pin RC6 (TX) and pin RC7 (RX) are used for the UART (serial) communication between the microcontroller and the computer. To change between TTL logic levels (5V) and RS232 signals (+/-12V), an IC is needed which is max232.
Don’t connect TX and RX pins directly to an RS232 serial port which may damage your microcontroller.
CCS C compiler serial monitor can be used to communicate with the microcontroller.

PIC16F877A UART example CCS C code:
This is the full C code for this example.
Using Multiple RS-232 Ports on a PIC ® MCU or PIC ® DSC. In order to use multiple RS-232 connections on a PIC ® MCU or PIC ® DSC, multiple #USE RS232 pre-processor directives will need to be setup using the STREAM option. A #USE RS232 pre-processor directive will remain in effect for GETC, PUTC, PRINTF and KBHIT functions until another #USE. Tutorial para usar la comunicacion serial en los microcontroladores PIC con el compilador CCs. The RS-232 is a standard for serial binary data signals connecting between a Data Terminal Equipment (DTE) and a Data Communication Equipment (DCE). One of the significant differences between TTL level UART and RS-232 is the voltage level. Valid signals in RS-232 are ±3 to – ±15V, and signals near 0V is not a valid RS-232 level.