{"id":3395,"date":"2025-04-18T06:33:47","date_gmt":"2025-04-18T06:33:47","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3395"},"modified":"2025-06-10T11:06:09","modified_gmt":"2025-06-10T11:06:09","slug":"test-2-send-two-name-value-pairs-display-the-response","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/","title":{"rendered":"Test 2: Send two name-value pairs, display the response"},"content":{"rendered":"\n<p>Test 2 sends the query string &#8220;<code>a=5&amp;b=-9<\/code>&#8220;, and then displays the server response, which is the sum&nbsp;<code>a+b<\/code>, or&nbsp;<code>-4.<\/code>&nbsp;The code is written to make it easy for you to send other values of&nbsp;<code>a<\/code>&nbsp;and&nbsp;<code>b<\/code>.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Prepare<\/h6>\n\n\n\n<p>The first bit is the same as in test 1, where we Idle the SX10509 and then clear its network Tx buffer.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Test2: \n        GoSub           SCH_Idle                ;Force the SCH into idle\n        WaitForST       sSCH_GotEcho            ;Wait for the command to be echoed\n        GoSub           SCH_ClearTx             ;Make sure the SX10509 Tx buffer is clear\n        WaitForST       sSCH_GotEcho            ;Wait for the command to be echoed<\/pre>\n\n\n\n<p>We have to clear the buffer before writing to it, because writes to the SX10509 network Tx buffer always&nbsp;<em>append<\/em>&nbsp;to whatever is already there.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Write the query string<\/h6>\n\n\n\n<p>The next block of code writes &#8220;<code>a=5&amp;b=-9<\/code>&#8221; to the SX10509 network Tx buffer. It does this in several small bits to make it easy for you to hack the code, and also to illustrate an important aspect of the&nbsp;<code>iiPrintText<\/code>&nbsp;and similar SPLat instructions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        LoadI           0                       ;Write offset pointer for iiPrintText and similar instructions\n        iiPrintText     abTxData,\"a=\"           ;Write the first name\n        LoadX           5                       ;Set the first value, use an integer\n        iiuPrintXVW     abTxData                ;Write the first value\n        iiPrintText     abTxData,\"&amp;b=\"          ;Write delimiter and the second name\n        fLoadW          -9                      ;Set the 2nd value as a float\n        iifPrintWVW     abTxData,10,3           ;Write the 2nd value, max 10 characters, max 3 decimal places<\/pre>\n\n\n\n<p>The instructions that start with&nbsp;<code>ii<\/code>&nbsp;all use the index register&nbsp;<code>I<\/code>&nbsp;as an offset from a base address, then increment&nbsp;<code>I<\/code>&nbsp;as they process several contiguous bytes of data. When the instruction has completed,&nbsp;<code>I<\/code>&nbsp;is left pointing one byte beyond the last byte processed. Hence, in the above code, the 4 separate elements of the total query string will be written to separate, contiguous area of the Xwire transmit data block that starts at address&nbsp;<code>abTxData<\/code>.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Write to the SX10509<\/h6>\n\n\n\n<p>Next we have to Write the query string to the SX10509 network Tx buffer. After the&nbsp;<code>iiPrint<\/code>s (etc) above,&nbsp;<code>I<\/code>&nbsp;has been incremented by the total number of bytes written to the Tx data block. Because it started out containing 0, it now has the&nbsp;<em>byte count<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        ItoX                                    ;Get the number of bytes written\n        Store           bTxLength               ;Data length byte in the Xwire N\/W Tx data block\n        GoSub           SCH_Write               ;Set the command byte to Write\n        WaitForST       sSCH_GotEcho            ;Wait for the command to be echoed <\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Send a GET<\/h6>\n\n\n\n<p>Now the query string has been written to the SX10509 network Tx buffer, we can generate a GET request. This will be sent to the server with the just-written query string appended:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        GoSub           SCH_Get                 ;Send a GET request to the server\n        WaitForST       sSCH_GotEcho            ;Wait for the command to be echoed<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Check the status code from the server<\/h6>\n\n\n\n<p>Just like in Test 1, the status code should be 200. This time I have chosen not to display it if it&#8217;s bad &#8211; I simply abandon the operation.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        fRecallW        abRxData                ;Get the result code -&gt; W     \n        fLoadQ          200                     ;OK code\n        fTestWeqQ                               ;OK?\n        GoIfZ           WAFbutton               ;g\/ bad response - give up<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Read and display the data returned by the server<\/h6>\n\n\n\n<p>This is just the same as before.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        LoadI           0                       ;Offset into SCH network Rx buffer\n        GoSub           SCH_Read              \n        WaitForST       sSCH_GotEcho            ;Wait for the command to be echoed\n        GoSub           RxDisplay               ;Display the result\n        \n        GoTo            WAFbutton<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Test 2 sends the query string &#8220;a=5&amp;b=-9&#8220;, and then displays the server response, which is the sum&nbsp;a+b, or&nbsp;-4.&nbsp;The code is written to make it easy&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3387,"menu_order":6,"template":"","class_list":["post-3395","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>Test 2: Send two name-value pairs, display the response - 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=\"Test 2: Send two name-value pairs, display the response - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"Test 2 sends the query string &#8220;a=5&amp;b=-9&#8220;, and then displays the server response, which is the sum&nbsp;a+b, or&nbsp;-4.&nbsp;The code is written to make it easy...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T11:06:09+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-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/\",\"name\":\"Test 2: Send two name-value pairs, display the response - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-18T06:33:47+00:00\",\"dateModified\":\"2025-06-10T11:06:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/#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: SPLat Call Home (SX10509) programming\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Example: SPLat Call Home sandbox program\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Test 2: Send two name-value pairs, display the response\"}]},{\"@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":"Test 2: Send two name-value pairs, display the response - 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":"Test 2: Send two name-value pairs, display the response - SPLat Controls","og_description":"Test 2 sends the query string &#8220;a=5&amp;b=-9&#8220;, and then displays the server response, which is the sum&nbsp;a+b, or&nbsp;-4.&nbsp;The code is written to make it easy...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T11:06:09+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-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/","name":"Test 2: Send two name-value pairs, display the response - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-18T06:33:47+00:00","dateModified":"2025-06-10T11:06:09+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/test-2-send-two-name-value-pairs-display-the-response\/#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: SPLat Call Home (SX10509) programming","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/"},{"@type":"ListItem","position":4,"name":"Example: SPLat Call Home sandbox program","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-splat-call-home-sx10509-programming\/example-splat-call-home-sandbox-program\/"},{"@type":"ListItem","position":5,"name":"Test 2: Send two name-value pairs, display the response"}]},{"@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\/3395","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\/3387"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}