Embedded Systems Unit 2 Part 3-1
Embedded Systems Unit 2 Part 3-1
Communication Interface
05-Sep-20 ECE-GNITS 2
• Embedded system is in constant interaction with the
real world.
Example:
4
Actuator:
• Actuator is a form of transducer device (mechanical or electrical)
which converts signals to corresponding physical action (motion).
Actuator acts as an output device.
5
The I/O subsystem of the embedded
system facilitates the interaction of the
embedded system with the external world.
05-Sep-20 ECE-GNITS 6
Light Emitting Diode (LED)
Optocoupler
Stepper Motor
I/O Relay
Subsystem
Piezo Buzzer
Keyboard
05-Sep-20 ECE-GNITS 7
Light Emitting Diode (LED):
Light Emitting Diode (LED):
• Light Emitting Diode (LED) is an output device for visual indication in any embedded
system.
• LED can be used as an indicator for the status of various signals or situations.
• Typical examples are indicating the presence of power conditions GND like “Device ON”,
“Battery low” or “Charging of battery” for a battery operated handheld embedded devices.
• LED is a p-n junction diode and it contains an anode and a cathode.
• For proper functioning of the LED, the anode of it should be connected to +ve terminal of
the supply voltage and cathode to the –ve terminal of supply voltage.
• The current flowing through the LED must limited to a value below the maximum current
that it can conduct.
• A resister is used in series between the power supply and the resistor to limit the current
through the LED.
05-Sep-20 ECE-GNITS 9
05-Sep-20
05-Sep-20
05-Sep-20
05-Sep-20
05-Sep-20
05-Sep-20 ECE-GNITS 15
05-Sep-20
05-Sep-20 ECE-GNITS 17
7-Segment LED Display
• The 7-segment LED display is an output device for displaying alphanumeric characters.
• It contains 8 light-emitting diode (LED) segments arranged in a special form. Out of the 8
LED segments, 7 are used for displaying alphanumeric characters and 1 is used for
representing ‘decimal point’ in decimal number display.
• The LED segments are named A to G and the decimal point LED segment is named as
DP.
• The LED Segments A to G and DP should be lit accordingly to display numbers and
characters.
• The 7-segment LED displays are available in two different configurations, namely;
Common Anode and Common Cathode.
• In the common anode configuration, the anodes of the 8 segments are connected
commonly whereas in the common cathode configuration, the 8 LED segments share a
common cathode line.
05-Sep-20 ECE-GNITS 18
Cont’d
• Based on the configuration of the 7 – segment LED unit, the LED segment anode or
cathode is connected to the Port of the processor/controller in the order „A‟ segment to
the Least significant port Pin and DP segment to the most significant Port Pin.
• The current flow through each of the LED segments should be limited to the maximum
value supported by the LED display unit
• The typical value for the current falls within the range of 20mA.
• The current through each segment can be limited by connecting a current limiting
resistor to the anode or cathode of each segment
05-Sep-20 ECE-GNITS 19
Optocoupler
• Optocoupler is a solid state device to isolate two parts of a circuit.
• Optocoupler combines an LED and a photo-transistor in a single housing
(package).
• Figure illustrates the functioning of an optocoupler device.
05-Sep-20 ECE-GNITS 20
Cont'd
• In electronic circuits, an optocoupler is used for suppressing interference
in data communication, circuit isolation, high voltage separation,
simultaneous separation and signal intensification, etc.
• Optocouplers can be used in either input circuits or in output circuits.
• Figure illustrates the usage of optocoupler in input circuit and output
circuit of an embedded system with a microcontroller as the system core.
• The paper feed mechanism of a printer/fax makes use of stepper motors for
its functioning.
05-Sep-20 ECE-GNITS 22
Stepper Motor
• Based on the coil winding arrangements, a two-phase stepper motor is
classified into two. They are:
• Unipolar
• Bipolar
05-Sep-20 ECE-GNITS 23
Unipolar
• A unipolar stepper motor contains two
windings per phase.
• The direction of rotation (clockwise or
anticlockwise) of a stepper motor is
controlled by changing the direction of
current flow.
• Current in one direction flows through
one coil and in the opposite direction
flows through the other coil.
• It is easy to shift the direction of rotation
by just switching the terminals to which
the coils are connected.
• Figure illustrates the working of a two-
phase unipolar stepper motor.
05-Sep-20 ECE-GNITS 24
Bipolar
• A bipolar stepper motor contains
single winding per phase.
• For reversing the motor rotation the
current flow through the windings is
reversed dynamically.
• It requires complex circuitry for
current flow reversal.
• There is one disadvantage of unipolar
motors. The torque generated by them
is quite less. This is because the
current is flowing only through the
half the winding. Hence they are used
in low torque applications.
05-Sep-20 ECE-GNITS 25
Cont’d
• The stepping of stepper motor can be implemented in different ways by
changing the sequence of activation of the stator windings. The different
stepping modes supported by stepper motor are explained below.
• Full Step: In the step mode both the phases are energized simultaneously.
The coils A, B, C and D are energized in the following order:
• It should be noted that out of the two windings, only one winding of a phase
is energized at a time.
05-Sep-20 ECE-GNITS 26
Cont’d
Wave Step:
In the wave step mode only one phase is energized at a time and each coils
of the phase is energies alternatively. The coils A, B, C and D are energized
in the following order:
05-Sep-20 ECE-GNITS 27
Cont’d
Half Step :
It uses the combination of wave and full step. It has the highest torque and
stability. The coil energizing sequence for half step is given below.
05-Sep-20 ECE-GNITS 28
Cont’d
• The rotation of the stepper motor can be reversed by reversing the order
in which the coil is energized.
• Two-phase unipolar stepper motors are the popular choice for embedded
applications.
• The current requirement for stepper motor is little high and hence the
port pins of a microcontroller/processor may not be able to drive them
directly.
• Also the supply voltage required to operate stepper motor varies
normally in the range 5V to 24 V.
• Depending on the current and voltage requirements, special driving
circuits are required to interface the stepper motor with
microcontroller/processors.
05-Sep-20 ECE-GNITS 29
Cont’d
The following circuit diagram illustrates the interfacing of a stepper motor
through a driver circuit connected to the port pins of a
microcontroller/processor.
Port Pins A
M
Driver IC C
Microcontroller
ULN2803 B D
Vcc
GND Vcc
05-Sep-20 ECE-GNITS 30
Relay
• Relay is an electro-mechanical device. In embedded application, the ‘Relay’
unit acts as dynamic path selectors for signals and power.
• The ‘Relay’ unit contains a relay coil made up of insulated wire on a metal
core and a metal armature with one or more contacts.
• The magnetic field attracts the armature core and moves the contact point.
The movement of the contact point changes the power/signal flow path.
05-Sep-20 ECE-GNITS 31
Relay
The following figure shows how a Relay looks internally and how it can be
constructed,
05-Sep-20 ECE-GNITS 32
Cont’d
• Figure given below illustrates the widely used relay configurations for
embedded applications.
05-Sep-20 ECE-GNITS 33
Cont’d
• The Single Pole Single Throw configuration has only one path for
information flow. The path is either open or closed in normal condition.
• For normally Open Single Pole Single Throw relay, the circuit is
normally open and it becomes closed when the relay is energized.
• For normally closed Single Pole Single Throw configuration, the circuit
is normally closed and it becomes open when the relay is energized.
• For Single Pole Double Throw Relay, there are two paths for information
flow and they are selected by energizing or de-energizing the relay.
05-Sep-20 ECE-GNITS 34
Cont’d
• The Relay is normally controlled using a relay driver circuit connected to
the port pin of the processor/controller.
• A transistor can be used as the relay driver. The transistor can be selected
depending on the relay driving current requirements.
Vcc
Freewheeling Diode
Relay Coil
Load
Port Pin
Relay Unit
05-Sep-20 ECE-GNITS 35
Piezo Buzzer
• It is a piezoelectric device for generating audio indications in embedded
applications.
• A Piezo buzzer contains a piezoelectric diaphragm which produces
audible sound in response to the voltage applied to it.
• Piezoelectric buzzers are available in two types
1.Self-driving
2.External driving
• Self-driving contains are the necessary components to generate sound at
a predefined tone.
• External driving piezo Buzzers supports the generation of different tones.
• The tone can be varied by applying a variable pulse train to the
piezoelectric buzzer.
• A Piezo Buzzer can be directly interfaced to the port pin of the
processor/Controller
05-Sep-20 ECE-GNITS 36
Push button switch
• Push Button switch is an input device.
• Push button switch comes in two configurations,
namely ‘Push to Make’ and ‘Push to Break’.
• The switch is normally in the open state and it makes a
circuit contact when it is pushed or pressed in the ‘Push
to Make’ configuration.
• In the ‘Push to Break’ configuration, the switch is
normally in the closed state and it breaks the circuit
contact when it is pushed or pressed.
• The push button stays in the ‘closed’ (For Push to
Make type) or ‘open’ (For Push to Break type) state as
long as it is kept in the pushed state and it
breaks/makes the circuit connection when it is released.
• Push button is used for generating a momentary pulse.
05-Sep-20 ECE-GNITS 37
Keyboard
• Keyboard is an input device for user interfacing.
• If the number of keys required is very limited, push button switches can
be used and they can be directly interfaced to the port pins for reading.
05-Sep-20 ECE-GNITS 38
Matrix Keyboard
Vcc
4.7K
4.7K
4.7K
4.7K
• For example, for interfacing 16
keys, in the direct interfacing Row 0
To Microcontroller/processor Port
technique 16 port pins are
Row 1
required, where as in the matrix
keyboard only 8 lines are
Row 2
required.
• The 16 keys are arranged in 4 Row 3
Column 1
Column 0
Column 3
Column 2
• The key press in matrix keyboard
is identified with row-column To Microcontroller/processor Port
scanning technique.
05-Sep-20 ECE-GNITS 39
05-Sep-20 ECE-GNITS 40
Programmable Peripheral Interface
• Programmable Peripheral Interface (PPI) devices are used for extending
the I/O capabilities of processors/controllers.
• 8255A is a popular PPI device for 8 bit processors/controllers.
• 8255A supports 24 I/O pins ad these I/O pins can be grouped as either
three 8-bit parallel ports (Port A, Port B and Port C) or two 8 bit parallel
ports (Port A and Port B) with Port C in any one of the following
configuration.
✓ As 8 individual I/O pins
✓ Two 4bit Ports namely Port CUPPER (CU) and Port CLOWER (CL)
• The Configuration of ports is done through the Control Register of
8255A.
• The control register holds the configuration for Port A, Port B and Port
C. The bit details of control register is
D7 D6 D5 D4 D3 D2 D1 D0
05-Sep-20 ECE-GNITS 41
8255 Architecture
05-Sep-20 ECE-GNITS 42
Control Word Format 8255A
05-Sep-20 ECE-GNITS 43
BSR Mode of 8255 PPI
05-Sep-20 ECE-GNITS 44
PORT A- Mode 1 Input
05-Sep-20 ECE-GNITS 45
PORT A- Mode 1 output
05-Sep-20 ECE-GNITS 46
MODE 2- PORT A
05-Sep-20 ECE-GNITS 47
05-Sep-20 ECE-GNITS 48
Programmable Peripheral Interface (PPI)
Bit Description
Port C Lower (CL) I/O mode selector
D0 D0 = 1; Sets CL as Input Port
D0 = 0; Sets CL as Output Port
Port B I/o mode selector
D1 D1 = 1; Sets Port B as Input Port
D1 = 0; Sets Port B as Output Port
Mode Selector for Port C lower and Port B
D2 D2 = 0; Mode 0 – Port B functions as 8bit I/O Port. Port C Lower
functions as 4 bit Port.
D2 = 1; Mode 1 – Handshake Mode. Port B uses 3 bits of
Port C as handshake signals
Port C Upper (CU) I/o mode selector
D3 D3 = 1; Sets CU as Input Port
D3 = 0; Sets CU as Output Port
Port A I/o mode selector
D4 D4 = 1; Sets Port A as Input Port
D4 = 0; Sets Port A as Output Port
D5, D6 Mode Selector for Port C upper and Port A
D6 D5 = 00; Mode 0 – Simple I/O mode
D6 D5 = 01; Mode 1 – Handshake Mode. Port A uses 3 bits of
Port C as handshake signals
D6 D5 = 1X; Mode 2. X can be 0 or 1 – Port A functions as Bi-
directional Port
D7 Control/Data mode selector for Port C
D7 = 1; I/O mode.
D7 = 0; Bit Set/Reset (BSR) mode. Functions as the control/status lines for Port A and B. The bits of Port C
can be set or reset just as if they were output ports.
05-Sep-20 ECE-GNITS 49
The generic interfacing of a 8255A device with an 8 bit processor/
controller with 16bit address bus
Processor/
82C55A
Controller Data Bus D0….D7 D0….D7
Data Bus Port
Pins 34 to 27
Latch
A0 Pin 9
(Eg: 74LS373) PA0….PA7
A1 Pin 8
Port A
ALE
A2….A7 PB0….PB7
Port B
Higher Order
Address Bus Address Bus Address
(A8….A15) CS\ Pin 6
decoder PC0….PC7
Port C
RD\ RD\ Pin 5
WR\ WR\ Pin 36
RESET OUT RESET Pin 35
05-Sep-20 ECE-GNITS 50