SlideShare a Scribd company logo
https://www.facebook.com/groups/embedded.system.KS/
Embedded System
PART 3ENG.KEROLES SHENOUDA
1
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Index (2)
 Previous Projects Solution
 LCD
 LCD Driver
 KeyPAD
 KeyPad Driver
2
https://www.facebook.com/groups/embedded.system.KS/
Previous Projects
Solution
3
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
DIO_Project2
Seven Segment Digital Clock
without Timer Module
4
https://github.com/keroles/Embedd
ed_System/tree/master/Embedded_
System/Projects_solutiones/new_di
ploma/clock_6_digits_without_Tim
er_Module
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
GPIO Project 3
Assignment
Microcontroller
session
Write code to make the following
functionality:
5
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
https://github.com/keroles/Embedded_System/tree/master/Embedded_Syst
em/Projects_solutiones/new_diploma/security%20system
6
https://www.facebook.com/groups/embedded.system.KS/
New Content
7
https://www.facebook.com/groups/embedded.system.KS/
LCD (Liquid Crystal
Display)
8
https://www.facebook.com/groups/embedded.system.KS/
Interfacing an 16×2 character LCD (Liquid Crystal
Display)
 LCD stands for liquid crystal display. Now
earlier we used to use 7 segment displays for
display purposes, but now LCD’s are preferred.
The main reason is we need less number of
data bus lines for interfacing LCD’s as
compared to 7 segment displays.
 Other reason is we can print various characters
on the screen.
 Now the basic characters are already saved
inside CGROM(Character Generator ROM).
So you need to send only the ASCII values
in order to display the character on screen
 16×2 LCD means It has 2 rows and 16 columns
9
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
LCD interfacing
10
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
LCD interfacing
 a VDD pin for 5 volts
 a VSS pin for ground.
 V0 pin for the adjustment of the LCD contrast.
 Some LCDs even have an LED backlight and are generally the last two
pins.
 the LCD has a row of 8 pins to serve as its port. D0, D1, D2, D3, D4, D5, D6
and D7. These pins are generally used to pass information into the LCD,
but it can also be set to pass information back to the microcontroller
 read/write is microcontroller centric: the LCD "read" mode is the process
of passing information from the LCD to the microcontroller
(microcontroller port set as input or reading or listening).; the LCD
"write" mode is passing information from the microcontroller to the LCD
(microcontroller set to output or writing).
 The pin on the LCD that is responsible for whether the information sent is
a character or a control, is the RS pin (Register Select)
 the pin that helps the LCD accept information is called the EN pin (Enable)
11
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Block Diagram
12
 There are three memories in LCD
to manipulate display characters:
 CGROM – character generating
ROM which is responsible for
stored standard character patter
n.
 CGRAM – character generating
RAM which holds custom
character pattern space ( total 8
in 2×16 module).
 DDRAM – data display RAM
which stores ASCII codes.
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
LCD Functionality
13
(1) to make sure the LCD
is not busy
(2) Control the LCD's
cursor, or display
function
(3) Write a character to
the LCD for it to display
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
LCD Functionality
14
(1) to make sure the LCD is not busy
a. set the port to receive data on the
microcontroller (Data direction as input).
b. put the LCD in read mode (RW on).
c. put the LCD in command mode (RS off).
And the port now magically contains the data
from the LCD (D7 pin will be ON if the LCD is
busy and OFF if the LCD is not busy).
(2) Control the LCD's
cursor, or display
function
(3) Write a character to
the LCD for it to display
Microcontroller
If Data 7 is 1 (LCD Busy)
If zero (LCD not Busy)
Read Command
RW ON
RS OFF
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
LCD Functionality
15
(1) to make sure the LCD
is not busy(2) Control the LCD's cursor, or display function
(Send a command to the LCD)
• set the port direction as output so you can send
information to the LCD.
• turn RW off so you can write.
• turn RS off for command mode.
• Write the command on D0…D7
• turn on the enable and then turn it off.(delay ~500ns)
The LCD will magically perform the command.
(3) Write a character to
the LCD for it to display
Microcontroller
Write Command
RW off
RS OFF
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
LCD Functionality
16
(1) to make sure the LCD
is not busy
(2) Control the LCD's
cursor, or display
function
• (3) Write a character to the LCD for it to display
Send a character to the LCD: This is the same as sending
a command except the RS is on and the port will equal
the character corresponding to the ASCII code.
• set the port direction as output so you can send
information to the LCD.
• turn RW off so you can write.
• turn RS ON for Data mode.
• Write the command on D0…D7
• turn on the enable and then turn it off.(delay ~500ns)
Microcontroller
Write character
RW off
RS ON
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
16×2 lcd commands
COMMAND FUNCTION
17
0x80 Force cursor to
beginning of the first
line
0xC0 Force cursor to
beginning of second line
0x38 Use two lines and 5x7
matrix
0x83 Cursor line 1 position 3
0x3C Activate second line
0xC3 Jump to second line
position 3
0xC1 Jump to second line
position1
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
16×2 lcd commands 18
Instruction Hex
Function Set: 8-bit, 1 Line, 5x7 Dots 0x30
Function Set: 8-bit, 2 Line, 5x7 Dots 0x38
Function Set: 4-bit, 1 Line, 5x7 Dots 0x20
Function Set: 4-bit, 2 Line, 5x7 Dots 0x28
Entry Mode 0x06
Display off Cursor off
(clearing display without clearing DDRAM content)
0x08
Display on Cursor on 0x0E
Display on Cursor off 0x0C
Display on Cursor blinking 0x0F
Shift entire display left 0x18
Shift entire display right 0x1C
Move cursor left by one character 0x10
Move cursor right by one character 0x14
Clear Display (also clear DDRAM content) 0x01
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
LAB: write LCD Driver [8bit] Data
mode
19
Test your driver by print your name and an
integer number then double number
https://www.facebook.com/groups/embedded.system.KS/
LCD Driver
20
focus
with me
https://github.com/keroles/Embedded_System/tree/master/A
tmega32_Drivers/ATMEGA32_Drivers/lcd
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Solution:LCD 21
Configure
4Mode
Or 8Mode
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
22
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
23
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
24
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
25
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
26
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
27
Interview question
How to display in lcd real number
got by ADC?
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
28
https://www.facebook.com/groups/embedded.system.KS/
Keypad 4*4
30
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
keypad
 keypad is multiplexed keys. Buttons are connected in a multiplexed form for reducing the pin usage of control system.
 Consider we have a 4x4 keypad, in this keypad we have 16 buttons, in normal cases we need 16 controller pins to interface
