UNIT V Microcontroller

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 92

UNIT V

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

 The functional block diagram of 8255 is shown in th figure.


 It contains Data bus buffer, Read/Write control logic unit and
I/O Ports.
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

ii) Data bus buffer


It is a bidirectional 8-bit buffer. It is used to interface the 8255
with the system data bus.
The data, control word and status information signal in between
the microcontroller and 8255 are communicated only through data
bus buffer.
FUNCTIONAL BLOCK DIAGRAM

iii) Control logic


The read/write control logic unit has 6 control signals. These
signals are given below
RD (Read) :When this signal is low, the microcontroller reads
data from the selected l/O port of 8255.
WR (Write): When this signal is low, the microcontroller writes
data into the selected I/0 port or the control register.
RESET: It is an active high signal. When it is high, it clears the
control word register and sets all ports in the input mode.
CS (Chip select): It is an active low signal. It enables the
communication between the 8255 and the microcontroller
FUNCTIONAL BLOCK DIAGRAM

 A1 – A0 : These lines are used for selecting the ports or control


word register of 8255 as shown in the table.
 Ihese lines are generally connected to the microcontroller
address lines
CONTROL WORD FORMAT OF 8255

 The control section of 8255 has an 8-bit register called control


register. An 8-bit binary word present in the control register is
called control word. The control word specifies the function for
each l/O port.
MODES OF OPERATION OF 8255

 The operation of 8255 can be classified into two modes. They


are
1. Bit Set/Reset (BSR) mode
2. I/O mode
 The Bit D7 of the control word determines either the l/O
function or the BSR function.
I/O mode:
 The l/O mode is further classified into three modes. They are
Mode 0 - Simple /O Port
Mode 1- Strobed I/0 Port (Hand shake l/O Port)
Mode 2 – Bi directional I/O Port
MODE 0

Mode 0 (Simple l/0 port)


In this mode all the ports can be programmed either as input port
or output port.
In this mode, the output ports are latched and the inputs are not
latched but they are buffered.
If a port is in mode 0, data can be written into the port or read
from the port without any control signals. Totally, 16
Combinations are possible in mode 0. One combination in mode 0
is shown in the figure.
MODE 0
MODE 1

Mode 1 (Strobed l/0 port)


In this mode ports A and B can be programmed either as input
port or output port.
In this mode hand shake signals are exchanged between the
controller and peripherals prior to data transfer. The port C pins are
used for handshake signals.
Mode 1 - Input configuration
Port A Input port
PC3 – PC5: Control signals for port A
Port B - Input port
PCO - PC2 -Control signals for port B
PC6, PC7 :- Not used, they can be used in Mode 0 (simple I/O
pins)
MODE 1

 The details of control signals are explained below


i) STB (Strobe)
It is an active low signal, generated by a peripheral device, to
indicate that it has to be transmitted a byte of data.
ii) IBF (Input Buffer Full)
It is an active high acknowledge signal, generated by 8255, to
indicate that the input latch has received a data byte.
iii) INTR (Interrupt Request)
It is an active high signal, used to interrupt the controller, when
its input buffer is full. The representation of input configuration
in Mode 1 is shown in the figure.
MODE 1
MODE 1

Mode 1-0utput configuration


Port A- Output port
PC3, PC6, PC7 - Control signals for port A
Port B-Output port
PCO to PC2 - Control signals for port B
PC4, PC5- Not used, they can be used in Mode 0 (simple l/O
pins)
MODE 1

 The details of control signals are explained below


i) OBF (Output Buffer Full)
It is an active low signal. It is generated, when the
microcontroller writes data into the output port of 8255.
ii) ACK (Acknowledge)
It is an active low signal. It is generated from a peripheral
device, when the device receives the data from the output port of
8255.
iii) INTR (Interrupt Request)
It is an active high output signal. It is used to interrupt the
microcontroller to request the next data byte output.
 The representation of output configuration in mode 1 is shown
in the figure
MODE 1
MODE 2

Mode 2 (Bidirectional 1/O Port)


In this mode port A only acts as bidirectional data transfer port.
Port A uses five signals from Port C as control signals for for data
transfer. The remaining bits from Port C can be used in mode 0 or
as handshake signals for Port B.
Port B may be operated as in mode 0 or mode 1.
In this mode the data transfer is done in both directions, in
between the microcontroller ànd peripheral devices.
The configuration of mode 2 is shown in the figure
MODE 2
BIT SET/RESET MODE (BSR MODE)

