control - Stuff about or related to control systems
Have you ever got tangled up in a program that has
become like a bowl of spaghetti, and your brain feels like the pasta
sauce? This is what can happen when you try to write a program that
must do several things at once, asynchronously with each other.
A trivial example would be to program 3 flashing lights, one at 1s,
one at 1.36s and one at 2.84s.
The solution is to use MultiTrack. With MultiTrack
your pasta dish becomes more like a lasagne, with clearly defined
layers, each with its own purpose, smoothly working together to
produce an overall outcome.
The vital idea behind MultiTrack is that you can write
a program as a number of quite separate tasks which run
independently of each other. They can coordinate their
activities, by exchanging data (usually very small amounts
of data) via shared memory variables.
For example, in a cow insect spray system I programmed
recently, one task takes care of filtering genuine cow signals out
of "bumpy" raw sensor data, one task takes care of timing the spray
head (and limiting the spray time to 2 seconds, in case a cow
stalls), and one task controls the chemical/water mix ratio. Because
they are separate tasks, if I need to change the timing for the
spray it won't affect the timing of the input cow filter or of the
chemical dosing pump. By dividing the overall job into separate
tasks I can conquer the complexities.
As a bonus, if you need to add a new bit of
functionality, say an inhibit push button and timer to
prevent a human from getting sprayed when walking through
the treatment area, it can be done with the minimum amount of
surgery on the existing code.
MultiTrack is extremely easy to use (3
instructions to learn!). There is an introductory mini-tutorial in
the SPLat/PC help menu. It will take you 20 minutes tops to
run the mini-tutorial. That's about the time it takes to
whip up a bowl of spaghetti and sauce, and will be the best
investment you ever made in advancing your programming skills.
If you are not yet a SPLat user you should know that
MultiTrack is the easiest multitasking operating system on the
planet for embedded control systems. Make lasagne, not