16*2 Character LCD Interfacing with PIC Microcontroller in 8-bit Mode

///16*2 Character LCD Interfacing with PIC Microcontroller in 8-bit Mode
  • 16*2 Character LCD interfacing with PIC microcontroller in 8 bit mode

16*2 Character LCD Interfacing with PIC Microcontroller in 8-bit Mode

Here we are discussing various aspects of 16*2 Character LCD Interfacing with PIC Microcontroller in 8-bit Mode. A character LCD is the most basic form of an electronic display device which is widely used. The module will consist of 2 rows each with 16 columns which can display 16 characters. Already discuss LCD in4-bit mode in the chapter 4-bit LCD interfacing with pic microcontroller

Character LCD

Several other LCD modules are also available like 20×4 dimension LCD which can display 20 characters per line and 4 such lines would be available. The choice for the module depends on the requirement.

The main advantage of using a character LCD instead of a seven segment display and other multi-segment LEDs is that there is no limitation in displaying special & custom characters animations and so on. All character LCDs will have 16 pins among which 8 are data pins through which data or commands are passed into the LCD registers. A character LCD can be configured in 8 bit or 4-bit mode in which 8 data pins and 4 data pins are used respectively. This feature allows efficient use of the digital I/0 pins of the microcontroller.

lcd-charector

Features

The features of a character LCD module make it more suitable as an electronic display than 7 segment displays and other multi-segment display modules. Most importantly the module can be interfaced much easily unlike other modules with no complexity in both hardware and software. The 4-bit mode interfacing of the LCD module enables an efficient method of saving the number of general purposes I/O pins which is a major criterion for an embedded system designer. There is no limitation in characters which can be displayed using the module. The contrast of the module can be adjusted using the VEE pin of the module and LED backlight which makes the display more bright can be enabled with LED+ and LED- pin.

Register

A Character LCD consists of two registers

  1. Command register
  2. Data register

The RS (Register Select) pin of the LCD module is used to select the specific register. When RS is low, the command register is selected and when RS is high, data register is selected. State of R/W pin determines the operation to be performed whether to read or write data.

All instructions to be executed by the LCD are latched into the command register of the LCD. LCD commands include a clear display, the cursor on/off, display shift and so on.

Character to be displayed on the LCD is stored in the data register. The data is stored temporarily in the data register.

Commands

Commands are instructions given to the LCD module to perform a predefined task. The task to be performed is defined by the manufacturer. Some of the LCD commands are listed below.

  1. Clear display – 0x01
  2. Display on, cursor off – 0x0C
  3. Increment cursor – 0x04

The rest of the commands can be obtained from the device datasheet.

Sending the commands

The register select pin of the LCD module should be connected to a general purpose I/O pin and the corresponding pin should be made low. R/W pin should be grounded to select the write operation. The command register will not be accessed.
Enabling the LCD would latch in the value of the data port into the command register of the module. Enabling the module involves applying a high to low pulse to the Enable pin of LCD.

Example firmware:

RS, R/W, Data_PORT, and Enable_pin should be macro defined in the firmware.

Example:

Sending data

Data write operation involves the similar steps as that of a command write operation except data register should be selected by setting the RS pin and grounding the R/W pin. Enabling the module would then latch in the value in the data port to the data register of the module and corresponding character will be displayed on the LCD module.

lcd-wave-form-read

Example firmware:

RS, R/W, Data_PORT, Enable_pin should be macro defined in the firmware.

Initializing The LCD

First of all, it needs to be initialized before writing data into the character LCD. The initialization is done to configure the module for the specific use. It involves writing some initialization commands into the command register. Some of the initialization commands include a command to turn the display on and cursor off, the command to set cursor at the preferred position and the command to set the option for cursor increment or decrement and so on.
Ex:

The user can also display custom characters on LCD. More Details of displaying of custom character on LCD is specified in the Chapter Display Custom Character on 16*2 LCD using PIC microcontroller

16*2 Character LCD Interfacing with PIC Microcontroller 8-bit Mode- Circuit diagram

Character LCD Interfacing with PIC Microcontroller - circuit

Character LCD Interfacing with PIC Microcontroller – Circuit

DON’T MISS OUT UPDATES!
Be the first to get latest updates and exclusive content straight to your email inbox.
Stay Updated
Subscribe, it is quick.
We hate spam too. Give it a try, you can unsubscribe anytime.
Spread the love, share this

Leave A Comment

DON’T MISS OUT UPDATES!
Be the first to get latest updates and exclusive content straight to your email inbox.
Stay Updated
Subscribe, it is quick.
We hate spam too. Give it a try, you can unsubscribe anytime.
close-link
25% OFF - OpenLabPro Course
Use Coupon: CRS25UL

 
PIC Microcontroller Primer
Want to learn indepth programming, peripheral interfacing and driver development?
close-link
Launched: IoT online Course - 25% Off when you complete your order today.
Checkout Now
close-image

Subscribe To our Email Newsletter

Be the first to get latest updates and exclusive content straight to your email inbox.
Send me Tutorials and Guides
close-link