|ARM Technical Support Knowledge Articles|
Applies to: General Topics
Information in this article applies to:
Are there any reasons why I shouldn't call the printf function from within an interrupt?
There are numerous good reasons to avoid calling printf from an interrupt routine.
Interrupt routines are typically used to respond to events that occur quickly. For this reason, it is usually important that interrupt service routines run fast. The printf function is not a fast routine. Especially if you consider that the output from printf may output to the slow serial port. At 1200 baud, a 100 character string takes almost 1 second to send. The printf function will therefore take more than that to execute. In this case, your interrupt service routine will take around 1 second to execute. If that interrupt happens faster than once per second, you will lose interrupts.
Article last edited on: 2000-05-24 00:00:00
Did you find this article helpful? Yes No
How can we improve this article?