You are currently browsing the Pilot’s Logbook weblog archives for the day 13. April 2009.
- 1. March 2010: Solve this!
- 29. January 2010: PIC32 Starter Kits Software v2.0
- 27. January 2010: Animation on the MikroE PIC32MX4 Multimedia Board
- 26. December 2009: Merry Christmas and Happy New Year
- 18. November 2009: MikroE MX4 Multimedia Board
- 30. September 2009: Good old printf() (continued)
- 26. August 2009: Changing habits... and dreaming a bit
- 24. July 2009: Where is my RAM?
- 15. July 2009: Olimex PIC-P32MX board
- 28. June 2009: A Great New Board from mikroElektronika
Archive for 13. April 2009
Good Old printf()
13. April 2009 by pilot.
Good old printf() is probably the oldest debugging tool ever used, I mean beside a light bulb (nowadays replaced by an LED) … yet it represents a pretty sophisticated one when working in a deeply embedded control project. If you take the standard definition of the printf() function (as in the ANSI C standard) it assumes that you will be able to convert and print integers and floating point numbers of any size, and use a myriad of formatting options.
Assuming you have a serial port (UART) to spare for the interface with a terminal (Hyper- if you use a PC) it is the code space requirements (even excluding the floating point support) for a full implementation that makes it a difficult choice. It could be pretty large (several K of code), comparable if not more than the entire program memory available on some 8-bit microcontrollers.
So in the past I have used a bit of everything to avoid relying on printf() for my debugging/diagnostic output. Mostly macros including itoa() followed by puts() and a mix of other hand made optimizations for simple hex output.
In the 16-bit and 32-bit world, there is a little bit more room to breathe, and with a smart compiler’s help, things get manageable. Read the rest of this entry »
Posted in PIC32, Tools | 1 Comment »