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

04 Input and Output Device Interfacing

I/O devices like switches, LEDs, LCDs and 7-segment displays require interface chips to synchronize data transfer between the CPU and devices. Interface chips connect the device data pins to the CPU data bus and I/O port pins. Common interfacing techniques include reading switch states through I/O ports, driving LEDs and displays by outputting logic levels, and using LCD controller registers and timing to send commands and display data.

Uploaded by

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

04 Input and Output Device Interfacing

I/O devices like switches, LEDs, LCDs and 7-segment displays require interface chips to synchronize data transfer between the CPU and devices. Interface chips connect the device data pins to the CPU data bus and I/O port pins. Common interfacing techniques include reading switch states through I/O ports, driving LEDs and displays by outputting logic levels, and using LCD controller registers and timing to send commands and display data.

Uploaded by

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

Input devices

• Keypad
• Switch

I/O device Interfacing


Output devices
• LEDs
• 7 SEG Display
• LCD

I/O device Interfacing


I/O devices (Peripherals)
• Examples: switches, LED, LCD, printers, keyboard,
keypad
• Interface chips
• are needed to resolve the speed problem
• synchronizes data transfer between CPU and I/O device
• Connection of Interface and CPU
• Data pins are connected to CPU data bus
• I/O port pins are connected to I/O device
• CPU may be connected to multiple interface
• IO ports are simplest interface
Switch On I/O Ports

• Case-1:
• Gives a logic 0 on switch close
• Current is 0.5ma on switch close

• Case-2:
• Gives a logic 1 on switch close
• High current on switch close
• Case-3:
• Can damage port if 0 is output

I/O device Interfacing


Simple input devices
• DIP switches usually have 8 switches
• Use the case-1 from previous page
• Sequence of instructions to read is:

I/O device Interfacing


Bouncing contacts
• Contact:
• Push-button switches
• Toggle switches
• Electromechanical relays
• Make and break Contact normally open switch
• The effect is called "contact bounce" or, in a switch,
"switch bounce”.

• If used as edge-triggered input (as INT0), several


interrupt is accorded

I/O device Interfacing


Hardware Solution
• An RC time constant to suppress the bounce
• The time constant has to be larger than the switch bounce

Vcc

OUT
Software Solution

• Read the new state of switch N time

• Wait-and-see technique
• When the input drops
• an “appropriate” delay is executed (10 ms)
• then the value of the line is checked again to make sure the
line has stopped bouncing

I/O device Interfacing


Interfacing a Keypad
16 keys arranged as a 4X4 matrix
• Place a 0 on R0 port
• Read C port
• If there is a 0 bit F E D C
then the button R1
at the column/row B A 9 8 R2
R3
intersection has R4
7 6 5 4
been pressed.
• Otherwise, try next row 3 2 1 0

• Repeat constantly C1
C2
C3
C4

I/O device Interfacing


Simple output devices
• Case-1
• LED is ON if output=zero
• Most LEDs drop 1.7 volts and need about 10ma
• Current is (5-1.7)/470
• Case-2
• Too much current
• Failure of Port or LED
• Case-3
• Not enough drive (1ma)
• LED is too dim

I/O device Interfacing


The 7-Segment Display

• 7 LEDs arranged to form the number 8.


• By turning on and off (LEDs), different combinations can
be produced.
• useful for displaying the digits 0 through 9, and some
characters.

I/O device Interfacing


The 7-segment Display (Cont.)

• 7-segment displays come in 2 configurations:

Common Anode Common Cathode


Connect cathode to the output Connect cathode to the output

• Therefore, the common anode variety would be better


for our interfacing needs.

I/O device Interfacing


Interfacing a 7-segment display
• Two ways
• Connecting the 7 data lines to the microcontroller pin
• Using a decoder – (4-8 decoder ) e.g. 7447
• Common cathode – requires a 1 to light LED and 0 to switch off –
Active high
• Common anode – requires a 0 to light and 1 to switch off- Active
Low

I/O device Interfacing


Connecting using a decoder

I/O device Interfacing


BCD to 7_Seg lookup table
BCD pgfedcba he
7_seg x
0000 001111 11 3f
0001 00110000 30
0010 0101101 1 5b
0011 010011 11 4f
0100 011001 10 66
0101 01101101 6d
0110 01111101 7d
0111 00000111 07
1000 01111111 7f
1001 01101111 6f
a a a a a a a a
f b f b b f b f f b f b f b
g g g g g g g
e c e e c c c e c c e c c
d d d d d d d
LCD Interfacing
• Liquid Crystal Displays (LCDs)
• Cheap and easy way to display text
• Various configurations (1 line by 20 X char up to 8 lines X 80)
• Integrated controller
• The display has two register
• command register
• data register

• By RS you can select register


• Data lines (DB7-DB0) used to transfer data and commands

I/O device Interfacing


Alphanumeric LCD Interfacing

• Pinout
• 8 data pins D7:D0
• RS: Data or Command
Register Select
• R/W: Read or Write
• E: Enable (Latch data)

• RS – Register Select
• RS = 0  Command Register
• RS = 1  Data Register
• R/W = 0  Write , R/W = 1  Read
• E – Enable
• Used to latch the data present on the data pins.

• D0 – D7
• Bi-directional data/command pins.
• Alphanumeric characters are sent in ASCII format.

I/O device Interfacing


Interfacing LCD

I/O device Interfacing


LCD Commands
• The LCD’s internal controller can accept several commands and
modify the display accordingly. Such as:
• Clear screen
• Return home
• Decrement/Increment cursor

• After writing to the LCD, it takes some time for it to complete


its internal operations. During this time, it will not accept any
new commands or data.
• We need to insert time delay between any two commands or data sent
to LCD

I/O device Interfacing


Pin Description

I/O device Interfacing


Command
Codes

I/O device Interfacing


LCD Addressing

I/O device Interfacing


LCD Timing

I/O device Interfacing


I/O device Interfacing
Interfacing LCD

LM015
P3.4
RW
P3.5 E

P3.3 RS

P1.7-P1.0 D7-D0

I/O device Interfacing

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy