{"id":84,"date":"2006-02-13T11:41:20","date_gmt":"2006-02-13T16:41:20","guid":{"rendered":"http:\/\/www.tigoe.net\/pcomp\/code\/category\/code\/unixlinux\/84"},"modified":"2008-01-21T21:33:48","modified_gmt":"2008-01-22T02:33:48","slug":"serial-communication-in-osx-terminal","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/OSX\/84\/","title":{"rendered":"Serial Communication in OSX Terminal"},"content":{"rendered":"<p>knew it had to be possible to view serial data in the OSX terminal window, but I&#8217;m not enough of a unix geek to figure it out. Finally, a little googling told me what I needed to know. Here&#8217;s how to read and send serial data from the terminal in OSX.<\/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>, <a href=\"http:\/\/www.technorati.com\/tag\/OSX\" rel=\"tag\">OSX<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/serial\" rel=\"tag\">serial<\/a><\/p>\n<p><!-- technorati tags end --><br \/>\n<!--more--><br \/>\nFirst, open Terminal. If you&#8217;ve never used it before, it&#8217;s under Applications\/Utilities\/Terminal. Next, type<\/p>\n<pre>ls \/dev\/tty.*\n<\/pre>\n<p>to get a list of all of your serial ports. Pick the one that you want to open. For example, my list looks like this:<\/p>\n<pre>\/dev\/tty.BTRS232                        \/dev\/tty.Tigoe6630-AppleAgent-1\n\/dev\/tty.Bluetooth-Modem                \/dev\/tty.Tigoe6630-Dial-UpNetwor-2\n\/dev\/tty.KeySerial1                     \/dev\/tty.modem\n<\/pre>\n<p>And I know from previous experience that \/dev\/tty.Keyserial1 is my Keyspan USB-to-serial adaptor.  It&#8217;s connected to a PIC at the moment. The PIC&#8217;s programmed to read one byte of serial data at 9600 bits per second, then send back three bytes, &#8220;A&#8221;, &#8220;B&#8221; and &#8220;C&#8221;.<br \/>\nKnowing the serial port, you can just type screen portname datarate to show the serial data on the screen. In my case, it was:<\/p>\n<pre>screen \/dev\/tty.Keyserial1 9600\n<\/pre>\n<p>Then I started typing bytes at the PIC, and it sent bytes back to me. Whee!  No need for zTerm!   To quit the screen app, tyoe control-A, then control-\\.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I knew it had to be possible to view serial data in the OSX terminal window, but I&#8217;m not enough of a unix geek to figure it out&#8230;.  Here&#8217;s how to read and send serial data from the terminal in OSX: First, open Terminal.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-OSX"],"_links":{"self":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/84","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=84"}],"version-history":[{"count":0,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}