> >> > 3) We created execution threads. Execution threads implemented
> >> > with pragma's are similar to the ON operator in some basics. In
> >> > our case execution threads can be triggered by interrupts
> >> > conditioned with a logical expression. Timer and softcount = n
> >> > for example. Threads run to completion always. Threads
> >> > statistically use less RAM and stack than conventional
> >> > implementations. Threads may be software logical expressions
> >> > only, or a mix of interrupts and expressions. Very effective on
> >> > small processors like the 12bit Microchip PIC core. Language
> >> > supported execution threads eliminates the need for RTOS's in
> >> > many applications.
> >>
> >> Interesting even though I have some problems understanding
> >> really a thread means. Is it a subroutine? But you mentioned that
> >> threads run to completion always, so you disable the interrupt,
> >> right?
> >
> > A thread is a piece of straight line code which could be a
> > subroutine call that is called from a small compiler generated
> > executive that evaluates logical expressions and dispatches
> > the thread when the execution conditions are met. Run to
> > completion un-interrupted as an assumption makes thread
> > code simple to write and easy to debug. A lot of information
> > on assumptions is coded into the execution criterion. Threads
> > doesn't have to be a subroutine. Nice for execution stacks
> > with 2 or 4 levels of subroutines.
> >
>
> I often end up writing menu systems using state machines where, depending
> on a user action, a state is set. We then return to mainline code. The
> next time the menu system is called, it checks for a key. If one was
> pressed, it evaluates it based on the current state. This gets rather
> messy because I have to define all these different states. I like being
> able to have a wait loop in my code where it's just waiting for the next
> user input, but, while waiting, it goes off and does other stuff. I've
> written stuff where there's a NextTask() function that saves away the
> current stack, reloads the stack with the contents for the next task, then
> runs it until a NextTask() is hit. All functions run until they hit the
> NextTask(), which is generally until we get to a point where we are
> waiting for user input. I did this years ago on an 80286 with a separate
> stack for each task. I then just saved the stack pointer for each task,
> then restored it. I've also done it on the PIC18, but have only tested it,
> not used it in a real application. For the PIC18, I copy the stack to a
> RAM array, then copy it back when I resume the task. The code and test
> code is at
>
http://www.piclist.org/techref/microchip/language/c/MultiTask.c.htm .
>
> Harold
>
> --
> FCC Rules Updated Daily at
http://www.hallikainen.com - Advertising
> opportunities available!