Printf() size, questions?

How many bytes will printf() take up in a non debug-monitor
environment?

Also, is it easy to set up printf() to map to a second UART?
I will need control of the UART ISR so that I can handle receives
appropriately. How will this confict with printf()?

Parents
  • #pragma maxargs (20) will set the number of bytes used by variable arg. functions such as printf to 20. The default for the small model is 15, for the large 40. See page 34 of the latest C51 v6.02 C51.pdf manual.

    Mapping printf to any device is simple. First, write your own putchar(). One that can print to either UART based upon some file static var. This will automatically replace the library version. Then, write a device switcher function that controls the file static var. that putchar uses to determine which UART to use. Printf will use what ever function has the name putchar.

    - Mark

Reply
  • #pragma maxargs (20) will set the number of bytes used by variable arg. functions such as printf to 20. The default for the small model is 15, for the large 40. See page 34 of the latest C51 v6.02 C51.pdf manual.

    Mapping printf to any device is simple. First, write your own putchar(). One that can print to either UART based upon some file static var. This will automatically replace the library version. Then, write a device switcher function that controls the file static var. that putchar uses to determine which UART to use. Printf will use what ever function has the name putchar.

    - Mark

Children
More questions in this forum