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

How to rework "printf" function to use for two UARTS in the cygnal's MCU?

Hi,everyone!
A problem here:The cygnal's MCU has two
serial ports,so "printf" function must be reworked.But I don't know how to do it.
Give me a hand!
Thanks a lot!

Parents
  • Note that the printf library function is huge - it has to be to support all those formats & options!

    I think you'll find that the classic "Hello, world" first 'C' program will take up nearly all the 2K codespace limit of the C51 Eval version!

    For embedded stuff, it's usually better to write your own routines, implementing only those specific features which are actually needed in your application.
    You could then include a parameter which specifies which serial port to use.

    I did this, and included a "null" value for the port - this makes it easy, for example, to turn debug output on & off without obfuscating your mainline code with loads of "if( debug )" clauses.

Reply
  • Note that the printf library function is huge - it has to be to support all those formats & options!

    I think you'll find that the classic "Hello, world" first 'C' program will take up nearly all the 2K codespace limit of the C51 Eval version!

    For embedded stuff, it's usually better to write your own routines, implementing only those specific features which are actually needed in your application.
    You could then include a parameter which specifies which serial port to use.

    I did this, and included a "null" value for the port - this makes it easy, for example, to turn debug output on & off without obfuscating your mainline code with loads of "if( debug )" clauses.

Children