{"id":3683,"date":"2025-04-21T06:50:52","date_gmt":"2025-04-21T06:50:52","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3683"},"modified":"2025-06-10T07:25:58","modified_gmt":"2025-06-10T07:25:58","slug":"example-numeric-data-entry-function-with-gear-shift","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/","title":{"rendered":"Example: Numeric data entry function with gear shift"},"content":{"rendered":"\n<p>This programming example addresses the issue of providing a user interface that permits the user to set numeric parameter values. This might be for example a target weight on a batch weighing system or a temperature setpoint on a furnace control. Sometimes such parameters need to be adjustable over a wide range of numeric values, but they must also be constrained within permitted minimum and maximum values. In for instance a batch weighing system permissible values may range from 0.20kg to 20.00kg in steps of 10g (0.01kg).<\/p>\n\n\n\n<p>With controller like the MMi200 we are faced with the restriction that the off the shelf product does not have a numeric keypad. How then do we give a user the ability to enter a number like 19.87kg? One answer would in fact be to interface a numeric keypad, and write a suitable driver. That is perfectly possible, but it is not the solution we will pursue here (the classic tutorial in the SPLat\/PC help file has an example of just that).<\/p>\n\n\n\n<p>The solution in this example uses just 4 of the 5 front panel push buttons on the MMi200. They are used (designated) as &#8220;Up&#8221;, &#8220;Down&#8221;, &#8220;Yes&#8221; and &#8220;No&#8221; (the latter 2 could also be called &#8220;Accept&#8221; and &#8220;Reject&#8221;).<\/p>\n\n\n\n<p>What it does is to use the Up and Down buttons to increment or decrement a number with auto-repeating of the button as long as it is held down. However, the amount by which it changes is variable, with an automatic &#8220;gear change&#8221; feature that takes place while the Up (or Down) button is held down. With the gear change, as a particular digit position has been incremented and rolls over to zero, focus shifts to the next highest position which in turn gets incremented.<\/p>\n\n\n\n<p>For example, assume the number starts at 0 and is initially incremented by one. Providing the Up button is held on, the number will go through the following sequence:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    0,    1,    2,    3, ....    8,    9,\n   10,   20,   30,   40, ....   80,   90,\n  100,  200,  300,  400, ....  800,  900\n<\/pre>\n\n\n\n<p>etc. If the user releases the button at 900 and then presses it again, the function will shift back down to the lowest gear and resume counting by ones:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>  901,  902,  903,  904, ....  908,  909,<\/code>\n<code>  910,  920,  930,  940<\/code>\n<\/pre>\n\n\n\n<p>etc.<\/p>\n\n\n\n<p>The function allows you to set the initial value, the initial increment and the minimum and maximum allowable values. It actually turns out to be an advantage not having a full keypad, because this method makes it impossible for a user to go outside the min\/max limits. With a keypad this becomes much harder.<\/p>\n\n\n\n<p>The example is written as a function that can be incorporated quite readily into a larger program. You can download the examples collection from our website in the\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/download\/outlines-schematics-etc\/\">File Resources<\/a>\u00a0area. The code for this example is called FSETNMVS.SPT. This is an old example, written to be compatible with the Suspend\/Resume method of writing multitasking programs, which has been superseded by\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/\">MultiTrack<\/a>. The code provided includes test\/demo code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This programming example addresses the issue of providing a user interface that permits the user to set numeric parameter values. This might be for example&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":887,"menu_order":0,"template":"","class_list":["post-3683","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: Numeric data entry function with gear shift - 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: Numeric data entry function with gear shift - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"This programming example addresses the issue of providing a user interface that permits the user to set numeric parameter values. This might be for example...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T07:25:58+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\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/\",\"name\":\"Example: Numeric data entry function with gear shift - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-21T06:50:52+00:00\",\"dateModified\":\"2025-06-10T07:25:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming examples\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Example: Numeric data entry function with gear shift\"}]},{\"@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: Numeric data entry function with gear shift - 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: Numeric data entry function with gear shift - SPLat Controls","og_description":"This programming example addresses the issue of providing a user interface that permits the user to set numeric parameter values. This might be for example...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T07:25:58+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\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/","name":"Example: Numeric data entry function with gear shift - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-21T06:50:52+00:00","dateModified":"2025-06-10T07:25:58+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/example-numeric-data-entry-function-with-gear-shift\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Programming examples","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-examples\/"},{"@type":"ListItem","position":3,"name":"Example: Numeric data entry function with gear shift"}]},{"@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\/3683","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\/887"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}