You are on page 1of 13

1

iu khin tc ng c mt chiu loi nh


1. S khi
S khi cho iu khin tc ca ng c mt chiu loi nh s dng vi
iu khin P89C664: (hnh 1)
Yu cu l s dng vi iu khin iu khin tc ng c DC theo chiu
thun v ngc v hin thc hai tc (nhanh v chm). Cng tc (nt nhn)
c dung to ra hai tc v tc ng quay ngc.
S khi c minh ha hnh 1, s dng vi iu khin P89C664.
Phng php iu khin tc l bng iu rng xung (PWM) dung P89C664.
t chn 7 P1.5=0 (logic 0) v p dng PWM vo chn P1.4 (chn 6) lm cho
ng c quay thun. Vic iu khin quay thun hay nghch t c bng
thit k cu ca mch iu khin ng c. Nu nt nhn khng c nhn th
ng c vn n nh. Gi s nt nhn 1 c thit lp PWM t s 6:4 v nt 2
c thit lp PWm vi t s 9:1.
PWM =

Ton
Ton
=
T
Ton + Toff

P89C664
ng c chy

Mch li
ng c

ng c

Ngc chiu

Tc 1

Tc 2

Ngc chiu

Nt nhn 1

Nt nhn 2
Nt nhn 3

Hnh 1
T s 6:4 c chu k tng T=6+4=10 v 6 chu k mc cao (1), 4 mc thp
(0). T s 9:1 c T=10, v 9 mc 1, v 1 mc 0.
Thanh ghi capture CCAP1L (low) v CCAP1H(high) l 8 bit v c 256 (28)
mc tng.
mc tng/chu k=256/10=25,6
v vy t s 6:4 =154 mc tng logic 1, 102 mc logic 0. T s 9:1=230 mc
logic 1 v 26 mc logic 0.

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

Hnh 2: Mch to mc logic 0/1


Vi iu khin P89C664 c 64 KB B nh chng trnh Flash, 1 KB b nh
Ram trn chip, 3 timer-To, T1, T2, dy b m lp trnh c (PCA), b thu
pht bt ng b a nng (UART), giao tip I2C. P89C664 c 44 chn dng
PLCC. VCC (chn 44), Vss(chn 22), T0/CEX3 (P3.4), T1/CEX4(P3.5), T2
(P1.0), P.14(CEX1), P1.5(CEX2), P3.0 (RxD), P3.1 (TxD), P3.2 (/INT0), P3.3
(/INT1).
2. iu khin ng c:
S cu c minh ha hnh 3. Mch tn dng cp transistor b ph
NPN/PNP T2/T3 v T4/T5. ng c dung khng qu 0,5 A trong khi diode to
in p dn gy bi dng chuuyn mch nhanh.

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

Hnh 3: Mch iu khin cu s dng ng vo t chn P1.4 v P1.5 iu