Bit Set/Reset Mode (BSR Mode)


This mode is related to only Port C. The bits of Port C can be
controlled directly by the microcontroller.
A control word with bit D7 = 0, is called a BSR control word.
Using this bit set-reset feature, the microcontroller can send a
command to 8255 for setting/resetting the bits of port C.
The control word format for BSR mode is shown in the figure
The BSR control word does not affect the functions of Ports A
and B.
BIT SET/RESET MODE (BSR MODE)
INTERFACING EXTERNAL MEMORY TO 8051

 The microcontroller 8051 has separate address spaces for


program storage and data storage. Depending on the type of
instructions, the same address can refer to two logically and
physically different memory spaces.
 The 8051 has has 256 bytes of internal data memory. The lower
128 bytes are intended for internal data storage and the upper
128 bytes are the special function registers (SFRs).
 In 8051 microcontroller, 4 Kbytes of internal ROM is available
to hold the user application program. The- memory space for
this memory extends from 0000H to OFFFH.
INTERFACING EXTERNAL MEMORY TO 8051
INTERFACING EXTERNAL MEMORY TO 8051

 If the internal memory (ROM as well as RAM) is not sufficient,


additional memory can be connected externally.
 We can be able to connect 64 Kbytes of data memory (RAM and
another 64 bytes of program memory (PROM or EPROM)
externally.
 The connection diagram of 16 Kbytes of EPROM and 8 Kbytes
of static RAM with microcontroller 8051 is shown in the figure.
 The 8051 accesses external RAM whenever MOVX type of
instructions are executed. External ROM is accessed whenever
EA pin is connected to ground or when the PC contains an
address in between 1000H and FFFFH,
INTERFACING EXTERNAL MEMORY TO 8051

 The timing diagram associated with an externa memory access


is shown in the figure.
INTERFACING EXTERNAL MEMORY TO 8051

 During any memory access cycle, Port 0 is time multiplexed.


That is it first provides the lower byte of the 16 bit memory
address, then acts as a bidirectional data bus to write or read a
byte of memory data. Port 2 provides the high byte of the
memory address during the entire memory read/write cycle.
 When ALE is enabled the Port 0 latch the address signal. If the
memory access is from external ROM, the PSEN pin will go
low. If the memory access is for a RAM byte, the WR pin will
go low, when data flow from data bus to RAM or RD pin will
go low when data flow from RAM to data bus.
INTERFACING EXTERNAL MEMORY TO 8051

 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

 To expand the capability of I/O ports of 8051, the 8255 is


interfaced with 8051. The interfacing diagram of 8255 with
8051 is shown in the figure.
8051 INTERFACING WITH THE 8255

 The bidirectional data bus DO-D7 of 8255 is directly connected


to port 0 of 8051. Address latch 74LS373 is used to demultiplex
the lower order 8-bits of the address bus from multiplexed
address/data bus ADO-AD7 (PO.0 PO.7).
 The control lines WR and RD are directly connected to the WR
and RD lines of 8051. The 8255 is connected to the 8051 by
using memory mapped l/O scheme.
 Hence the 8255 is treated as external data memory. Separate
addresses are assigned to Port A, Port B, Port C and control
word register.
 By using the MOVX instruction the microcontroller can access
the ports and CWR of 8255.
RELAYS

 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

 Opto isolator is otherwise called op-to coupler. It isolates two


parts of a system.
 An opto isolator has an LED transmitter and a photo sensor
receiver, both are separated from each other by a small gap.
 When current flows through the LED, it transmits a light signal
to the receiver. The receiver produces the signal with the same
phase but a different current and amplitude.
 The gap between the transmitter and receiver of isolators
prevents the electrical current surge from reaching the system.
INTERFACING AN OPTO ISOLATOR

 The op-to isolator comes in a small IC package with four or


more pins. There are also packages that contain more than one
opto isolator.
 When placing an opto isolator between two circuits, we must
use two separate voltage sources, one for each side.
 The interfacing diagram of opto isolator with microcontroller is
shown in the figure.
 Unlike relays, no drivers need to be placed between the
microcontroller and the opto isolators
INTERFACING AN OPTO ISOLATOR
INTERFACING AN OPTO ISOLATOR

 Write an ALP to switch ON and OFF the lamp connected at port


pin P1.0 with a particular time period.
SENSOR INTERFACING

 Transducers convert physical data such as temperature, light


intensity, flow and speed to electrical signals. Depending on the
transducers, the output may be in the form of voltage, current,
resistance or capacitance.
 Thermistor is a transducer, which converts temperature into
electrical signal.
 LM 34 and LM 35 series from National Semiconductor
Corporation are simple and widely used linear temperature
sensors.
LM34 AND LM35 TEMPERATURE SENSORS

 The sensors of LM 34 series are precision integrated circuit


temperature sensors whose output voltage is linearly
proportional to the fahrenheit temperature. LM 34 does not
require any external calibration, since it is internally calibrated
 It's output IS varied to 10mV for each degree of Fahrenheit
temperature.
 LM 35 series sensors are precision integrated circuit temperature
sensors, whose output voltage is linearly proportional to the
celsius (centigrade) temperature. The LM 35 requires no
external calibration since it is internally calibrated.
 lt's output is varied to 10mV for each degree of centigrate
temperature.
INTERFACING LM35 TO MICROCONTROLLER
8051
INTERFACING LM35 TO MICROCONTROLLER
8051
 The connection diagram for intertacing the temperature sensor
LM35 with microcontroller through an ADC is shown in the
figure.
 The ADC 0808 has 8 bit resolution, with a maximum of 256
(25) steps.
 The LM 35 produces 10mV for every degree of temperature
change.
 We can condition Vin of the ADC 0808 to produce a Vout of
2550mV (2.55V) for full scale output. Therefore in order to
produce the full scale V of 2.55V for the ADC 0808, we need to
set Vref2.56V.
 This makes Vout of the ADC 0808 correspond directly to the
temperature as mentioned by LM35. The
INTERFACING LM35 TO MICROCONTROLLER
8051
 Zener diode is used to give a steady voltage across the 10K pot,
which overcomes any fluctuations in the power supply.
 LM 35 is connected directly to the INO input pin of ADC 0808.
 Port 0 pins of MC 8051 are directly connected to the digital
output terminals of ADC 0808.
 The port pin P3.0 is connected to ALE, the port pin P3.1 is
connected to SOC, the port pin P3.2 is connected to OE and the
port pin P3.3 is connected to EOC of 0808 ADC
 respectively.
 The port pins P2.0, P2.1 and P2.2 are connected to the address
lines of A, B and C respectively.
INTERFACING LM35 TO MICROCONTROLLER
8051
 The following steps are to be used for getting data of LM 35
through ADC 0808.
i) Select an analog channel (INO) by providing the bits of A, B and
C.
ii) Activate the ALE (Address latch enable) pin.
iii) Activate SOC (Start of conversion)
iv) Monitor EOC (End of conversion) to see the conversión is
finished.
v) Activate OE (Output enable) to read data from the ADC chip.
INTERFACING LM35 TO MICROCONTROLLER
8051
Write an ALP to read the temperature from a sensor and display it
through Port 3.
INTERFACING LM35 TO MICROCONTROLLER
8051
ADC INTERFACING

 Analog to Digital converters are most widely used devices for


data acquistion.
 Digital computers use binary (discrete) values, but in the
physical world everything is analog (continuous). Temperature,
pressure, humidity, and velocity are few examples of physical
quantities.
 A physical quantity is converted into electrical signals (voltage
or current) by using a device called a transducer. Transducers
are also referred to as sensors.
 An ADC has n-bit resolution where "n" can be 8, 10, 12, 16 or
even 24 bits. The higher resolution ADC provides a smaller step
size.
ADC INTERFACING

 The conversion time of ADC is defined as the time it takes the


ADC to convert the analog input to digital number.
 The ADC chips are either parallel or serial. In parallel ADC, 8
or more pins are provided for bringing out the binary data; but in
serial ADC only one pin is provided for bringing the binary data
(digital).
PARALLEL ADC 0808
PARALLEL ADC 0808

• The parallel analog to digital converter chip 0808 is an 8-bit


CMOS type successive approximation converter. Successive
approximation technique is one of the fast techniques for analog
to digital conversion.
• The conversion delay time is 100 micro second, at a clock
frequency of 640KHz. This time is quite low compared to other
Converters.
• The block diagram of ADC 0808 is shown in the figure.
• This converter contains 8 channel analog multiplexer, 256R
resister ladder and switch tree, output latch, SAR, and, control
and timing unit. This converter does not need an. external zero
or full scale adjustments, as they are already taken care of by
internal circuits.
PARALLEL ADC 0808

 This converter has a 3:8 analog multiplexer, so that at a time


