{"id":3370,"date":"2025-04-18T05:45:04","date_gmt":"2025-04-18T05:45:04","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3370"},"modified":"2025-06-10T11:00:43","modified_gmt":"2025-06-10T11:00:43","slug":"simplehmi-example-pin-numbers","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-example-pin-numbers\/","title":{"rendered":"SimpleHMI example: PIN numbers"},"content":{"rendered":"\n<p>This example shows you a way of defining and changing PIN numbers on\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5380\">SimpleHMI<\/a>. This can provide better security, and be easier for an\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5369\">Enduser<\/a>, than the PIN provided by the Bluetooth pairing processes. It also illustrates the use of the\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-the-trace-feature\/\">Trace feature<\/a>\u00a0to trace what is happening in the program if it is run with the SPLat\/PC version of SimpleHMI. The program initially offers you a single button choice: Ask for PIN. When that is clicked, the program asks you to input the pin (which defaults to 1234). If you get the PIN right it gives you an option to change the PIN.<\/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\">;SimpleHMI PIN example. <br>;This is the main program. A secondary program forces the PIN back to a known setting<br>fPIN    mEQU    0,4                     ;PIN is stored as a float in Shadow memory at 0 <br><br>#       Open_Serial User(38400,8,N) <br>        GoSub           InitializePIN   ;Make sure at least a default PIN is set<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      HeartBeat      ;Blink an output to show we are alive<br>        LaunchTask      Crash          ;Catch an input, crash to get back control of serial port<br>        RunTasksForever<br><br>;Connected event: Paint the screen<br>HMI_Connect: <br># HMI_Trace Print(\"Connect\") NL()<br># HMI Reset() Cls() HideAllButtons()   <br># HMI Cursor(1, C-9) Print(\"PIN number example\")<br># HMI ButtonEvent(, C-3, 0.3, 6, 0.4, \"Ask for PIN\", evGetPIN)<br>        return          <br><br>evGetPIN:<br># HMI_Trace Print(\"evGetPin\") NL()<br># HMI Reset() Cls() HideAllButtons()   <br># HMI Cursor(1, C-9) Print(\"PIN number example\")<br># HMI IntInputEvent(\"Enter the PIN\", 1000, 99999, evTestPIN) <br>        Return<br> <br>fTemp:   defFLOAT <br>;Here when enduser enters a PIN (<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o3808\">X<\/a> = True, PIN in W) or Cancels (X = False)<br>evTestPIN:                            <br># HMI_Trace Print(\"evTestPIN\") NL()<br>       GoIfF            NoPIN                      ;g\/ user Cancelled, nothing more to do<br>       fStore           fTemp                      ;Save enduser's input<br>       ShadowRead       fPIN,4                     ;Restore the old PIN<br># HMI_Trace Print(\"Entered\", f(fTemp,6,0), \" PIN is\", f(fPIN, 6, 0))  NL()<br>       fRecallQ         fPIN<br>       fTestWeqQ<br>       GoIfT            GotPin<br>       LaunchTask       PINFailed<br>       Return<br><br>PINFailed:<br># HMI_Trace Print(\"PINFailed\") NL()<br># HMI Cursor(5, C-8) SetFGColour(255,0,0) Print(\" **** FAIL **** \") SetFGColour(255, 255, 255)  <br>        Pause           100<br>        GoSub           HMI_Connect   ;Repaint the home screen<br>        KillTask        <br>        <br>NoPIN:<br>        GoSub           HMI_Connect   ;Repaint the home screen<br>        Return<br>        <br>GotPin:<br># HMI_Trace Print(\"GotPin\") NL()<br># HMI Reset() Cls() HideAllButtons()   <br># HMI Cursor(1, C-9) Print(\"PIN number example\")<br># HMI ButtonEvent(, C-5, 0.3, 6, 0.4, \"Enter new PIN\", evAskNewPin)<br># HMI ButtonEvent(, C+5, 0.3, 6, 0.4, \"Go back\", HMI_Connect)<br>        return          <br><br><br><br>evAskNewPin:                            <br># HMI_Trace Print(\"evAskNewPin\") NL()<br># HMI IntInputEvent(\"Enter the PIN\", 1000, 99999, evGotNewPIN) <br>       Return<br><br>evGotNewPIN:<br>;Here when enduser enters a new PIN (X = True, PIN in W) or Cancels (X = False)<br># HMI_Trace Print(\"evGotNewPIN\") NL()<br>       GoIfZ            NoPIN      ;g\/ user Cancelled, nothing more to do<br>       fStore           fPIN <br>       ShadowWrite      fPIN,4<br># HMI_Trace Print(\"New PIN:\") floatvar(fPIN,6,0)  NL()  <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             <br>              <br>;Force PIN to be > 1000. Anything less is assumed to be uninitialized.<br>InitializePIN: <br>        ShadowRead      fPIN,4<br>        fRecallW        fPin<br>        FLoadQ          1000<br>        fTestWgeQ       <br>        RetIfT<br>        fLoadW          1234<br>        fStore          fPin<br>        ShadowWrite     fPIN,4  <br>        Return   <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This example shows you a way of defining and changing PIN numbers on\u00a0SimpleHMI. This can provide better security, and be easier for an\u00a0Enduser, than the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3355,"menu_order":11,"template":"","class_list":["post-3370","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 example: PIN numbers - 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 example: PIN numbers - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"This example shows you a way of defining and changing PIN numbers on\u00a0SimpleHMI. This can provide better security, and be easier for an\u00a0Enduser, than the...\" \/>\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-example-pin-numbers\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T11:00:43+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\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/\",\"name\":\"SimpleHMI example: PIN numbers - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-18T05:45:04+00:00\",\"dateModified\":\"2025-06-10T11:00:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/#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-example-pin-numbers\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/#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 example: PIN numbers\"}]},{\"@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 example: PIN numbers - 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 example: PIN numbers - SPLat Controls","og_description":"This example shows you a way of defining and changing PIN numbers on\u00a0SimpleHMI. This can provide better security, and be easier for an\u00a0Enduser, than the...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T11:00:43+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\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/","name":"SimpleHMI example: PIN numbers - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-18T05:45:04+00:00","dateModified":"2025-06-10T11:00:43+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/#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-example-pin-numbers\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-simplehmi-programming-of-splat-controllers\/simplehmi-example-pin-numbers\/#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 example: PIN numbers"}]},{"@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\/3370","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=3370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}