Вы находитесь на странице: 1из 8

Unit 4

Lecture no: 23 8051 Interfacing and Applications

Microcontroller

DCMotorInterfacingwith8051:
TheDCmotorisanotherwidelyuseddevicethattranslateselectricalpulsesintomechanical
movement.Motorhas2leads+veandve,connectingthemtoaDCvoltagesupplymoves
the motor in one direction. On reversing the polarity rotates the motor in the reverse
direction.BasicdifferencebetweenStepperandDCmotorissteppermotormovesinsteps
whileDCmotormovescontinuously.Anotherdifferenceiswithsteppermotorthenumberof
stepscanbecountedwhileitisnotpossibleinDCmotor.MaximumspeedofaDCmotoris
indicatedinrpm.Therpmiseitherwithnoloaditisfewthousandstotensofthousandsor
withloadrpmdecreaseswithincreaseinload.
Voltage and current rating : Nominal voltage is the voltage for a motor under normal
condition.Itrangesfrom1Vto150V.Asvoltageincreases,rpmgoesup.Currentratingisthe
currentconsumptionwhenthenominalvoltageisappliedwithnoloadthatis25mAtoafew
amperes.Asloadincreases,rpmincreases,unlessvoltageorcurrentincreasesimpliestorque
increases. With fixed voltage, as load increases, power consumption of a DC motor is
increased.
UnidirectionalControl:
Figure3showstherotationoftheDCmotorinclockwiseandanticlockwisedirection.

Figure3:DCmotorrotation
BidirectionalControl:

(a)Motornotrunning (b)Clockwisedirection

NIT , Raichur
NIT , Raichur

Page7
8051 Interfacing and Applications

Microcontroller

(c)Counterclockwisedirection (d)Invalidstate(shortcircuit)
Figure4:HBridgeMotorConfiguration
Figure4showstheHBridgemotorconfiguration.Itconsistsoffourswitchesandbasedon
the closing and opening of these switches the motor either rotates in clockwise or anti
clockwisedirection.
Asseeninfigure4a,alltheswitchesareopenhencethemotorisnotrunning.Inb,turningof
themotorisinonedirectionwhentheswitches1and4areclosedthatisclockwisedirection.
Similarly,inctheswitches2and3areclosedsothemotorrotatesinanticlockwisedirection,
whileinfigure4dalltheswitchesareclosedwhichindicatesainvalidstateorashortcircuit.
Theinterfacingdiagramof8051tobidirectionalmotorcontrolcanbereferredtofig1718
fromtextprescribed.

Example6:AswitchisconnectedtopinP2.7.WriteanALPtomonitorthestatusofthe
SW. If SW = 0, DC motor moves clockwise and if SW = 1, DC motor moves
anticlockwise.

Program:
ORG0000H
CLRP1.0
CLRP1.1
CLRP1.2
CLRP1.3
SETBP2.7
MONITOR: JNBP2.7,CLOCK
SETBP1.0
CLRP1.1
CLRP1.2
SETBP1.3
SJMPMONITOR
CLOCK: CLRP1.0
SETBP1.1
SETBP1.2
CLRP1.3
SJMPMONITOR
END

NIT , Raichur

Page8
8051 Interfacing and Applications

Microcontroller

PulseWidthModulation(PWM):
Thespeedofthemotordependson3parameters:load,voltageandcurrent.Foragivenload,
wecanmaintainasteadyspeedbyusingPWM.Bychangingthewidthofthepulseappliedto
DCmotor,powerprovidedcaneitherbeincreasedordecreased.Thoughvoltagehasfixed
amplitude,hasavariabledutycycle.Thewiderthepulse,higherthespeedobtained.Oneof
thereasonsastowhydcmotorarereferredoveracis,theabilitytocontrolthespeedofthe
DCmotorusingPWM.Thespeedoftheacmotorisdictatedbytheacfrequencyofvoltage
applied to the motor and is generally fixed. Hence, speed of the AC motors cannot be
controlledwhenloadisincreased.
Figure5belowshowsthepulsewidthmodulationcomparison.

Figure5:PWMcomparison
Example7and8arethe8051Cversionoftheprogramswrittenearlier.

Example7:AswitchisconnectedtopinP2.7.WriteaCtomonitorthestatusoftheSW.
IfSW=0,DCmotormovesclockwiseandifSW=1,DCmotormovesanticlockwise.

Program:
#include<reg51.h>
sbitSW=P2^7;sbit
Enable=P1^0;
sbitMTR_1=P1^1;
sbitMTR_2=P1^2;
voidmain()
{
SW=1;
Enable=0;
MTR_1=0;
MTR_2=0;
while()
{
Enable=1;
if(SW==1)
{ MTR_1=1;
MTR_2=0;
}
else
{ MTR_1=0;
MTR_2=1;
}}}
NIT , Raichur

Page9
Microcontroller

Example8:AswitchisconnectedtopinP2.7.WriteanCtomonitorthestatusoftheSW.
IfSW=0,DCmotormoves50%dutycyclepulseandifSW=1,DCmotormoveswith
25%dutycyclepulse.

Program:
#include<reg51.h>
sbitSW=P2^7;sbit
MTR=P1^0;void
main()
{
SW=1;
MTR=0;
while()
{
if(SW==1)
{MTR=1;
Msdelay(25);
MTR=0;
Msdelay(75);
}
else
{MTR=1;
Msdelay(50);
MTR=0;
Msdelay(50);
}
}
}

Theinterfacingdiagramsfortheaboveexamplescanbereferredtothetext.

Вам также может понравиться