eight different analog inputs can be connected to the chip. Out
of these eight inputs, only one can be selected at a time for
conversion, by any using address lines A, B and C.
 It is a unipolar analog to digital converter. It is able to convert
only positive analog input voltages to their digital equivalents.
This chip does not contain any internal sample and hold circuit.
 It may be connected to each of the analog inputs for fast
varying analog input signals. The pin diagram of ADC 0808 are
shown in the figure.
PARALLEL ADC 0808
PARALLEL ADC 0808

 The signal descriptions are shown in the table.


PARALLEL ADC 0808

 The timing diagram of various signals used in ADC 0808 is


shown in the figure.
INTERFACING ADC 0808 WITH
MICROCONTROLLER 8051
 The interfacing diagram of ADC 0808 with microcontroller
8051 is shown in the figure.
INTERFACING ADC 0808 WITH
MICROCONTROLLER 8051
 The analog input signal to be converted into digital signal is
applied to the input pin INO.
 Port 0 pins are directly connected to the digital oulput terminals
of ADC 0808.
 The port pin P3.0 is connected to ALE, the port pin P3.1 is
connected to SOC, the port pin P3.2 is connected to OE and the
port pin P3.3 is connected to EOC of 0808 ADC respectively.
 The port pins P2.0, P2.1 and P2.2 are connected to the address
lines of A, B and C respectively.
STEPS TO PROGRAM THE ADC 0808

 The following steps are to be used for getting data of LM 35


through ADC 0808.
i) Select an analog channel (INO) by providing the bits of A, B and
C.
ii) Activate the ALE (Address latch enable) pin.
iii) Activate SOC (Start of conversion)
iv) Monitor EOC (End of conversion) to see the conversión is
finished.
v) Activate OE (Output enable) to read data from the ADC chip.
ADC PROGRAMMING
ADC PROGRAMMING
DAC INTERFACING

 The Digital-to-Analog converter (DAC) is a device widely used


to convert digital signals to analog signals.
 In DAC, the number of input data bits decides the resolution, An
'n' bit DAC provides 2" discrete voltage (or current) levels of
output.
 IC 0808 is an 8 bit DAC, which provides 28 = 256 discrete levels
of output. The pin diagram of DAC 0808 is shown in the figure.
 In DAC 0808 the digital inputs are converted to current (I out, and
by connecting a resistor to the Iout pin, which converts the result
to voltage.
DAC INTERFACING
DAC INTERFACING

 The total current provided by the Iout Pin is a function of the


binary numbers at the D0-D7, inputs of the DAC 0808 and the
reference current (Iref)

 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 output current produced from DAC 0808 is converted to


voltage by using an op-amp with a feedback resistor of 5KΩ.
 The interfacing diagram of DAC 0808 with microcontroller
8051 is shown in the figure
DAC PROGRAM

 Write an ALP for converting a digital data placed in memory


location 4201H to its equivalent analog signal.
KEY BOARD INTERFACING
 A common method of entering programs into a microcontroller
is through a keyboard.
 To perform the following three major tasks to get a meaningful
data from a keyboard.
i) Sense a key actuation
ii) Debounce the key
iii) Decode the key
 The three major tasks mentioned above can be performed by
software.
 Matrix keyboards are scanned by bringing each X row low (or
high) in sequence and detecting a Y column low (or high) to
identity each key in the matrix.
 X-Y scanning can be done by using dedicated keyboard circuitry
or by using microcontroller ports under program control.
KEY BOARD INTERFACING

 A simple matrix keyboard in which the keys are arranged in


rows and columns are shown in the figure.
KEY BOARD 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

 In keyboard interfacing there are two methods handling multiple


key press.
 They are two key lock out and N key rollover.
 The two key lock out takes into account only one key pressed.
An additional key pressed and released does not generate any
codes.
 The N key rollover will detect all the keys pressed in the order
of entry and generates corresponding key code.
KEY BOARD INTERFACING
KEY BOARD INTERFACING
KEY BOARD INTERFACING
SEVEN SEGMENT LED DISPLAY INTERFACING

 The 7 /segment display units for displaying its output. The


segment display contains LED segments arranged in a pattern of
8 (Eight).
 The 7 segment LEDs are available in two patterns, they are
