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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/08/10 14:03
Read: times


 
#177879 - Pardon accepted
Responding to: ???'s previous message
Andy Neil said:
Johan Smit said:
Call send_char from inside the serial interrupt. While in send_char do a reti. Then the interrupts are free, and you stay in send_char.

Eh???

If you do a RETI, it will cause a return, so you will not still be in send_char - surely?!

Then, when you hit the RETI at the end of the ISR, the fun really starts...

Let's look at the stack pointer.
In main routine SP = x
Serial interrupt occurs
In serial interrupt handler SP = x+2
Call send_char
In send_char SP = x=4
Call free_int
In free_int SP = x+6
Reti SP = x+4
Ret at end of free_int SP = x+2
In send_char SP = x+2
Return from send_char SP = x
You are in main routine

The reti is necessary for the hardware to reset and enable the next interrupt.
It was not me that was so clever. The principle is used in the Quantum Leaps RTOS.
Regards
Johan Smit

List of 17 messages in thread
TopicAuthorDate
Writing to SBUF in Serial Routine            01/01/70 00:00      
   Sure...            01/01/70 00:00      
   yes, but            01/01/70 00:00      
      TX inside serialint            01/01/70 00:00      
         Pardon??            01/01/70 00:00      
            Pardon accepted            01/01/70 00:00      
               Still a Missing Part of Scheme            01/01/70 00:00      
            Pardon            01/01/70 00:00      
               Will that work in 'C' ?            01/01/70 00:00      
                  Assembler if you want            01/01/70 00:00      
                     Why send_char?            01/01/70 00:00      
                        Why send_char            01/01/70 00:00      
                           You missed the point            01/01/70 00:00      
                              Call a routine from an interrupt            01/01/70 00:00      
                                 Still misunderstanding            01/01/70 00:00      
                                 misunderstandings            01/01/70 00:00      
      what happened to the OP?            01/01/70 00:00      

Back to Subject List