 | Discussion Forum |  |
|
|
string send on serial portNext Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author rock nmoon Posted 24-May-2002 05:01 GMT Toolset C51 |  string send on serial port rock nmoon Hi All,,
How can a formatted string be send on the serial port ??
Any help will be great.
Thankzz && Bye Rocknmoon | | Read-Only Author Christophe Champigny Posted 24-May-2002 08:41 GMT Toolset C51 |  RE: string send on serial port Christophe Champigny By using "printf" in stdio.h... | | Read-Only Author rock nmoon Posted 24-May-2002 21:39 GMT Toolset C51 |  RE: string send on serial port rock nmoon 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 | | Read-Only Author Mark Odell Posted 25-May-2002 01:27 GMT Toolset C51 |  RE: string send on serial port Mark Odell 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 | | Read-Only Author Andrew Neil Posted 25-May-2002 10:15 GMT Toolset C51 |  RE: string send on serial port Andrew Neil "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! | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|