{"id":3373,"date":"2025-04-18T05:48:33","date_gmt":"2025-04-18T05:48:33","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3373"},"modified":"2025-06-10T11:01:21","modified_gmt":"2025-06-10T11:01:21","slug":"simplehmi-the-logging-feature","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/","title":{"rendered":"SimpleHMI: The logging feature"},"content":{"rendered":"\n<p><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5380\">SimpleHMI<\/a>&nbsp;lets you do logging of data from the host device (SPLat or other). The logging facility features:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Up to 20 separate log files can be written with different data.<\/li>\n\n\n\n<li>File names can be automatically date stamped and sequence numbered, or both<\/li>\n\n\n\n<li>You can control the file name extension, for example&nbsp;<code>.txt<\/code>,&nbsp;<code>.csv<\/code>&nbsp;or&nbsp;<code>.log<\/code><\/li>\n\n\n\n<li>In Android, the log file directory is pre-determined. Your&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5369\">Enduser<\/a>&nbsp;can find it easily when connecting via USB<\/li>\n\n\n\n<li>Individual records can be date and\/or time stamped<\/li>\n<\/ul>\n\n\n\n<p>Logging uses the\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/\">HMI_Log hash command<\/a>. Please click that link and read up.<\/p>\n\n\n\n<p>Note that in SPLat\/PC the SIO\/SimpleHMI window must be active for logging to take place. A file path (folder name) must be specified for the log file, in the Settings tab of the SIO window. The file name itself is embedded in the SPLat program.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Example 1:<\/h6>\n\n\n\n<p>This is a simple example. It uses an MS120, but you could easily convert it to an MMi202 by re-defining the input buttons. The program simply logs button presses.<\/p>\n\n\n\n<p>When one of the buttons, named&nbsp;<code>iStart<\/code>&nbsp;is pressed, the program opens the log file and records the date. When subsequently another button,&nbsp;<code>iLogOne<\/code>&nbsp;is pressed, it logs the time. Finally, a 3rd button,&nbsp;<code>iAllDone<\/code>, halts the program by brutally crashing it. This allows SPLat\/PC to connect to the controller.<\/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>&nbsp;for some tips for working around problems with copy and paste out of Internet Explorer and HTML-help&nbsp;<code>(.chm)<\/code>&nbsp;files)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">;Input definitions to suit MS120\niStart          iEQU    12\niLogOne         iEQU    13\niAllDone        iEQU    16  \n\n        ON              20      ;LCD backlight on MS120\n        OBCA_Mode       2\n;                        0123456789123456\n        OBLCD_Text      \"Starting serial \"    \n        OBLCD_Text      \"(10S pause) \"    \n\n#       Open_Serial User(38400,8,N)         ;Initialise the serial port \n        LaunchTask      Capture        \n        LaunchTask      HeartBeat      ;Blink an output to show we are alive\n        RunTasksForever\n\n;----- Capture task -----\nCapture:\n        OBLCD_Cls\n;                        0123456789123456\n        OBLCD_Text      \"Push Start\"    \n        WaitOnK         iStart           ;Wait for user start command\n        OBLCD_Cls\n        OBLCD_Text      \"Push LogOne or\"\n        OBLCD_SetCur    1,0\n        OBLCD_Text      \"AllDone button\"\n               \n#       HMI_Log         FileOpen(mylog.txt,0)\n#       HMI_Log         Print(\"Log opened \") YYMMDD() LogWrite()\nLoop1: \n        YieldTask            \n        GoIfInK         iLogOne,LogOne   ;Test LogOne button \n        GoIfInK         iAllDone,AllDone ; Quit? \n        GoTo            Loop1\n\nLogOne:\n#       HMI_Log         Print(\"LogOne pressed at \") HHMMSS() LogWrite()\n        GoTo Loop1     \n\nAllDone:    \n        OBLCD_Cls\n        OBLCD_Text      \"All done\"\n\n#       HMI_Log         Print(\"Shut down \") YYMMDD() Print(\"at \") HHMMSS() LogWrite()\n\n;Deliberately crash so SPLat\/PC can get back control and connect\nHere:   GoSub           Here\n\n;Blink an output to signal the program is running\nHeartBeat:\n        On              8\n        Pause           1\n        Off             8\n        Pause           25\n        GoTo            HeartBeat        \n<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Example 2:<\/h6>\n\n\n\n<p>This is a more elaborate example, maintaining several logs in different modes.<\/p>\n\n\n\n<p>The following program maintains 3 separate logs:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A log of inputs 0 to 3, sampled once every 10 seconds. The file name is date stamped. Each record is time stamped.<\/li>\n\n\n\n<li>A log of each change of state on input 4. The file name is numbered. Turning input 3 on increments the file number. Each record is time stamped.<\/li>\n\n\n\n<li>A log of user presses on a button on the SimpleHMI screen. Uses a simple file name (no date or numbering). Each record is date and time stamped.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">***************** SimpleHMI logging example *****************************<br>#       Open_Serial User(38400,8,N) <br>        GoSub           HMI_Connect    ;Paint the initial screen<br>#       <a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5243\">HMI<\/a> ConnectEvent(HMI_Connect)  ;Declare the handler for the Connected event<br>        LaunchTask      Watch4Inputs   ;Log inputs 0-3 every 10s   <br>        LaunchTask      WatchInput4    ;Log all changes on input 4<br>        LaunchTask      WatchInput3    ;Task to create new files for Input 4 log<br>        LaunchTask      HeartBeat      ;Blink an output to show we are alive<br>        LaunchTask      Crash          ;Catch input, crash to get back control of serial port<br>        RunTasksForever<br><br>;Connected event: Paint the screen<br>HMI_Connect: <br># HMI Reset() Cls() HideAllButtons()   <br># HMI_Log FileOpen(Watch4Inputs.csv, 1)   ;Mode 1 = Dated file<br># HMI_Log FileOpen(WatchInput4.log, 2)    ;Create\/initial open. Mode 2 = numbered file<br># HMI_Log FileOpen(UserInputs.txt, 0)<br># HMI Cursor(1, C-7) Print(\"Logging example\")<br># HMI ButtonEvent(, C-3, 0.3, 6, 0.4, \"Enduser event\", evEnduser)<br>        return          <br> <br>;==================================================================================================================<br>;A log of inputs 0 to 3, sampled once every 10 seconds. The file name is date stamped. Each record is time stamped.<br>bInput0to3:     defBYTE<br>Watch4Inputs:   ;Log inputs 03 every 10s   <br>        InputFM         0                     ;Sample inputs 0-7<br>        LoadX           'F                    ;Select lower 4 bits<br>        AndM                                  ;Mask off top 4 bits  <br>        Store           bInput0to3            ;Save so HexVar can get hold of it<br># HMI_Log FileOpen(Watch4Inputs.csv, 1)       ;Mode 1 = Dated file<br># HMI_Log  HHMMSS() Print(\",\")  HexVar(bInput0to3) LogWrite() <br>        Pause           1000    ;10 seconds<br>        GoTo            Watch4Inputs<br><br>;==================================================================================================================<br>;A log of each change of state on input 4. The file name is numbered. <br>;Turning input 3 on increments the file number. Each record is time stamped.<br>;This uses two tasks. One watches for and logs changes. The other takes care of the new-file behaviour <br><br>WatchInput4:    ;Log all changes on input 4<br># HMI_Log FileOpen(WatchInput4.log, 2)<br># HMI_Log Print(\"Monitor started at \") hhmmss() LogWrite()<br>        Input           4                     <br>        GoIfT           WI4onA<br>WI4off:<br>        WaitOn          4  <br>WI4onA:<br># HMI_Log FileOpen(WatchInput4.log, 2)     ;Switch to the file<br># HMI_Log Print(\"Input 4 on  at \") hhmmss() LogWrite()<br>WI4on:<br>        WaitOff         4<br># HMI_Log FileOpen(WatchInput4.log, 2)     ;Switch to the file<br># HMI_Log Print(\"Input 4 off at \") hhmmss() LogWrite()<br>        GoTo            WI4off<br><br>;------------------------------------------<br>WatchInput3:    ;New file for Input 4 log <br>        WaitOnK          3<br># HMI_Log NewFile(WatchInput4.log)  ;Signal new file creation on the next record write<br>        GoTo           WatchInput3 <br>    <br>;==================================================================================================================<br>;A log of user presses on a button on the SimpleHMI screen. Uses a simple file name (no date or numbering). <br>;Each record is date and time stamped.<br>;Apart from the initial FileOpen in the ConnectEvent handler, this is the the whole thing.<br>evEnduser:<br># HMI_Log FileOpen(UserInputs.txt, 0) Print(\"Pressed at \") hhmmss() Print(\" on date:\") yymmdd()  LogWrite()<br>        Return<br><br>********************* Minor stuff ***************************************************        <br>;Blink an output to signal the program is running<br>HeartBeat:<br>        On              0<br>        Pause           1<br>        Off             0<br>        Pause           25<br>        GoTo            HeartBeat        <br>                <br>;Deliberately crash the program to get back control of the serial port, so SPLat\/PC can connect.<br>Crash:  WaitOnK         0<br>Here    GoSub           Here   <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>SimpleHMI&nbsp;lets you do logging of data from the host device (SPLat or other). The logging facility features: Logging uses the\u00a0HMI_Log hash command. Please click that&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3355,"menu_order":15,"template":"","class_list":["post-3373","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>SimpleHMI: The logging feature - 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=\"SimpleHMI: The logging feature - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"SimpleHMI&nbsp;lets you do logging of data from the host device (SPLat or other). The logging facility features: Logging uses the\u00a0HMI_Log hash command. Please click that...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T11:01:21+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-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/\",\"name\":\"SimpleHMI: The logging feature - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-18T05:48:33+00:00\",\"dateModified\":\"2025-06-10T11:01:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/#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: SimpleHMI programming of SPLat controllers\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"SimpleHMI: The logging feature\"}]},{\"@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":"SimpleHMI: The logging feature - 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":"SimpleHMI: The logging feature - SPLat Controls","og_description":"SimpleHMI&nbsp;lets you do logging of data from the host device (SPLat or other). The logging facility features: Logging uses the\u00a0HMI_Log hash command. Please click that...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T11:01:21+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-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/","name":"SimpleHMI: The logging feature - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-18T05:48:33+00:00","dateModified":"2025-06-10T11:01:21+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-logging-feature\/#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: SimpleHMI programming of SPLat controllers","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/"},{"@type":"ListItem","position":4,"name":"SimpleHMI: The logging feature"}]},{"@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\/3373","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\/3355"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}