{"id":61,"date":"2004-06-23T06:35:39","date_gmt":"2004-06-23T11:35:39","guid":{"rendered":"http:\/\/www.tigoe.com\/pcomp\/code2\/category\/picbasic-pro\/61"},"modified":"2008-01-21T21:35:18","modified_gmt":"2008-01-22T02:35:18","slug":"lantronix-device-connection-with-serial-feedback","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/picbasic-pro\/61\/","title":{"rendered":"Lantronix Device  Connection with serial feedback"},"content":{"rendered":"<p>This program waits for the Lantronix device to give an acknowledgment of a net connection before it starts to send data.  The Lantronix Device has to have its connect mode set to verbose, so that it will send ASCII N when not connected, ASCII D when disconnecting, and ASCII C when a connection is made.<\/p>\n<p><!-- technorati tags start --><\/p>\n<p style=\"text-align:right;font-size:10px;\">Technorati Tags: <a href=\"http:\/\/www.technorati.com\/tag\/networked objects\" rel=\"tag\">networked objects<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/networks\" rel=\"tag\">networks<\/a><\/p>\n<p><!-- technorati tags end --><br \/>\n<!--more--><\/p>\n<pre>'     connection to the Lantronix device through a hex inverter:\nTX var portd.0\nRX var portd.1\n\n' serial to PC for debugging:\ndebugTX var portc.6\n\n' some indicator LED's for later use:\nyellowLED var portb.2\ngreenLED var portb.7\nredLED var portb.3\n\n' two switches:\nswitch1 var portb.0\nswitch2 var portb.1\n\n' data coming in the serial port:\ninbyte var byte\n\n'    set the switch pins to input mode:\ninput switch1\ninput switch2\n\n' clear all variables:\nclear\n\nmain:\n    ' the Lantronix device is set to connect mode D5, meaning that\n    ' it will return a byte to the PIC to indicate\n    ' the connection status. a \"C\" means it's\n    ' connected to a remote device or server.\n    ' this routine waits for a C:\n    \n    while inByte &lt;&gt; \"C\"\n        serin2 RX, 16468, [inbyte]\n        serout2 portc.6, 16468, [inbyte, 10, 13]    \n    wend\n    \n    ' once we're connected, we send out the switch states\n    ' via the Lantronix devic:\n    serout2 TX, 16468, [\"b0: \", DEC portb.0, 9, \"b1: \", DEC portb.1, 10, 13]    \ngoto main\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The Lantronix Device has to have its connect mode set to verbose, so that it will send ASCII N when not connected, ASCII D when disconnecting, and ASCII C when a connection is made.&#8217;  connection to the Lantronix device through a hex inverter:TX var portd.0RX var portd.1&#8242; serial to PC for debugging:debugTX var portc.6&#8242; some indicator LED&#8217;s for later use:yellowLED var portb.2greenLED var portb.7redLED var portb.3&#8242; two switches:switch1 var portb.0switch2 var portb.1&#8242; data coming in the serial port:inbyte var byte&#8217; set the switch pins to input mode:input switch1input switch2&#8242; clear all variables:clearmain: &#8216; the Lantronix device is set to connect mode D5, meaning that &#8216; it will return a byte to the PIC to indicate &#8216; the connection status.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,10],"tags":[],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-Lantronix","category-picbasic-pro"],"_links":{"self":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/comments?post=61"}],"version-history":[{"count":0,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/61\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}