0% found this document useful (0 votes)
2 views14 pages

Microprocessor design and course Lecture Three

The document discusses the basic concepts of input/output (I/O) interfacing in microprocessor systems, highlighting the roles of input devices (like keyboards and scanners) and output devices (like LEDs and printers). It details the operation of I/O ports, particularly in the context of the PIC18F452 microcontroller, including the configuration of pins for input and output. Additionally, it covers common peripherals used in embedded systems, such as seven-segment displays and DIP switches, along with their interfacing methods.

Uploaded by

msimiyu888
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)
2 views14 pages

Microprocessor design and course Lecture Three

The document discusses the basic concepts of input/output (I/O) interfacing in microprocessor systems, highlighting the roles of input devices (like keyboards and scanners) and output devices (like LEDs and printers). It details the operation of I/O ports, particularly in the context of the PIC18F452 microcontroller, including the configuration of pins for input and output. Additionally, it covers common peripherals used in embedded systems, such as seven-segment displays and DIP switches, along with their interfacing methods.

Uploaded by

msimiyu888
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/ 14

Input/Output Ports and

Interfacing
Basic I/O Concepts
2

Peripherals such as LEDs and keypads are


essential components of microprocessor
systems (microcontroller-based systems)
Input devices
 Provide digital information to MPU
 Examples: keyboard, scanner, digital camera, and
switches
Output devices
 Receive digital information from a MPU
 Examples: LED, seven-segment display, LCD, and
printer
Devices are interfaced to a MPU using I/O
ports
Sept Dec 2019 01/22/25
I/O Interfacing
3

Sept Dec 2019 01/22/25


Interfacing and Addressing
4
I/O ports
 Generally the ports are bidirectional
 Device to be controlled by the MCU are accessed
through the ports
 Buffers and latches are used to minimize errors

 Reading binary data from an input device


MPU places the address of an input port on the address
bus
Enables the input port by asserting the RD signal
Reads data using the data bus
 Writing binary data to an output device
MPU places the address of an output port on the address
bus
Places data on data bus
Asserts the WR signal to enable the output port

Sept Dec 2019 01/22/25


I/O Ports of PIC18F452 MCU
5
MCU includes five I/O ports
 PORTA, PORTB, PORTC, PORTD, PORTE
Ports are multiplexed
 Can be set up to perform various functions
Each I/O port is associated with several
SFRs
 PORT
 Functions as a latch or a buffer
 TRIS
 Data direction register
 Logic 0 sets up the pin as an output
 Logic 1 sets up the pin as an input
 LAT
 Output latch similar to PORT

Sept Dec 2019 01/22/25


I/O Example
6

Write instructions to set up pins RB7-RB4 of


PORTB as inputs and pins RB3-RB0 as
outputs
Opcode Operand Comments
MOVLW 0xF0 ;Load B’11110000’ into
WREG
MOVWF TRISB ;Set PORTB TRIS Reg

Sept Dec 2019 01/22/25


Interfacing Output Peripherals
7

 Commonly used output peripherals in embedded systems


LEDs
 Seven-Segment Displays
 LCDs

 Two ways of connecting LEDs to I/O ports


 Common Cathode
 LED cathodes are grounded
 Logic 1 from the I/O port turns on the LEDs
 Current is supplied by the I/O port called current sourcing
 Common Anode
 LED anodes are connected to the power supply
 Logic 0 from the I/O port turns on the LEDs
 Current is received by the chip called current sinking

Sept Dec 2019 01/22/25


Interfacing Output Peripherals
8

Common Cathode Common Anode


Sept Dec 2019 01/22/25
Seven-Segment
9 Display
Seven-segment Displays
 Used to display BCD digits
 0 thru 9
A group of 7 LEDs physically
mounted in the shape of the
number eight
 Plus a decimal point
 Each
LED is called a
segment
 ‘a’ through ‘g’
 Two types
 Common anode
 Common cathode

Sept Dec 2019 01/22/25


Seven-Segment Display
10

 Common Anode
 All anodes are connected together to a power supply
 Cathodes are connected to data lines
 Logic 0 turns on a segment
 Example: To display the digit 1
 All segments except b and c should be off
 11111001 = F9
H

Common Anode

Sept Dec 2019 01/22/25


Seven-Segment Display
11

 Common Cathode
 All cathodes are connected together to ground
 Anodes are connected to data lines
 Logic 1 turns on a segment
 Example: To display digit 1
 All segments except b and c should be off
 00000110 = 06H

Sept Dec 2019 01/22/25


Example 9.4
12
Interfacing Seven-Segment Display to
PORTB
 Common Anode
 Table Look-Up

Sept Dec 2019 01/22/25


Interfacing Input
13 Peripherals
Commonly used input peripherals
 DIP switches, push-button keys, keyboards, and A/D

converters
DIP switch
 One side of the switch is tied high
 To a power supply through a resistor called a pull-up resistor
 The other side is grounded
 The logic level changes when the position is switched
Push-button key
 Same as the DIP switch except that contact is

momentary

Sept Dec 2019 01/22/25


Interfacing Dip Switches
14

Sept Dec 2019 01/22/25

You might also like