{"id":32,"date":"2008-02-12T15:52:00","date_gmt":"2008-02-12T21:52:00","guid":{"rendered":"http:\/\/blog.blockos.org\/?p=84"},"modified":"2010-06-27T20:24:49","modified_gmt":"2010-06-27T19:24:49","slug":"mazinser-lcd","status":"publish","type":"post","link":"https:\/\/blog.blockos.org\/?p=32","title":{"rendered":"MazinSer LCD"},"content":{"rendered":"<p>Woohoo!<\/p>\n<p>I just got my hands on a <a href=\"http:\/\/www.sparkfun.com\/commerce\/product_info.php?products_id=462\">20&#215;4 serial LCD<\/a> from <a href=\"http:\/\/www.sparkfun.com\">Sparkfun<\/a>. It&#8217;s basically a standard LCD with a little PIC based serial TTL interface board plugged on it.<\/p>\n<p>10 lines of code and 3 wires later, I had a wonderful &#8220;Hello world&#8221; displayed on screen. The only problem is that I was using pin 1 (TX) which is shared with the serial USB interface. So when the sketch is uploaded, it&#8217;s also sent to the SerLCD. And you end up with garbage on screen. Hopefully, <a href=\"http:\/\/www.arduino.cc\">Arduino<\/a> comes with a <a href=\"http:\/\/www.arduino.cc\/en\/Tutorial\/SoftwareSerial\">soft serial class<\/a>. It lets you use custom pins for serial communication. The only downside it that it can only run at 4800 baud or 9600 baud.<br \/>\nNext serial fun : <a href=\"http:\/\/www.4dsystems.com.au\/prod.php?id=22\">4DSystem&#8217;s \u00b5DRIVE-uSD-G1<\/a>.<\/p>\n<p>Here&#8217;s the result!<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/blockos.org\/mooz\/lcd01.jpg\" alt=\"Arduino+SerLCD in action\" \/><\/p>\n<p>The mandatory piece of code.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &lt;softwareSerial.h&gt;\r\n\r\n#define SERLCD_CMD                  0xFE\r\n\r\n#define SERLCD_CLEAR                0x01\r\n#define SERLCD_MOVE1_R              0x14\r\n#define SERLCD_MOVE1_L              0x10\r\n#define SERLCD_SCROLL_R             0x1C\r\n#define SERLCD_SCROLL_L             0x18\r\n#define SERLCD_DISP_ON              0x0C\r\n#define SERLCD_DISP_OFF             0x08\r\n#define SERLCD_UNDERLINE_CURSOR_ON  0x0E\r\n#define SERLCD_UNDERLINE_CURSOR_OFF 0x0C\r\n#define SERLCD_BLINKING_CURSOR_ON   0x0D\r\n#define SERLCD_BLINKING_CURSOR_OFF  0x0C\r\n#define SERLCD_SET_CURSOR_POS       0x80\r\n#define SERLCD_CURSOR_OFF           0x0C\r\n\r\n\r\n#define rxPin 6\r\n#define txPin 7\r\n\r\nvoid setup()\r\n{\r\n  char *str = &quot;BlockoS! :)&quot;;\r\n  char *cursor;\r\n\r\n  SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);\r\n\r\n  pinMode(rxPin, INPUT);\r\n  pinMode(txPin, OUTPUT);\r\n\r\n  mySerial.begin(9600);\r\n\r\n  mySerial.print(SERLCD_CMD, BYTE);\r\n  mySerial.print(SERLCD_CLEAR, BYTE);\r\n\r\n  mySerial.print(SERLCD_CMD, BYTE);\r\n  mySerial.print(SERLCD_BLINKING_CURSOR_ON, BYTE);\r\n\r\n  for(cursor=str; *cursor!='&#92;&#48;'; ++cursor)\r\n  {\r\n    mySerial.print(*cursor, BYTE);\r\n  }\r\n}\r\n\r\nvoid loop()\r\n{\r\n  \/* Nothing *\/\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Woohoo! I just got my hands on a 20&#215;4 serial LCD from Sparkfun. It&#8217;s basically a standard LCD with a little PIC based serial TTL interface board plugged on it. 10 lines of code and 3 wires later, I had a wonderful &#8220;Hello world&#8221; displayed on screen. The only problem\u2026 <a class=\"continue-reading-link\" href=\"https:\/\/blog.blockos.org\/?p=32\">Continue reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,3],"tags":[26],"_links":{"self":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts\/32"}],"collection":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":2,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions\/129"}],"wp:attachment":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}