{"id":567,"date":"2016-05-18T09:23:28","date_gmt":"2016-05-18T09:23:28","guid":{"rendered":"https:\/\/einhugur.com\/blog\/?page_id=567"},"modified":"2016-05-19T22:48:54","modified_gmt":"2016-05-19T22:48:54","slug":"hd44780-based-lcd-display","status":"publish","type":"page","link":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/","title":{"rendered":"HD44780 based LCD display"},"content":{"rendered":"<h2>In this example we are going to connect to HD44780 based LCD display.<\/h2>\n<p>The display I am using \u00a0has 2 lines with 16 letters each. Same example will also work for HD44780 based displays that have 4 lines with 20 letters per line.<\/p>\n<p>Now before going\u00a0further then I want it to be known that this guide is much based on the <a href=\"http:\/\/developer.xojo.com\/rpi-lcd-character-display\">Guide from Xojo Inc on HD44780 displays<\/a>. I had been struggling a bit with my self if this guide should be made given that Xojo already had one but then I opted to do it for completeness and as base for other displays that we will be doing. As I went on though then I did some substantial improvements to the Xojo guide which should make this guide worth having. Those include custom glyphs, better detail \u00a0on connecting and how to not damage your display if your display is not one that protects it self as the ones from\u00a0Adafruit and other minor things.<\/p>\n<p><a href=\"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage2.jpg?ssl=1\"><img data-attachment-id=\"578\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/lcdimage2\/\" data-orig-file=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage2.jpg?fit=400%2C182&amp;ssl=1\" data-orig-size=\"400,182\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1463422158&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;160&quot;,&quot;shutter_speed&quot;:&quot;0.03030303030303&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"LCDImage2\" data-image-description=\"\" data-medium-file=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage2.jpg?fit=300%2C137&amp;ssl=1\" data-large-file=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage2.jpg?fit=400%2C182&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-578\" src=\"https:\/\/i2.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage2-300x137.jpg?resize=300%2C137&#038;ssl=1\" alt=\"LCDImage2\" width=\"300\" height=\"137\" srcset=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage2.jpg?resize=300%2C137&amp;ssl=1 300w, https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage2.jpg?w=400&amp;ssl=1 400w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<hr \/>\n<h5><strong>Disclaimer:<\/strong><br \/>\nWe do not take any responsibility for possible errors in the guide or errors that you might do wiring it up. Incorrect wiring can result in damaged display\u00a0or damaged Raspberry PI.<\/h5>\n<hr \/>\n<h5><strong>Pieces we use in this example:<\/strong><\/h5>\n<ul>\n<li>Raspberry PI 2 (or Raspberry PI 3).<\/li>\n<li>Cobbler and Cobbler cable.<\/li>\n<li>Bread board\u00a0<span style=\"color: #999999;\">(I found it nice to have two for this).<\/span><\/li>\n<li>Header pins to solder into the display.<\/li>\n<li>HD4478 based LCD display. I had 1602 LCD module with blue backlight that I paid about $3 for on Ali Express but I am finding them now all the way down to $1.96 with free shipping.<br \/>\n<span style=\"color: #999999;\">(Do not get one with Electro Luminescent backlight as those will draw a lot of power. They might have EL in their names)<\/span><\/li>\n<li>10 k\u03a9 potentiometer.<\/li>\n<li>560 \u03a9\u00a0resistor\n<ul>\n<li><span style=\"color: #999999;\">Not required if you&#8217;re buying the LCD from Adafruit<\/span><\/li>\n<li><span style=\"color: #999999;\">Many\u00a0displays do not have a current limiting resistor installed for the LED backlight, this resistor is only needed for those. \u00a0It is hard to tell until you actually apply power to the LCD if yours has built in resistor or not. So it is a good idea to put in a resistor to begin with at least.<\/span><\/li>\n<li><span style=\"color: #999999;\">This may vary between displays, I used 1 k\u03a9 resistor, and the display was bright. 560 \u03a9 is the most common though and probably would have been fine for me.<\/span><\/li>\n<li>WiringPI needs to be installed on the Raspberry PI -&gt;\u00a0<a href=\"http:\/\/wiringpi.com\/download-and-install\/\"><u><span style=\"color: #0066cc;\">See here<\/span><\/u><\/a>.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h5>Soldering:<\/h5>\n<p>Usually those displays do not come with pins soldered on them. So you can either solder header pins on it or wires. The displays take standard header pins with 2,54 mm spacing.<\/p>\n<p>This is how it looked like after I quickly soldered the one I tested:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage5.jpg?ssl=1\"><img data-attachment-id=\"575\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/lcdimage5\/\" data-orig-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage5.jpg?fit=400%2C251&amp;ssl=1\" data-orig-size=\"400,251\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1463507839&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;50&quot;,&quot;shutter_speed&quot;:&quot;0.03030303030303&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"LCDImage5\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage5.jpg?fit=300%2C188&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage5.jpg?fit=400%2C251&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-575\" src=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage5-300x188.jpg?resize=300%2C188&#038;ssl=1\" alt=\"LCDImage5\" width=\"300\" height=\"188\" srcset=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage5.jpg?resize=300%2C188&amp;ssl=1 300w, https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage5.jpg?w=400&amp;ssl=1 400w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>I opted for letting the pins come out at back so I can push the display into a breadboard, or later if I use the display in permanent project I can use the display in a case without the pins sticking out at front.<\/p>\n<hr \/>\n<p><strong>If you are not familiar with breadboards, how to place a cobbler on the breadboard or need to know how to read the color codings on the resistors then click here bellow<\/strong><\/p>\n<p><a class=\"mb-button mb-style-glass mb-size-small mb-corners-default mb-text-style-default \" style=\"background-color: #2b7dc4;\" href=\"https:\/\/einhugur.com\/blog\/index.php\/understanding-your-breadboard-and-placement-of-raspberry-cobbler\/\">\u00a0<i class=\"fa fa-code-fork\"><\/i>\u00a0 Using breadboard<\/a> <a class=\"mb-button mb-style-glass mb-size-small mb-corners-default mb-text-style-default \" style=\"background-color: #2b7dc4;\" href=\"https:\/\/einhugur.com\/blog\/index.php\/basic-electronics\/resistor-color-codings\/\">\u00a0<i class=\"fa fa-bars\"><\/i>\u00a0 Resistor color codings<\/a><\/p>\n<hr \/>\n<h5>Connecting the LCD:<\/h5>\n<p>When connecting then its best to connect LCD pins 1, 2, 15 and 16 first as well as fully connecting the potentiometer (see connection map bellow). Then turn on the Raspberry PI and adjust the potentiometer until you clearly see boxes outlining character placeholders in one of the lines in the display. If you are unable to get the placeholders, then re-check your connections.<\/p>\n<p>Once you can see the placeholders clearly then you can power down your Raspberry PI and proceed to connect the rest of the pins on the display.<\/p>\n<h5><strong>Connection map:<\/strong><\/h5>\n<table style=\"height: 377px;\" border=\"1\" width=\"485\" cellspacing=\"1\" cellpadding=\"1\">\n<tbody>\n<tr>\n<th>LCD<\/th>\n<th>Raspberry PI cobbler<\/th>\n<\/tr>\n<tr>\n<td>#1 (GND) or (VSS)<\/td>\n<td>GND<\/td>\n<\/tr>\n<tr>\n<td>#2 (VCC)<\/td>\n<td>5v<\/td>\n<\/tr>\n<tr>\n<td>#3 (Vo)<\/td>\n<td><strong>To potentiometer middle pin<\/strong><\/td>\n<\/tr>\n<tr>\n<td>#4 (RS)<\/td>\n<td>GPIO25<\/td>\n<\/tr>\n<tr>\n<td>#5 (RW)<\/td>\n<td>GND<\/td>\n<\/tr>\n<tr>\n<td>#6 (EN)<\/td>\n<td>GPIO24<\/td>\n<\/tr>\n<tr>\n<td>#7, #8, #9, #10<\/td>\n<td>not used<\/td>\n<\/tr>\n<tr>\n<td>#11 (D4)<\/td>\n<td>GPIO23<\/td>\n<\/tr>\n<tr>\n<td>#12 (D5)<\/td>\n<td>GPIO17<\/td>\n<\/tr>\n<tr>\n<td>#13 (D6)<\/td>\n<td>GPIO21<\/td>\n<\/tr>\n<tr>\n<td>#14 (D7)<\/td>\n<td>GPIO22<\/td>\n<\/tr>\n<tr>\n<td>#15 (LED+)<\/td>\n<td>to 560 \u03a9\u00a0resistor that then goes to 5.0v<br \/>\n<span style=\"color: #808080;\">(See notes above in the part list on if you <\/span><br \/>\n<span style=\"color: #808080;\">should use this resistor or not)<\/span><\/td>\n<\/tr>\n<tr>\n<td>#16 (LED-)<\/td>\n<td>GND<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a href=\"https:\/\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png\">\u00a0<\/a><\/p>\n<table style=\"height: 119px;\" border=\"1\" width=\"485\" cellspacing=\"1\" cellpadding=\"1\">\n<tbody>\n<tr>\n<th>Potentiometer<\/th>\n<th>Raspberry PI cobbler<\/th>\n<\/tr>\n<tr>\n<td>#1<\/td>\n<td>GND<\/td>\n<\/tr>\n<tr>\n<td>#2<\/td>\n<td><strong>#3 (Vo) (In the LCD)<\/strong><\/td>\n<\/tr>\n<tr>\n<td>#3<\/td>\n<td>5v<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?ssl=1\"><img data-attachment-id=\"82\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hc-sr501-sensor\/gpio-header\/\" data-orig-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?fit=440%2C870&amp;ssl=1\" data-orig-size=\"440,870\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"GPIO Header\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?fit=152%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?fit=440%2C870&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-82\" src=\"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header-152x300.png?resize=152%2C300&#038;ssl=1\" alt=\"GPIO Header\" width=\"152\" height=\"300\" srcset=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?resize=152%2C300&amp;ssl=1 152w, https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?w=440&amp;ssl=1 440w\" sizes=\"(max-width: 152px) 100vw, 152px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<hr \/>\n<h5>The Xojo code:<\/h5>\n<p>For the Xojo code then I\u00a0mostly use modified version of\u00a0Paul Lefebvre&#8217;s GPIO library from Xojo Inc. I\u00a0modified it to add support for custom Glyphs. (See download link at bottom for the modified library and the example code). The code\u00a0I show bellow is how to use the modified library.<\/p>\n<p><em>(Note the &amp;amp in the binary masks shown bellow should be &amp;, the syntax highlighter does not show it right)<\/em><\/p>\n<pre lang=\"xojo\">\/\/ Property on a Window\r\nPrivate lcd As GPIO.LCD\r\n\r\n\/\/ Open event of the Window\r\nSub Open()\r\n GPIO.SetupGPIO()\r\n \r\n \r\n Const kRSPin = 25\r\n Const kEPin = 24\r\n Const kD4Pin = 23\r\n Const kD5Pin = 17\r\n Const kD6Pin = 21\r\n Const kD7Pin = 22\r\n \r\n lcd = new GPIO.LCD(kRSPin, kEPin, kD4Pin, kD5Pin, kD6Pin, kD7Pin)\r\n \r\n Dim glyph as GPIO.LCDGlyph\r\n \r\n \/\/ We create some glyph, the display can store max 8 at once, but we can set up as many as we want here since our code will apply them in smart way so that the limit will not be how many are set up but the limit will be 8 different custom glyphs per line in the display.\r\n \r\n \/\/ A Glyph that represents the Icelandic Thorn letter (upper case)\r\n glyph = new GPIO.LCDGlyph\r\n glyph.SetLine(0,&amp;b10000)\r\n glyph.SetLine(1,&amp;b10000)\r\n glyph.SetLine(2,&amp;b11100)\r\n glyph.SetLine(3,&amp;b10010)\r\n glyph.SetLine(4,&amp;b10010)\r\n glyph.SetLine(5,&amp;b11100)\r\n glyph.SetLine(6,&amp;b10000)\r\n glyph.SetLine(7,&amp;b10000)\r\n \r\n glyph.LetterCode = Asc(\"\u00de\")\r\n \r\n lcd.RegisterCustomGlyph(glyph)\r\n \r\n \/\/ A Glyph that represents the Icelandic Thorn letter (lower case)\r\n glyph = new GPIO.LCDGlyph\r\n glyph.SetLine(0,&amp;b10000)\r\n glyph.SetLine(1,&amp;b10000)\r\n glyph.SetLine(2,&amp;b11100)\r\n glyph.SetLine(3,&amp;b10010)\r\n glyph.SetLine(4,&amp;b10010)\r\n glyph.SetLine(5,&amp;b10010)\r\n glyph.SetLine(6,&amp;b11100)\r\n glyph.SetLine(7,&amp;b10000)\r\n \r\n glyph.LetterCode = Asc(\"\u00fe\")\r\n \r\n lcd.RegisterCustomGlyph(glyph)\r\n \r\n \/\/ A Glyph that represents the \u00f3 letter (lower case)\r\n glyph = new GPIO.LCDGlyph\r\n glyph.SetLine(0,&amp;b00010)\r\n glyph.SetLine(1,&amp;b00100)\r\n glyph.SetLine(2,&amp;b01110)\r\n glyph.SetLine(3,&amp;b10001)\r\n glyph.SetLine(4,&amp;b10001)\r\n glyph.SetLine(5,&amp;b10001)\r\n glyph.SetLine(6,&amp;b01110)\r\n glyph.SetLine(7,&amp;b00000)\r\n \r\n glyph.LetterCode = Asc(\"\u00f3\")\r\n \r\n lcd.RegisterCustomGlyph(glyph)\r\n \r\n \r\n \/\/ A Glyph that represents the \u00f6 letter (lower case)\r\n glyph = new GPIO.LCDGlyph\r\n glyph.SetLine(0,&amp;b01010)\r\n glyph.SetLine(1,&amp;b00000)\r\n glyph.SetLine(2,&amp;b01110)\r\n glyph.SetLine(3,&amp;b10001)\r\n glyph.SetLine(4,&amp;b10001)\r\n glyph.SetLine(5,&amp;b10001)\r\n glyph.SetLine(6,&amp;b01110)\r\n glyph.SetLine(7,&amp;b00000)\r\n \r\n glyph.LetterCode = Asc(\"\u00f6\")\r\n \r\n lcd.RegisterCustomGlyph(glyph)\r\n \r\n \/\/ A Glyph that represents the \u00ed letter (lower case)\r\n glyph = new GPIO.LCDGlyph\r\n glyph.SetLine(0,&amp;b00010)\r\n glyph.SetLine(1,&amp;b00100)\r\n glyph.SetLine(2,&amp;b00000)\r\n glyph.SetLine(3,&amp;b01100)\r\n glyph.SetLine(4,&amp;b00100)\r\n glyph.SetLine(5,&amp;b00100)\r\n glyph.SetLine(6,&amp;b01110)\r\n glyph.SetLine(7,&amp;b00000)\r\n \r\n glyph.LetterCode = Asc(\"\u00ed\")\r\n \r\n lcd.RegisterCustomGlyph(glyph)\r\n \r\nEnd Sub\r\n\r\n\/\/ Action event on a button\r\nSub Action()\r\n \/\/ And test our glyphs\r\n lcd.Clear()\r\n lcd.Home()\r\n lcd.SetMessage(\"\u00de\u00f3r is the\",1,true)\r\n lcd.SetMessage(\"thundergod\",2,true)\r\n\r\n \/\/ The last parameter in SetMessage says we want to parse the text and look for custom glyphs in it.\r\nEnd Sub\r\n\r\n\/\/ Action event for a second button\r\nSub Action()\r\n Dim glyph as GPIO.LCDGlyph\r\n \r\n \/\/ We can also create custom glyph on the spot and just use it without registering it mapped to any character.\r\n \r\n \/\/ A Glyph that represents a arrow to right\r\n glyph = new GPIO.LCDGlyph\r\n glyph.SetLine(0,&amp;b10000)\r\n glyph.SetLine(1,&amp;b11000)\r\n glyph.SetLine(2,&amp;b11100)\r\n glyph.SetLine(3,&amp;b11110)\r\n glyph.SetLine(4,&amp;b11110)\r\n glyph.SetLine(5,&amp;b11100)\r\n glyph.SetLine(6,&amp;b11000)\r\n glyph.SetLine(7,&amp;b10000)\r\n \r\n \/\/ Register it in slot 0 (we have 8 slots, numbered 0 to 7)\r\n lcd.SetCustomGlyph(0,glyph)\r\n \r\n lcd.Clear()\r\n lcd.Home()\r\n \r\n lcd.SendByte(0,true)\r\nEnd Sub\r\n\r\n<\/pre>\n<p>And here are example results what the code generates, notice the Icelandic letters that the display should not support normally without custom glyphs:<\/p>\n<p><a href=\"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage4.jpg?ssl=1\"><img data-attachment-id=\"576\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/lcdimage4\/\" data-orig-file=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage4.jpg?fit=350%2C204&amp;ssl=1\" data-orig-size=\"350,204\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1463506558&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;64&quot;,&quot;shutter_speed&quot;:&quot;0.03030303030303&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"LCDImage4\" data-image-description=\"\" data-medium-file=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage4.jpg?fit=300%2C175&amp;ssl=1\" data-large-file=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage4.jpg?fit=350%2C204&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-576\" src=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage4-300x175.jpg?resize=300%2C175&#038;ssl=1\" alt=\"LCDImage4\" width=\"300\" height=\"175\" srcset=\"https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage4.jpg?resize=300%2C175&amp;ssl=1 300w, https:\/\/i1.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage4.jpg?w=350&amp;ssl=1 350w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i2.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage1.jpg?ssl=1\"><img data-attachment-id=\"579\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/lcdimage1\/\" data-orig-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage1.jpg?fit=350%2C217&amp;ssl=1\" data-orig-size=\"350,217\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1463506541&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;80&quot;,&quot;shutter_speed&quot;:&quot;0.03030303030303&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"LCDImage1\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage1.jpg?fit=300%2C186&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage1.jpg?fit=350%2C217&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-579\" src=\"https:\/\/i2.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage1-300x186.jpg?resize=300%2C186&#038;ssl=1\" alt=\"LCDImage1\" width=\"300\" height=\"186\" srcset=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage1.jpg?resize=300%2C186&amp;ssl=1 300w, https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage1.jpg?w=350&amp;ssl=1 350w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>And finally the arrow glyph that we created which is not mapped to any specific character:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage3.jpg?ssl=1\"><img data-attachment-id=\"577\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/lcdimage3\/\" data-orig-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage3.jpg?fit=350%2C204&amp;ssl=1\" data-orig-size=\"350,204\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1463505421&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;50&quot;,&quot;shutter_speed&quot;:&quot;0.03030303030303&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"LCDImage3\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage3.jpg?fit=300%2C175&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage3.jpg?fit=350%2C204&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-577\" src=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/LCDImage3-300x175.jpg?resize=300%2C175&#038;ssl=1\" alt=\"LCDImage3\" width=\"300\" height=\"175\" srcset=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage3.jpg?resize=300%2C175&amp;ssl=1 300w, https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/LCDImage3.jpg?w=350&amp;ssl=1 350w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>The mask when setting up custom Glyphs is a Binary mask for each line that consists of 5 bits, and you have 8 lines.<\/p>\n<p>So graphically setting up a glyph would look like this:<\/p>\n<p><a href=\"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/GlyphMask.png?ssl=1\"><img data-attachment-id=\"582\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/glyphmask\/\" data-orig-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/GlyphMask.png?fit=137%2C214&amp;ssl=1\" data-orig-size=\"137,214\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"GlyphMask\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/GlyphMask.png?fit=137%2C214&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2016\/05\/GlyphMask.png?fit=137%2C214&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-full wp-image-582\" src=\"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/GlyphMask.png?resize=137%2C214&#038;ssl=1\" alt=\"GlyphMask\" width=\"137\" height=\"214\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Which would give the following mask:<\/p>\n<pre lang=\"xojo\">glyph = new GPIO.LCDGlyph\r\n glyph.SetLine(0,&amp;b00010)\r\n glyph.SetLine(1,&amp;b00100)\r\n glyph.SetLine(2,&amp;b00000)\r\n glyph.SetLine(3,&amp;b01100)\r\n glyph.SetLine(4,&amp;b00100)\r\n glyph.SetLine(5,&amp;b00100)\r\n glyph.SetLine(6,&amp;b01110)\r\n glyph.SetLine(7,&amp;b00000)<\/pre>\n<h5>Downloading the code:<\/h5>\n<p><a class=\"mb-button mb-style-glass mb-size-small mb-corners-default mb-text-style-default \" style=\"background-color: #2b7dc4;\" href=\"http:\/\/www.einhugur.com\/Downloads\/GPIO\/LCDProject.zip\">\u00a0<i class=\"fa fa-download\"><\/i>\u00a0 Download source code<\/a><\/p>\n<hr \/>\n<p>Thats it for now !!<\/p>\n<hr \/>\n<p><a href=\"http:\/\/s.click.aliexpress.com\/e\/u37AeEUJq\" target=\"_parent\"><img src=\"https:\/\/i2.wp.com\/g01.a.alicdn.com\/kf\/HTB12xcxKXXXXXblXFXXq6xXFXXXR\/Free-Shipping-1PCS-LCD1602-1602-module-Blue-screen-16x2-Character-LCD-Display-Module-font-b-HD44780.jpg_220x220.jpg?w=474\" data-recalc-dims=\"1\" \/><span style=\"display: block;\">AliExpress.com Product &#8211; Free Shipping 1PCS LCD1602 1602 module Blue screen 16&#215;2 Character LCD Display Module HD44780 Controller blue blacklight<\/span><\/a><\/p>\n<p><a href=\"http:\/\/s.click.aliexpress.com\/e\/Q3VZvf6eA\" target=\"_parent\"><img src=\"https:\/\/i2.wp.com\/g02.a.alicdn.com\/kf\/HTB1Y23aIpXXXXX5XXXXq6xXFXXXO\/Freeshipping-LCD-2004-20x4-Character-LCD-Display-Module-font-b-HD44780-b-font-Controller-blue-screen.jpg_220x220.jpg?w=474\" data-recalc-dims=\"1\" \/><span style=\"display: block;\">AliExpress.com Product &#8211; Freeshipping ! New 2004 204 24 Character LCD 0XModule Display For Arduino<\/span><\/a><\/p>\n<p><a href=\"http:\/\/s.click.aliexpress.com\/e\/3JmyzZR7Y\" target=\"_parent\"><img src=\"https:\/\/i2.wp.com\/g03.a.alicdn.com\/kf\/HTB1_wanJFXXXXc5aXXXq6xXFXXXK\/Multimetro-HoldPeak-HP-770D-Auto-Range-font-b-Digital-b-font-font-b-Multimeter-b-font.jpg_220x220.jpg?w=474\" data-recalc-dims=\"1\" \/><span style=\"display: block;\">AliExpress.com Product &#8211; HoldPeak HP-770D Multimeter<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this example we are going to connect to HD44780 based LCD display. The display I am using \u00a0has 2 lines with 16 letters each. Same example will also work for HD44780 based displays that have 4 lines with 20 letters per line. Now before going\u00a0further then I want it to be known that this &hellip; <a href=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">HD44780 based LCD display<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":94,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"spay_email":""},"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/Pd75nk-99","jetpack-related-posts":[{"id":94,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/","url_meta":{"origin":567,"position":0},"title":"Xojo GPIO","date":"September 19, 2015","format":false,"excerpt":"Guides for GPIO in Xojo \u00a0Infrared motion detection (Updated 1. May 2016) Shows\u00a02 ways of coding: Using Interrupts or simple polling. Sensors: \u00a0HC-SR501,\u00a0ST-00082 Mini,\u00a0Mini IR Pyroelectric Infrared PIR Motion Human Sensor Detector Module Uses:\u00a0Basic GPIO Relay board In this example we \u00a0wire up a relay board and let your Xojo\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":853,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hd44780-based-lcd-display-part-2-non-standard-sizes\/","url_meta":{"origin":567,"position":1},"title":"HD44780 BASED LCD DISPLAY - Part 2 (Non standard sizes)","date":"April 15, 2017","format":false,"excerpt":"In this example we are going to connect to some specialized HD44780 based displays. This article is followup on our previous article called\u00a0HD44780 based LCD display. The standard 16 x 2, or 20 x 2 or even 20 x 4 are great for many purposes, and cheap as well. But\u00a0sometimes\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2017\/04\/8x2Display.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":288,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/connecting-max7219_led_matrix-with-spi-bus\/","url_meta":{"origin":567,"position":2},"title":"Connecting MAX7219_LED_MATRIX with SPI bus","date":"October 21, 2015","format":false,"excerpt":"In this example we going to connect a\u00a0MAX7219_LED_MATRIX and control it with the SPI bus on the Raspberry PI. 8. Nov 2015 Important !! When I was working on next step in this to daisy chain more than one on same bus then I measured some extreme power usage at\u2026","rel":"","context":"Similar post","img":{"alt_text":"MAX7219_LED_MATRIX","src":"https:\/\/i2.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/10\/MAX7219_LED_MATRIX-e1445384705632.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":10,"url":"https:\/\/einhugur.net\/blog\/index.php\/links\/other-xojo-blogs\/","url_meta":{"origin":567,"position":3},"title":"Other Xojo Blogs","date":"August 31, 2015","format":false,"excerpt":"The official blog from Xojo Inc. The official Xojo Blog Bob has for long time had blog on Xojo development. I really like this one (probably since I tend to agree with Bob on many things) BKeeney Briefs MBS \u00a0Plugin Blog -\u00a0He is supposed to be competitor but the Xojo\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":74,"url":"https:\/\/einhugur.net\/blog\/index.php\/links\/xojo-developer-related-links\/","url_meta":{"origin":567,"position":4},"title":"Xojo developer related links","date":"September 12, 2015","format":false,"excerpt":"Xojo Inc\u00a0- the makers of\u00a0Xojo Ohanaware\u00a0- App Wrapper and other tools that Xojo Mac developers should not be without. Lua (The makers of the Lua interpreter) Python (The makers of the Python language) Scientific Specialties - Some great books about Xojo and\u00a0use of Xojo with Raspberry PI and electronics.","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":70,"url":"https:\/\/einhugur.net\/blog\/index.php\/links\/other-sites-that-have-xojo-addons-and-plugins\/","url_meta":{"origin":567,"position":5},"title":"Other sites that have Xojo addons and plugins","date":"September 12, 2015","format":false,"excerpt":"VanHoeak Software - Some awesome plugins for Xojo MBS Plugins, a lot of plugins for Xojo.\u00a0 MacOSLib\u00a0- Macoslib A Macintosh library to use advanced features which are not available in Xojo Thomas Templemann's page\u00a0-\u00a0TT also has the excellent ZIP Archive classes RubberViews\u00a0-\u00a0Create one window, this class will manage all controls\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/567"}],"collection":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=567"}],"version-history":[{"count":2,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/567\/revisions"}],"predecessor-version":[{"id":614,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/567\/revisions\/614"}],"up":[{"embeddable":true,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/94"}],"wp:attachment":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}