In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Peter; Perhaps I am somewhat dense, but I don't totally grasp the significance of what you're trying to accomplish; albeit you have significantly simplified the RTOS I posted, but also imposed limitations. If you are running a timer/scheduler in the mainline, and the mainline can be pre-empted and its context saved, you are stuck with interrupting only a single mainline thread. The scheduler will require that all other mainline threads be completed before a new one may be scheduled. While that may have merit in low activity circumstances, I believe it is rather limiting if there are many threads (I often have a dozen) and if any of those take a long time to complete. I recognize that you still will run VP's in the ISR......that is something I was wanting to get (mostly) away from; the exception being very short precision PWM DAC's that require execution at EXACTLY the same time every pass. So, I end up using the ISR (almost) only for running the RTOS. While I have not stated as much, the pr-emptive RTOS that was posted as my contest entry had some bugs and inefficiencies, and is now totally re-written and improved. It consumes only 99 bytes of code, and I think some 35 instructions per interrupt "tick", but alas, almost half the SX28 RAM if one implements all 8 thread levels. I have now used this improved RTOS in a number of applications, and have found it to be quite robust. It is very convenient to have up to 8 threads run, each one interruptable by a higher priority, and then carry on where it left off when it is restored. The only (obvious) caveat being that each thread be finished before it is re-started again; ie they are not re-entrant. I will take a closer look at what you have done, and also run the code you have provided to try and gain a better insight into what you are up to.....at first scan I think I see some errors, but that could be that I don't yet fully understand it. Cheers, Peter (pjv) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108896#m108996 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)