Beruflich Dokumente
Kultur Dokumente
DC MOTOR CONTROL
Name: ____________________________________
Section: ECE41
DURATION: 3 Hours
OBJECTIVES:
BACKGROUND:
The H-Bridge type of design is an effective way of controlling the direction and
speed of a DC motor.
76
SW2
SW1
SW-SPST
SW-SPST
BAT1
12V
DC Supply
+88.8
SW4
SW3
SW-SPST
SW-SPST
MATERIALS/COMPONENTS (Optional):
4 Mhz Crystal Oscillator
- 1 piece
- 1 piece
- 1 piece
(N-Channel) - 2 pieces
- 1 piece
2N7000
- 2 pieces
- 1 piece
PIC16F84A
- 1 piece
77
EQUIPMENT:
Computer with installed MPLAB IDE V.8.33
PIC Start Plus Programmer or equivalent
DC Motor Control circuit Board with model no. 2012E7B4(01-10)V1
DC Power Supply
IC Puller
TOOLS:
Breadboard
Connecting Wires
PROCEDURE:
Part 1: Clockwise Direction
a.
Open the MPLAB IDE software. Using the project wizard, choose
PIC16F84A as the device.
Create a folder and name it as Expt_7.1. Use the DC_Motor1 as the
b.
Compile the copied PIC16F84A template using Ctrl F10 of your keyboard.
Make sure that it is working properly before you proceed to the next step.
Type the given source code for H-Bridge dc motor shown below.
d.
;**********************************************************************
;
Filename:
File Version:
;**********************************************************************
78
list
p=16F84A
#include <p16F84a.inc>
CODE 0x0000
goto start
; go to beginning of program
MAIN_PROGRAM CODE
start:
banksel
TRISB
; Bank 1
bcf
TRISB, 0
bcf
TRISB,1
banksel
PORTB
; Bank 0
bsf
PORTB,0
bsf
PORTB,1
PORTB,1
Stop_Motor:
Start_Motor:
bcf
goto $
;-----------------------------------------------------------------------------------------END
; directive 'end of program'
;************************************************************************************************************
e.
79
f.
VDD
+
5V
10k
10k
R3
1k
10k
VCC
+
6V
12V
C1
100uF
R2
1k
Q2
P-Channel
Q3
P-Channel
IRF9530
IRF9530
S1
-
Reset
Button
RA0
RA1
RA2
RA3
RA4T0CKI
4
16
MCLR
OSC1CLKIN
VSS
VDD
RB0INT
RB1
RB2
RB3
RB4
RB5
RB6
RB7
OSC2CLKOUT
14
6
7
8
9
10
11
12
13
15
2N7000
+
M
MOTOR
Q5
U1
17
18
1
2
3
2N7000
Q4
N-Channel
Q6
Q1
IRF530N
PIC16F84
X1
N-Channel
IRF530N
HC-49/U_4MHz
g.
Check your connections before you power up the circuit. If you are not
sure with your connections, kindly ask assistance from your professor.
h.
Adjust the power supply with the required voltages. Connect one at a time
the probes of power supply to your circuit board. Make sure that you do
not over supply the circuit.
Note: If you notice that the power transistors IRF530 and IRF9530
become hot easily, turn off the power supply immediately. It means that
there is something wrong with the circuit. Check again your connections.
Refer to the specification sheet of IRF530 and IRF9530 to check the pin
assignment of transistors.
i.
In the given source code in Part 1, modify the Start_Motor by changing all
the PORTB, 1 to PORTB, 0.
b.
c.
d.
Open the MPLAB IDE software. Using the project wizard, choose
PIC16F84A as the device.
Type the given source code for H-Bridge dc motor shown below.
d.
;**********************************************************************
;
Filename:
File Version:
;**********************************************************************
list
p=16F84A
#include <p16F84a.inc>
CODE 0x0000
goto start
; go to beginning of program
MAIN_PROGRAM CODE
start:
banksel
TRISB
; Bank 1
bcf
TRISB, 0
bcf
TRISB,1
banksel
PORTB
; Bank 0
bsf
PORTB,0
bsf
PORTB,1
bcf
PORTB,1
call
delay
bsf
PORTB,1
call
delay
goto
Start_Motor
Stop_Motor:
Start_Motor:
;-------------------------------------------------------------------------delay
movlw
movwf
0x0FF
M
movlw
0x0FF
D1
82
D2
movwf
; 1 cycle delay x M
decfsz
goto
decfsz
goto
return
N,f
D2
M,f
D1
; 1 cycle delay x N x M
; 2 cycle x N x M
; 1 cycle delay x M
; 2 cycle
delay x M
;2 cycle delay
;-----------------------------------------------------------------------------------------END
; directive 'end of program'
;************************************************************************************************************
e.
f.
Test the source code using the H-Bridge DC Motor Controller circuit shown
in Figure 7.1 or using a DC Motor Control circuit Board with model no.
2012E7B4(01-10)V.
g.
83
i.
Part 4: Exercises
a. Develop a source code for this condition: if button in RA3 is pressed, the
motor will rotate in clockwise direction. Write your codes in the space
provided below.
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
84
b. Develop a source code for this condition: if button in RA4 is pressed the
motor will rotates in counter clockwise direction. Write your codes in the
space provided below.
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
c. Develop a source code for this condition: if button in RA1 is pressed, the
motor will rotate in counter clockwise direction and once the button in RA0 is
pressed, the motor stops for 2 seconds and starts to rotate again in counter
clockwise direction. Write your codes in the space provided below.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
85
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
d. Develop a source code for a 40% full speed of DC motor.
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
______________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
86
SUMMARY:
________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
CONCLUSION:
________________________________________________________________
______________________________________________________________________
______________________________________________________________________
87
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
____________________________________________________________________
RECOMMENDATION:
________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
_____________________________________________________________________
REFERENCES:
Mano, M. Digital Design 4th ed. Singapore: Pearson Education, Asia, 2007
88
Bartee, T. Computer Architecture and Logic Design. New Jersey: John Wiley & Sons,
2004
PIC16F84a Datasheet.pdf
http://www.microchip.com
89