Hi,
Sorry for the mistake. Here is the question again:
I need to use 89C52 timer2 counter function. However, when I use the timer2, I cannot use printf function to debug my program, that is, no display output. However, printf function works fine for timer0 and timer1 function.
How I can use printf within the timer2 program?
Thanks
Ed
Erik, sorry for the confusion. My questions are:
1. Timer2 cannot use printf in ISR. Can I use printf in the main program?
2. Why timer0 and timer1 can use printf in the main program and ISR?
Once again, thanks for your prompt reply.
It's not so much that you can't use printf in an ISR - you can do it, and you might get away with it...
The trouble is:
* printf is a huge function - and that's Bad for an ISR;
* the default printf uses polled output - and that's Bad for an ISR;
* printf is not reentrant - and that's really bad if you also call it from main!
View all questions in Keil forum