khin tc ng c mt chiu v hng quay.
ng c ngng (off) khi P1.4 v P1.5 logic 0, cc C ca T1 v T6 mc cao.
V vy T2 v T4 s dn (on) trong khi T3 v T5 tt (off)(khng dn) v khng
c dng dn qua ng c gia 5V v t (GND, mass).
ng c quay(on): khi P1.5=0, cc C ca T6 s cao, T4 dn v T5 tt. Nu
tn hiu PWM p dng vo P1.4 th khi PWM logic 1, T1 dn, cc C ca T1
mc thp; v vy T2 tt v T3 dn. Do dng in dn qua t thong qua
transistor T3, ng c Dc v qua transistor T4 ln ngun +5V.
ng c quay ngc(reverse): Nu P1.4=0 (logic 0) th T2 dn v T3 tt. Nu
tn hiu PWM p dng vo P1.5 th khi PWM l logic cao (1), transistor T4 tt
v T5 dn, to ra dng in dn ngc thong qua T5, ng c v T2.
5.6.3. Hoch nh chng trnh:
Chng trnh iu khin ng c theo mt hng t chn P1.4 dng phng
php iu rng xung, c cu trc t dy m lp trnh c (PCA). Quay
ngc t c bng cch p t PWM chn P1.5.
Hai tc l : nhanh (9:1) v chm (6:4). Nghch o v tc c chn t
nt nhn on/off tch cc mc thp (logic 0).
Chng trnh kim tra nt nhn bng hnh ng ngt /INT0 mc thp chn
P3.2. Chng trnh sau khai bo vect ngt c a ch 0003H v ch ti chui
uc chn ngt CHECK.
Org 03h; a ch ngt ngoi 0
Sjmp check; nhy ti chng trnh phc v ngt
Khi ng (START)
CFH=1100 1111 b v iu ny lm cho chn 4 v 5 ca port 1 l bng zero v
v vy hnh ng u tin ca chng trnh l tt ng c.
SETB IT0 bt ngt xy ra trn chuyn t mc cao sang thp (cnh xung) ca
hnh ng nt nhn trn chn 2 ca port 3 (/INT0).
MOV IEN0,#81H t s nh phn 1000 0001 vo thanh ghi cho php ngt IE
IEN0 cho php hnh ng ca /INT0.
Kim tra (CHECK)
Cc nt nhn ca port 1 chn s 0 (quay ngc), chn 1(6:4 tc 1), chn
2(9:1 tc 2) l bnh thng logic 1. Khi nt nhn c nhn, chng chuyn
thnh logic 0 v lnh JNB (jump if not bit) tr nn tch cc v gi chng trnh
ti chng trnh phc v tng ng.
Tc (SPEED)
Vi tc 1 v tc 2, hnh ng PWM l thong qua chn 4 trn port 1 khi
cho quay ngc, tc 1R v tc 2R, hnh ng PWM l thong qua chn 5
ca port 1. Nh vy hnh ng ca hai dng chng trnh u tin ca bn
chng trnh con ny l khng cho php hnh ng PWM trn chn i din.
Chng trnh: Sinh vin lm nh mt bi tp.
Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

Bi tp: Vit chng trnh hp ng iu khin ng c DC trn dung Keil


Vision 2 hay TopView.
M phng: dung Proteus.
Chng trnh:
$include (REG66x.inc)
; a ch SFR
org 0
; a ch reset
sjmp START
;nhy ti START
org 03h
; a ch ngt ngoi 0
sjmp CHECK
;nhy ti chng trnh con ngt
org 40h
; a ch bt u chng trnh
START: mov p1,#0CFh
; ng c li v zero (0).
setb IT0
;ngt trn cnh m
mov IEN0,#81H
; ngt ngoi 0 INT0 c cho php
STAY: SJMP STAY
;ch y cho ti khi ngt xy ra.
CHECK: JNB P1.0, REVERSE; nu c chn nhy ti reverse
JNB P1.1, SPEED1 ; nhy ti tc 1 6:4
JNB P1.2, SPEED2 ; nhy ti tc 2 9:1
SJMP CHECK
;kim tra nt nhn tr li
SPEED1: ANL CCAPM2,#0FDH; xo PWM li trn chn P1.5
CLR P1.5
; t P1.5 v logic 0
ORL CCAPM1,#42H; bt (set) ECOM1 v PWM1(P1.4)
MOV CCAP1L,#102; np gi tr m 6;4
MOV CCAP1H,#102; m 6:4 c np li
ORL CCON,#40H ; bt CR bt timer PCA ln
RETI
;tr v t ngt
SPEED2: ANL CCAPM2,#0FDH; xa PWM li trn P1.5
CLR P1.5
; t P1.5 v logic 0
ORL CCAPM1,#42H ; bt ECOM1 v PWM1(P1.4)
MOV CCAP1L,#26; np s m 9:1
MOV CCAP1H,#26; s m 9:1 c np li
ORL CCON,#40H ; bt CR bt timer PCA ln
RETI
;tr v t ngt
REVERSE: JNB P1.1,SPEED1R; nhy ti quay ngc speed1
JNB P1.2, SPEED2R; nhy ti quay ngc speed2
SJMP CHECK
;kim tra nt nhn ng vo
SPEED1R: ANL CCAPM1,#0FDH; xo PWM li trn P1.4
CLR P1.4
; t P1.4 v logic 0
ORL CCAPM2,#42H ; bt ECOM2 v PWM2 (P1.5)
MOV CCAP2L,#102; np gi tr m 6;4
MOV CCAP2H,#102; m 6: 4 c np li
ORL CCON,#40H ;bt CR bt timer PCA ln
RETI
;tr v t ngt
SPEED2R: ANL CCAPM1,#0FDH; xa PWM li trn P1.4
Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