16 buttons, but this is not good in control system point of view. This pin usage can be reduced by connecting the buttons in
multiplex form.
 For example consider we have 16 buttons and we want to attach it to a controller to form a keypad, these keys are arranged
as shown
31
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
keypad
 Here we have connected 16 keys in a multiplexed form so to
reduce the pin usage of controller. When compared to the first
case of connected 16 keys we needed 16pins on controller but
now after multiplexing we need simply 8 pins of controller to
connect 16 keys.
 Normally this is what presented inside a keypad:
32
8 pins
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
KeyPad
 The keypad here has four columns and four rows, for identification of button
pressed, we are going to use cross reference method. Here first we are going to either
connect all columns or all rows to vcc, so if rows are connected to common vcc, we
are going to take the columns as inputs to controller.
33
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
34
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Multiplexing
35
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Multiplexing
36
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Multiplexing
37
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
Multiplexing
38
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
39
Still pressed
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
40
Once released
https://www.facebook.com/groups/embedded.system.KS/
KeyPad Driver
41
https://github.com/keroles/Embedded_System/tree/master/A
tmega32_Drivers/ATMEGA32_Drivers/keypad
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
42
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
43
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
44
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
45
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
46
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
47
https://www.facebook.com/groups/embedded.system.KS/
Lab:
Create a
Calculator
on
ATmega32
48
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
References
 https://www.newbiehack.com/MicrocontrollersABeginnersGuideIntroductiona
ndInterfacinganLCD.aspx
 http://www.slideshare.net/MathivananNatarajan/asynchronous-serial-data-
communication-and-standards
 4x4 Keypad Interfacing with ATmega32 Microcontroller
49
https://www.facebook.com/groups/embedded.system.KS/https://www.facebook.com/groups/embedded.system.KS/
50

More Related Content

PDF
Microcontroller part 2
PDF
Microcontroller part 4
PDF
Microcontroller part 9_v1
PDF
Microcontroller part 7_v1
PDF
Microcontroller part 1
PDF
Microcontroller part 5
PDF
Microcontroller part 8_v1
PDF
Automotive embedded systems part6 v2
Microcontroller part 2
Microcontroller part 4
Microcontroller part 9_v1
Microcontroller part 7_v1
Microcontroller part 1
Microcontroller part 5
Microcontroller part 8_v1
Automotive embedded systems part6 v2

What's hot (20)

PDF
Microcontroller part 6_v1
PDF
Automotive embedded systems part6 v1
PDF
Microcontroller part 1
PDF
Automotive embedded systems part8 v1
PPTX
Embedded C programming session10
PDF
Automotive embedded systems part5 v2
PDF
Automative basics v3
PDF
Automotive embedded systems part4 v1
PDF
Automotive embedded systems part2 v1
PDF
Automotive embedded systems part7 v1
PDF
Automotive embedded systems part1 v1
PDF
C programming session9 -
PPT
CLP S7 300 E S7 400
PDF
PDF
Manual micrologix 1100
PPT
operating and configuring cisco a cisco IOS device
PPT
Cis81 ccna1v5-2-configuring networkoperatingsystem
PDF
Smart pos stepbystep-v2-0
PDF
Instructions for Use of the Renesas C Compiler for the Robo Interface
Microcontroller part 6_v1
Automotive embedded systems part6 v1
Microcontroller part 1
Automotive embedded systems part8 v1
Embedded C programming session10
Automotive embedded systems part5 v2
Automative basics v3
Automotive embedded systems part4 v1
Automotive embedded systems part2 v1
Automotive embedded systems part7 v1
Automotive embedded systems part1 v1
C programming session9 -
CLP S7 300 E S7 400
Manual micrologix 1100
operating and configuring cisco a cisco IOS device
Cis81 ccna1v5-2-configuring networkoperatingsystem
Smart pos stepbystep-v2-0
Instructions for Use of the Renesas C Compiler for the Robo Interface
Ad

