In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: Not quite. You have the normal mainloopcode running. This gets interrupted by the isr. If it is not time for a context switch, the isr exits and the mainloopcode continues. If it is time for a context switch, the mainloopcode return address is saved and the TaskSchedule address is placed on the shadow stack. When the isr exits the subroutine TaskSchedule runs as mainline code. This calls DoSchedule and there it is decided which task to run. All this is mainline code. The isr keeps running. When the task returns TaskSchedule waits for the isr interrupt to restore the context for mainloopcode, or if RTCC is low enough then TaskSchedule restores the context for the mainloopcode directly. regards peter ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=157842#m176190 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)