0% found this document useful (0 votes)
4 views

CAM PROJECT REPORT1

This document presents a project on interfacing a Liquid Crystal Display (LCD) with the 8051 microcontroller, detailing the necessary components, programming techniques, and practical applications. It includes an embedded C program that monitors a switch's status and displays corresponding messages ('NO' or 'YES') on the LCD. The project aims to enhance user interaction and visual feedback in embedded systems through effective LCD integration.

Uploaded by

Malavika R Nair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

CAM PROJECT REPORT1

This document presents a project on interfacing a Liquid Crystal Display (LCD) with the 8051 microcontroller, detailing the necessary components, programming techniques, and practical applications. It includes an embedded C program that monitors a switch's status and displays corresponding messages ('NO' or 'YES') on the LCD. The project aims to enhance user interaction and visual feedback in embedded systems through effective LCD integration.

Uploaded by

Malavika R Nair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

College of Engineering

Cherthala

PROJECT
ON
LCD INTERFACING

Under the guidance of :

Laghima PM

Professor , ECE department

College of Engineering Cherthala

Made by,

Akash A A - 6
Bhagavath S - 8

Malavika R Nair -17

PROJECT TITLE

Assume a switch is connected to a port pin. Write


an embedded C program for 8051 microcontroller
to monitor its status and send two messages to
LCD continuously as follows: SW=0 send “NO”,
SW=1 send “YES”.
TABLE OF CONTENTS

 ABSTRACT
 INTRODUCTION
 COMPONENTS REQUIRED
 PROCESS OF WORKING
 APPLICATION
 CONCLUSION
ABSTRACT

This project focuses on the interfacing of a Liquid


Crystal Display (LCD) with 8051 microcontrollers,
providing a step-by-step guide for successfully
integrating these two components. The aim is to
enable developers to create effective visual
displays and user interfaces for their 8051-based
projects.
The project also delves into the software aspect
of LCD interfacing with 8051 microcontrollers. It
explores the programming techniques using
assembly language or C language to initialize the
LCD, configure display settings, and send
commands or data to display information. Key
functionalities, such as displaying text, numbers,
and symbols, as well as scrolling and cursor
control, are demonstrated through practical
examples and code snippets.
This project equips individuals with the necessary
knowledge and skills to create engaging and
informative displays using LCDs and 8051
microcontrollers.

INTRODUCTION

Microcontrollers have revolutionized the field of


embedded systems by providing compact and
cost-effective solutions for a wide range of
applications. In many embedded projects, the
need for visual feedback and interaction with
users is crucial. Liquid Crystal Displays (LCDs)
have emerged as a popular choice for displaying
information due to their low power consumption,
compact size, and ease of integration. In this
project, we explore the interfacing of an LCD with
8051 microcontrollers, aiming to enable
developers to create effective visual displays and
user interfaces.
This project aims to equip developers with the
necessary knowledge and practical skills to
successfully interface an LCD with 8051
microcontrollers. By mastering the principles,
hardware connections, and software
programming involved, developers will be able to
enhance the functionality and user interaction of
their projects by integrating visually appealing
and informative displays.

COMPONENTS REQUIRED
 Keil Microvision 5
 LCD
 Connecting Wires
 Nuvoton Microcontroller
KEIL MICROVISION 5

Keil µVision 5 is an integrated development


environment (IDE) specifically designed for embedded
systems development. It is developed by Arm and
widely used in the industry for programming
microcontrollers. Keil µVision provides a comprehensive
set of tools, including a powerful editor, compiler,
debugger, and simulator, to facilitate the development
process.

LCD

LCD, or Liquid Crystal Display, is a type of flat panel


display technology that uses liquid crystals to produce
visual output. It is widely used in a variety of electronic
devices, including televisions, computer monitors,
smartphones, and embedded systems.

CONNECTING WIRES

Used to connect between two sources

NUVOTON MICROCONTROLLER

Nuvoton Technology Corporation is a semiconductor


company specializing in the design and manufacturing
of microcontrollers, microprocessors, and other
integrated circuits. Nuvoton microcontrollers, also
known as Nuvoton MCUs, are widely used in various
applications ranging from consumer electronics to
industrial automation

PROCESS OF WORKING
Display units are the most important output devices in
embedded projects and electronics products. 16x2 LCD
is one of the most used display unit. 16x2 LCD means
that there are two rows in which 16 characters can be
displayed per line, and each character takes 5X7
matrixspace on LCD. In this tutorial we are going to
connect 16X2 LCD module to the 8051microcontroller

PIN DISCRIPTION
RS: RS is the register select pin. We need to set it to 1,
if we are sending some data to be displayed on LCD.
And we will set it to 0 if we are sending some command
instruction like clear the screen.
RW: This is Read/write pin , we will set it to 0, if we are
going to write some data on LCD. And set it to 1, if we
are reading from LCD module. Generally this is set to 0,
because we do not have need to read data from LCD.
Only one instruction “Get LCD status”, need to be read
some times.
E: This pin is used to enable the module when a high to
low pulse is given to it. A pulse of 450 ns should be
given. That transition from HIGH to LOW makes the
module ENABLE.

