Reputation: 78
I tried printf
in a function, but I don't see anywhere the result in MPLAB X IDE.
Why?
Where can I find the printed result?
I am using PIC32 Curiosity development board and XC32.
int a = 5;
int b = 10;
printf("a = %d\nb = %d\n", a, b);
Any info?
Upvotes: 4
Views: 10835
Reputation: 4288
printf
always uses the UART as STDOUT.
If you use the simulator you could enable UART IO under Project Properties. Know it's your choice if you like to see your printed data in a file or in an output window.
Upvotes: 6
Reputation: 141698
Why?
Because mplabX IDE doesn't have access to your hardware. I guess you use debugging (you haven't written), then your debugging (unit? hardware? software?) might not support it.
Where I can find the printed result?
That depends on how you have written your _mon_putc() function. By default, MPLAB® XC32's libraries use UART2 for STDOUT.
For example for PIC32MZ EF CURIOSITY DEVELOPMENT BOARD UART2 (signal U2TX) would be on pin 7 on MCU, that would be pin 4 on J11 or pin 13 on J10 or pin 5 on connector J14. The best would be to buy a cheap UART<->USB converter to read from that uart.
Any info?
Sure.
(XC32) How do I instruct printf to output to UART1 or other UART channels instead of UART2?
Debugging: Can I redirect printf or putchar to the MPLAB X console?
stdio over uart1 example
The mplab simulator uses uart1 as stdout and the simulator connects a simulated "reader" to that uart which shows it's output on mplab console. The uart on your real hardware, I guess, isn't anyhow connected to the computer.
Upvotes: 1