{"id":2543,"date":"2025-04-16T05:24:51","date_gmt":"2025-04-16T05:24:51","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=2543"},"modified":"2025-06-10T11:18:44","modified_gmt":"2025-06-10T11:18:44","slug":"print","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/","title":{"rendered":"# Print()"},"content":{"rendered":"\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>Valid For<\/th><td>#HMI<\/td><\/tr><tr><th>Applies To<\/th><td>HMI430<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This function prints text on the LCD.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Function Prototype<\/h6>\n\n\n\n<pre class=\"wp-block-preformatted\">#HMI Print(<br>   \"\\C\" | \"\\R\" | \"\\RR\"<br>   \"text\" | values,<br>   \"text\" | values,<br>   etc<br>)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>Parameter<\/th><th>Option<\/th><th>Description<\/th><\/tr><tr><th>&#8220;\\C&#8221; or &#8220;\\R&#8221; or &#8220;\\R\\R&#8221;<\/th><td>optional<\/td><td>&#8220;C&#8221;entering or &#8220;R&#8221;ightAlign or &#8220;R&#8221;esume&#8221;R&#8221;ightAlign directive.&nbsp; This&nbsp;<strong>MUST<\/strong>&nbsp;be placed at the start of the string.&nbsp; SimpleHMI will then perform the required alignment on everything in&nbsp;<strong>this<\/strong>&nbsp;print statement.<\/td><\/tr><tr><th>&#8220;text&#8221;<\/th><td>optional, multiple<\/td><td>A string to display.&nbsp; This may occur more than once.&nbsp;&nbsp;&nbsp;<\/td><\/tr><tr><th>values<\/th><td>optional, multiple<\/td><td>Values to print, refer to the\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/\">formatting functions<\/a>\u00a0chapter.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h6 class=\"wp-block-heading\">Description<\/h6>\n\n\n\n<p>This function prints text and values within the current bounds.\u00a0 It uses the font as specified by\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/setfont\/\">SetFont()<\/a>\u00a0and colours as specified by\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/setcolors\/\">SetColours()<\/a>.\u00a0 There&#8217;s not really any limit to how many arguments you can provide to the Print() instruction, but try to keep it short to allow other parts of your program a chance to run.<\/p>\n\n\n\n<p>C style carriage return &#8220;\\r&#8221; or linefeed &#8220;\\n&#8221; escape sequences may be used to print on the next line.&nbsp; Characters on the next line will have the same alignment, that is, they will also be left aligned, centered or right aligned.<\/p>\n\n\n\n<p>Values either from byte or floating point registers or from RAM may be printed using the\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/\">formatting functions<\/a>.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Centering and Right Alignment<\/h6>\n\n\n\n<p>Print() can use the current bounds to display your message either:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>From the current cursor position.&nbsp; This is the default.<\/li>\n\n\n\n<li>Or horizontally centered within the current bounds, via &#8220;\\C&#8221; (note this MUST be a capital C).<\/li>\n\n\n\n<li>Or right aligned against the edge of the current bounds, via &#8220;\\R&#8221; (note this MUST be a capital R).<\/li>\n\n\n\n<li>Or to resume the right alignment, that is, to prepend more text to the existing right aligned text on the current line, via &#8220;\\R\\R&#8221; (note these MUST be capital R&#8217;s).<\/li>\n<\/ul>\n\n\n\n<h6 class=\"wp-block-heading\">Examples<\/h6>\n\n\n\n<pre class=\"wp-block-preformatted\">   #HMI Print( \"\\CHello World\\nThe count is \", b(=x), \"units\" )<\/pre>\n\n\n\n<p>&nbsp;Assuming the X register is 46, this will display the following message, horizontally centered:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Hello World<br>The count is 46units<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">   #HMI SetFont( \"sysdefault.fon\" )<br>   #HMI SetBounds( x:50px, b:3, w:200px, h:3 )<br>   #HMI SetColours( f:HUEkGreen, b:HUEkOrange )<br>   #HMI Cls()<br>   #HMI Print( \"\\C\\r\", f(*fTemperature, 4, 1), \"\u00b0C\" )<br>   #HMI SetBounds()<br>   #HMI SetColours( f:HUEkWhite, b:HUEkTransparent )<\/pre>\n\n\n\n<p>This will display the temperature in green as held in the variable &#8220;fTemperature&#8221;, centered within an orange 3 line box.&nbsp; It is very good practice to remove the bounds via &#8220;#HMI SetBounds()&#8221; when you&#8217;ve finished with the bounds.&nbsp; This allows other parts of your program to assume the bounds is the whole screen.&nbsp; In this example, the following things are assumed to exist in the program:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">HUEkWhite        #EQU 'FFFFFFFF<br>HUEkTransparent  #EQU '00000000<br>HUEkGreen        #EQU 'FF00C000<br>HUEkOrange       #EQU 'FFFF9000<br><br>fTemperature defFLOAT<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Low Level<\/h6>\n\n\n\n<p>If you need to do something unusual with Print and the built in\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/\">formatting functions<\/a>\u00a0don&#8217;t provide the required functionality, then you can roll your own.\u00a0 The serial command that instructs the HMI controller to print takes this form:<\/p>\n\n\n\n<p>1, &#8220;@&#8221;, &#8220;Test Message&#8221;, 3<\/p>\n\n\n\n<p>Where<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1 = StartOfMessage marker<\/li>\n\n\n\n<li>@ = Print instruction<\/li>\n\n\n\n<li>3 = EndOfMessage marker<\/li>\n<\/ul>\n\n\n\n<p>So here&#8217;s an example the echos text received on the serial port to the LCD, centering it too:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">   iiPrintText    COMHMI,1,\"@\"   ;being print instruction<br>   iiPrintText    COMHMI,\"\\C\"    ;request centering<br>_DisplayLoop<br>   COMRx_ReadOne  COM0           ;get a character from the serial port<br>   RtoX                          ;end if nothing..<br>   GoIfnz         _EndDisplay    ;..in buffer<br>   iiChrPrintX    COMHMI         ;display this character<br>   Goto           _DisplayLoop<br>_EndDisplay<br>   iiPrintText    COMHMI,3       ;end print instruction<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Valid For #HMI Applies To HMI430 This function prints text on the LCD. Function Prototype #HMI Print( &#8220;\\C&#8221; | &#8220;\\R&#8221; | &#8220;\\RR&#8221; &#8220;text&#8221; | values,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2505,"menu_order":15,"template":"","class_list":["post-2543","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># Print() - 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=\"# Print() - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"Valid For #HMI Applies To HMI430 This function prints text on the LCD. Function Prototype #HMI Print( &quot;C&quot; | &quot;R&quot; | &quot;RR&quot; &quot;text&quot; | values,...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T11:18:44+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=\"3 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\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/\",\"name\":\"# Print() - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-16T05:24:51+00:00\",\"dateModified\":\"2025-06-10T11:18:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming reference\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Instructions arranged by function\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"# Hash commands and functions\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"# HMI Controller Instructions\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"# Print()\"}]},{\"@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":"# Print() - 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":"# Print() - SPLat Controls","og_description":"Valid For #HMI Applies To HMI430 This function prints text on the LCD. Function Prototype #HMI Print( \"C\" | \"R\" | \"RR\" \"text\" | values,...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T11:18:44+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/","name":"# Print() - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-16T05:24:51+00:00","dateModified":"2025-06-10T11:18:44+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/print\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Programming reference","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/"},{"@type":"ListItem","position":3,"name":"Instructions arranged by function","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/"},{"@type":"ListItem","position":4,"name":"# Hash commands and functions","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/"},{"@type":"ListItem","position":5,"name":"# HMI Controller Instructions","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/hash-commands-and-functions\/hmi-controller-instructions\/"},{"@type":"ListItem","position":6,"name":"# Print()"}]},{"@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\/2543","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\/2505"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=2543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}