Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

LCD interface in 4bit mode with LPC1768- (Part 5/21)

By Prabakaran P.M December 19, 2021

Interfacing of 5V LCD with a 3.3V Controller like LPC1768 is little tricky to handle. This is the Article to explain how a 16x2 LCD is interfaced with LPC1768 in 4-bit mode. LCD in 4 bit, which means we are going to use 4 lines instead of 8 line which save 4 GPIOs which can be used for other purposes. For setting up the Environment for the development of ARM cortex M3 is well discussed in this article.

The LPC 1768 is ARM Cortex- M3 based Microcontrollers for embedded application features in low power consumption and a high level of integration. The ARM Cortex M3 is designed in a such way to enhance debug features and a higher level of system integration. It clocks at a CPU frequency of 100 MHz, and incorporates a 3-stage pipeline and uses a Harvard architecture with separate local instruction and data buses for third bus peripherals. The ARM Cortex- M3 CPU have an internal pre-fetch unit to support speculative branching. The peripheral components include 512KB of flash memory, 64kb of data memory, Ethernet MAC, USB OTG, 4 UART’s, 8-channel general purpose DMA controller, 2 SSP Controllers, 10-bit DAC, Quadrature encoder interface, SPI interface, 3 I2C bus interface, 2 input plus 2 outputs I2S bus interface, 4 general purpose timers, ultra-low power Real-Time Clock (RTC) with separate battery supply, and up to 70 general purpose I/O pins, 6-output general purpose PWM. The LPC1768/66/65/64 are pin-compatible with the 100-pin LPC236x ARM7-based Microcontroller series.


16X2 LCD Basics:

The Chinese LCD used here is JHD162A. It has a KS0066U/ HD44780U controller. It has a 16 pin interface device which consists of 2 rows with 16 characters each. The operating voltage is 5V. Also, it has an LED backlight. There are 2 modes of operation:

1) Instruction Mode: To initialize and configure the LCD before its use

2) Data Mode: Displays the characters for the respective codes that are given to the LCD via Data Pins.

LCD Pin Description:

Pin No

Symbol

I/O

Description

1

VSS

–

Ground

2

VCC

+5V

3

VEE

Contrast Control

4

RS

Input

Command/Data Register

5

R/W

Input

Read/Write Register

6

E

Input/Output

Enable

7

DB0

Input/Output

Not Used in 4-Bit Mode

8

DB1

Input/Output

Not Used in 4-Bit Mode

9

DB2

Input/Output

Not Used in 4-Bit Mode

10

DB3

Input/Output

Not Used in 4-Bit Mode

11

DB4

Input/Output

Data Bus in 4-Bit Mode

12

DB5

Input/Output

Data Bus in 4-Bit Mode

13

DB6

Input/Output

Data Bus in 4-Bit Mode

14

DB7

Input/Output

Data Bus in 4-Bit Mode

15

VCC

–

For LCD Back Light

16

VSS

–

For LCD Back Light

Fig. 1: Pin Description of LCD

Initializing LCD Module:

Once you have verified all the connections from MCU to HFC4050 to LCD Module, we can go ahead to display text on the LCD. But first, the LCD needs to be initialized properly. (According to the Datasheet) Before initializing the LCD, you will need to wait for a minimum time of about 15 milliseconds after the input voltage supply is stable and greater than 4.5 Volts.

The first step is to make sure that the RS and Enable are held LOW. Next is to input some commands to the LCD using the Data pins. These commands will not be executed until a pulse is supplied to the Enable pin. After supplying the command with a pulse, Enable has to be made High and then Low after a short delay. Then, the command is executed.

The LCD can be configured in 4-bit mode by sending the appropriate command which is called “Function set” to it. The Function set is a hexadecimal command of the LCD MPU unit, which selects working modes of the LCD. The “Function Set” is mentioned in following table:

Function Set Of LCD To Configure In 4bit Mode

Fig. 2: Function Set Of LCD To Configure In 4bit Mode

Description: 

DL – Data Length (DL = 1 8bit, DL = 0 4bit)

N – No. of Lines (N = 1 2Lines, N = 0 1Lines)

F – Fonts (F = 1 5×10 dots, F = 0 5×7 dots)

According to the table, the value of Function Set for 4 –bit mode will be 0010 0000(0x20) because DL=0. The value “Function Set” for the LCD configuration 2 line (N=1), 5X7 dots (F=0) and 4-bit (DL=0) mode will be 0010 1000(0x28).

When the power supply is given to the LCD, it remains in 8-bit mode. Now, if 0x20 is sent, lower nibble will not be received by LCD because four data lines (D4-D7) are connected, so 0x02 is sent instead of 0x20. For more details about the LCD interfacing refer these Links.

How to interface LCD in 4 bit mode with AVR microcontroller.

How to interface LCD with LPC2148.

Create a project using Keil uvision4 for LPC1768 Microcontroller:

In this section, we will start creating a project in Keil MDK we have already installed Keil µVision and Co-MDK Plug-in + CoLinkEx Drivers required for the CoLinkEx programming adapter. You can start by downloading the project files and kick start your practical experiment.

Code.rar

Code Description:

These functions explained are included by making a LCD library and included in the coding files.

The below function is to send command bytes to the LCD:

Lcd_CmdWrite ()

The below function is to send Data bytes to the LCD:

Lcd_DataWrite ()

 

Initialization of 4-bit mode:

    Lcd_CmdWrite(0x02);                // Initialize LCD in 4-bit mode

    Lcd_CmdWrite(0x28);                // enable 5×7 mode for chars

    Lcd_CmdWrite(0x0E);                // Display OFF, Cursor ON

    Lcd_CmdWrite(0x01);                // Clear Display

    Lcd_CmdWrite(0x80);                // Move the cursor to beginning of the first line

You may also like:


  • What are EMS/EMC immunity lab tests?

  • What are the top development boards for AI and ML?

  • What are LoRa gateways and what types are available?

  • What types of motors are used in electric vehicles?

  • What are the top open-source software systems for home automation?

  • What is MicroPython?

Project Source Code

###
 
The codes are linked in Description ###

Circuit Diagrams

Circuit-Diagram-of-LCD-interface-in-4bit-mode-with-LPC1768

Project Components

  • LCD
  • LED
  • Resistor

Project Video


Filed Under: ARM, Tutorials

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • High Side current sensing
  • How to simulate power electronics converter in PSpice?
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe