Introduction
Experiment 4 DC Motor Interfacing with 8051
Circuit Diagram
Working Algorithm
Forward
Reverse
Code
Output
Tasks
Discover more from
AmbeTronicS
8051 – DC
Suggestion to read
Motor
● M
otor Driver Working
(L293D)
Interfacing
byAdmin
Introduction
Tags
8051,DC Motor,L293D,Tutorials hen we talk about controlling the
W
robot,thefirstthingcomesintomindis
Categories
controlling DC motors. Interfacing the
8051 DC motor to the microcontroller is a
very important concept in Robotic
Last Updated on: November 23rd, 2024 applications. By interfacing the DC
motortothemicrocontroller,wecando
many things like controlling the
Inourprevioustutorial,wesawhowto
direction of the motor, controlling the
interface the LCD with 8051 in 4-bit
speed of the motor. This article
mode. In this tutorial, we are going to
describeshowtocontroltheDCmotor
learn DC Motor Interfacing with 8051.
using the AT89C51 controller.
Let’s run….
DC motor in simple words is a
A
Table of Contents device that converts electrical energy
(directcurrentsystem)intomechanical
Suggestion to read
nergy. It is of vitalimportanceforthe
e
industry today.
he maximum output current of the
T
microcontroller pin is 15mA at5V.But
the power requirements of most DC
motors is out of reach of the
microcontrollerandeventhebackemf
(electromotive force) which is
produced by the motor may damage
the microcontroller. Hence it is not Working Algorithm
goodtointerfacetheDCmotordirectly
to the controller. So use the motor
Forward
driver circuit in betweentheDCmotor
and controller.
● E NPin High (En1 = 1 or
En2 = 1)
ere, we are using an L293D motor
H
● Input 1 or Input 3 Pin
driver IC to drive DC motors. Using
High (In1 = 1 or In3=1)
thisIC,wecandrive2DCmotorsata
● Input 2 or Input 4 Pin
time. For this IC motor supply is
Low (In2 = 0 or In4 = 0)
variable 4.5 to 36V and it provides
maximumcurrentof600mA.Justrefer
Herefor the L293d Driver’s operation. Reverse
● E NPin High (En1 = 1 or
DC Motor En2 = 1)
● Input 1 or Input 3 Pin
Interfacing with Low (In1 = 0 or In3=0)
● Input 2 or Input 4 Pin
8051 Low (In2 = 1 or In4 = 1)
Code
Circuit Diagram
In this code, the First motor will rotate
forward and the second motor will
● Input 1 – Port 2.0
rotate reverse.
● Input 2 – Port 2.1
● Enable 1 – Port 2.2
● Enable 2 – Port 2.3 #include<reg51.h>
● Input 3 – Port 2.4
● Input 4 – Port 2.5
sbit in1=P2^0;
sbit in2=P2^1;
{
sbit en1=P2^2;
in1=1;
sbit en2=P2^3;
in2=0;
sbit in3=P2^4;
}
sbit in4=P3^5;
void
reverse
()
void
forward
()
;
{
void
reverse
()
;
in4=1;
void
main
()
in3=0;
{
}
en1=1;
Output
en2=1;
while
(
1
)
{
forward
()
;
reverse
()
;
[ Please find the output image ]
}
Notes:
}
● T
he maximum current
capacity of L293 is
void
forward
()
600mA/channel. So do
not use a motor that
c onsumes more than
that.
The supply voltage range
●
of L293 is between 4.5
and 36V DC. So you can
use a motor falling in that
range.
● Mostly in Robotic
application, we will use
DC gear Motor. So the
same logic is used for
that Gear motor also.