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
Unless I am missing something is not T2 or T1 to be dedicated as a baud rate generated for serial output? If you are using printf through the serial port (which is the default behavior with putchar). This means you either cannot use T1 or you cannot use T2 as a regular timer and use the serial port. If you intend to use both those timers no serial port, otherwise you must select one timer to generate the baud clock. Some variants of the C51 allow external baud rate generation I believe.
Stephen