CLR P1.4
; t P1.4 v logic 0
ORL CCAPM2,#42H; bt ECOM2 v PWM2
MOV CCAP2L,#26
; np s m 9:1
MOV CCAP2H,#26
, m 9:1 c np li
ORL CCON,#40H
;bt CR bt timer PCA ln
RETI
;tr v t ngt
END
Chng trnh dung phn mm Raisonance. Bn c th dung Keil Vision hay
TopView.
Tham kho: David Calcutt, Fred Cowan, Hassan Parchizadeh, 8051
Microcontrollers: an Application based introduction, Newnes (Elsevier), 2004.

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

Bi 6: Hin thc h thng iu khin tc v v tr ng c mt chiu

I.Mc tiu:
Kho st lm m hnh ng c dung vi iu khi nPIC
16F877A/887 giao tip my tnh.
Nhn dng hm truyn ng c DC dng p ng n c h h ca ZieglerNichols.

iu khin v thu thp d lu tc v v tr ng c theo


phng php on/off.
-S dng chng trnh VB6.0, v chng trnh CCS cho PIC.
Cm bin tc l encoder.
II. C s l thuyt:

1. S khi iu khin
Khi my
tnh

Khi Vi
iu
khin
PIC

Khi
cng sut
(cu H)

Khi
ng c
DC

Khi
Encoder

Hnh S khi iu khin


Khi my tnh
Dng ngn ng lp trnh Visual Basic 6.0 lm phng tin giao tip. Nhim
v ca VB6 l:
To giao din ngi dng giao tip vi ngi s dng. Trn cho
php thay i gi tr tc yu cu, thay i b thng s PID, chn chiu quay
ca ng c, v th biu din p ng ca h thng.
Thit lp giao tip vi khi Vi iu khin qua cng ni tip RS 232.
Ly gi tr o tc thc t do khi vi iu khin truyn v x l.
T gi tr o tc thc t, thc hin thut ton PID xut gi tr rng
xung v khi Vi x l iu khin.
Xut gi tr iu khin chiu quay ca ng c c thit lp trn giao
din ngi dng.
Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

Khi vi iu khin
Dng ngn ng lp trnh C (CCS C) cho PIC 16F877A/887 lp trnh cho
Vi iu khin PIC. Nhim v ca khi Vi iu khin l:
Thit lp giao tip vi my tnh qua cng giao tip ni tip.
Thc hin thut ton PID s , s dng tnh nng iu rng xung(PWM).
Thc hin vic ly tc thc t ca ng c t khi encoder v truyn
gi tr ny v cho khi my tnh x l.
Khi cng sut
Nhim v ca khi ny l:
Khuch i cng sut t tn hiu iu khin do khi vi iu khin truyn
ti iu khin ng c DC.
Cho php o chiu quay ca ng c thng qua cu H.
Khi ng c DC
Khi nhn c xung iu khin t khi cng sut, ng c s quay vi tc
ph thuc vo rng ca xung truyn ti. ng c DC servo c tch hp
sn encoder (200 xung).
Khi encoder
o tc ca ng c bng cch xut xung lin tc v cho khi Vi iu
khin. ng c quay nhanh hay chm ty thuc vo s xung xut ra trong mt
khong thi gian. Vic nh thi gian ly mu c thc hin t khi vi iu
khin.
2.Hm truyn ng c:
Hm truyn ng c DC:
ng c DC l thit b truyn ng cng sut m phn phi nng lng
ra ti.
ng c mt chiu c m t hnh sau:

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

