Workshop 16F877 5sx

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Assignment 35

DC Motor Control [ 1 ]
(Continuous running control)

(DC Motor)

(DC Motor) 3
1. - (ON - OFF Control)
2. (Direction Control)
3. (Speed Control)
H Bridge

N.O..

N.O..

com.

com.

com.
N.O..
.

com.
N.O..
.

4 .
4
1. Free Run Stop 4 .

2. Forward Drive RY1 RY4 2 .


A B
3. Reward Drive RY2 RY3 2 .
B A
4. Fast Stop Brake RY2 RY4 RY1 RY3 2
.

2
4
Circuit Diagram

1
H Bridge 8 Model SE-RYI-8 4
. PortB Model SE-PIC877

1. 1
2. 12 H Bridge


s_off
fwd
rwd
brake
trisa
trisb
adcon1
portb

var
var
var
var
=
=
=
=

portb.3
portb.2
portb.1
portb.0
%111111
%00000000
7
0

start:
if (s_off = 0) and (fwd = 1) and (rwd = 1) and (brake = 1)
if (s_off = 1) and (fwd = 0) and (rwd = 1) and (brake = 1)
if (s_off = 1) and (fwd = 1) and (rwd = 0) and (brake = 1)
if (s_off = 1) and (fwd = 1) and (rwd = 1) and (brake = 0)
pause 50
goto start
end
--------------------------- End of Program ----------------------------

then
then
then
then

portb
portb
portb
portb

=
=
=
=

%0000
%1001
%0110
%1010

Assignment 36

DC Motor Control [ 2 ]
(Jogging control)

(DC Motor)
(Jogging Control)

(DC Motor) Jogging


Assignment 35
Jogging
2
fwd rwd

Assignment 35

fwd
rwd
trisa
trisb
adcon1
portb

var
var
=
=
=
=

portb.2
portb.1
%111111
%00000000
7
0

start:
if (fwd = 1) and (rwd = 1) then portb = %1010
if (fwd = 0) and (rwd = 1) then portb = %1001
if (fwd = 1) and (rwd = 0) then portb = %0110
pause 50
goto start
end
--------------------------- End of Program ----------------------------

Assignment 37

DC Motor Control [ 3 ]
(Speed control)

(DC Motor)
( Speed Control )

(DC Motor) 2
1. (Linear DC voltage Control)

(Armature
Voltage)
VCE
Armature Voltage

VCE
VBE

1

SPEED

active
2. (Switching Control) VBE Control Voltage Cutoff Saturate
Active

2 PWM

2
ON OFF Duty cycle
(Pulse Generator)
400 Hz - 2 KHz
duty cycle
1
% Duty cycle = Pulse width X 100
Cycle

------------------------ 1

duty cycle
2

Voutput

= %Duty cycle X

Vsupply

------------------------ 2

2
%Duty- cycle PWM
(PWM : Pulse Width Modulation) PWM
Pulse Width

PWM
PIC16F877 PWM
2
I/O 2 RC2
HPWM 1 RC1 HPWM 2

HPWM chanel, duty cycle, frequency

PIC BASIC PRO RC2 PWM chanel 1


duty cycle A/D RA0 duty cycle

PWM Signal

'*************************************************
'* Name : Speed.BAS
'* Author : Somboon Niamglam
'* Notice : PIC16F877 MCU
'*
: Speed Control
'* Date
: 15/09/2005
'* Version : 1.0
'*************************************************
DUTY VAR BYTE
SPEED VAR BYTE
BRAKE VAR PORTA.3
ADCON1=14
TRISA =%111111
TRISC =%00000000

START: IF (BRAKE=0) THEN


HPWM 1,0,800
ELSE
ADCIN 0,SPEED
HPWM 1, speed, 800
ENDIF
PAUSE 50
GOTO START
END

Assignment 38

DC Motor Control [ 4 ]
(Speed and Direction control)

(DC Motor)
( Speed Control ) (Direction Control)

(DC Motor)
H-Bridge
PWM

1 MOSFET H Bridge
POWER MOSFET 4
Opto Isolated Gate Drive Opto Isolated
Gate Drive INA INB
POWER MOSFET H Bridge
Complementary
EN / PWM POWER MOSFET

2 MOSFET H Bridge SE HB 60

3 MOSFET H-Bridge

DUTY VAR BYTE


SPEED VAR BYTE
BRAKE VAR PORTA.3
FWD
VAR PORTA.2
RWD
VAR PORTA.1
ADCON1 = 14
TRISA = %111111
TRISC = %00000000

START: IF (BRAKE=0) AND (FWD=1) AND (RWD=1) THEN


HPWM 1,255,800
ELSE
IF (BRAKE=1) AND (FWD=0) AND (RWD=1) THEN LOW PORTC.0:HIGH PORTC.1
IF (BRAKE=1) AND (FWD=1) AND (RWD=0) THEN HIGH PORTC.0:LOW PORTC.1
ADCIN 0, SPEED
DUTY = 255 - SPEED
HPWM 1, DUTY, 800
ENDIF
PAUSE 50
GOTO START
END

You might also like