{"id":2127,"date":"2025-04-15T06:09:27","date_gmt":"2025-04-15T06:09:27","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=2127"},"modified":"2025-06-10T10:34:46","modified_gmt":"2025-06-10T10:34:46","slug":"example-simple-text-display-with-oblcd","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/","title":{"rendered":"Example: Simple text display with OBLCD"},"content":{"rendered":"\n<p>This example displays a variable status message for some sort of washing machine (maybe an industrial parts washer). The machine can have the following states: Idle; filling; heating; washing; emptying; rinsing and cooling.<\/p>\n\n\n\n<p>The status display &#8220;owns&#8221; the bottom line of a 2&#215;16 LCD, i.e. row 1. We will write the display function as a self-contained subroutine. It will be called with a number in\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o3808\">X<\/a>\u00a0that indicates the current machine status, i.e. dictates which message is to be displayed. The following table defines call arguments (X values) versus action or display message:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>X<\/th><th>Status<\/th><th>Comment<\/th><\/tr><tr><td>0<\/td><td>Initialize<\/td><td>Called only at startup to initialize LCD<\/td><\/tr><tr><td>1<\/td><td>Idle<\/td><td>&nbsp;<\/td><\/tr><tr><td>2<\/td><td>Filling<\/td><td>&nbsp;<\/td><\/tr><tr><td>3<\/td><td>Heating<\/td><td>&nbsp;<\/td><\/tr><tr><td>4<\/td><td>Washing<\/td><td>&nbsp;<\/td><\/tr><tr><td>5<\/td><td>Emptying<\/td><td>&nbsp;<\/td><\/tr><tr><td>6<\/td><td>Rinsing<\/td><td>&nbsp;<\/td><\/tr><tr><td>7<\/td><td>Cooling<\/td><td>&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>X=0 is special in that it initializes the LCD. It should be called only once, as it will result in the screen being erased, which could interfere with the &#8220;owners&#8221; of other lines of the LCD.<\/p>\n\n\n\n<p>We need to plan exactly what we intend to display for each state, so we can be sure our messages will fit.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>0123456789012345<\/code> (ruler line)\n<code>Status: Idle<\/code>\n<code>Status: Filling<\/code>\n<code>Status: Heating<\/code>\n<code>Status: Washing<\/code>\n<code>Status: Emptying<\/code>\n<code>Status: Rinsing<\/code>\n<code>Status: Cooling<\/code><\/pre>\n\n\n\n<p>As luck would have it, the longest status word &#8220;<code>Emptying<\/code>&#8221; can fit together with &#8220;<code>Status: <\/code>&#8220;. Had that not been the case we would have had to think up some different words, or abbreviate or eliminate &#8220;<code>Status: <\/code>&#8220;.<\/p>\n\n\n\n<p>One thing we must watch, though, is that some words are shorter, so we will make them all the same length by padding with spaces. That avoids one word being displayed with the remnants of a previous, longer word also showing, for example &#8220;Idling&#8221; or &#8220;Rinsing&#8221;.<\/p>\n\n\n\n<p>We will also need a small amount of code to test the message display. To do this we use two front panel buttons on the MMi201 to count up and count down a memory variable &#8220;Status&#8221;, making sure to not go over 7 or under 0.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">;Status message display example from onboard LCD documentation\n\n;Start of test code vvvvvvvvvvvvvvvvvvvv\niUpKey     iEQU     12\niDnKey     iEQU     11\n\nStatus     mEQU     0\n\nStart\n          GoSub     StatusDisplay  ;initialize\n          SetMem    Status,1\n\nLoop\n          InputK    iUpKey\n          GoIfT     Up\n          InputK    iDnKey\n          GoIfT     Down\n          GoTo      Loop\n\nUp\n          Recall    Status\n          Push\n          GoIfXGE   7,Loop\n          IncX\n          Push\n          Store     Status\n          GoSub     StatusDisplay\n          GoTo      Loop\n\nDown\n          Recall    Status\n          Push\n          GoIfXLE   1,Loop\n          DecX\n          Push\n          Store     Status\n          GoSub     StatusDisplay\n          GoTo      Loop\n;End of test code ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nStatusDisplay:\n      Branch                       ;Test X\n      Target          Status0      ;Goes here if X=0\n      Target          Status1      ;Goes here if X=1\n      Target          Status2      ;Goes here if X=2\n      Target          Status3      ;Goes here if X=3\n      Target          Status4      ;Goes here if X=4\n      Target          Status5      ;Goes here if X=5\n      Target          Status6      ;Goes here if X=6\n      Target          Status7      ;Goes here if X=7\n\nStatus0      ;Come here to initialize the LCD. Also, display \"Status: \"\n      OBLCD_Type      2            ;initialize the LCD\n      OBLCD_SetCur    1,0\n;                     ;01234567\n      OBLCD_Text      \"Status: \"\n;\"Fall through\" and add the word \"Idle\" at initialization time.\n\nStatus1      ;Come here to display Idle message\n      OBLCD_SetCur    1,8\n;                     ;89012345\n      OBLCD_Text      \"Idle      \"\n      Return\n\nStatus2      ;Come here to display Fill message\n      OBLCD_SetCur    1,8\n;                     ;89012345\n      OBLCD_Text      \"Filling \"\n      Return\n\nStatus3      ;Come here to display Heat message\n      OBLCD_SetCur    1,8\n;                     ;89012345\n      OBLCD_Text      \"Heating \"\n      Return\n\nStatus4      ;Come here to display Wash message\n      OBLCD_SetCur    1,8\n;                     ;89012345\n      OBLCD_Text      \"Washing \"\n      Return\n\nStatus5      ;Come here to display Empty message\n      OBLCD_SetCur    1,8\n;                     ;89012345\n      OBLCD_Text      \"Emptying\"\n      Return\n\nStatus6      ;Come here to display Rinse message\n      OBLCD_SetCur    1,8\n;                     ;89012345\n      OBLCD_Text      \"Rinsing \"\n      Return\n\nStatus7      ;Come here to display Cool message\n      OBLCD_SetCur    1,8\n;                     ;89012345\n      OBLCD_Text      \"Cooling \"\n      Return<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This example displays a variable status message for some sort of washing machine (maybe an industrial parts washer). The machine can have the following states:&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2126,"menu_order":1,"template":"","class_list":["post-2127","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>Example: Simple text display with OBLCD - 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=\"Example: Simple text display with OBLCD - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"This example displays a variable status message for some sort of washing machine (maybe an industrial parts washer). The machine can have the following states:...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T10:34:46+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=\"2 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\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/\",\"name\":\"Example: Simple text display with OBLCD - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-15T06:09:27+00:00\",\"dateModified\":\"2025-06-10T10:34:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Product documentation\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Product documentation: Onboard peripherals\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Onboard LCD\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"OBLCD: Programming\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"OBLCD: Examples\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/\"},{\"@type\":\"ListItem\",\"position\":7,\"name\":\"Example: Simple text display with OBLCD\"}]},{\"@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":"Example: Simple text display with OBLCD - 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":"Example: Simple text display with OBLCD - SPLat Controls","og_description":"This example displays a variable status message for some sort of washing machine (maybe an industrial parts washer). The machine can have the following states:...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T10:34:46+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/","name":"Example: Simple text display with OBLCD - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-15T06:09:27+00:00","dateModified":"2025-06-10T10:34:46+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/example-simple-text-display-with-oblcd\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Product documentation","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/"},{"@type":"ListItem","position":3,"name":"Product documentation: Onboard peripherals","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/"},{"@type":"ListItem","position":4,"name":"Onboard LCD","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/"},{"@type":"ListItem","position":5,"name":"OBLCD: Programming","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/"},{"@type":"ListItem","position":6,"name":"OBLCD: Examples","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/product-documentation\/product-documentation-onboard-peripherals\/onboard-lcd\/oblcd-programming\/oblcd-examples\/"},{"@type":"ListItem","position":7,"name":"Example: Simple text display with OBLCD"}]},{"@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\/2127","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\/2126"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=2127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}