In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Craig; I'm a bit baffled by some of your questions, but it's probably due to your approach..... using SX/B; and I'm NOT knocking that; it has its place. In assembler with an RTOS scheduler these problems simply go away. You can have multiple serial UART routines running simultaneously, as well as LCD display drivers, and I2C all operating concurrently. Normally I have very little in the ISR; in fact almost nothing; just a tick counter or an interrupt event flag...... a whopping 3 instructions. The interrupt runs at a fairly fast rate, 1 or 2 uSec, and all application timings are driven from that. I'm just putting the finishing touches on a co-operative RTOS that would be perfect for applications such as yours. It permits up to 8 active threads and there can be any number of dormant threads that can be launched by an active thread. Each thread can suspend itself or any other thread for any number of the 1 or 2 uSec ISR ticks, and then carry on where it left off, or alternately carry on at some other spot, thereby making state machines a snap. The overhead of this RTOS is not too cumbersome... it takes about 1.5 uSec for a task switch, less than 50 instructions for the whole RTOS and 2 RAM bytes per active thread. A couple of macros assist in enrolling each thread into the 8 level stack, and suspending a thread while a pause is required, or an alternate thread is to run. What is so nice about this kind of approach is that you can focus on one task at a time as there is very little timing interaction between active threads. But, at this time at least, it only works for assembler...... some relatively minor (I believe) changes are required to SX/B to accommodate it. If you are interested in this method, I'd be happy to share it with you.... there are very few (one in fact) warts left; it's been very nice and stable. 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=195387#m195679 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)