Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/02/08 11:16
Read: times


 
#160493 - ISR for UART?
Responding to: ???'s previous message
ISR is implemented through printf. putchar is also implemented by printf itself.

Sound like the order is reversed :-)
Usually,
putchar() is implemented through a ring buffer connected to the UART ISR
As of printf(), the library implements it over putchar().

anyway, it's fine if it works actually well.

But when you are handling the UART in interrupt, why "TI0=1;" is required at the initialization stage on the main()?
It evokes the UART interrupt uselessly.
And also, it triggers the trouble as you said on your first post.

In usual implementation, just when the UART pauses TX session, putchar() kicks the UART by
SBUF0 = first_byte_on_ring_buffer;
OR
TI0=1;

Is the ring buffer pointers (indices) initialized properly before enabling interrupt (EA = 1;) ?
Where is this initialization?


As you are using "#pragma LARGE", and you don't use any memory specifier, all variables go to XRAM space, including function parameters and internal working of the functions. Then, the IRAM space is almost empty. I don't think stack overflow occurs at just moment after the initialization under this condition.

Tsuneo


List of 21 messages in thread
TopicAuthorDate
Program hangs at one point - 8051F340            01/01/70 00:00      
   Assembly window            01/01/70 00:00      
   hyper terminal interface            01/01/70 00:00      
      Stack size?            01/01/70 00:00      
         Stack size            01/01/70 00:00      
            Stack Management            01/01/70 00:00      
   Watchdog            01/01/70 00:00      
      stack and preview..            01/01/70 00:00      
         Limited stack            01/01/70 00:00      
      Where is the UART ISR?            01/01/70 00:00      
         ISR for UART            01/01/70 00:00      
            ISR for UART?            01/01/70 00:00      
               why "TI0=1;" is required            01/01/70 00:00      
            No, it isn't            01/01/70 00:00      
               Solved - I guess            01/01/70 00:00      
                  'polling' is NOT "standard C"            01/01/70 00:00      
                     You are right Erik..            01/01/70 00:00      
      Thought I will thank you individually..            01/01/70 00:00      
   Disable watchdog            01/01/70 00:00      
      and in Keil it is:            01/01/70 00:00      
         Status : WDT disabling in the status worked            01/01/70 00:00      

Back to Subject List