common anode type and common cathode type.
 If the display units are multiplexed together, we can display
more than one character at a time.
 Interfacing diagram of 4-digit multiplexed LED display with
microcontroller 8051 is shown in the figure.
 In four 7 segment LEDs are multiplexed together.
 The port 3 pins are used to drive the segments of the LEDs
through driver IC. Similarly, the port pins P1.0 through P1.3 are
used to drive the digits, through driver transistors.
SEVEN SEGMENT LED DISPLAY INTERFACING
SEVEN SEGMENT LED DISPLAY INTERFACING

 For displaying a character "PASS" in the display unit, the


hexacode may be formed as follows.

 The character P may be displayed at digit 3 (P1.3), the character


A may be displayed at digit 2 (P1.2), the character S may be
displayed at digit 1 (P1.1) and the character S may be displayed
at digit 0 (P1.0).
SEVEN SEGMENT LED DISPLAY PROGRAM
STEPPER MOTOR INTERFACING

 Stepper motor is a device, used for getting accurate position


control of rotating shafts. It converts electrical pulses into
mechanical movements.
 A stepper motor employs rotation of its shaft, in terms of steps.
 To rotate the shaft of the stepper motor, a sequence of pulses is
needed for applying to the windings of the stepper motor. The
number of pulses required for one complete rotation of the shaft
of the stepper motor is equal to its number of teeth on its stator.
 The stator teeth and rotor teeth lock with each other to fix a
position of the shaft.
 The schematic diagram of a stepper motor is shown in the figure
STEPPER MOTOR INTERFACING

 This stepper motor is a permanent magnet type stepper motor. It


contains a four pole stator and a rotor with six permanent poles.
 The stator is made up of laminated soft iron. The stator
windings are energized by the application of pulses. Each pole
of the stator has two coils, wound in an opposite sense. So that
each pole can be made either a north pole or a south pole, as
described by applying appropriate pulse to one of the coil.
STEPPER MOTOR INTERFACING

• This type of winding is known as bi-filler pole winding.


• The structure of bi-filler pole winding is shown in the figure.
• The X and Y are two coils wound on the same pole. Similarly M
and N are the two coils wound on the same pole, which are
situated at diametrically opposite position
STEPPER MOTOR INTERFACING

 The excitation sequence of a stepper motor is shown in the table


below.

 For doing the above type of excitation, each sequence of data is


continuously output through Port 1 for a specific duration of
time.
STEPPER MOTOR INTERFACING

 The connection diagram of stepper motor Microcontroller with


8051 is shown in the figure

 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

 DC motors are used in many applications like process control


and automation in industry robotics, printers, Scanners etc,
 Speed control is an important factor in these applications.
 Speed of DC motor depends upon the average DC voltage
applied across its armature.
 If the polarity of the applied voltage is changed, the motor can
run in reverse direction.
 The speed of the DC motor is controlled by using Pulse Width
Modulation (PWM) method. By using the PWM signal, the
average voltage of the DC motor can be varied, there by the
speed of the DC motor is controlled.
DC MOTOR INTERFACING USING PWM

 Two different pulse modulated signals are shown in the figure.


In the first waveform, ON period is high and OFF period is low.
Therefore its average, voltage is high.
 In the second waveform ON period is low and the OFF period is
high. Therefore its average voltage is low.
DC MOTOR INTERFACING USING PWM

 In pulse width modulation, the period of the pulse is kept


constant; Pulse ON period and OFF period times may be varied.
 The interfacing diagram of DC motor with 8051 microcontroller
is shown in the figure.
DC MOTOR INTERFACING USING PWM
 The speed of the DC motor is increased, when the duty cycle of
the signal is high. Similarly, the speed of the DC motor is
decreased, when the duty cycle of the signal is low..
 We can be able to change the duty cycle of the PWM signal and
also the motor speed may be varied.
 Normally the current produced from the microcontroller is not
sufficient to drive the DC motor effectively. Hence drivers may
be connected in between the motor and microcontroller.
 The speed of the motor as constant. For doing this, a feedback
circuit Connected may be to it.
 The feedback circuit contains a speed sensor for getting the
present speed of the motor. According to the sensor output, the
microcontroller adjusts the speed or the motor by changing the
duty cycle of the signal applied to it. Hence constant speed can
be maintained.
DC MOTOR INTERFACING USING PWM
DC MOTOR INTERFACING USING PWM

You might also like