Tutorial: MultiTrack
MultiTrack is a mechanism that allows you to very easily write SPLat programs that can do many things at once.
MultiTrack makes it very easy to write several programs that can run simultaneously and independently of each other in one controller. You need to apply one or two simple rules and write a tiny bit of code to "glue" it all together, but once that's done it's a breeze. MultiTrack also provides an excellent foundation for libraries of re-usable code.
With MultiTrack we have:
- Extended the capabilities of the FastTrack instruction sub-set to provide true multitasking capability.
- Added a versatile timing mechanism, called SuperTimers, that covers the whole range from 10mS to 46 hours in a single unified way, and allows a large number of simultaneous timers (limited only by available RAM memory).
- Added an easy to use but very powerful mechanism for controlling several identical "channels" in a controller, say for a 4-head bottle capper.
- Expanded the FastTrack concept of instructions that wait for an event (like
WaitOn
) to cover a wide range of events. - Extended the timing functions of
Pause
, WaitOnT, WaitOffT and WaitOnKT
to a full 46 hour range. - Added buffering to the OBLCD device (LCD display) on the MMi201 to make it easier to share between multiple tasks.
The end result is that SPLat becomes even easier to program, and allows less experienced users to write more sophisticated programs
This tutorial is divided into 3 levels: Basic, Intermediate and Advanced, so you can work up to the level that suits your experience and needs.
Outcomes (what you will get out of this tutorial):
Basic:
Teaches you the basic mechanics of MultiTrack.
- Extend the simplicity of FastTrack programming into programs with several things happening at once.
Intermediate:
Let's you start to structure programs to unlock the full power of MultiTrack
- Use semaphores for inter-task synchronization. You will be able to have several tasks running at once, but able to coordinate between themselves.
- Extend beyond FastTrack timing using the new SuperTimers, allowing you to wait for several events, not just one, and up to 46 hours, not just 5 minutes. It's only slightly more complicated to use than
WaitOnT
, - Understand the relationship between the MultiTrack mechanism and subroutines and registers.
Advanced:
Gets into some of the more sophisticated stuff.
- Create multiple extended timers
- Measure intervals from 10mS to 46 hours.
- Speed up SuperTimers to simplify debugging of processes that take hours or days.
- Build multi-channel applications (the same code operating on several sets of data and I/O)
- Use transient tasks (tasks that live just long enough to do their job, then fade away and release memory for other things)
Prerequisites (what you should know before you start):
Basic:
- You should understand FastTrack programming of SPLat. That is covered the mini-tutorials built into SPLat/PC and in the older FastTrack tutorial in the SPLat/PC help file. You will appreciate MultiTrack the most if you have been struggling to create programs that do several things at once (SPLat has always been capable of that, but MultiTrack makes it ever so much easier).
- You should know how to drive SPLat/PC, including editing, single stepping and setting breakpoints.
Intermediate:
- An understanding of automatic RAM allocation.
- Semaphores
Advanced:
- Indexed addressing (or data arrays in other languages)
- Use of SPLat registers
- Floating point operations