I'm trying to use printf() function on LPC2138 UART0 but it seems it doesn't work. It works fine on UART1 but not on UART0. Am I missing something? Must I use some redirect or something? Michal
printf() outputs through putchar() which usually outputs to a single I/O device. Does your putchar() allow for multiple I/O devices? How do you switch between them?
"printf() outputs through putchar()..." http://www.keil.com/support/man/docs/ca/ca_printf.htm "... which usually outputs to a single I/O device." You will need to consult your compiler Manuals (specifically, the Library section) to find out the specific requirements of the particular putchar() implementation. I wouldn't be surprised if GCC requires you to do some sort of "device open" for the UART; I have no idea for RealView - you'll have to read that one up for yourself!
I did sweep over the manuals for my compiler (http://www.keil.com/support/man/docs/ca/ca_putchar.htm ) but I can't find any thing valuable in there. Because of that I put my problem on a forum. I know Please read the manual sometimes works but not in this case…
http://www.keil.com/support/man/docs/ca/ca_putchar.htm As it suggests on that page, you'll have to modify the source to provide the functionality you require.
"but I can't find any thing valuable in there." Eh??? http://www.keil.com/support/man/docs/ca/ca_putchar.htm says: "Source code is provide in the LIB folder." See also http://www.keil.com/support/man/docs/ca/ca_lib_source.htm You have the complete source code, so you can see exactly what it's doing, and modify it to your requirements!
http://www.keil.com/support/docs/2014.htm http://www.keil.com/download/docs/288.asp
Andy! Thanks a lot. I made some mistake in reprogramming putchar :(. Thanks for help again! Michal