Upload
muhd-izwan-ikhmal-rosli
View
286
Download
2
Embed Size (px)
Citation preview
8/9/2019 Chapter 4 Plc Programming
1/100
BAKISS HIYANA BT ABU BAKAR
CHAPTER 4:PLC
PROGRAMMING
8/9/2019 Chapter 4 Plc Programming
2/100
Course Learning Outo!es "CLO#
$% E&'(ain (ear() *(o+s, 'arts, o!'onentsan- instrutions .oun- in t/e auto!ations)ste!s% "C0#
0% Construt si!'(e auto!ation se1uentia(ontro( o. /ar-2ire- or PLC s)ste! *ase-on IEC 3$$$ an- NEMA stan-ar-s% "C4#%
8/9/2019 Chapter 4 Plc Programming
3/100
Specifc Objectives:
A.ter o!'(ete- t/is /a'ter, stu-ent 2i(( +no2 t/e !a5or
o!'onent
• 6a!i(iari7e 2it/ t/e PLC Progra!!ing s)ste!
• A*(e to e&'(ain PLC 'rogra!!ing !et/o- using La--er8iagra! an- !ne!oni o-e, Instrution set an- (ogi
.untion%• Un-erstan- an- use La--er 8iagra! an- !ne!oni o-e
to so(9e ontro( s)ste!s iruits%
• E&'(ain t/e .o((o2ing (ogi instrution set: Loa-% Loa- Not,Out, An-, An- Not, Or, Or Not, EN8, No O'eration, An- L-an- Or L-%
• E&'(ain se1uentia( instrution set: Inter(o+, u!', Kee',Set;Reset, Mo9e, S/i.t Register, Arit/!eti 6untion an-8i
8/9/2019 Chapter 4 Plc Programming
4/100
4.1 PLC PROGRAMMING SYSTEM
DEFINITION
An ati9it) o. '(anning, *ui(-ing
an-e&euting a 'rogra! to 'er.or!
t/e
tas+s re1uire-
8/9/2019 Chapter 4 Plc Programming
5/100
4.1 PLC PROGRAMMING SYSTEM
Here are t/e 'arts t/at s/ou(- *e t/ere in a PLC
'rogra!:
8/9/2019 Chapter 4 Plc Programming
6/100
4.1.1 F!"#s PLC P$"%$!!i&% Met'"(
IEC $$$= is t/e internationa( stan-ar- .or 'rogra!!a*(e
ontro((er 'rogra!!ing (anguages% T/e .o((o2ing is a (ist o. 'rogra!!ing (anguages s'ei>e-
*) t/is stan-ar-:
i% La--er 8iagra! "L8#
ii% Mne!oni Co-e
iii% Instrution List;Set "IL#i9% 6untion B(o+ 8iagra! "6B8#
9% Se1uentia( 6untion C/art "S6C#
9i% Struture- Te&t "ST# ;?in-o2s Base- 'rogra!
One o. t/e 'ri!ar) *ene>ts o. t/e stan-ar- is t/at it a((o2s!u(ti'(e (anguages to *e use- 2it/in t/e sa!e'rogra!!a*(e ontro((er%
T/is a((o2s t/e 'rogra! -e9e(o'er to se(et t/e (anguage
*est suite- to ea/ 'artiu(ar tas+%
8/9/2019 Chapter 4 Plc Programming
7/100
i% La--er 8iagra! "L8#
• La--er 8iagra! is +in- o. gra'/ia( 'rogra!!ing(anguage t/at /ange- t/e re(a) ontro( 2iring iruit-iagra!%
• La--er 8iagra! ontains rig/t an- (e.t 9ertia( (ine tore'resent bus bar , .or @9e =9e 'o2er (ine %
• T/e /ori7onta( (ine onnets *us *ar is a((e- logic line 2/i/ '(aing o. s2it/ing e(e!ents o. n NO & NC andOUTPUT
• T/e o!*ination o. s2it/ing e(e!ent is a((e- as Rung
• La--er -iagra! a(so s/o2s t/e ontro( iruit an- t/e-is'(a) .untion an- a o!*ination o. t/e se1uene o.
o'erations .or ea/ *ran/ o. t/e /ori7onta( (inesse'arate()%
8/9/2019 Chapter 4 Plc Programming
8/100
Gra'/ia( -iagra! o. La--er 8iagra!
8/9/2019 Chapter 4 Plc Programming
9/100
Base- on t/e 'iture a*o9e, one s/ou(- note t/at a (a--er
-iagra! onsists o. t2o *asi 'arts: (e.t setion a(so a((e-on-itiona(, an- a rig/t setion 2/i/ /as instrutions%
T/e 'airs o. 9ertia( (ines a(ong t/e *ran/ (ine is a((e- t/eon-itions% T/ese on-itions onsist o. t2o, na!e():
i% Nor!a(() o'en on-ition "NO#ii% Nor!a(() (ose- on-ition "NC#
?/en a on-ition is .u(>((e-, instrution is e&eute-%
8/9/2019 Chapter 4 Plc Programming
10/100
N"tes:
• Nor!a(() o'en on-ition is ON i. t/e *it o'eration is ON an-2i(( *e O66 i. t/e *it o'eration is O66 %
• Nor!a(() (ose- on-ition is ON i. t/e *it o'eration is O66 an-2i(( *e O66 i. *it o'eration is ON%
8/9/2019 Chapter 4 Plc Programming
11/100
C"!p$is"& bet)ee& $e*+ )i$i&% &(L((e$ Di%$!
RELAY ?IRING LA88ER 8IAGRAM
8/9/2019 Chapter 4 Plc Programming
12/100
ii% Mne!oni Co-e
• T/ese instrutions an *e-eri9e- -iret() .ro! t/e (a--er(ogi -iagra!s an- entere- intot/e PLC t/roug/ a si!'(e'rogra!!ing ter!ina(%
• La--er -iagra!s an not *erea- *) t/e 'rogra!!ingConso(e%
• T/ere.ore La--er 8iagra!s /as
to *e on9erte- to !ne!onio-e t/at 'ro9i-es t/e sa!ein.or!ation as La--er 8iagra!an- an *e t)'e- -iret() ont/e onso(e 'rogra!!ing%
ADDRESS INSTRUCTION DATA
00000 LD 00000
00001 OR 00001
00002 AND 00003
00003 AND LD
00004 OUT 01000
00005 TIM 000
#0050
00006 CNT 002
#0010
00007 FUN 01
8/9/2019 Chapter 4 Plc Programming
13/100
iii% Instrution List;Set "IL#
• T/is (o2=(e9e( (anguage is si!i(ar to Asse!*() (anguage an-is use.u( in ases 2/ere s!a(( .untions are re'eate- o.ten%
• A(t/oug/ it is 'o2er.u(, it is onsi-ere- to *e -iu(t to(earn%
E&a!'(e:Ca(u(ate ne2 2eig/t *) su*trating tare 2eig/t .ro! net
2eig/t%
8/9/2019 Chapter 4 Plc Programming
14/100
i9% 6untion B(o+ 8iagra! "6B8#
• 6B8 is a gra'/ia( (anguage t/at a((o2s 'rogra!!ing inot/er (anguages "(a--er, instrution (ist, or struture- te&t#to *e neste- 2it/in t/e 6B8%
• In 6B8, 'rogra! e(e!ents a''ear as *(o+s 2/i/ are2ire- toget/er in a !anner rese!*(ing a iruit -iagra!%
• 6B8 is !ost use.u( in t/ose a''(iations in9o(9ing a /ig/-egree o. in.or!ation;-ata Do2 *et2een ontro(o!'onents, su/ as 'roess ontro(%
• T/e !ain one't is t/e -ata Do2 t/at start .ro! in'uts an-'asses in *(o+"s# an- generate t/e out'ut%
8/9/2019 Chapter 4 Plc Programming
15/100
i St t - T t "ST# ;?i - B -
8/9/2019 Chapter 4 Plc Programming
16/100
9i% Struture- Te&t "ST# ;?in-o2s Base-'rogra!• Progra!!ing /as *een -e9e(o'e- as a !ore !o-ern
'rogra!!ing (anguage% It is 1uite si!i(ar to (anguages su/
as BASIC an- Pasa(%• ST is i-ea( .or tas+s re1uiring o!'(e& !at/, a(gorit/!s or
-eision=!a+ing%
• Its onise .or!at a((o2s a (arge a(gorit/! to *e -is'(a)e-on a sing(e%
• Benefts o Structured Text:
Peo'(e traine- in o!'uter (anguages an easi() 'rogra!ontro( (ogi
S)!*o(s !a+e t/e 'rogra!s eas) to un-erstan-
Progra!s an *e reate- in an) te&t e-itor
Runs as .ast as (a--er
8/9/2019 Chapter 4 Plc Programming
17/100
E,!p*e 1
• ?e /a9e Motor t/at 2i(( *e ontro((e- !anua(() *) 0 'us/*uttons "Start Pus/ Button, an- Sto' Pus/ Button#%
• ?/en t/e Start Pus/ Button is 'us/e- t/en t/e Motor 2i((*e turne- ON%
• ?/en t/e Sto' Pus/ Button is Pus/e- t/en 2e 2ant to sto't/e Motor% "Seurit) (ogi /as *een ta+en o< t/is (ogi, .ort/e 'ur'ose o. -e!onstration%#
8/9/2019 Chapter 4 Plc Programming
18/100
4.1.- se *((e$ (i%$! &( !&e!"&ic c"(est" s"*ve c"&t$"* s+ste! ci$c#its.
• E&a!'(e$:
8/9/2019 Chapter 4 Plc Programming
19/100
• E&a!'(e 0:
instructin
00000 00003
00001
ADDRESS INSTRUCTION DATA
00000 LD 00000
00001 OR 00001
00002 AND 00003
00003 OUT 0100000004 FUN 01
01000
8/9/2019 Chapter 4 Plc Programming
20/100
E&a!'(e :
instructin
00000 00002
00001 00003
ADDRESS INSTRUCTION OPERAND / DATA
00000 LD 00000
00001 OR 00001
00002 LD 00002
00003 OR NOT 00003
00004 AND LD ------
00005 OUT 01000
00007 FUN 01
01000
8/9/2019 Chapter 4 Plc Programming
21/100
/sic Te$!s
8/9/2019 Chapter 4 Plc Programming
22/100
1. E,ec#ti"& C"&(iti"&s
Logia( o!*ination o. t/e ON an- O66 states gat/ere- to
esta*(is/ an instrution to *e i!'(e!ente-% T/is on-ition isa((e- E&eution Con-ition% Re.er to >gure *e(o2%
Instrutions 2i(( *e in t/e E&eution Con-itions ON 2/en IR is ON, IR $ is O66 an- IR 0 is ON%
8/9/2019 Chapter 4 Plc Programming
23/100
0% Ope$&( /its
Bit o'erations .or e9er)
instrution an *e o.an) *it in !e!or) areaso. IR, SR, HR, TC or TR%
It s/o2s t/at conditions
in La--er 8iagra! an*e -ei-e- *) I;O *it,fags, work bits, timers/counters et%
Ta*(e s/o2s t/e
!e!or) !a' re.ers tot/e PLC t)'e SYSMACOMRON=CFM$H
DATA AREAS !ITS FUNCTIONS
IR "r" In$ut"r"
IR00000 %IR00&15
Us' "s in$ut (it
Out$ut"r"
IR01000 )IR01&15
Us' "s ut$ut (it
*r+
"r"
IR02000 )
IR04&15
IR20000 )IR23115
Fr,- us' in "
$r.r"/ N s$ciic
unctin
SR "r" SR2200 )SR25515
!it us' "s ,".s "n'cntr, (it
TR "r" TR 0 ) TR 7 !it us' t str
t/$r"r- t ONOFFst"tus "t $r.r"/
unctin
R "r" R 0000 )
R 1&15
!it us' t str '"t" "n'
ONOFF st"tus n
$r
Ar" r
Ti/rCuntr
TC 000 ) TC
255
T s"/ nu/(r is us'
r ti/r "n' cuntr
TC000 t TC002 us' r8intr9", ti/r:
8/9/2019 Chapter 4 Plc Programming
24/100
0. L"%ic /*"c
T/e res'on- to an instrution is -eter!ine- *) t/ere(ations/i' *et2een t/e on-itions on t/e instrution (inet/at onnets t/e!%
An) grou' o. on-itions t/at .or!e- to 'ro-ue a (ogia(resu(t is a((e- a (ogia( *(o+%
8/9/2019 Chapter 4 Plc Programming
25/100
4. I&st$#cti"& /*"c
A *(o+ o. instrution is o!'ose- o. a(( t/e instrutions
ontaine- in a *(o+%
B(o+ is o*taine- *) -ra2ing a /ori7onta( (ine 2it/oututting a 9ertia( (ine an- 9ie 9ersa%
8/9/2019 Chapter 4 Plc Programming
26/100
2O3 PLC 3ORS 5
A PLC 2or+s *) ontinua(() scanning a 'rogra!2it/ onsisting o. i!'ortant ste's
8/9/2019 Chapter 4 Plc Programming
27/100
$% SCANNING
• Sanning is t/e 'roess o. CPU
8/9/2019 Chapter 4 Plc Programming
28/100
-. C2EC INPT STATS
6irst t/e PLC ta+es a (oo+ at ea/ in'ut to -eter!ine i. it ison or orst in'ut on Ho2 a*out t/e seon- in'ut Ho2 a*out t/e t/ir-%%% It
reor-s t/is -ata into its !e!or) to *e use- -uring t/ene&t ste'%
Ne&t t/e PLC e&eutes )our 'rogra! one instrution at ati!e% Ma)*e )our 'rogra! sai- t/at i. t/e >rst in'ut 2ason t/en it s/ou(- turn on t/e >rst out'ut%
6ina(() t/e PLC u'-ates t/e status o. t/e out'uts% Itu'-ates t/e out'uts *ase- on 2/i/ in'uts 2ere on -uringt/e >rst ste' an- t/e resu(ts o. e&euting )our 'rogra!-uring t/e seon- ste'%
0. E6ECTE PROGRAM
4. PDATE OTPT STATS
8/9/2019 Chapter 4 Plc Programming
29/100
4.- /ASIC LOGIC INSTRCTIONSET
T/ere are a (ot o. instrutions use- to
-e9e(o' t/e PLC 'rogra!%Ea/ instrution /as a res'eti9e
.untion%
8/9/2019 Chapter 4 Plc Programming
30/100
4.-.1 /sic L"%ic I&st$#cti"&
a# Loa- "L8#:
) T/ese instrutions are use to start a (ine o. t/e'rogra!%
) It is use- in t/e >rst ontats in t/e nor!a(() o'enon-ition "NO#%
OTPT
7777771777
A''rss Instructin O$r"n'D"t"
00000 LD 00000
00001 OUT 01000
E,p*&ti"&: T/e E&eution Con-itions o. t/e instrution on t/e rig/t2i(( *e ON 2/en IR is ON%
L((e$ Di%$!M&e!"&ic C"(e
8/9/2019 Chapter 4 Plc Programming
31/100
Loa- Not "L8 Not#:
T/ese instrutions are use to start a (ine o. t/e
'rogra!% It is use- in t/e >rst ontats in t/e nor!a(()
(ose- on-ition "NC#%L((e$ Di%$!M&e!"&ic C"(e
E,p*&ti"& T/e E&eution Con-itions o. t/e instrution on t/e rig/t 2i((*e ON 2/en IR is O66
"#tp#t
77777 71777 "''rss Instructin O$r"n'D"t"00000 LD NOT 00000
00001 OUT 01000
8/9/2019 Chapter 4 Plc Programming
32/100
*# An- "AN8#:
T/ese instrutions are use- i& t'e sec"&( c"&tct i&
&"$!**+ "pe& 8NO9 an- a se$ies 2it/ p$evi"#sc"&tcts
"#tp#t
77777 7777171777
A,"/"t Ar""n O$r"n'D"t"
00000 LD 00000
00001 AND 00001
00002 OUT 01000
E,p*&ti"&
T/e E&eution Con-itions o. t/e instrution on t/e rig/t 2i((*e ON 2/en IR an- IR $ are ON
L((e$ Di%$! M&e!"&icC"(e
8/9/2019 Chapter 4 Plc Programming
33/100
An- Not "AN8 NOT#:
T/ese instrutions are use- in t'e sec"&( c"&tct i&
&"$!**+ c*"se( 8NC9 an- in se$ies )it' p$evi"#sc"&tcts
"#tp#t
77777 77771
71777
A''rss instructin O$r"n'D"t"
00000 LD 00000
00001 AND 00001
00002 OUT 01000
L((e$ Di%$! M&e!"&icC"(e
E,p*&ti"& T/e E&eution Con-itions o. t/e instrution on t/e rig/t 2i((*e ON 2/en IR ON an- IR $ are O66%
8/9/2019 Chapter 4 Plc Programming
34/100
# Or "OR#:
T/ese instrutions are use- i& t'e sec"&( c"&tct i& &"$!**+ "pe& 8NO9 &( i& *i&e 8p$**e*9 )it'p$evi"#s c"&tcts.
"#tp#t
7777771777
77771
"''rss instructin O$r"n'D"t"
00000 LD 00000
00001 OR 00001
00002 OUT 01000
L((e$ Di%$! M&e!"&icC"(e
E,p*&ti"&
T/e E&eution Con-itions o. t/e i&st$#cti"& "& t'e $i%'t)i** be ON )'e& eit'e$ IR 77777 "$ IR 77771 $e ON.
8/9/2019 Chapter 4 Plc Programming
35/100
Or Not "OR NOT#:
T/ese instrutions are use- i& t'e sec"&( c"&tct i& &"$!**+ c*"se( 8NC9 &( i& *i&e 8p$**e*9 )it'p$evi"#s c"&tcts.
OTPT
77777 71777
77771
A''rss instructin O$r"n'D"t"
00000 LD 00000
00001 OR NOT 0000100002 OUT 01000
L((e$ Di%$! M&e!"&icC"(e
E,p*&ti"& T/e E&eution Con-itions o. t/e instrution on t/e rig/t 2i(( *eON 2/en eit/er IR is ON or IR $ is O66 or IR ON, IR $ O66 si!u(taneous()
8/9/2019 Chapter 4 Plc Programming
36/100
-# Out "OUT#:
T/ese instrutions are use- .or t'e c"i* "#tp#t.
IR $ 2i(( ON 2/en IR is ON %
"''rss instructin O$r"n'D"t"
00000 LD 00000
00001 OUT 10000
77777 71777
L((e$ Di%$! M&e!"&icC"(e
8/9/2019 Chapter 4 Plc Programming
37/100
e# EN8 "6UN "$#:
EN8 instrution /as no '/)sia( ontat -e9ie%
It is t/e (ast instrution re1uire- .or o!'(etion o. a'rogra!%
I. no EN8 instrution, t/e 'rogra! annot *e i!'(e!ente-
END
7777777771
71777"''rss instructin O$r"n'D"t"
00000 LD 00000
00001 AND NOT 00001
00002 OUT 01000
00003 FUN 01
L((e$ Di%$! M&e!"&icC"(e
6or PLC t)'e OMRON = SYSMAC CFM$H, t/e instrution 6UN $ ist/e EN8 instrution%
8/9/2019 Chapter 4 Plc Programming
38/100
.# An- Loa- "AN8 L8#:
T/e AN8 L8 &" p'+sic* c"&tct (evice.
O&*+ p$"%$!!i&% t""* "$ s"*vi&% c"!p*e,#&cti"&s s#c' s AND c"&&ects nu!*er o. OR, ORNOT, OR L8 in t/e series%
L((e$ Di%$! M&e!"&icC"(e
8/9/2019 Chapter 4 Plc Programming
39/100
.# An- Loa- "AN8 L8#:
o AN8 L8 instrution is use- to onnet 'ara((e( *(o+s inseries%
o E&a!'(e:
8/9/2019 Chapter 4 Plc Programming
40/100
.# An- Loa- "AN8 L8#:
o T/e AN8 L8 instrution !ust *e use- i. t/e e(e!ent orseria( *(o+ is in .ront o. t/e 'ara((e( *(o+%
o I. t/e 'ara((e( *(o+ is in .ront o. t/e e(e!ent or seria( *(o+,AN8 instrution an *e use- to onnet a(( 'arts toget/er%
o E&a!'(e:
E&a!'(e AN8 L8:
8/9/2019 Chapter 4 Plc Programming
41/100
E&a!'(e AN8 L8:
o Re!ar+: I. t/ere are !ore t/an t2o *(o+s are to *eonnete- seria((), t/e) s/ou(- *e onnete- in a to' to*otto! se1uene%
o 6or e&a!'(e, *(o+ $ an- 0 s/ou(- *e onnete- >rst, t/enonnet *(o+ to it an- so on%
8/9/2019 Chapter 4 Plc Programming
42/100
g# OR (oa- "OR L8#:
T/e OR L8 instrution /as no '/)sia( ontat -e9ie%
On() a 'rogra!!ing too( .or so(9ing o!'(e& OR .untion asa series o. ontats L8 "or L8 NOT#, in 'ara((e( 2it/ a serieso. ot/er ontats%
L((e$ Di%$! M&e!"&icC"(e
8/9/2019 Chapter 4 Plc Programming
43/100
8/9/2019 Chapter 4 Plc Programming
44/100
OR L8 an- AN8 L8:
?/en *ot/ (ogi *(o+ instrution is to *e use- in La--er8iagra!, a 'rogra! !ust *e 2ritten $"! t'e b"tt"!
#p t" !e$%e *"%ic b*"cs. F"$ e,!p*e; *((e$ (i%$! be*"):
Logi *(o+ o. instrution .or t/e (ast t2o *(o+s "*(o+s *$an- *0 *(o+s# are 2ritten >rst an- t/en .o((o2e- *) t/e>rst (ogi *(o+ instrution "*(o+ a#%
8/9/2019 Chapter 4 Plc Programming
45/100
8/9/2019 Chapter 4 Plc Programming
46/100
/# No o'eration "NOP#:
T/ese instrutions -o not /a9e a (a--er -iagra! s)!*o(s
an- 2i(( not -o an) o'erations%
?/en )ou re!o9e t/e !e!or) in t/is instrution 2i(( *e-is'(a)e- on t/e onso(e sreen PLC 'rogra!!ing%
8/9/2019 Chapter 4 Plc Programming
47/100
8e=o!'osition o. a net2or+
T/e +e) 'roess o. -e=o!'osition o. a net2or+ is to se'aratet/e iruits t/at a''ear *et2een t2o 9ertia( (ines into
in-e'en-ent e(e!ents an- seria( *(o+s, t/en o-ing t/osee(e!ents an- seria( *(o+s aor-ing to t/e !ne!oni o-ingru(es an- t/en onnet t/e! "2it/ AN8L8 or ORL8 instrution#.ro! (e.t to rig/t an- to' to *otto! to .or! a 'ara((e( or aseria(='ara((e( *(o+s, an- >na(() to .or! a o!'(ete net2or+%
Sa!'(e -iagra!:
8/9/2019 Chapter 4 Plc Programming
48/100
A s)ste!ati a''roa/ o. Contro( S)ste!
8/9/2019 Chapter 4 Plc Programming
49/100
A s)ste!ati a''roa/ o. Contro( S)ste!8esign using A PLC
$% 8eter!ine t/e !a/ine se1uene o. o'eration%
0% Assign!ent o. in'ut out'ut%
% ?riting t/e 'rogra! ; onstrut (a--er -iagra!%
4% Con9ert to !ne!oni o-e%
% Running t/e s)ste!%
8/9/2019 Chapter 4 Plc Programming
50/100
E&a!'(e A''roa/ o. Contro( S)ste! 8esign:
• 8esign t/e .o((o2ing se1uenes:
A grin- !a/ine nee- to *e ontinuous() .untion 2/enON *utton, S$ is 'resse- an- on() O66 2/en sto' *utton,S0 is 'resse-%
STEP $: T/e !a/ine se1uene:
STEP 0: I;O assign!ent:
T'e ctivit+ T'e se
8/9/2019 Chapter 4 Plc Programming
51/100
STEP : La--er 8iagra!:
STEP 4: Mne!oni o-e:
M1
END
S$S0
M$
$ 0$$
$$
A(($ess I&st$#cti"&
Dt
L8 $
$ OR $$0 AN8 NOT 0
OUT $$
4 6UN"$#
8/9/2019 Chapter 4 Plc Programming
52/100
4.0 SPECIAL SE=ENTIAL INSTRCTIONSET
A se1uene o. instrutions 2/i/ usua(() ats as t/e (astinstrution in t/e instrution (ine%
Instrution se1uene SET; RESET; EEP; DIFFERENTIATEP; DO3N DIFFERENTIATE; use- to ON an- OFF state
out'ut *its in t/e IR. T/ese instrutions are use- to c"&t$"*t'e stt#s o. t/e ot/er *its in t/e IR or in ot/er areas%
INTERLOC instrution se1uenes an o9ero!e t/e'ro*(e! o. st"$i&% e,ec#ti"& c"&(iti"&s; in t/e *ran/es
o. t/e (a--er -iagra!%
>MP instrution se1uene an *e use- to c"&t$"* (evicest't $e
8/9/2019 Chapter 4 Plc Programming
53/100
a# Kee' "6UN "$$##:
EEP i&st$#cti"& is #se( t" !i&ti& t'e stt#s bit"pe$ti"& bse( "& t)" stte e,ec#ti"& c"&(iti"&.
KEEP "$$# "pe$tes *ie Ltc'i&% Re*+ 2/i/ is set b+S an- $eset b+ R.
?/en S is in t/e ON state, t/e o'eration o. a 'artiu(ar'ro-ut instrution is ON an- re!ain ON unti( reset,regar-(ess o. 2/et/er S is ON or O66%
?/en R is in t/e ON state, t/e o'eration o. a 'artiu(ar
'ro-ut instrution is O66 an- re!ain O66 unti( reset,regar-(ess o. 2/et/er R is ON or O66%
6or PLC t)'e OMRON = SYSMAC CFM$H, t/e instrution FN11 is EEP i&st$#cti"&.
8/9/2019 Chapter 4 Plc Programming
54/100
L((e$ Di%$! s'")s EEP i&st$#cti"&
o Instrution L8 0 ats as S "Set#=an- t/e L8 atsas R "Reset#%o ?/en t/e instrution L8 0 ON, t/e out'ut instrution
OUT $4 2i(( *e ON an- 2i(( re!ain ON e9en i. t/einstrution L8 0 is O66%o ?/en t/e instrution L8 ON, t/en t/e out'ut OUT$4 instrution O66 an- 2i(( re!ain O66 e9en t/oug/ t/einstrution L8 0 in O66 or ON state%
E,p*&ti"&
L((e$ Di%$! s'")s EEPi&st$#cti"&
Ope$ti"& tb*e
8/9/2019 Chapter 4 Plc Programming
55/100
00002
00003
HR000
01004
i&st$#cti"&
Ti!i&% (i%$!
8/9/2019 Chapter 4 Plc Programming
56/100
*# Set;Reset "SET;RESET#:
SET an- RESET instrution 2i(( /ange t/e status o. *ito'erations on() 2/en t/e i!'(e!entation is ON%
In t/e O66 on-ition, t/e instrutions 2i(( not /ange t/e *ito'eration status%
L((e$ Di%$! s'")s t'e Set &( Reseti&st$#cti"&
M&e!"&ic C"(e
8/9/2019 Chapter 4 Plc Programming
57/100
?/en t/e in'ut instrution L8 is ON, SET instrution
o!!an- to ON an- a(2a)s ON regar-(ess o. 2/et/er t/ein'ut instrution L8 is ON or O66%
?/en t/e in'uts instrution L8 $ is ON, RESETinstrution is ON an- SET instrution 2i(( *e o< %
Its o'erations an *e un-erstoo- (ear() in t/e KEEPinstrution%
M&e!"&ic C"(e
E,p*&ti"&
# "6UN"4## E - "6UN "##
8/9/2019 Chapter 4 Plc Programming
58/100
# u!' "6UN"4## u!' En- "6UN "##:
• Instrutions MP "4# is usua(() #se( i& pi$s )it' t'ec"!!&( >ME 87?9 "$ t'e j#!p.
• MP "4# is a o!!an- to -eter!ine t'e st$ti&% p"i&t "t'e j#!p &( >ME 87?9 is t'e instrution t/at t'e(i$ecti"& " t'e j#!p.8 )'e$e t" j#!p9.
• ?/en t/e instrution MP "4# is ON, no 5u!' 2i(( our an-t/e 'rogra! 2i(( *e i!'(e!ente- as 2ritten%
• ?/en t/e instrution MP "4# is O66, a 5u!' to t/e
instrution ME "# 2/i/ /as t/e sa!e nu!*er 2i(( *e-one% 6urt/er instrutions are t/e instrutions ME "# 2i((*e i!'(e!ente-%
8/9/2019 Chapter 4 Plc Programming
59/100
o Instrutions UMP an- UMP EN8 an use t/e !be$s $"!t'e $&%e " 77 t" @@.
o To set t/e instrution .or PLC t)'e OMRON = SYSMAC CFM$H,is FN 74 "$ >MP instrution an- FN 7? i&st$#cti"& ist'e >MP END i&st$#cti"&.
L((e$ Di%$! s'")s >MP i&st$#cti"&
M&e!"&ic C"(e
8/9/2019 Chapter 4 Plc Programming
60/100
o ?/en t/e in'ut instrution L8 is ON, instrution MP"4# 2i(( *e ON% Su*se1uent instrutions 2i(( *ei!'(e!ente- as 2ritten%
o I. t/e in'ut instrution L8 $ is ON, out'ut instrution
OUT $ 2i(( *e ON%
o I. t/e in'ut instrution L8 $ is O66, out'ut instrutionOUT $ 2i(( *e O66%
E,p*&ti"&
00000
8/9/2019 Chapter 4 Plc Programming
61/100
o ?/en t/e in'ut instrution L8 is O66, instrution MP"4# 2i(( *e O66% Ne&t 5u!'s to Instrution ME "# 2i((our%
o A(( instrution t/at is *et2een MP "4# an- ME "# 2i(( *e
ignore-%
o Re.er to t/e ta*(e a*o9e%
00001
01000
Ope$ti"& tb*e
Ti!i&% (i%$!
-# Inter(o+ "6UN "0## Inter(o+ C(ear "6UN
8/9/2019 Chapter 4 Plc Programming
62/100
-# Inter(o+ "6UN "0## Inter(o+ C(ear "6UN"##:
IL 87-9 &( ILC 8709 !#st be #se( t"%et'e$.
T/ese instrutions are #se( t" s"*ve t'e p$"b*e! "st"$i&% e,ec#ti"& c"&(iti"&s t b$&c' p"i&ts.
?/en t/e INTERLOCK instrution is ON as s/o2n in La--er8iagra!, t/e i!'(e!entation o. t/e INTERLOCK instrution2i(( ontro( a(( o. t/e instrution e&eution unti( t/einstrution JINTERLOCK CLEAR%
?/en t/e INTERLOCK instrution is O66, INTERLOCK CLEAR
instrution 2i(( reset t/e 'rogra! o'eration%
8/9/2019 Chapter 4 Plc Programming
63/100
To set t/e INTERLOCK instrution .or PLC t)'e OMRON =SYSMAC CFM$H is FN 7- "$ INTERLOC i&st$#cti"&&( FN 70 is INTERLOC CLEAR i&st$#cti"&.
L((e$ Di%$! s'")s IL 8 7- 9
(& ILC 8 70 9
0000
00001
1000
T1 T2 T3 T4
Ti!i&%(i%$!
M&e!"&ic C"(e
8/9/2019 Chapter 4 Plc Programming
64/100
?/en t/e instrution in'ut L8 is ON, t/e instrutionIL "0# 2i(( *e ON%
Instrution out'ut OUT $ 2i(( -e'en- on t/einstrution in'ut ON L8 $ an- L8 %
I. t/e in'ut instrution L8 $ ON, out'ut OUT $
2i(( *e ON% I. t/e in'ut instrution L8 $ O66, out'ut OUT $
2i(( *e O66%
E,p*&ti"&
. / *( * (
8/9/2019 Chapter 4 Plc Programming
65/100
In t/e e9ent t/at t/e in'ut instrutions L8 O66,instrution IL "0# is O66%
Instrutions to t/e out'ut OUT $ 2i(( *e O66%
Ne&t 'rogra! ILC "# 2i(( reset t/e 'rogra!%
Re.er t/e ta*(e *e(o2:
e# 8i
8/9/2019 Chapter 4 Plc Programming
66/100
e# 8i
8/9/2019 Chapter 4 Plc Programming
67/100
Re.erring to La--er 8iagra!,
o ?/en t/e in'ut instrution L8 is ON "/as /anges .ro! O66
to ON#, o'eran- *it $ 2i(( *e ON, t/e out'ut OUT $ 2i((*e ON 2it/in a 9er) s/ort ti!e an- t/en O66%
o ?e an not see t/e situation in t/e 'ro-uts%
o A.ter t/at t/e o'eran- *it $ 2i(( *e O66 regar-(ess o. t/estatus o. t/e in'ut instrution L8 %
M&e!"&ic C"(e
0000
01000
01001
T1 T2 T3 T4
$$
L((e$ Di%$! s'")s t'eDIFFERENTIATE DO3N i&st$#cti"& M&e!"&ic C"(e
8/9/2019 Chapter 4 Plc Programming
68/100
Re.erring to La--er 8iagra!,
?/en t/e in'ut instrution L8 is O66 "/ange .ro! ON toO66#, o'eran- *it $ 2i(( *e ON, t/e out'ut OUT $ 2i(( *eON 2it/in a 9er) s/ort ti!e an- t/en O66%
?e an not see t/e situation in t/e 'ro-uts%
A.ter t/at t/e o'eran- *it $ 2i(( *e O66 regar-(ess o. t/estatus o. t/e in'ut instrution L8 %
$$
0000
01000
01001
T1 T2 T3 T4
.# M "6UN "0$##
8/9/2019 Chapter 4 Plc Programming
69/100
.# Mo9e "6UN "0$##:
• MOE instrution o') -ata .ro! soure /anne( to-estination /anne(%
• IR is t/e !e!or) areas t/at an *e use- .or MOEinstrution%
• To set t/e instrution .or PLC t)'e OMRON = SYSMACCFM$H, 6UN "0$# is i&st$#cti"& "$ MOE%
• S)!*o(:
• La--er -iagra!:
• Mne!oni o-e:
8/9/2019 Chapter 4 Plc Programming
70/100
Re.erring to La--er 8iagra!,• ?/en t/e in'ut instrution L8 ON, a(( -ata in IR
2i(( *e o') into IR$%
# S/i.t R i t "S6T "$##
8/9/2019 Chapter 4 Plc Programming
71/100
g# S/i.t Register "S6T "$##:
• Shit Register " S6T # !o9e $3 *it -ata, *it *) *it 2/i/ are $or in a ertain /anne(%
• Ea/ *it $ or re'resent $ on-ition%• S)!*o(:
• S6T " $ # ontro( *) t/ree e&eution on-ition 2/i/ are 8I ,CP an- R%
• S an- E !ust in t/e sa!e !e!or) area su/ as IR, SR, AR,
HR or LR%
• S is at rig/t si-e o. t/e s/i.t register an- E is at (e.t si-e o.
8/9/2019 Chapter 4 Plc Programming
72/100
S is at rig/t si-e o. t/e s/i.t register an- E is at (e.t si-e o.t/e a-a(a/ s/i.t register%
• I. 8I is ON, $ 2i(( *e !o9e into t/e register%
• I. 8I is O!! , 2i(( *e !o9e into t/e register%
• ?/en 8I !o9e into register, a(( origina( *it in t/e register2i(( *e !o9e to t/e (e.t%
• T/e (ast (e.t si-e *it 2i(( *e -e(ete%
• ?/en R is ON, it 2i(( RESET t/e o'eration an- a(( *it in t/e
register 2i(( /ange to J%
Dtbei&%(e*et
e
• La--er -iagra!:
8/9/2019 Chapter 4 Plc Programming
73/100
g
• Mne!oni o-e:
/# Arit/!eti 6untion:
8/9/2019 Chapter 4 Plc Programming
74/100
/# Arit/!eti 6untion:
SET CARRY STC "4# 6UN"4#:
• S)!*o(:
• I. t/e e&eution on-ition O!! , instrution STC " 4 # 2i(( not.untion%
• I. e&eution on-ition ON, instrution STC " 4 # 2i(( ON arr)" C) #%
• SR04 is arr) Dag t/at 2i(( ON i. arr) our in e&eution
on-ition%
• To set t/e instrution .or PLC t)'e OMRON = SYSMAC CFM$H,6UN "4# is i&st$#cti"& "$ SET CARRY %
CLEAR CARRY CLC "4$# 6UN "4$#:
8/9/2019 Chapter 4 Plc Programming
75/100
CLEAR CARRY CLC "4$#= 6UN "4$#:
• S)!*o(:
• I. t/e e&eution on-ition O!! , instrution CLC " 4$ # 2i(( not.untion%
• I. t/e e&eution on-ition ON, instrution CLC " 4$ # 2i(( O!!C) " SR04 #%
• CLEAR CARRY use to reset C) " 04 # to %
• To set t/e instrution .or PLC t)'e OMRON = SYSMAC CFM$H,6UN "4$# is instrution .or CLEAR CARRY %
8/9/2019 Chapter 4 Plc Programming
76/100
A88 'roess:
8/9/2019 Chapter 4 Plc Programming
77/100
A88 'roess:
• Resu(t 2i(( *e store in R%• C) 2i(( *e set i. t/e resu(t QQQQ%
• La--er -iagra!: Mne!oni o-e:
Rr t ,"''r 'i".r"/;o Instructin CLC < 41 = i,, rst C- t 8 0 :o 21600 t 21&15 is (it t"t 'n:t "9 "n- s$ciic
unctin> s c"n ( r,- uso ADD rsu,t i,, ( str "t IR100
8/9/2019 Chapter 4 Plc Programming
78/100
EAMPLE 0:
8/9/2019 Chapter 4 Plc Programming
79/100
EAMPLE 0:
SUBTRACT SUB " $ #= 6UN "$#:
8/9/2019 Chapter 4 Plc Programming
80/100
SUBTRACT SUB " $ #= 6UN "$#:
• S)!*o(:
• Instrution SUB is to >n- t/e -i
8/9/2019 Chapter 4 Plc Programming
81/100
EAMPLE $:
8/9/2019 Chapter 4 Plc Programming
82/100
EAMPLE $:
COMPARE CMP " 0 #= 6UN "0#:
8/9/2019 Chapter 4 Plc Programming
83/100
COMPARE CMP " 0 # 6UN "0#:
• S)!*o(:
• Instrution CMP use to o!'are 0 -ata .ro! 0 -i
8/9/2019 Chapter 4 Plc Programming
84/100
• La--er -iagra!:
• Mne!oni o-e: Co!'are Resu(t:
8/9/2019 Chapter 4 Plc Programming
85/100
E&'(anation:
• TR use to te!'orar) store t/e status ON;O66 at t/einstrution *ran/% Bit TR are .ro! TR unti( TR %
• ?/en instrution L8 ON, instrution CMP " 0 # 2i((e&eute%
• Instrution COMPARE 2i(( o!'are t/e 9a(ue in C$ 2it/ t/e9a(ue in C0% Re.er to t/e ta*(e a*o9e%
Rr t ,"''r 'i".r"/;o 10 i,, ( c/$"r it 5o Rsu,t; 10 ? 5o S> OUT 10000 i,, ON
4%%0 Bui(- 'rogra! using s'eia( se1uentia(i i
8/9/2019 Chapter 4 Plc Programming
86/100
instrutions set• EAMPLE $:
• A *urg(ar a(ar! is ati9ate- *) N%O 'us/ *utton, '(ae- on a
-oor, 8$ an- 2in-o2, ?$%• ?/en t/e a(ar! is ar!e- an- a -oor or 2in-o2 is o'ene-,
t/e a(ar! 2i(( trigger ON%
• T/e on() 2a) to turn O66 t/e a(ar! is *) -isa*(e t/e 'o2ersu''() or /it t/e reset *utton, S$%
• 8ra2 t/e PLC (a--er -iagra! an- 2rite t/e !ne!oni o-eto e&eute t/e ontro( ation%
4.4 TIMER CONTER INSTRCTION
8/9/2019 Chapter 4 Plc Programming
87/100
4.4 TIMER CONTER INSTRCTION
• TIMER "TIM# an- COUNTER "CNT# is t/e instrutions t/at
re1uire nu!*ers TIM ; CNT "N# an- t/e set 9a(ue"S#%
• T/e range o. nu!*ers TIM ; CNT is .ro! to 0, 2/i(et/e range o. set 9a(ues .or t/e TIM ; CNT is toQQQQ%
• T/e nu!*ers TIM ; CNT an not *e use- t2ie% ?/en anu!*er /as *een use- as -e>ner, su/ as nu!*er .orinstrutions on TIM ; CNT, t/e nu!*er an not *e use-again%
• ?/en a nu!*er is -e>ne- as t/e nu!*er o. TIM ; CNT, itan *e use- as o.ten as re1uire- as an o'erator o'eran- inot/er instrutions .ro! t/e o!!an- TIMER or COUNTER%
4 4 1 Ti!e$ I&st$#cti"& Set
8/9/2019 Chapter 4 Plc Programming
88/100
4.4.1 Ti!e$ I&st$#cti"& Set
• S)!*o(:
• Ti!er nu!*ers "N# is *et2een an- 0%
• T/e set 9a(ue "S# is *et2een to QQQQ%
• A(( nu!*ers TIM ; CNT an *e use- as -e>ner in on() one
TIMER or COUNTER instrution%• TIMER is ena*(e-;ati9ate- 2/en t/e e&eution on-ition is
ON an- 2i(( *e reset to set 9a(ue "S# 2/en t/e e&eutionon-ition is O66%
• T/e set 9a(ue "S# o. TIMER is t/e BC8 *et2een to
QQQQ%• 6or e&a!'(e, i. TIMER *e set to seon-s, t/en t/e set
9a(ue "S# is %
8/9/2019 Chapter 4 Plc Programming
89/100
4.4.- Ti!e$ App*icti"& S"*#ti"&Met'"(
E&a!'(e $:
8/9/2019 Chapter 4 Plc Programming
90/100
Ope$ti&% C"&(iti"&:
• ?/en t/e in'ut "L8 # is ON, t/e ti!er ontat 2i(( *eati9ate- a.ter seon-s%
• Ne&t, t/e out'ut "OUT $# 2i(( *e ON%
0000
TIM000
se
Ti!i&% (i%$!
E&a!'(e 0:
8/9/2019 Chapter 4 Plc Programming
91/100
'
Ope$ti&% C"&(iti"&:
• ?/en t/e in'ut "L8 # ON, t/e ti!er "TIM # 2i(( *e
ati9ate- a.ter seon-s an- t/e out'ut "OUT $# 2i(( *eON%
• ?/i(e t/e out'ut "OUT $ $# 2i(( *e ON as soon as t/esu''() is su''(ie- an- 2i(( *e O66 a.ter seon-s%
• Ti!er 2i(( ontinue to *e ati9e as (ong as t/e in'ut
state is ON%
E&a!'(e :
8/9/2019 Chapter 4 Plc Programming
92/100
Ope$ti&% C"&(iti"&:
• ?/en t/e in'ut "L8 # ON, t/e ti!er "TIM # 2i(( *e ati9ate-a.ter seon-s% Ne&t t/e out'ut "OUT $# 2i(( *e ON%
• A.ter seon-s t/e out'ut "OUT $# ON, t/e ti!er "TIM $# 2i((*e ati9ate- t/e ne&t out'ut "OUT $# 2i(( *e O66 an- t/e ti!er
"TIM $# 2i(( *e O66%• ?/en t/e ti!er TM$ O66, ontat TIM $ "NC# 2i(( *e ON an- t/e
out'ut "OUT $# is ON state%
• Out'ut "OUT $# 2i(( ontinue ON an- O66 unti( t/e in'ut "L8# in t/e O66 state%
4.4.0 C"#&te$ I&st$#cti"& Set
8/9/2019 Chapter 4 Plc Programming
93/100
• S)!*o(:
• Nu!*er TIM ; CNT an *e use- as -e>ner .or eit/er ti!er orounter%
•
Counter nu!*ers are range .ro! 777 t" -??.• Counters are use- to a(u(ate t/e c"#&t (")& $"! t'e
set v*#e 8SB9 "& t'e e&eution on-ition on t/eounting 'u(se "CP# 2/en it is /ange- .ro! O66 to ON%
• T/e set 9a(ue "S# is $&%e 7777 t" @@@@.
• Counters 2i(( reset to t/e reset "R#%
8/9/2019 Chapter 4 Plc Programming
94/100
4.4.4 C"#&te$ App*icti"& S"*#ti"&Met'"(
8/9/2019 Chapter 4 Plc Programming
95/100
Ti!i&% Di%$!:
8/9/2019 Chapter 4 Plc Programming
96/100
0000
0001
CNT 001
1000
4.? COM/INED LOGICAL FNCTIONSE=ENCE
8/9/2019 Chapter 4 Plc Programming
97/100
SE=ENCE T/e A''(iation O. Ti!er An- Counter Instrutions:
• T/e nu!*er o. Counter annot *e t/e sa!e nu!*er to t/enu!*er o. ti!er *eause *ot/ s/are t/e sa!e -ata in t/ePLC !e!or)%
• La--er -iagra!: Ope$ti&% C"&(iti"&:o Counter set to ount % ?/en t/ein'ut "L8 ,# is t/e 'u(se o.
>9e, a ounter 2i(( *e ati9ate- an-t/us t/e out'ut "OUT $# 2i(( *eON%o ?/en t/e out'ut "OUT $#ON, TIM $ 2i(( *e ati9ate- a.ter seon-s an- t/en t/e out'ut "OUT
$ $# 2i(( *e ON%o Bot/ t/e out'ut "OUT $# an-"OUT $ $# 2i(( a(2a)s *e ONunti( reset "L8 $# in t/e ONstate%o
Reset 2i(( return t/e ounter to
0001
Ti!i&% Di%$!:
8/9/2019 Chapter 4 Plc Programming
98/100
0000
0001
CNT 000
TIM001
1000
1001
SEC
SEC
SEC
SEC
EAMPLE $ " Ti!er An- Counter Instrutions#
• T/e arrier is !o9e- *) t/e .or2ar-;re9erse !otor% T/e initia( 'osition
8/9/2019 Chapter 4 Plc Programming
99/100
T/e arrier is !o9e- *) t/e .or2ar-;re9erse !otor% T/e initia( 'ositiono. t/e arrier is t/e (e.t 'osition in-iate- *) t/e (i!it s2it/ S4% ?/ent/e start 'us/ *utton, S$ is 'resse- "t/en re(ease#, t/e arrier 2i(( *e(oa-e- 2it/ 'iees o. 'ro-ut, 2/i/ is sense *) '/oto sensor S
*e.ore it !o9es to t/e rig/t unti( it tou/es t/e rig/t (i!it s2it/ S,t/e auto!ati arrier 2i(( /a(t .or seon-s *e.ore it re9erse to t/e(e.t% One it tou/es S4, t/e arrier sto' unti( it is suient() (oa-e-%
T/en it starts on9e)ing again% T/e sto' *utton, S0 sto's t/e !otorregar-(ess o. 2/i/ -iretion it is turning%
• Stu-) t/e -esri'tion as gi9en% T/en -esign a (a--er -iagra! an-!ne!oni o-e *) a''()ing 6i9e "# se1uenes o. 'rogra!!ing!et/o-% Sensor (S3)
LS2 (S5)!rr"er
LS1
(s4)
S#o$ (S2)
!rr"er
%1%2
S#!r# ( S1)
A &
Con'eor
e*#
8/9/2019 Chapter 4 Plc Programming
100/100