4.4.5 How Do I Redirect Standard I/O When Using Printf?

The printf function does two things: it formats text, based on the format string and placeholders you specify; and it sends (prints) this formatted text to a destination (or stream). You can choose the printf output go to an LCD, SPI module or USART, for example. For more on the using ANSI C function printf, including how to customize the output so that it goes to another peripheral, refer to the following document. It is available for download from the Microchip Technology website, www.microchip.com.

Microchip Unified Standard Library Reference Guide” (DS-50003209)