Hnh 5.9: S ni dy ca ng c DC
Trong : Load : ti; Armature: phn ng, Field: trng; Inertia: m men
qun tnh; Friction: ma st.
T thong ca ng c t l vi dng in t, gi s t trng khng bo
ha:
= K f if
(1)
M men ca ng c c gi s l tuyn tnh vi v dng in phn
ng ia (armature current)
(2)
Tm = K1 .ia (t ) = K 1 K f i f (t )ia (t )
hay Tm (t ) = K m .ia (t )
trong o K1 la hang so t le.
Sc phan ien ong: Vb = K 1 .
d (t )
Hay Vb (t ) = K b
= K b (t )
dt

R rang t phng trnh (2) c phn t tuyn tnh, mt dng in phi


l hng s. Trng hp ia=Ia dng in phn ng khng i ta c ng c c
iu khin bng dng t (field current controlled motor). Xt trng hp ng
c DC c iu khin bng phn ng (armature controlled DC motor), ng
c s dng dng ia nh l bin iu khin. Phn cm (stator) dung cun dy t
v dng hay t trng khng i. Khi dng in t khng i c thit lp
trong cun dy t, m men ng c l
Tm ( s ) = TL ( s) + Td ( s )
(3)
M men ng c bng m men phn phi cho ti. Quan h ny c
minh ha (3). Trong , TL(s) l m men ti v Td(s) l m men ca nhiu (the
hien momen ma sat tai nh la ma sat Coulomb).
Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

9
Tm ( s ) = ( K 1 K f I f ) I a ( s ) = K m I a ( s )

(4)

vi K m = K1 : hang so momen.
Khi t trng khng i c dung, ta c
Tm ( s ) = K m I a ( s )

M men ti cho qun tnh quay c vit nh sau:


d 2 (t )
d (t )
+b
= Tm (t ) Td (t )
2
dt
dt
TL ( s) = Js 2 ( s) + bs ( s) = Tm ( s ) Td ( s )

TL (t ) = J

(8)
trong Km l hm ca t tnh ca vt liu t.
Dng in phn ng c quan h vi in p vo t vo phn ng
(armature) Va(s) ( goi la U):
di a (t )
+ Vb (t )
dt
Va ( s ) = Ra I a ( s ) + La sI a ( s ) + Vb ( s )

Va (t ) = Ra ia (t ) + La

(5)

trong Ra l in tr phn ng
La l in cm phn ng.
Va l in p vo t vo phn ng.
Vb(s) (goi la E) l in p in ng ngc (sc phn in ng phan
ng) v t l vi tc ng c.
Vb ( s) = K b ( s)
(6)
v dng in phn ng
I a (s) =

Va ( s ) K b ( s)
( R a + La s )

(7)

Quan h cho ng c DC c iu khin bng phn ng c minh ha


hnh sau:
S dng phng trnh (4), (7) v (8) hay s khi v cho Td(s)=0, ta
gii v t c hm truyn sau:
G ( s) =
=

(s)
Va ( s )

Km
s[( Ra + La s )( Js + b) + K b K m ]

Km

(9)

.
s ( s 2 + 2 n s + n2 )
Km
(s)
hay G ( s) =
=
3
Va ( s ) La Js + ( Ra J + bLa ) s 2 + ( K b K m + Ra b) s

Phng trnh trang thai: khi co nhieu Td(t)


dia (t ) Ra
dt La
d K

= m
dt J
d 0
dt

Kb
La
b

J
1

0
1
0
i
(
t
)
a La
1

0 (t ) + 0 Va (t ) + Td (t ) (10)

0J
0 (t ) 0

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

10

trong o Td(t) c xem la ngo vao th hai trong phng trnh trang
thai.
Khi khong co nhieu Td(t), Phng trnh trang thai:
dia (t ) Ra
dt La
d K

= m
dt J
d 0
dt

