Skip to main content
Knowledgebase
Home
Renesas Electronics Europe - Knowledgebase

Is it OK to change output destination of the print statement to a UART?

Latest Updated:11/21/2014

Question:

I am using the CA78K0R compiler for RL78 and 78K0R products. Is it possible to change the output destination of the printf statement to a UART?

Answer:

The CA78K0R uses the putchar function of the standard library to handle output by the printf statement in a program. To change the destination for output by the printf function, create a new putchar function.
By default, the putchar function converts characters specified by arguments into the unsigned char type and outputs those characters to the SFR with symbol P0 (port 0). Create a putchar function in which this processing is changed to processing for transmission through a UART.
Suitable Products
C Compiler Package for RL78 and 78K Families
Compiler for RL78 Family and 78K0R [CA78K0R]
Compiler for 78K0R [CC78K0R]