5.3 Example code for 16-bit PIC MCUs and dsPIC® DSCs
If you want to run example code in the MPLAB X IDE simulator, the IDE's UART IO feature,
available for most devices, allows you to view output from the stdout
stream. Once properly configured, the output of printf()
and other
functions writing to stdout
can then be viewed from the IDE when the
program is run in the simulator.
When available, this feature is enabled using the Enable Uartx IO checkbox in the Project properties > Simulator > Uartx IO Options dialog (shown below). You might have a choice of UARTs. Choose the UART that your code will write to. Output can be displayed in a window in the IDE or sent to a file on your host machine, based on the selections you make in the dialog.
The IO helper functions provided by the MPLAB XC16 and XC-DSC compilers will work with the simulator's USART IO feature without any modification; however, remember that you might need to modify these helper functions to suit applications running on your own hardware.