UNIT V Microcontroller
UNIT V Microcontroller
UNIT V Microcontroller
MICROCONTROLLER
INTERRUPT AND SERIAL COMMUNICATION
INTERFACING TECHNIQUES
IC 8255 – Block Diagram – Modes of 8255.
Interfacing external memory to 8051
8051 interfacing with the 8255
ASM Programming :
Relays
Sensor interfacing
ADC interfacing
DAC interfacing
Keyboard interfacing
Seven segment LED Display Interfacing
Stepper Motor interfacing
DC motor interfacing using PWM
8255 - PROGRAMMABLE PERIPHERAL
INTERFACE
The INTEL 8255 is a general purpose programmable peripheral
interface. It is used to perform a variety of Input/output
functions in a microcomputer system.
It is a 40 DIP IC.
It requires +5V DC power supply for its operations.
The 8255 interfaces the microcontroller on one side with
peripherals on the other side
The pin out diagram and signal diagram of 8255A are shown in
the figure
8255 - PROGRAMMABLE PERIPHERAL
INTERFACE
FUNCTIONAL BLOCK DIAGRAM
i) lnput/output Ports
The 8255 consists of two 8-bit ports of Port A and Port B, and
two 4-bits ports of Port C upper (CU) and Port (CL).
The Ports are grouped as Group A and Group B.
Group A consists of Port A (PA7- PAO) and Port C upper ( PC7-
PC4).
Group B consists of Port B (PB7-PBO) and Port C lower (PC3-
PC0). lower
FUNCTIONAL BLOCK DIAGRAM
The WR and RD signals are alternate uses for Port 3 pins 16 and
17. The port 0 is used for the lower address byte and data, Port 2
is used for upper address bits.
The use of external memory consumes many of the port pins,
leaving only Port 1 and parts of Port 3 for general l/O.
8051 INTERFACING WITH THE 8255
The electro mechanical relays have been used for many years in
industry to control high dc or ac voltages and currents. Relays
also provide isolation between the controller and the circuit
under control. Relays are made up of three basic components:
1. Electromagnet
2. Spring
3. Some Contacts
Relays have two states – Open and close. A contact can be either
normally open or normally close. The State of the contact can be
changed by passing specified amount of current through the coil
of the electromagnet.
RELAY INTERFACING WITH
MICROCONTROLLER 8051
For energize the relay the voltage required for the coil of the
electromagnet is normally +5V (or) +12V. On the other hand
contact voltage can be 100 or more. Interfacing diagram of relay
with 8051 is shown in figure.
RELAY INTERFACING WITH
MICROCONTROLLER 8051
Micro controller pins could not produce sufficient voltage (or)
current to driver the relay. For this reason, we place a driver or a
power transistor in between the microcontroller and the relay.
Here SPDT (Single pole Double – throw) type relay is Interface
with help of driver circuit.
One between CP and S1 is normally close and the contact
between CP and S2 is normally Open, When the Electromagnet
is energized by passing the desired amount of current through
the coil the conditions reverses.
RELAY INTERFACING WITH
MICROCONTROLLER 8051 PROGRAM
Write an ALP to turns the lamp ON and OFF by energizing and
deenergizing the relay at every second.
SOLID STATE RELAY
Solid state relay is another widely used relay. In this relay there
is no coil, spring or mechanical contact switch The entire relay
is made out of semiconductor materials.
The switching time of solid state relay is faster than that of
electromechanical relay.
OPTO ISOLATOR
Where D0 is LSB, D7, is the MSB for the inputs and Iref is the
input current that must be applied to pin 14. DAC 0808 has fast
settling time of 100ns. It can be directl interfaced to TTL,
CMOS, PMOS and others. It operates at +4.5V to +18V supply.
The supply V may be either +5V or +12V. V is kept -12V. From
pin 5 to pin 12 are for digital inputs. Pin 5 is MSB and pin 12 is
LSB
DAC INTERFACING
DAC INTERFACING
The rows are connected to port 1 lines of 8051 and the columns
are connected to port 3 lines of 8051 also. The rows and
columns are normally tied 'high'. At the intersection of a row
and column, a key is placed such that pressing a key will short
circuit the row and the column.
A key actuation is sensed by sending a 'low' to each row once at
a time via port 1. The columns are then read via port 3 to see
whether any of the normally high columns is pulled low by a
key actuation. For finding the key actuation,
Ihe rows can be checked individually to determine the row in
which key ls down. The row and column code in which the key
is pressed can thus be found.
KEY BOARD INTERFACING
The next step ls to debounce the key. Normally the key bounces,
when it is pressed or released. When this bounce occurs, it may
appear to the microcontroller that the same key has been
actuated several times instead of just One.
The problem can be eliminated by reading the keyboard after 20
ms and then verifying to see if it is still down. If it is, then the
key actuation is valid. This process is called key debouncing.
The next step is to translate the row and column code into its
equivalent hexadecimal code or ASCIl code. This can be easily
accomplished by a program.
The flow chart for the software required for the keyboard
interfacing with microcontroller is shown in the figure.
KEY BOARD INTERFACING
KEY BOARD INTERFACING
The four coils of stepper motor are connected to the Port 0 pins
through drivers. The Port pin P1.0 is connected to the coil A, the
Port pin P1.1 is connected to coil B, the Port pin P1.2 is
connected to the coil C and the Port pin P1.3 is connected to the
coil D.
STEPPER MOTOR INTERFACING
DC MOTOR INTERFACING USING PWM