{"id":3303,"date":"2025-04-18T04:28:44","date_gmt":"2025-04-18T04:28:44","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3303"},"modified":"2025-06-10T09:22:01","modified_gmt":"2025-06-10T09:22:01","slug":"multitrack-basic-quick-start-for-dummies","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/","title":{"rendered":"MultiTrack (Basic): Quick-start for Dummies"},"content":{"rendered":"\n<p>If you are in a real hurry, this section may be all you need to get started with using MultiTrack. This is especially so if you have been limiting yourself to the\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/fasttrack-instructions\/\">FastTrack instructions<\/a>\u00a0and now want to get SPLat to do several things at once. The MultiTrack mechanism greatly expands what can be achieved using little more that the 14\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/fasttrack-instructions\/\">FastTrack instructions<\/a>. You will need to learn a few more instructions (just 2 to get going), but it&#8217;s very worthwhile!<\/p>\n\n\n\n<p>Let&#8217;s illustrate this with an example. As usual, we&#8217;ll do some rather pointless light flashing, because right now I want you to focus on the mechanisms, not the logic of the application.<\/p>\n\n\n\n<p>Suppose we want a simple FastTrack program which just flashes output 0, on for 430mS and off for 870mS, endlessly. This will do it:<\/p>\n\n\n\n<p><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/cutting-and-pasting-code-from-the-splat-knowledge-base\/\">(Click here<\/a>\u00a0for some tips for working around problems with copy and paste out of Internet Explorer and HTML-help\u00a0<code>(.chm)<\/code>\u00a0files)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SlowFlash:      On          0\n                Pause       43\n                Off         0\n                Pause       87\n                GoTo        SlowFlash<\/pre>\n\n\n\n<p>Cool! The only snag is that this program will tie up the whole SPLat processor (a.k.a.\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o3807\">SPLatty<\/a>) just flashing a light. Suppose we want to really get bold and simultaneously have output 1 flashing at a quite different rate, say 110mS on and 50mS off. That could get messy! But thanks to MultiTrack, it&#8217;s simple.<\/p>\n\n\n\n<p>Here&#8217;s how we do it, using MultiTrack:<\/p>\n\n\n\n<p>Firstly we start to think of each of the two flashers as&nbsp;<em>tasks<\/em>. A task is like a program within a program. It sits there continuously performing a particular set of actions, independently of anything else in your program. A complete control program may consists of a number of tasks taking care of individual bits of the overall functionality, such as managing a pump or an operator interface.<\/p>\n\n\n\n<p>In our simple flasher application the first task is already written. It&#8217;s called&nbsp;<code>SlowFlash<\/code>. Let&#8217;s do the second one and call it&nbsp;<code>FastFlash<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">FastFlash:      On          1\n                Pause       11\n                Off         1\n                Pause       50\n                GoTo        FastFlash<\/pre>\n\n\n\n<p>All we need now is something to tie the two tasks together. Here it is (I won&#8217;t re-type the two tasks from above):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">;Start of program\n\t\t\tLaunchTask  SlowFlash\n\t\t\tLaunchTask  FastFlash\n\n\t\t\tRunTasksForever\n;The code for the two tasks goes in below here ...<\/pre>\n\n\n\n<p>What the&nbsp;<code>LaunchTask<\/code>&nbsp;instruction does is to schedule the task that starts at the named line (<code>SlowFlash<\/code>&nbsp;or&nbsp;<code>FastFlash<\/code>&nbsp;in this case) for later execution. It does not actually execute any of the task code, it simply builds a queue (list) of tasks (which we call the task queue) that will be executed later.<\/p>\n\n\n\n<p>The&nbsp;<code>RunTasksForever<\/code>&nbsp;instruction then sets the task queue running. That means that each of the tasks in the queue is &#8220;run&#8221;, in turn, in a round-bobbin sequence.<\/p>\n\n\n\n<p>You can best understand what happens by running the program in SPLat\/PC. Here&#8217;s the whole program in one block you can copy and paste into SPLat\/PC (you will need SPLat\/PC V7.16.0 or later. You can download the latest SPLat\/PC\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/download\/splat-pc-32-bit\/\">here<\/a>).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">;Start of Dual flasher program\n               LaunchTask  SlowFlash\n               LaunchTask  FastFlash\n\n               RunTasksForever\n\n;==== SlowFlash task ==============\nSlowFlash:\tOn          0\n               Pause       4\n               Off         0\n               Pause       8\n               GoTo        SlowFlash\n;==== FastFlash task ==============\nFastFlash:\tOn          1\n               Pause       1\n               Off         1\n               Pause       5\n               GoTo        FastFlash<\/pre>\n\n\n\n<p>I have reduced the time intervals for you, so the program will give reasonably noticeable flashing in simulation mode.<\/p>\n\n\n\n<p>Try single stepping the program and observe what happens. You will notice a lot of jumping between a&nbsp;<code>Pause<\/code>&nbsp;in one task and a&nbsp;<code>Pause<\/code>&nbsp;in the other task. What is happening is that when a task gets run, and is executing a&nbsp;<code>Pause<\/code>&nbsp;that has not yet timed out, it immediately&nbsp;<em>yields<\/em>. What yielding means is that because the task has nothing to do, it frees up the processor (SPLatty) to do something else (switch to another task). Because one tasks yields as soon as it has nothing useful to do, and thereby lets SPLatty do something in another task, we get the illusion of SPLatty doing several things at once. If you look carefully you will see that the status bar at the bottom of the SPLat\/PC editor window tells you when the program is in MultiTrack. The action of switching from one task to another is called task switching or task swapping.<\/p>\n\n\n\n<p>All the FastTrack instructions that block the processor, i.e. make it wait for something to happen, become\u00a0<em>non-blocking<\/em>\u00a0with MultiTrack. That means you can now write several tasks using instructions like\u00a0<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/fasttrack-instructions\/waiton-ii\/\">WaitOn<\/a><\/code>,\u00a0<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/fasttrack-instructions\/pause-tttt\/\">Pause<\/a><\/code>\u00a0and\u00a0<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/fasttrack-instructions\/waitofft-iitttt\/\">WaitOffT<\/a><\/code>, string them together using\u00a0<code>LaunchTask <\/code>and\u00a0<code>RunTasksForever<\/code>, and it will just work. Later you will learn how to make tasks communicate with each other via\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/\">semaphores<\/a>\u00a0and other\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o414\">RAM<\/a>\u00a0variables so they can synchronize and coordinate their activities.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Exercise:<\/h6>\n\n\n\n<p>Add a third task to the sample program above. Call it&nbsp;<code>Toggle<\/code>.&nbsp;<code>Toggle<\/code>&nbsp;should monitor input 0. When input 0 comes on&nbsp;<code>Toggle<\/code>&nbsp;should turn on output 3.&nbsp;<code>Toggle<\/code>&nbsp;should then wait for input 0 to turn off, and then wait for it to turn on again a second time, then turn output 3 off. This should repeat indefinitely. If a push button switch is connected to input 0 it will act as a push on, push off switch for output 3. If your recognize this as the same tired old example I always trot out, don&#8217;t worry. It&#8217;s the simultaneous running of several tasks that counts, not what it does. Better still, if you don&#8217;t like my example devise your own!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are in a real hurry, this section may be all you need to get started with using MultiTrack. This is especially so if&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3299,"menu_order":0,"template":"","class_list":["post-3303","spl_knowledgebase","type-spl_knowledgebase","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MultiTrack (Basic): Quick-start for Dummies - SPLat Controls<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MultiTrack (Basic): Quick-start for Dummies - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"If you are in a real hurry, this section may be all you need to get started with using MultiTrack. This is especially so if...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T09:22:01+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/\",\"name\":\"MultiTrack (Basic): Quick-start for Dummies - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-18T04:28:44+00:00\",\"dateModified\":\"2025-06-10T09:22:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials, application notes and white papers\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Tutorial: MultiTrack\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"MultiTrack (Basic): Quick-start for Dummies\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"name\":\"SPLat Controls\",\"description\":\"OEM Embedded Machine Controllers\",\"publisher\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\",\"name\":\"SPLat Controls\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"contentUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"caption\":\"SPLat Controls\"},\"image\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MultiTrack (Basic): Quick-start for Dummies - SPLat Controls","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"MultiTrack (Basic): Quick-start for Dummies - SPLat Controls","og_description":"If you are in a real hurry, this section may be all you need to get started with using MultiTrack. This is especially so if...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T09:22:01+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/","name":"MultiTrack (Basic): Quick-start for Dummies - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-18T04:28:44+00:00","dateModified":"2025-06-10T09:22:01+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-basic-quick-start-for-dummies\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Tutorials, application notes and white papers","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/"},{"@type":"ListItem","position":3,"name":"Tutorial: MultiTrack","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/"},{"@type":"ListItem","position":4,"name":"MultiTrack (Basic): Quick-start for Dummies"}]},{"@type":"WebSite","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","name":"SPLat Controls","description":"OEM Embedded Machine Controllers","publisher":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization","name":"SPLat Controls","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","contentUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","caption":"SPLat Controls"},"image":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase"}],"about":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/types\/spl_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/users\/1"}],"up":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3299"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}