Viewers also liked (17)

PDF
C programming part2
PDF
C programming part2
PDF
C programming session6
PDF
C programming first_session
PDF
PDF
C programming session8
PDF
C programming session10
PDF
Microcontroller part 3
PDF
C programming first_session
PDF
C programming session7
PDF
C programming part2
PDF
C programming session8
PDF
K vector embedded_linux_workshop
PDF
Microcontroller part 4
PDF
C programming session3
PDF
C programming part4
PDF
Microcontroller part 2
C programming part2
C programming part2
C programming session6
C programming first_session
C programming session8
C programming session10
Microcontroller part 3
C programming first_session
C programming session7
C programming part2
C programming session8
K vector embedded_linux_workshop
Microcontroller part 4
C programming session3
C programming part4
Microcontroller part 2
Ad

Similar to Microcontroller part 3 (20)

PDF
Lcd tutorial for interfacing with microcontrollers basics of alphanumeric lc...
PDF
Expanding The Micro Blaze System
PDF
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
PPTX
Starting Raspberry Pi
PPT
Introduction to Blackfin BF532 DSP
PDF
My First 100 days with an Exadata (PPT)
PPTX
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
PDF
Tft touch screen manufacturers
PPT
Christchurch Embedded .NET User Group - Introduction to Microsoft Embedded pl...
PDF
CREST CCT Lab Prep Notes
PDF
Rodrigo Almeida - Microkernel development from project to implementation
PDF
D0364017024
PDF
Experiences with Oracle SPARC S7-2 Server
ODP
Android crash debugging
PDF
825s72 a
PDF
ROCm and Distributed Deep Learning on Spark and TensorFlow
DOCX
Comp 129 final exam 100% correct answers
PDF
VJITSk 6713 user manual
PPTX
Making a Process (Virtualizing Memory)
DOCX
Comp 129 final exam 100% correct answers
Lcd tutorial for interfacing with microcontrollers basics of alphanumeric lc...
Expanding The Micro Blaze System
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
Starting Raspberry Pi
Introduction to Blackfin BF532 DSP
My First 100 days with an Exadata (PPT)
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
Tft touch screen manufacturers
Christchurch Embedded .NET User Group - Introduction to Microsoft Embedded pl...
CREST CCT Lab Prep Notes
Rodrigo Almeida - Microkernel development from project to implementation
D0364017024
Experiences with Oracle SPARC S7-2 Server
Android crash debugging
825s72 a
ROCm and Distributed Deep Learning on Spark and TensorFlow
Comp 129 final exam 100% correct answers
VJITSk 6713 user manual
Making a Process (Virtualizing Memory)
Comp 129 final exam 100% correct answers

More from Keroles karam khalil (17)

PDF
C basics quiz part 1_solution
PDF
Autosar Basics hand book_v1
PDF
Automotive embedded systems part5 v1
PDF
Automotive embedded systems part3 v1
DOCX
PDF
Homework 5 solution
PDF
PDF
PDF
C programming session7
PDF
PDF
Homework 4 solution
PDF
PDF
PDF
Homework 3 solution
PDF
C programming session5
C basics quiz part 1_solution
Autosar Basics hand book_v1
Automotive embedded systems part5 v1
Automotive embedded systems part3 v1
Homework 5 solution
C programming session7
Homework 4 solution
Homework 3 solution
C programming session5

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
OOP with Java - Java Introduction (Basics)
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
web development for engineering and engineering
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Welding lecture in detail for understanding
PPT
Project quality management in manufacturing
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
composite construction of structures.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
DOCX
573137875-Attendance-Management-System-original
R24 SURVEYING LAB MANUAL for civil enggi
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
OOP with Java - Java Introduction (Basics)
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
web development for engineering and engineering
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Welding lecture in detail for understanding
Project quality management in manufacturing
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
composite construction of structures.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Model Code of Practice - Construction Work - 21102022 .pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
additive manufacturing of ss316l using mig welding
bas. eng. economics group 4 presentation 1.pptx
UNIT 4 Total Quality Management .pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Internet of Things (IOT) - A guide to understanding
573137875-Attendance-Management-System-original

Microcontroller part 3