Thursday, March 31, 2016

8051 DC Motor Interfacing

A direct current (DC) motor is used to translate electrical pulses into mechanical movement. In the DC motor we have only + and – leads. Connecting them to a DC voltage source moves the motor in one direction. By reversing the polarity, the DC motor will move in the opposite direction. With the help of relays or some specially designed chips we can change the direction of the DC motor rotation. H-Bridge concept can be used to control the direction of DC motor.

8051 DC Motor Interfacing

H-Bridge Logic Configurations:
Motor Operation P1 P2 P3 P4
Off Open Open Open Open
Clockwise Closed Open Open Closed
Counter Clockwise Open Open Closed Closed
Invalid Closed Closed Closed Closed

Program to move DC motor clockwise and counter clockwise.

ORG 0H
MAIN: CLR P1.0 ; P1
CLR P1.1 ; P2
CLR P1.2 ; P3
CLR P1.3 ; P4
SETB P2.7
MONITOR: JNB P2.7, CLOCKWISE
SETB P1.0 ; P1
CLR P1.1 ; P2
CLR P1.2 ; P3
SETB P1.3 ; P4
SJMP MONITOR
CLOCKWISE: CLR P1.0 ; P1
SETB P1.1 ; P2
SETB P1.2 ; P3
CLR P1.3 ; P4
SJMP MONITOR
END


By changing the width of the pulse applied to the DC motor we can increase or decrease the amount of power provided to the motor, thereby increasing or decreasing the motor speed. Although the voltage has fixed amplitude, it has a variable duty cycle. That means the wider the pulse, the higher the speed. We can create the various duty cycle pulses using software.

8051 DC Motor Interfacing - PWM

Program to generate pulse of different duty cycle.
ORG 0H
MAIN:
CLR P1.0
SETB P2.7
MONITOR:
JNB P2.7, FIFTYPERCENT
SETB P1.0 ; high pulse
MOV R5, #25
ACALL DELAY
CLR P1.0 ; low pulse
MOV R5, #75
ACALL DELAY
SJMP MONITOR
FIFTYPERCENT:
SETB P1.0
MOV R5, #50 ; high pulse
ACALL DELAY
CLR P1.0 ; low pulse
MOV R5, #50
ACALL DELAY
SJMP MONITOR
DELAY:
HERE1: MOV R2, #100
HERE2: MOV R3, #255
HERE3: DJNZ R3, HERE3
DJNZ R2, HERE2
DJNZ R5, HERE1
RET
END



Related topics:
8051 External Program Memory Interfacing   |   8051 External Data Memory Interfacing   |   8051 Memory Mapped IO   |   8051 LED Interfacing   |   8051 Switch Interfacing   |   8051 Keyboard Interfacing   |   8051 7-Segment Display Interfacing   |   8051 LCD Interfacing   |   8051 ADC Interfacing   |   8051 DAC Interfacing   |   8051 Relay Interfacing   |   8051 Sensor Interfacing   |   8051 Stepper Motor Interfacing

List of topics: 8051

No comments:

Post a Comment