Keil Logo

string send on serial port

Next 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
New! string send on serial port
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
New! RE: string send on serial port
By using "printf" in stdio.h...
Read-Only
Author
rock nmoon
Posted
24-May-2002 21:39 GMT
Toolset
C51
New! RE: string send on serial port
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
New! RE: string send on serial port
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
New! RE: string send on serial port
"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

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.