This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UART - printf - keil

printf() is a library routine provided by keil library.
So whenever we use printf in our code I assume what it
might be doing is calls a routine which places characters
of the printf statement in the UART buffer to get it
transmitted from there.

Now in LPC2000 we have two UARTs UART0 and UART1. So the
routine called for printf must be placing characters in one
of these UART buffers. Now I dont find any method to force the
printf tatement to place characters in buffer of specific UART
of our choice.

SO I assumed keil printf statement may be using UART1 data
buffer as default. Because it works fine with UART1 but not
with UART0.

While testing in our code I configured UART0 to transmitte
the data and than used printf statement to send the data. Than I
connected RS232 port of the PC with UART0 of our controller and
observed that it was receiving no data at all.

But when I connected the port to UART1 it was receving garbej
data. Data was garbej because I didnt configure UART1(I assume)

Code and other configuration was same in both the cases except
connection of the PC Rs232 port with UART1 instead of
UART0.

So I am Concluding that keil uses UART1 as default for printf
statments. AM I CORRECT?

Plz guide me if my conclusion is wrong and plz suggest some method
to use UART0 with printf statements because I cant use UART1 in
my project.