0
1
i
(
t
)
a La

0 (t ) + 0 Va (t )
(11)

0
0 (t )

Tuy nhin, i vi nhiu ng c DC, hang so thi gian ien t cua ong c
(hng s thi gian ca phn ng) a = La / Ra b b qua nn ta c

G ( s) =

(s)
Va ( s )

Kb
La
b

J
1

Km
[ K /( Ra b + K b K m )]
(12)
= m
s[ Ra ( Js + b) + K b K m ]
s ( 1 s + 1)

trong hng s thi gian tng ng 1 = Ra J /( Ra b + K b K m ). , con goi la


hang so thi gian ien c cua ong c.Ch l Km bng Kb (Km=Kb=Ce). S
bng nhau ny c minh ha bng cch xem xt hot ng ng c trng
thi xc lp v cn bng cng sut khi in tr rotor b b qua.

Armature
Va(s)+

Tm(s)
Km
Ra + sLa

Td(s)
- TL(s)

1
J .s + b

1
.s V tr

Vb(s)
Kb

Hnh 5.10 : S khi ng c mt chiu c iu khin bng phn ng.


Khi xet ham truyen cua toc o, ta co :

G ( s) =
=

( s)
Va ( s )

Km
[( Ra + La s)( Js + b) + K b K m ]

Km
( s 2 + 2 n s + n2 )

(13)

va khi bo qua a = La / Ra th ham truyen toc o la:


Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

11

G(s) =

( s)

Va ( s )

[ K m /( Ra b + K b K m )]
1s + 1

(14)

ay la khau quan tnh bac nhat.


Khi b qua phn ng phn ng, b qua ma st (b=0) v gi s cc phn
t trong h thng l tuyn tnh, c cc phng trnh sau:
di
dt
d
Mc = J
dt
= Cei

U = E + Ri + L
M dc
M dc

(15), (16), (17) va (18)

E = C e

trong :
U : in p hai u phn ng.
I : dng in qua ng c.
R,L: in tr, t cm mch in phn ng.
E, Mdc: s c in ng, moment quay ca ng c.
J: moment qun tnh ca cc phn quay v Mc l moment cn.
Ce=Km : hang so momen
T phng trnh trn , c th suy ra hm truyn ng c nh hnh sau , cho
Mc=0 :

1R
1 + sL / R

Mc
Mdc -

I
Ce

1
J .s

E
Ce

Hnh5.11 : S khi ng c mt chiu khi t thng khng i.


Ham truyen toc o :
G ( s) =

( s)
Va ( s )

Ce
La Js + ( Ra J ) s + Ce 2
2

(19)

Ham truyen v tr :
G ( s) =

(s)
Va ( s )

Ce
La Js + ( Ra J ) s 2 + Ce 2 .s
3

(20)

3.p ng nc h h theo Ziegler-Nichol:

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

12

Xem l thuyt bi 5 Hin thc h thng iu khin nhit .


4.iu khin on/off:
Xem l thuyt bi 5 Hin thc h thng iu khin nhit .

III. Th nghim

1. Th nghim kho st h h :
Mc ch : Xc nh thng s hm truyn ng c t th qu trnh qu
h h vi u vo hm nc.
Mt cch gn ng, c th gi thuyt ng c mt chiu c hm truyn l khu
bc nht c hm truyn nh sau :
Udk

K
Ts + 1

wdco

Trong K : h s biu din quan h vo ra : K=wdco/Udk.


2.iu khin tc theo phng php on/off vng kn:

R +

B iu khin
on/off

ng c DC

Trong :
R: tc t.
C: tc o c.
E:sai lch= r-c

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc

13

U: tn hiu iu khin.

1. iu khin v tr theo phng php on/off vng kn:

Trong :
R: v tr gc t.
C: v tr gc o c.
E:sai lch= r-c
U: tn hiu iu khin.

IV. Bo co kt qu:
Sinh vin np bo co v ging vin nhn xt, nh gi.

Hng dn th nghimiu khin t ng (b sung)-Hunh Minh Ngc