{"id":274,"date":"2018-05-02T07:37:33","date_gmt":"2018-05-02T07:37:33","guid":{"rendered":"http:\/\/ferrywahyuwibowo.my.id\/?p=274"},"modified":"2018-05-02T07:37:33","modified_gmt":"2018-05-02T07:37:33","slug":"vhdl-for-16x2-lcd","status":"publish","type":"post","link":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/274\/vhdl-for-16x2-lcd\/","title":{"rendered":"VHDL for 16&#215;2 LCD"},"content":{"rendered":"<p>The Liquid Crystal Display (LCD) is used to display the character that is represented as the American Standard Code for Information Interchange (ASCII) values. The ASCII values are 8-bit (0-7). The ASCII value can be shown in Fig. 1.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-277\" src=\"http:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/ASCII-e1525161419208-300x291.png\" alt=\"\" width=\"300\" height=\"291\" srcset=\"https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/ASCII-e1525161419208-300x291.png 300w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/ASCII-e1525161419208-768x744.png 768w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/ASCII-e1525161419208-110x107.png 110w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/ASCII-e1525161419208-420x407.png 420w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/ASCII-e1525161419208-444x430.png 444w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/ASCII-e1525161419208.png 827w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>F<\/strong><strong>ig. 1. ASCII Code<br \/>\n<\/strong><\/p>\n<p style=\"text-align: left;\">In this ASCII case, to make character &#8220;a&#8221; the number shall be 61H and the character &#8220;A&#8221; shall be 41H, and so on. The 16&#215;2 LCD with 5&#215;8 pixel matrix (per character) means that the LCD contains 2 rows and 16 characters and can be displayed per line. The single character displayed in 5&#215;8 pixel matrix. The configuration of this LCD is shown in Fig. 2.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-279\" src=\"http:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/LCDConfiguration-e1525166116107-300x138.jpg\" alt=\"\" width=\"300\" height=\"138\" srcset=\"https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/LCDConfiguration-e1525166116107-300x138.jpg 300w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/LCDConfiguration-e1525166116107-110x50.jpg 110w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/LCDConfiguration-e1525166116107-420x193.jpg 420w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/LCDConfiguration-e1525166116107.jpg 438w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>F<\/strong><strong>ig. 2. LCD Configuration<\/strong><\/p>\n<p>The details of the LCD configuration could be shown in Table 1.<\/p>\n<p style=\"text-align: center;\"><strong>Table 1. Details of LCD Configuration<\/strong><\/p>\n<table class=\"aligncenter\" style=\"height: 512px;\" border=\"1\" width=\"388\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><strong>Pin<br \/>\n<\/strong><\/td>\n<td><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 Name<\/strong><\/td>\n<td><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Function<\/strong><\/td>\n<td><strong>\u00a0\u00a0\u00a0 Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 1<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Vss<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Power supply<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Ground<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 2<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Vdd<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Power supply<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 +5v<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 3<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Vo<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Contrast adjust<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0-5v<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 4<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RS<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Command<\/td>\n<td>\u00a0 Register select<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 5<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RW<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Command<\/td>\n<td>\u00a0\u00a0\u00a0 Read \/Write<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 6<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 E<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Command<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Enable<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 7<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB0<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data(LSB)<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 8<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB1<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0\u00a0 9<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB2<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0 10<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB3<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0 11<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB4<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0 12<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB5<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0 13<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB6<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0 14<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB7<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Input\/Output<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0 Data(MSB)<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0 15<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LED+ BKL<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 +5v<\/td>\n<\/tr>\n<tr>\n<td>\u00a0\u00a0\u00a0 16<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 K<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LED- BKL<\/td>\n<td>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Ground<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The Functions of LCD could be defined as bellow:<\/p>\n<ol>\n<li>Power Supply: the first two pins of LCD must be connected to +5V and 0V.<\/li>\n<li>Vo: the V0 pin is a contrast pin used to set the contrast of LCD using variable resistor (VR) about 10K in range 0-5V.<\/li>\n<li>Register Select (RS): the RS is a command pin for the LCD. The LCD command and RW operations are set by RS pin. The LCD consists of two registers i.e. the data and command register. When command writes on the LCD, the data register is used. When the data either read or write on the LCD, the command register is used. The selections of register are determined by the logic status of RS. If the logic state of RS is \u20181\u2019, the data register is selected. If the logic state of RS is \u20180\u2019, the command register is selected.<strong><br \/>\n<\/strong><\/li>\n<li>Enable: When the data send to data pins of LCD, the high to low pulse will be given.<\/li>\n<li>Data Pins (DB0-DB7)<strong>: <\/strong>The DB0-DB7 is data input\/output (I\/O) pins. The LCD is accepted the 8 bit data as a parallel form. The format of data stream is first bit must be LSB bit continue it the other bits are sent. The LCD supports only an ASCII value.<\/li>\n<li>LED Backlight: The pin no\u2019s 15 and 16 are allocated for LCD backlight. The supply of LED backlight is +5V and 0V. It makes a brightness of the LCD display. The LED backlight pins are denoted as (Anode (A), Cathode (K)) on the LCD.<\/li>\n<\/ol>\n<p>For summary, The LCD consists of 8-Data lines 0f DB0-DB7, RS- Register Select line, RW-Read Write line, and En- Enable line (See Fig. 3).<\/p>\n<p>The initialization to display characters to the LCD, First the LCD requires to send commands to initialize the display, Curser Position, Clear Display, increment curser etc. All this command are send to instruction Register. Instruction Register can be enabled by RS = \u20180\u2019, RW = \u20181\u2019, En= \u20181\u2019. The ASCII codes to command in the FPGA are shown in below,<\/p>\n<p>38 = Function Set: 8-bit, 2 Line, 5&#215;7 Dots<\/p>\n<p>0c = Display on Cursor off<\/p>\n<p>06 = Entry Mode<\/p>\n<p>01= Clear Display<\/p>\n<p>C0 = Place Curser to 2<sup>nd<\/sup> line<\/p>\n<p>After sending commands, Data can be transferred to Display in the LCD. For sending, Data enable and Data Register by sending RS= \u20191\u2019, RW= \u20181\u2019, En= \u20191\u2019.<\/p>\n<p>Data can be transferred in 2 ways 8-bit mode and 4-bit mode and for interfacing in 8-bit mode with the entire Data pin DB0-DB7.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-282\" src=\"http:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/FPGALCD-286x300.png\" alt=\"\" width=\"286\" height=\"300\" srcset=\"https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/FPGALCD-286x300.png 286w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/FPGALCD-105x110.png 105w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/FPGALCD-401x420.png 401w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/FPGALCD-410x430.png 410w, https:\/\/ferrywahyuwibowo.my.id\/wp-content\/uploads\/2018\/05\/FPGALCD.png 416w\" sizes=\"(max-width: 286px) 100vw, 286px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Fig. 3. Interfacing FPGA<\/strong><\/p>\n<p>For 16&#215;2 LCD VHDL code download, please click <a href=\"http:\/\/ferrywahyuwibowo.my.id\/index.php\/fpgavhdl-projects\/\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Liquid Crystal Display (LCD) is used to display the character that is represented as the American Standard Code for Information Interchange (ASCII) values. The ASCII values are 8-bit (0-7). The ASCII value can be shown in Fig. 1. Fig. 1. ASCII Code In this ASCII case, to make character &#8220;a&#8221; the number shall be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":290,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[33],"tags":[53,7,28,13,15,26,8],"_links":{"self":[{"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/posts\/274"}],"collection":[{"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":7,"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":291,"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/posts\/274\/revisions\/291"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/media\/290"}],"wp:attachment":[{"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ferrywahyuwibowo.my.id\/index.php\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}