Hi All,, How can a formatted string be send on the serial port ?? Any help will be great. Thankzz && Bye Rocknmoon
By using "printf" in stdio.h...
How do i use printf() ?? DO i have to use it in the serial ISR or in the main code ?? Any sample code will be great. Thankzz && Bye -Rocknmoon
Just write your own version of putchar() and getchar(). See my interrupt driven, ring buffered example (FREE) at http://www.embeddedfw.com. It should be blatantly obvious after looking at the UART example. If not, I have failed, please tell me how. - Mark
"DO i have to use it in the serial ISR or in the main code ??" Absolutely do not use printf in any ISR! You just use printf as you would in any 'C' program; eg, the classic "Hello, world!" printf ends up using putchar - C51 provides a standard, non-interrupt-driven implementation which uses the standard 8051 UART. You may need to customise it to your own requirements; eg, different port, interrupt-driven, etc This is documented in the manual, there's an example in the downloads section, and Mark has given you his own implementation!