Two topics - State Machines
Russell McMahon email (remove spam text)
>Sort of an inside joke among some programmers - There really IS no such
>a thing as "multitasking" on single-CPU computers, just different ways
>to PRETEND we're doing multiple tasks simultaneously, by doing a little
>of each task at a time, then switching to the next task - really
>quickly. <G> And repeatedly.
At that level of picky-ness (PIC-i-ness?) I'd have to assert that there was
no such thing as a microprocessor based state machine either :-). This is
especially true if the total set of inputs to the "machine" exceeds the data
word size of the processor so that you have to macke numerous decisions to
decode and implement the state actions.
A REAL state machine is a simultaneously switchjing (clocked or ripple
through) piece of hardware. A microprocessor implementation is just another
way at looking at code with a complex set of conditional branches. As
someone noted, you can end up writing something that others would describe
as a stae machine without ever having heard that they exist. A state machine
can be as much a way of thinking or a programming paradigm.
All that said, the state machine concept is a marvellous one for simplifying
complex programming tasks - especially realt-me multitasking ones :-)
While I'm drivelling, I disagree about the lack of ability to do REAL
multitasking on a single cpu machine.
if a task operates in :"real time" and produce "outputs" of whatever form in
response to certain stimulii and prior conditions, what does it matter what
the computer is doing in the time it has left over after doing the
componnets of the task?
If there were multiple (say 10) computers doing multiple (say 10) such tasks
simultaneously and each is idle for 95% of the time or one computer is doing
all 10 tasks and being idle for 30% of the time, would the tasks be any less
"simultaneous" or "multiple" in the latter case. As long as the outputs are
indistinguishable in each case the answr is, of course, no. If the 10
computers are truly multitasking then the single computer is also truly
But then, I know, you know that.
See also: www.piclist.com/techref/microchip/devices.htm?key=pic
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the