Skip to main content
Knowledgebase
Home
Renesas Electronics Europe - Knowledgebase

How to change the destination of printf to a UART?

Latest Updated:05/18/2015

Question:

I am using the CC-RL compiler for RL78 devices. How do I change the destination of printf to a UART?

Answer:

The printf function of CC-RL produces output by calling the putchar function. Create a new putchar function to change the destination of output by printf. In the default putchar function, the letters defined as arguments are output to the SFR with the symbol P0 (port 0) after being converted to the unsigned char type. Create a putchar function in which this processing is changed to transmission through a UART.
Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family