There are some preset command instructions in LCD,


we have used them in our program below to prepare
the LCD (in lcd_init() function). Some important
command instructions are given below:
CODE

#include <reg51.h>;
#define LCD_DATA P2
sbit RS = P3^0; // Register select pin
sbit EN = P3^1; // Enable pin
sbit SW_PIN = P1^0; // Switch pin

void delay(unsigned int ms)


{
unsigned int i, j;
for (i = 0; i<ms; i++)
for (j = 0; j <112; j++); // Delay loop (adjust as
needed)
}

void LCD_Command(unsigned char cmd)


{
RS = 0; // Select command register
LCD_DATA = cmd; // Send command to data pins
EN = 1; // Enable high
delay(5); // Delay for EN high pulse width
EN = 0; // Enable low
delay(5); // Delay for EN low pulse width
}

void LCD_Data(unsigned char dat)


{
RS = 1; // Select data register
LCD_DATA = dat; // Send data to data pins
EN = 1; // Enable high
delay(5); // Delay for EN high pulse width
EN = 0; // Enable low
delay(5); // Delay for EN low pulse width
}
void LCD_Init()
{
LCD_Command(0x38); // 2 lines, 5x7 matrix
LCD_Command(0x0C); // Display on, cursor off
LCD_Command(0x01); // Clear display
LCD_Command(0x80); // Move cursor to line 1, position 1
}

void LCD_WriteString(char *str)


{
while (*str)
{
LCD_Data(*str++);
}
}

void main()
{
LCD_Init(); // Initialize LCD
while (1)
{
if (SW_PIN == 0)
{
LCD_Command(0x01); // Clear display
LCD_Command(0x80);// Move cursor to line1
LCD_WriteString(“NO”);

}
else if (SW_PIN == 1)
{
LCD_Command(0x01); // Clear display
LCD_Command(0x80); // Move cursor to line 1
LCD_WriteString(“YES”);
}
delay(100); // Delay between updates
}
}

CODE EXPLANATION

In this program, the switch is connected to P1^0 pin of the


8051 microcontroller. The LCD is connected to the 8051
microcontrollers Port 2 (P2) data pins, and the control pins RS
and EN are connected to P3^0 and P3^1, respectively.
The LCD_Init() function initializes the LCD by sending the
required commands to set it up. The LCD_Command() function
sends commands to the LCD, while LCD_Data() sends data. The
LCD_WriteString() function writes a string of characters to the
LCD.

In the main loop, the program continuously checks the status of


the switch using
SW_PIN. If the switch is pressed (SW_PIN is low), it clears the
display, moves the cursor to line 1, position 1, and writes “NO”;
to the LCD. If the switch is released (SW_PIN is high), it clear
the display, moves the cursor to line 1, position 1, and writes
“YES”; to the LCD.
APPLICATION
The application of LCD interfacing with a switch can be found in
various electronic systems where user input needs to be
displayed on an LCD screen. Some common applications
include:

1. Keypad Input: When a switch is used as part of a keypad, the


user can input numbers, letters, or other characters by pressing
different switches. The microcontroller reads the state of the
switches and displays the corresponding input on the LCD.

2. Menu Navigation: In systems with a menu-based user


interface, switches can be used to navigate through different
options or menu items. The LCD displays the current menu
selection, and the user can use the switches to move up, down,
left, or right within the menu.

3. Control Panels: LCDs with switches are often used in control


panels for various devices such as home automation systems,
industrial control systems, or consumer electronics. The
switches can be used to input commands or adjust settings,
while the LCD displays relevant information or status updates.

4. Security Systems: In security systems like access control or


alarm systems, switches can be used to input passwords, arm
or disarm the system, or trigger specific actions. The LCD can
display prompts, status information, or confirmation messages.

5. Data Entry: In applications where data entry is required, such


as in measurement devices or data loggers, switches can be
used to input numeric values, timestamps, or other relevant
data. The LCD provides a visual interface for displaying the
entered data.

6. Game Controllers: In gaming systems or handheld consoles,


switches can be used as buttons or controls for player
interaction. The LCD can display game information, scores, or
character statuses.
CONCLUSION

In conclusion, interfacing an LCD with the 8051


microcontroller provides a user-friendly way to
display information and interact with a system. It
offers enhanced user interaction, information
display capabilities, versatility, and cost-
effectiveness. However, limitations such as
display size, memory usage, and timing
synchronization should be considered. Overall,
LCD interfacing with the 8051 microcontroller is a
popular and effective method for incorporating
visual feedback and user interaction in
embedded systems.

You might also like