Sie sind auf Seite 1von 180

BasicFunctions

I RegisterBasics
9 PLC Timer Functiqns
L0 PLC CounterFunctions
a

RegisterBasics

OUTLINE
o E-2 Ceneral
8-l Introduction Cha&.terisrirs : t-3 HoldinsRegkters
oiRegisrers
E E-4 lnputRgistersr
Single
andCrou!-- t-S outpurRegisters:
SingleandCroup^

OBJECTIVES
youwill beeblero
Al theendofthischapter,
E Lis!rhefivecornmon
typesof PLCragisrels.
E Describethe functionof eachof theive reeisrer
1!pes.
o Describehow eachof th fiVecommontypesoiPLC regisrer!is usedin pLC

tt1
8

8-1 TNTRODUC ION imF


pcckcdinsrdeto schow ir5
Sofar, we hrv cumincd rhecomplelePLC !!\tc|n and
w. ..tpl,'cJ genLrulprogr' nrrinr t-"' j l-r'''nJ Tore'pccifi-
i f
"
"".rlr,*.o-g',." i.g un-off 1p rr''nJ o r-olf ] r'l (r ro-e sc h"!e
."ifl,'* 'urprr'' \e
"r
fooi".l ,, ,-..ri,'l .omm-nd' ,nd iunc ron' rnJ hcn | r-crrel ' rrddel
-qrc
andcountefs'
a;aern. fo, u proc"sspfoblemlt is now timeto moveon to timcfs
i*o" t-un.tions availablc with all PLCS' but bcfore $e do so- it is bell 1o
"or"
r'"tlc. $llh dn lnlroduclion lo rcgi'ler<:rnemol)lo(Jrion{ fd( plol d9 lt-J Hi
',.a,
"* .Irrrge oi Jdr- i.'lrucl;ons info mrrion rrd shdr p"r'cularl)
iempordr) .r
qilh l.mer\ counlcr\ KPco r'r mrra'
ete.-rr. nuneri."l \.lue'-..o"i"1<J "nd lo rhe 'Lb:L_l
il,ouet',:h",cl'p.r ' it meanrto pro!iJr onl) 'n inlro'l"cliL'n
trke place as thc tex! proSresses espcciallv *hen we
irnh"r
"nutvsit "ill of digital bits' and lhe
cncounrerdata movementsystems,the utilizing di
SEQUENCERtunctionin chaplefslJ, 15,and l6 'cspect'vely gf
fr
in
8-2 GENERAL CHARACTERISTICSOF REGISTERS
Wrtninth. PLC CPU. _cti.lcr' rrc rbJrd in rsv l'calx n' The mrcrolrole"ol
f,.r,al4,,f r.s 1.,. crl) c'u 'iblcb) thc u'cr' fhe'e
""'rri"hrh,rcnorl h<lplhc
,ljiit"" .a, 8. lb. o- J: o t' rrdc ,r ipen,lnf on Ih{ IniirJproce':or)
co'ntrol andarithrncticandlogicunitssithin the processoflo caffyouttheirlrsks'
re3:'l<r( rLu'tc \' In'l{\ IeE'{(cf' (JnJiIlor code reB\l<15 L
Accum,llrlur 'l.tJ (tore
.iEh p:d regi5ler' itd injtr-ctrJn rLgr:r(f: -'ll sJrk lJ 'emporlnly
J.rI,whl;hrnr..rni,.r'rJtoi-ci:lr'elhec fr!ingoulol progrimnleJ i-n't ons
In addiiionto theseinternalregistersthe CPU's RANI also conlarns slots

lr that a.e dsignaled to holdvariableinformation. Theselocations'or addresses'


ir"o re.sisters Throughoutlhis chapterand texl we assumethese
reeistersare 16 bils $ide. Therecan be a mere handfulot such registefsor
",rtinot
hr,ildreds. depending on Ihesizeoi theCPU andcomplxilyof the userprogram'
Eachbii locationin a register contains, ofcourse.ehhera I or a 0 You can
ln
observefegistercontenlson a vDT by callingup thc regis!e'on a keyboard'
contents on a typeo pnntou!
addition,on manymodclsyoucanprintlhe register
Variousnumbcringsystems afe possible for rcadingregister contentsor pnnllng
thmoul. Chaple;22descnbes a variet!' of PLC numbering systems' Depending
on yourPLC capabililies, you maychoose 1o prinl values
regis!er based on oneor
example, onc model allows you to choose
moie difierent numberingsyslems.For
or 4-ASCIL Other possibilitiesare
betweenl-Decimal, :-Binarv, 3-Hex,
Oclal and specialcodesunique to lhe system being osed- Still other PLCS are
numbering system' usually the FIGURE8.1
confined to displayingor pnnling in oniy one
PLC Regisler
decimalsystem,
Reeisrersare usualJydesignaledusing prelixesfollowd by numbers' as is
the case:nthischapter.({R 256represenls holdingregister:i6;OG2,represents
\edel of
ouro,rterouoreei'lcr ru-nber I ln oLher ')\tem\' d cenainnumerical
uaa.ess-., *er 6e a"renea ro )pecrfic l1\k or frrnclion one model ol PLC has
"
!-l ;loLDt\c it ECtSrERs II'

fegisieraddress$901 througb910 ai\ign.,i :,r ii:l1ersand counlcrronly..Ir is


impodl{+ro delefminethefunctionsfor :he:,itJ:.ii.s of \ our pLC regisrers
from
i!s operational
manual.
In chapter8 wc look ai the functionoi i:: lie) f.gr\rers.We seehow the
holdingregisler,inpuiregisters(singleandgfrr: liC o!lpur registers (singleand
group)operareto temporarily storedarafo. lr1i.roD.o..ssormanipulation.

8-3 HOLDINGREGISTERS
A holding,or working,register(HR) ''holds-lhe i.:::;iis of q calcqlalion. arirh-
,!9!g a. 19cjc.Conceptually,it is in the midCl. .,4:heCPU. as shownin fig-
ufe 8-1.
Because in manyPLCs,panicularly smalleror.i. ::e holdingregisteris not
dircctlyaccessible to inpuls or outputs.inpul and ri:.!t rcgrslers(singleor
group)interlhcethe holdingrcgistercontentsto the L.ulirtie$orld. Signaldala
from a specificinputdeviceis first "deposired. in lhe lorln of0s and ls, in an
iiso inputregister.ll may $en be manipulated by the microprocessor and rhe resuhs
he mtcroprocessoi sentto a holdingregis!er.Conversely, bforetheconte.lsof the holdingregisrer
.rb! the user.These canallccltheoutputdevice,theyarelransfefrd ro an ou:!ur regisrer.
The outpur
.focessor)help regisle.'s0s and ls "drive" oulputintedacede!ice\ sucha! optoisolators.
ther
'nTyout theirtasks.i To illustrateholdingregisteruse,we can look L.riefl!at rheir functionin
on code reglsters; arithmetic,timer,andcounleropefations.Keepin mind.rho!!h. lhatnot only are
temporafllyst theseoperations covcrcdin muchgreaterdctailin larer.h.ti.rs. buralsoholding
riammedfunctions,. .egistersareusedin numerous otherfunctions thatarcao\ eredIn futurechaDters,
. arsocontatnsslots / In arithmetic operarions. a holJingregistermign(rJ.iJrn rhe fir(r Jp;rdnd:
OnS ,Or a d d reS S eS , \another holding register,
lhe second operand; and a final holdingregisler,rhe
' \le assumthese ldestination of the mathematical manipulation(see figure 8-:).
5uch rcglsrersor / In the timer function,the presettimevalue would t'e placed
lheuserprogram, /(\ designatedregister.The holding registeris the registerin which
. lora 0 , Yo uca n tlr place(seefigure8-3A).
on a keyboard.Il The tefr lulnctlon
nI( I ilar (
ncti( IS Ssimilr Gee figure B ).
:8--3 8 . The presetcountvalueis
.i a typed printout. alsoplacr ed l n ons slant isigna
lant ot des latedd regtster.Th ,ldingreginer.ofcourse.is
ronlentsor prinling ist,fi n 'nclhthec rt tak
the regist *es l

.':;:r;xi:::i
\lems.Dependi Ho'" many Ldina iing re dste
I6. ln largemachinesthereare hundreds
there?in ! LallIPLCs

programminguse, manipulalion,and visualanalysis.


t therema)rbe as few as
of holdingregisrers. all accessible
for

.r possibiliriesare
ll other PLCS art
nem. usuallythe FIGURE 8-I
PLC Registers(Reprintedfrom
rY numbers,as is w e b b , J .. a n d G .e s b o c kK, .
: OG2,represents t993.Indusnial Caf,ttu|Elec-
merical seriesof tr,,i.r, 2nd ed. Macmillan.)
8-12 r@ 1000 3-t:
iodel of PLC has
iJ

O PE F A N OI I\-?L
HR 0 0 7 5 T}le :

O P EFA N2D
H B0076 .
INPUT lhat e.
DESTNATION One in
nals)-l
syslen:

FICURE8-2
Reeiste6in Arithme!icOperations o

PFESETS WHEFETI.]E
or
FTGUREE.3 c
HoldingRegisters
in Timersand TIM]NGVALUE15SET,
ITMAYBEA CONSTANT I c
Counrers oi
ORA OESIGNATEDBEGiSTEB.
I
c
oi T
, 'T
o,-
a
c
c
I or
9
8gG. ISTI']EOESIGNATED L c
{HOLOING) AEGISTERIN ol
WI'IICHTHECOUNTTAKES c
PLACE. o C
T MEF l{
c
o c
P FE S E TJS W Ii E qE IH E F c
C OU N TV A LUSES E T.
LTMAYBEA CONS'TANI o C
OA A OESIGNATEO REGISTER. o
c
(
(

R E G.ISTH EOE S IGN A IE D


(HOLDING) FEGISTRN FIGI
W H IC H
TH E C OU N TTA K E S lnpu
PLACE,
COUNTEB
. i . :i- ii\.:i 1\j - i;l
--::

j-J I\PLT REGISTERS:SI\GLE d\D GROI.P


T.e :::.: regjsierhasbasicallylhe samecharacreristics as the holdingfegisl.r.
.\.e!: ihar ii is readilyaccessible10lhe input modules ierminalsof pons. Ihe
iuiiber of input.egislcrsin a PLC is no.mallyone'lenththalof holdingregis!ers
Tie inpur groupregister(lG) is somewhallike the input fegisler.lt differs in
rhareachoneof the individuall6 bits is difecllyaccessible from one inputpor!
One inpui group registerreceivesdata irom l6 consecutiveinput Ports (tenni
ndl\,. Fisure8-r illu(rrate.hos rhrslG slnem $ork. Jllljjll3lr1&e oflhqlc
.r'srcmi. thatonl' one regi"teri' requiredIo 'ervr(e lo rnpul' Withourlhe IG

ON

ON
ON

-a U
I ON

ON
T
T ON
ON
ON
I
N ol
-!D L ON

<E S ON
l
o ON
N ON

o
n
ON InpulG|oupFegslerlG 0002
o ON

ON
ON
o!

I
33,4{l tG 0003
4$64 tG ooo4

FIGURE8-4
Scheme
tnputCroupRegister
I I E C I];1 E RB AS IC S

FIGUREE-5 16BlrSysr6m ot.


InpurCroup/lnput
PorrNum-
Lik:
the l:
1,16 ln tt
9 '1 6 11-32
174q 33.48 num:

49,56 65.30 Sroul


57-U inpIl
65-72 97-1i2 tion.
lnai
gtorl
syslcm,you wouldneedl6 regisrrs ro servicel6 inputs.Withoutrhc inpurgroup sys:
') rem.\ol qout! _.e p ru.e. rnpuer mernor)\prce (o run )orr proEr,,rns. pari
Ihc.npur 'rlo,ru.epon lcrr' Jl .orre.pond.,oa. ngleinpurgroupr,-,gr.rcr
bil. EachIG .egisrerslatusconrrotjonebil s sratus.Wtrena port is enibled,or
on, it createsa I in rheconspo.ding brrslor.if the por! is off. ir producesa 0 in
the conesponding bit slol.
It is necessaryto kno\! ho$ !our pLC groupstheinputnumberstha!cofre_
spondto eachinputgroupregister. A r\ picalschemeis shownin figure8,5.

V
ON
FI(i
0 ia
r001 0000 1000 I r0o Die,
19 ON
2A ON
0 2r
c 22
0100 0011 1111 0001
23 ON

oG2 1" 25
2-<,
1011 I 0 t 0 0 t 0 0 1 l 0 l

\ \0 2i
ON

32 CN
29 ON
1 ON
OG3wouldbe 33-48 0 3r
32 ON
v
FICURE8-6
Outputcroup RegistefScheme
lll

OL T P L T REGISTERS:SINGLEAND GROt' P
_'1 _
L.i. :rr'np-r re!i..c . rne oulpJr-etr'rLrh.r'he -mc o-' c'hrr'cr' "
ihe holdingregisler. The outputre8isierdiffcrsfrom the inputregistr'however'
io rtrt lr is readityaccessible to th oLrlputmodules terrninxlsand ports The
numberof outpu!regislers is normallYequalto the numberof input reSislers'
The oulputgroupregister(OC) is ofSanized in a mannersrmrlarto the rnput
nrorpr.s,rt.r. lr diftcr' trom rhe IG rn a mrrner 'rr il rr ro Lhe'rrffcrcnce bet\^een
Figure 8-o hosr how rhe oC Icgi'ler lunc-
inouiree]'ren"nd ourpurreSr'rcrs
iiinr. O-n"OC.egi.t"r.an control l6outpttls lfaIisinab;lposition itwiLlturn
ii"ilii .o*"tpo"ai"g ourputon A 0 triLliurn ils corfesponding ouipulotT The
' groLn eg'l.r' r' ir l r 'r 'tre rnnJl gioup regr'ler
eruLrornr ichemefur oulpul
I,ren.-ttrc groulir; chcm( r"hotr'n nr''''-- l''rlo :rJrp regr\lrrl.
..'flr.uldrl\ ,.<iJl rn .cquen.<roprr"l or' .l : | 6
'n

: : - : . i :i 3 a ti d , or
' P. r n ,-i
^--j

EXERCISES
, - : ers i h a t c o. le- $hereea chr vpef it s
:: i- su re 8 i. l . L h tth e fi vc maj ortypesof reei stes U sea bbck di rgtrm to sho*
i n to rh e P L C scheme of operal ' on
Wh a r* ' o u l dthei nP u!groupregi stcrl ook l i kefoL(hethrcei npulmodul esl alusar r ange_
r" " ,' rr,.".i " ngi ,t" i -l l w h;! w oul dthe nufl berof 0r' h Io rtgj ncr beI whar would
rh erc g i rterconl eni s be. i n bi nary_?

-i_l o^ *
FIGURI]8.7
lT_l ore Diseramtbr Erercise2
ION .s!491 !1!!.e! sl!!!:
's -lorv
zo -!s- -!.9,
105 0N
-!9-
209 oFF
49 0N
21 0 0N
:r-l o.-r
-;;---1^--
50 0N
11.7 ON
52 0N io8 oFF 21 2 0N
do * 213 0N
2a loFr
-?!_-.] orr 55 0N 215 0N
--:o-'l or 56 0N 112 0N 216 oFF
57 0N 217 0N
li_l orr rS Bi( PLC) 218 0N
oFF
_4,
29
59
60
0N
OFF
219
llN 61 0N 221 oFF
:o--']or.r 62 0N 222 0N
223 0N
64 0N 224 oFF
l2 lo N
rl
and-inplt
3. What would be the stalus ol the correspondingoulpuls for rhe four outpur
rne
groupregiste.sshownin lisure8-8? Whata.e lhe c ore \potding outpu! numbe'sror
four OG and IC reeistersshownl
LU RE C] S -I' E RB' \S]C 5

FIGURE8.E 00lt 1 1 0 0 1 0 1 0 0 1 1 1 oG 0007


Diagramfor Exercis. l

liro o''o] ocoooo


c 0r0r 1r11 0000 0r10 rG0011

D ri 00 1011 1011 1000 oG 0021

PL
.j'.J*,- \

OUTL'
i, i lor b'\r . , ,,, 1 9-1 lnt
Typcsc
q . \ r ,q1 .\ ', f, \,1,-.r,,., t
f' ., ,r1,,i i

. I il OBJE.
ntt'utt'tl
.
\l - ll'"'
,.,
\\- r'i,i'.iL o- I E Desi
a List
\'
\, \ \
\ lHR. J \
!?:lr;:1\
\
\ O'h
ir
14o ! tt
ii L I
Llr'..t!\r 1 ' ,1 , i( f,I,.l ,-l f,, r'\
' \1

r, , . . r, . \ o . , r r l ' 1 ,, r cc,' .' i,' ,tU?I,


( t-
e-l c...,\,":,1,1
1,.,1
,ri l .i , l -

l-iFL) 1 rr ,t1 ; i

.1.r 0!

UFf
GI 4- I{,io\
rri r
a fa
a

:Irj wr

-: ':
:: G

PtC Timer Functions

OUTLINE
o 9-2 TheBasicPLCTinrerFunction
9-1 Introduction : 9-3 EramDiesot Nine
TypesoiTimerFunction E 9-4 An Indusrrial
Applications Pro.ess
TiminsApplicaiion

OBJECTIVES
A t th e n do ft hi s chapter,you w i l l be abl eto
o Describethe PLC .tentivetimer function.
tr Lisl and describeeicht major timins funcriors rhar are comnonly used in circuits and
Processes.
o Apply PLC funclionsand PLC circuitry to processcontrol for eachof theseeighr
mejor timing funciions.
ApplyPLC timersin rnultipletiniDgproblenstha!conbineiNo oimore ofthe basic
dmjngtunctions.
Aplly PLC timersfor the controlofindustdalprocesses.
Pt_cl]\,1t]R[L \i tr)\5

INTRODUCTION
T h c m o ._ .u m n o r.- rr ' J I o .cr. cur ,rul Jc. c(
-o,i . JnJ i onr.,ctr r! rh, inpur
r ime r. I h c m o .- c o m -ro r:--; rr r f-rcr:or ' , fl V L D-r..r
F L.c y O:,J. h:ch :! rhe ba\;,
i u n !i ,,. r'" ,. e " throu
- -t.o n -rior her
i""e .""nc;' ,
J re L l I' o m r( o f ro re .i h r -J.r, TtIIL D fLA y ON ";;;..;:;;:
"".i .n,.,on,. pL.. hdve
lhe one basicfLncliontimercapabiijryin mulriples.This chaprcriltuslralesrhe
basrcPLC TI\i E DELAY ON functionandsvenotherderivedtimingfunctions.
upper
Tvpicalof rhe derivedfuncrion5 areTIME DLAy OFF, intcrvalpulseriming,
and multiplcpulsetimingof morethanone piocessoperation.
time.
\-ormallyoniv oneofrwo typerofthe basicpLC timingfunctionat btocksis
jn a PLC- The timing black functionsare
usedwith variouscontactarrangements
and in multiples !q 4qgAqplishvarioos liming tasks. T!,picat indusrrial timin;
task5includerimingof lhe intervalsfor l('ckjjng,iainti;g. anrt hear trearingl
Timerscan alsopredererminc the inrc.\,alberweenr\{o operations. Whh a pLt
!ou canulilizeas manytimerblocksasyou need,withinlhe pLC nemory limila_
llons. {i.,., ,n. i,/^ .ecf
What does lhe PLC rimer tunclion replace?I)etailcd descriprionsof rradi_
tionalindustrialrimcrsflay befoundin controls!exrs,including th;se Iistcdin the
bibljography. Synrbolsfor convenlional timersmay be foundin appendixC. pLC
trmerfunctionscanreplaceony of thesejndustrialtimers.Whetheithc industrial
iimeris motofdrivcn,RC rinreconstant, or Cash.por,it canbe easilysirnutateJly
a PLC.
lhc Jililtl..,.1rd-.,.,rc.
(Jccr(on:c rjnrer;\ore rechnololiJal nepabu\..the
.
rhreerlpc. ot InJL:r rt ljmersj-.1 ljsreJ.The.e digir"ltlmrngde!icesrre
also
discussed in varioLrscont|olslexts.lhe pLC rimlngfunctionis ilo.e uersoriie ana
llexiblcthanellherthc industrialo. the digitalelectronic tjllar!. .
. Onemajoradvanlage of rhepLC rimeris thatits timemay be a programma- Ena
ble variable rime as we as a 6xed !ime. The variabterime intervai miy te
in
accordance with a changing .egi!rervalue.Anotheradvantage ofthe pLC rimeris
thatits timeraccuracyxnd .epearabilily areext.emelyhighbecause it is basedon
solid-sta!e technologv

9-2 THE BASIC PLC TIIIER FUNCTION


A,single input rimer, calledz nonrctentiue /in?r, is usedin some pLCs. An
exampleis shownin 6gure9-1. Energrzing IN 001causesthetimerto run tor four
seconds.At the cnd of four secondsthe oulputgoeson. Whenlhe inpu! is de_
energized,lhe output goesoff and th rimer resetslo 0. lf lhe input IN 001 is o Er .
turned off during the timing inter.,,al(for example,afier 1.,,-seconds),the rimer
reseisto 0,
FIGURE9-1
Sinsle'In!utTimef
F]
D.
' IH E Br\S l C P LC TIU E R FU N C IION t27

There are someoperationalCisadlanlagesof !he single-inputiyle that are


overcomeby the doublc-input PLC liner, calladil /e/entiuetimer. Thc double-
input type is more commonly used in PLCS.We use the doublc-inputtimer
throughout ihischapter.Figure 9-2 showstheIayoutof!hedouble-input timerfor
two typical formats.
I!9-.19!gr!1pgt y .q_s!I9-9-2_is!h-e,E-rablefrset line , lvhic h allo r s the rimer
to i un $ hrn energizqd.whcn Je encrgized. thc limcri' kcprJr 0 or resetro 0. The
upperlinecausesthe timer to run whenthe limer is enabled.Whenenabled,the
iim:e;=6ns;J lo;g ;s the run inprir'is dnirlized. IfRun is de'enersizedwhile the
timeris running,thetimingstopswherejt is anddoesno! resetto 0. Note tharfor )
. t_,.roctional
blocks
figure9-2A ifbolh IN 001(Run)andIN 002,(Enable-resei) opcnand closeat the \ ,.
\dme time.lhe im<ffunclion'in the (omemrnrleJd rhelrr< nfigrrco I (
]r IndLrslrial
timi For formatA in figure9-2. suppose lN 002is closedandIN 001is turnedon.
and heal rreali
After sixseconds. IN 001is opened.Thetimerretainsa countof 6. Tin1inghasnot
rrions.Wilh a p
reachedthe prese!valueof 14seconds, andthetimeroutputis stilloff. Thc timer
'LC memoryli doesno! reselunlesslN 002is opened.Supposethat sometimelater IN 001is
reclosed.Afier eightmore secondsof IN 001beingclosed.lhe timer coil will
1\ energize, sinc6'8 = 14.
FofmatB in 6gure9-2 is an altmate. lN 7 is for timingRT I I = RN. lN 8
n appendix c. =
crherrhe induslrial enables RT 3l RS.Whenrhetimefgoeson, ils oulput3l (inte.nal)turnsoulpur
, easilysimulatedby
:calstcp abovelhe rheti mng
va!e.sser -
rg devices
arc also ora desg.ardregsrer
more versattleand

y be a programma:
nle.val may be id
jlthe PLc rinef
ruse it is basedo
\\J
Bes.rsrhdesisnared
A ElockFormal

N7 .Fl
: somePLCs.
F-r lry
:l?#fi'::l
: IN 00t is: ifrt
tN6 ,FS.
J;#r
'nput the
ionds), rl Tirne
ti
H|---''- ___-{o Ourpul(78)
|
ro,r",
" "ou
I.IGURE 9-2
DoublelflpulTimer
1tr8 P L C T IIl E R F U N C IIO \S

FIGURE9-] KEY:O Otr


Charl
Seque.cirs
Ourln9
li4!L Conv.nllon

+o x o

Elc. ..

X- Conlaci Closed

' O-Co.laclOpen

78on. l! tome PLC furm"r'. rhereti.rerco-nr rr not drrplJ\a-le.Al u. In or,e


erC formai.. thi pre'ri rime' aluei' i red f6r rhefunctiJnchi .in- lor er .mple E
EL-\}IPLE
5-second timer, l0-second timer.and so on.
An addedhelpin defining limerconlaclstalusis shownin ngurc9-3. The.e
are three statesin a timing cycler(a) the initial or reset state,(b) the siarc during q
timing, and (c) the stateafter timing is complete.A systemof X for on and O for
off is normallyused.Th chaplefexamples illustratethis convention.ln some
sistemsa I is usedinsteadof an x to indicalecontactcloscd.

9-3 EXAMPI,ES OF NINE TYPESOF


TIMER FUNCTIONAPPLICATIONS
Some commonly used timer functionsare
Ex. 9-l On delay.OutputB comeson at a specific settimeafteroutpu!A is
turned on. When A is lurned off, B also goesofl
Ex. 9-2 Off delay.Both A and B bavebeenturnedon at thc sametime.
Both are in opemtion.When A is lurned off, B remainson for a
specificsertrmeperiodbeforegoingorf.
Ex. 9-3 Linited on time. A and B go on al the sametime. B goes off after
. specificset time period.but A remainson,
Ex. 9-4 Repeatcycling.An output pulseson and quickly off at a constan!
presettime interval,
Ex. 9-5 "One"shot" operation.Oulput B goeson for a specifiedtime after
output A is turned on. Output B will run for its specifiedtim
interval even if A is turned off during tbe B timing interval.
Ex. 9-6 Altemate on and off of two outputs. An exampleof this timing
applicationis two altmatelyflashingsignallights.The time on for
each ofthe two lightsmay be the same,or rhe two times could be
set lo differentintervals.
Ex. 9-7 Multiple on delay.Two differenleventsstar!at ditrerenrtime jnter,
vals after an initial staning time referencepoint.
-==--s-r L\\vpLEs oF rt\E T\ PESL)Frr\rERFUr-crtoNAPPLI(:ATIoNSlr9
'-
Ex.9-8 Ilullipleofl delav.Tso diffef.ntfunclionsrmainon for two dif'
ferenrtime inlen als aftera process is tu.nedoff.
Ex.9-9 Intenal time siihin a clcle. \\'e may requiretharan outpulcome
on 7-5seconds afteas! sremtr2nup,remainon for 4,5 seconds,and
:r then offand sra! oii. The irler!al sould thenbe repeatedonly
go
aflerthe s)stmis shui oiTan.lihn lumed backon.
Thereareothertimingexamples se coirldillustrat as sell; however,these
nineexamples arerep.esentati\e of PLC rinrrg capabilities.
Now we giveexamples of eachof ihe xrnelisiedtimingsystems.In most
cases,eachexample in teririsoi 3:ri:d!stl.ialproblem.Eachexample
is illustrated
includesa diagramsho$ingtime \.rsus o:ri:r: or-off sralus.The time-stalus
rhe X
diagram\In-cluJc O J( :!n"ii n': _ :.:<:: r.(
"nd

,sen-for example
EXAMPLE Example9-listhesimpleslformoftimedela) \\ hnihe.i..uit is turnedon. one
n figure9-3. 9-1 action takesplace.A specifiedlime lalei, anolher aciilin !r..urs Bolh relay logic

t,nil'"'.'s
b) & stare

xvention.In
and PLC logic diagramsare shown in this exampleoii! to. conparison. Subse-
quent exampleshave PLC diagramsonly. Figure 9-.1 shoss the program for
example9-1.
The sequencefor exampie9-l is
L WhenswhchI is tumcdon.iighrA lights.
2, EightsecondsafterA lights,B Iighis.
go
3. BothlighN off or stayoff whenever swhchI is opened.

:c afteroutputA ist E)CAMPLEExarnple9-tis an off-delaycircuit.A motorandits lubricalionpumpmotorare


9-2 bothrunning.Lubricationfor mainmotorbearings is requiredduringmotofcoast"
!t the same tine. down.AJterthemainlnoloris shu!off, the lubricatingpumpremainson for a time
remainson for a correspondingto coast"downlime.In thisexample, a pumpremains
lubricaling on
for 20secondsafterfie mainsyslem is shutdown Figrlre9-j lhe
sho$'s required
B goes of after I program,

off at a constant
EXAMPLE Example 9*3 involvestwo parls. The 6rsl part is for a singletime interval, the
'i"'flH,"lf,"J 9-3 secondis a multiplelime interval xample.
Example9-3-l illustratesa situationin which two inputsgo on at lhe same
g inlerval. !ime. Then,oneof themisto go offafterapreset periodof time. Figure9-6 shows
ie of this timing this situationfor two outputs.One output,A, stayson; the olher output, B, tums
offat the end of lhe timing interval. Resetringis accomplishedby tuming IN 001
, times could be and 002 off.
Figure 9-7, examplc9-3-2, shows a multiple application timing system.
':rnt time inter_ Threeoutputstuft on at tbe sametime. One slayson. Anolher. M, shutsoff after
8 seconds.The third output. N, shutsoff afler l,{ seconds.
I LC T I\IER F L 5 C T IO\5

Swl a Sec L2 L1 L2

+
T

N0o1 cFro017

18
; 2A
21
2?
23
8 Sec 24

HBO O l

rIG
TlmlngDlagram EI :

On
LT l- CF0 o 1 7 otf Er
EXA}lPLE
9-1

"i " r ;-
tir
On luf
LT 2. CF0 0 1 8
olt im
I
sw1-lNoo1 sw1nN001
on th.
FIGURE 9.4
Example9-1. Time Delay On
E]L{}IPLE Er.
9-5 ati
pf
-------,J-r L\.r\!P[aoFNINE fYPLSOFrlrlIRl]trNCllON,'\PlLlC.\flO)l5 l.l I

N001

TS
1N001 cR o16

Timesro20whe.motor

cF018 cR0r9

a
:2
_3
il--e-J '-_ l-"
O.
oH

oi,olio
lN000l tNoo0l
On olr

FIGURE9.5
Example9-2. TimeDelayOfI

I EXAMPLE Example9-4 is a pulsedtimer. A short voltagepulse is producedever! 12 sec-


9-4 onds,The PLC circuit shown in 6gure9-8 will producethe requiredpulses.The
dmeris iniliallyturnedon by its "time" inpul.Aie. the timinginterval,the timer
{ lums lhe outputon, When the outputgoeson. one of ils conlacts,TT 013,
inmediately opensand resetsth timer to 0. When the limer is reset to 0, lhe
r- Noo1 output is tumed off. Then, sincethe timer is also off, fi oli recloses,resta(ing
ott the cycle. The pulsedon time is a very shor!, one'scancycle time. The process
repeatsitself continuously.

EXAMPLE Example9-5, shownin figure 9-9, is $e one'sho!syslem.The oulput comeson


9-5 after its specifiedtime period even if lhe input is tumed off during the liming
period. lN 00ll must be openedand reclosedto reset rhe sysiem.
c

1i
" l"-J
It
t, td
--r *11
E ll
"la li t:
"i
n--l;--t
oo oo
) E

= P:
=a 3F;

i
o
E
!
1
F
F: !
s
o
o o o o oo o

5
q
a o
d I E
6
E

!
II
a
I
E
I o
6 __l
lll
q\ E ,!
t-

?- d i6
,6 il

:(}
m 9
I
3

e a
I a
6 g_ -L

-aE5

p fE
o
133
l3r 1' II : ] I ' I\IIR J ' L \C .l II)\5

EXAItPLE E.\ampLc 9 6 j\.rn !lrcrn.rringr*o-outputsyslem.Figur9 l0 is an e\ampleof


9-6 this itfp icr(ion. Ir i\.r irltcrnrrelyflashingPLC pfogram.Outpulsll
r$o-light.
and l: conr.ollhc l(o ights.Theoulputsalternalcon'offandolf'on every5/10of
a sccond.The on trmesfor crch lighi can be variedby rcscllingthe limesin the E\TIlPLE i r=.-,- :
9,1
FIGU RE 9- I O f1259
Exa mp le9 6 A r c r nle F l a s h e r tN0001TT260
-l
IN
l
-_ 1-
Noo6l 11259
4H l \-_

tN00o1rT259
I lNi
IH
N'
rNo00rTT259
I,H LiqhlA I rf.i:

1 N 000r
TT259
ir'
I LightB
L---.1
I

5sec 1osec. 1 s Sec.

TT259
oll

ofr

On

atl

oi T----- -- r-----;----- [I(


Llghr
B cFr2 I x L o- | L Er
ofr - ^
',.r ti1\ L l \ ' ' t . Nt \ ! f Y I r. \ n ri r' ! L ! lllj L lll_ lll ''\' D5

funciionalblock.Thc programmed timcsmaybe the samcvaluc,or eachcouldbe


set at differenllime values lN 0001is the systemon-olfcontrol

delavon for two oulputswith respcctto the startof a


;XAMPLE Example9-7 is fo. a time
;-; sequcnce. Thcre are lwo wals to accomplish a lime delayon. both of which a'e
9-lL
sho$n in lirLrre In thc diagram on the len. both time intervalsstartat the
_1_
vt
sametime
samething,
and deliry
but
7 and
chains
l2
the
seconds
timers
The
The
diagram
second
on the .ightaccomplishes
lime delay is accomplished
the
by

II Oulpul 018 e.ergizes aher 7 sec and 019 aier 12 sec {5 more) afier 1N001s energrzod
c Fo 1 7

4!
-l
I
O
.{1
Or

:" 1 c8018

},],,s,,,"

nning 0i.9ram
rNO02is rre e^e,e reser.FUl

On
cF0017
otl

cR0018
q
l
+_ I -)Bolh resel by N0002
4
o cF0019
On
otl
I I
o lN00l tlN00r
On
rNoo2
ofi

FIGURE 9-11
Exanple 9-7. Dual On Delay-Two Schemes
I' IT IE I{ F L \C ' IION 5

adding5 seconds lo rhefirjit- \c(unJ.. tur J rc\ujfingrimedetri


Ivfulliple of ti \econds.
timedclayon canbe , cjonpt.\hcJb) JftropriareJv:rLjd;nt
morerimers.

EX-{MPLE Dualtimcdetayoff.isillurrrared
in figurc9_lt. W" u." onu.,uutrppti*in;;
9-8 rl{ustratron.
Whenrhclighrsareturnedoff i
::::i:
.emain:: i:: ;,llt"l;l.,:"';;;:',;,:J,*;i'i;:,:1,:;J ::[i*il l:
on for 1
anaddirional
J miaures
arterthedoortlsil g;!1 .ri.ii""il".j!
outpulsare identifidin lhe figure.Fo. mc
off oulpuls. an addiiional
repearedlwo lrnesof losic are addeda. ,"oJii"uoi'*

EX.{MPLE Examplc9 9 is Ib..a rimedintervatofa nL


9*19
:::::: rhistrpe
orrime jl".*i'"'.:::
rin.' ;n c:.p:,i,,:t
vrt t n,,operJr:, '",.-Xif,"Tft:,'J:l:ii:T
n .,.r,".*,,"r ;;;r";";;: r:; I i::'";;:
"..-"",
t( r . .ncn
r or unuir ,b .econJ\
: : 8.).l
lhe . L;::i
n :l l i fl
i ,,u rn e J :.).re n ;,iur neJon
$ n :c n i., net trme
ar r er
prc pro',m,n-, o n . a-rr.noq(a
"."."1.J". ,ii",,;;;":;.;;[:L,J",i;sure

9-4 AN INDUSTRIALPROCESS
TIMING APPLICATION
Thc iolloring problenrequirestheuseoffi
jii:I,{:.'"ml*i',""'".yl:
:,",,ll::;li*,I*t *llx'#il]::il:'+r:
.n'pri't.a
ry, ;;;",;i;j;'",:;";t "ffi:::lJi::,#Tiil#ff:,:i;
',L,ingrapidry).
rheme;ri*ei*r
*,"r,i. ."r"il"ir"yi"ii
:J..;::,::Tr!::l:r.,iJery "
The heatingis do"nby a nonconracr lnouctlonheatingprocess.A hieh
currentin theci.cular
coilaroundtheoulsic
currcnrs
inrh
part.
rhep".,h","r".";;;ij"";r":li
Hililfi : i::i;::"j:li:i.
:.ff;f ii;l"lJ:',""'.1
l';iliJ"'tll,li
i;,'1.'1.,[.J::L'X,filJkl":liqi
quenchwuteri5 pumpcdintorhcinnerhatioj

*h1iffi
ril,,f*t'y'.$*l#: ;?,;ii'ff',rJH
#,T*::'i"i is
station
isshown
in6sure
e-r4 rh
'."""i'ff::iil'fjJ:1tl,"jr'*:,i#::"
j:::::::,'turnins
I lii l"xi'iJ;liii",li'i,';, rh
svs,em
on
J. Borhlefr and dghrc,arLburronsarc dcpres,ed.
" anv o'he.irne purhingan1 rrop burron
sropsarl
i.:::,.:,::'::,:;:,
5. The.parr is raisedfrom bottom !o lop
by pneumaucarr aclron.A soie_ Ft(
noid valve supptieslhis airto a pneu;ari;
;levati"c iir" l";".- Er
"yri"a...
fRocEsS fl\ll\G ''\l'l'LICAll()\
9-r ,\\ I),,11)usllilAL

!ghls- N00i s :.se.

D o o rL o qc N . . i a , , C .

NO01 CFl
alter the start of

: The fan is ro co
til I6 seconds
igure9-13sho\rs
it.
225

.1.TION
_amming as wellas
iingmachine. The
ir. Hardeningis ac-
. lhenrmmediately
i\ a .elativelyhard

iprocess. A high
:s high circulating Tlni.9 D|lgrrm
re coil hascooii
-imoverheatingor
Jr on rhe pan. The
I Sprayingthe part
,roll results in fast

ficu]-14.
Doo,Lis ffl
_JV
x *l**"
The

I
r bulton stops all tNo01 rN001
Closed
r action.A sole_: FIGURE 9_U
lrnder,The lower- Exadple 9-8. Dual Off Delay
tlli ft_c illlliR FUNCI lONS

F I G U R E 9 -1 3
E r a mp l e9 -9 . l m b c d d e dl n te r
! al T i m i n g
i, lNl

tr
Ir TS

ntttd

, \cc4:l c5

ol

limi! swirch must be aciualed before lhe parl will rise Lower-limit
switchacluarionindicaiesthalibfeis a pan on themandrelandtha!the
mandrelis down. \ote thal ihe limh switch opensas the part leaveslhe
boltomPosition.
6. The mandrelmales conlactwilh a lini! switch at the top of th travel.
'7. lleat comeson for I0 secondsand goesoff.
8. Quenchcomeson for 8 secondsand goesoff.
9. The part retums down by gravity and spring action The upper-limit
switch becomesinaclivatedwben the mandrclstans down
10. The part and mandrelreachlhe boltom. The downlimit switch is again

lt. The systemshouldreset.


t2 . The part is removed
,\\ IN DLS IR I.\L P R {]C E 5SII\II\O P P I-IL.\III]\
' -t

.tr:::--+

l'^--l
loonl CyLinder I
lootrl l up-l
iGra!ityiSpingr
i F6rum i

FIGURE9.I4
StalionLaYou!
Heat/Quench

Someoptional featuresnot includedin lhis programare


nse. Lower-li If you assume the heatgeneratorandbothwaterpumpsafe on, inlerlocks
xandreland that could b addedto insure they are runningthroughoutthe process.
, thepartleaves The same ring part could be processedtlvo or more limes. we could
requirethe ring to be removedafter step 12 before resetlinglakes place
,. tollthe travel ls proper temperaturereached?A thermocouplesensofcolrld be incorpo-
raled to monitor temperaturc.
tr Manual conlrols for setup could be added. These are Up, Heat, and
1. The upprli Quench.
o Safetyfeaturescould be added,suchas a saiely shieldlhat lowers dLrring
lni! swirch is heat. Where does the processreslaft after interrupledpo\|er is restored?
c Other featLrres as requird.
The next step is to assignPLC registeror addressnumbersto the various
inputs and outpuls.
Inpuls OutPUts

u00| I{asterSiop 0 0t 9 SolenoidValve-UP


0001 Ilaslr Start 0021 HeatOn ContactorCoil
I:: :.:
0001 Left Slop 0023 QuenchSprayWaterSolenoid
0001 Lefl Start ro pilot Lii:
000i Righ!Stop Options
0006 Right S!ar1 00r7 SyslemOn Pilot Lighl
0007 Limit SwitchDown 0018 Machineon/Up PilotLight
000E Limi! SwitchUP
a- -'- -i,
d-u
L''
li
n-.
NOO3 NOOS 1N004 NO06 N007
1"- ,
Pan i. P ace 1lNO07) C oses
p l sh t r p ( r N004
& 5)
Fu . ( C8018) O.
lo "
\;.

TS 1 LsD

flGURE
Connecli

EXERCISES
Wnte a
proSran
1 A11
sqi
CFlB

-_wOl r
3.E

cR22 4. G

FIGURE9-T5
HearQuenchMachineProgram
L X IJR CI5 E\ lJl

A ladderdirgramto carry out the processis then developcd.


as shown in
9-15.
nsure
Thenextslepis io drawtheconncction dingramibr the PLC.Thereareeight
inputconnectionsand fiveoutputconnections, threeto process acturtofsand lwo
to pilot The
Ughts. connection diagramis illusrratcdin fi8urc9-16.
The finaltwo developmenlal stepsare to proS.amlhc PLC fbr lhe process
and make modificationsas requi.ed.

1T
1
T9
20
21
22
23

25
26

o 27
2A
29
30
31
32

- '"",
FTGURE9-16
DiagranFo. PLC\{odule.Inpurs.
C!nnection andOutputs

EXERCISES
Write a PLC programfo. thcse chapr.f problemi. rnsci th.nr inro a PLC and tesl the
Prcgramslor co.fect ope.aoon
1 . A l i m e .i s to l um on afan sw nch8.6secondr ar,era $al l s\enchi s tumedon. I f dle wall
switch is turned off during the 8.6 secondtine inten-al. rhe timer is !o reset to zero
seconds,so that when the wall swnch is aeainru.n.d on, the delav h the firll 8 6

2. When a switch is tumed on, C goeso. imnedialely and D Eoeson 9 secondslaler.


Openin8dre swilch turns bolh C and D off
E and F are tumd on by a swilch. Whenlhe swnch is tumed off, E goesotTimmedi'
ate1y.F remainsod for another7 secondsand then goesotr.
c atrd H both 8lr on when an input is en.r-qized.G turns off afler 4 seconds. H
Tuming input off at anv tme tums
continuesrunninguntil the input h de-energized.

I
I)r,c It\ltrR FU\c flo)r5
rI
5. ' i w o p u l s e .ss ra na r th c s a mel i m e.P ul seoul purJ i s to pul sccverr I: scco.ds.puts
o u tP u tK i ! to p u l s cc v c ry l s e conds.
6. W h e nL i s l u me do n . M i s ro g o on l l seconds
m a l te rh o w l o n g L i s i !me d o n .
Larer.V S oeson afte. seconds,

7. A . T w o l i s h ts a rero fi a s ho f a fd o l tal di l ferentj ntefval s.Onej son 5 secoi dsandorj


s e c o n d sT. h c o l h e r i s o i 3 s e condsand off8 seconds.B Tso i j shrsare ro fl ash
a h e rn a l e l yo, n e l o r 5 s e c o n d so..e for 8 seconds.
no
1$
E . T h e .ea re fo u r o u rp u 6 :R . S . T . and L. R sransi mmedi atety \rhenan i nD uri s ner-.
g i z e d .S n a d s 4 s e c o n disa re . T sGns5 seconds l are.rhanS . U goeson 1.9seconds
a i i e . S. On e s w j l c htu rn sa l l o u tputsoff.
9. R c p e a te x e rc i s e T fo rru rn i i g o ii del ayo..S soesoII4secondsai terR .T-qoesoff6.
s e c o n d sa i i e r R . U g o e so tr: i i econdsafterS .
10. A n o u tp u rp u l s e \' . . i s i o !o .n I i scconds rfter!n i nput,W , i s rurnedon.The v ri m-
PI
o n i n te rv a li s ro l a s r:: s c .o n d sonl y. V i s l o so on agai nI secondsl ater i or 5.j

ll. I h rre .r- th ,e e :,,.r8 d e \rc or d proce.(i ngLne A . B . Jnd C A fcr rhe prJce\s
, x .A j s i o n a n a J i e r7 sconds
b e g j n smi el apse.
N cxt, mi xerB i s ro sta 3.6seconds
a fte fA . M i x e r C ,s ro 5 ta ni s e .o ndsafterB . A l l thenremai non unri la masterE nabt
s w i tc hi s tu rn c do fT
12. W h e na s l l n b u to n i s d e p re s j e d. ;U goeson. Fi ve secondsl arer.N goeson. W hen
S(opis pushed.bort \l 3nd \ Sooff. In addition,6 secondsafterM and N Boofi, tan F,
$ h i c h h a d p re v i o u s l )b c e no fT .toes on. F rmai nson unti l the stad bul toni s agai n
d e p r s s e da.t $ h i ;h ri mei t q o c so { T.
ll. A w o o d s a e . w . 3 a n . F . a n da lubri cati on pump,P , al l go on w hena stan burroni s
p u s h e dA . s ro pb u i (.n rro p srh esawonl y.Thc fan i s to r!n an addi ri onal 5 seconds ro oul
b l o w th e c h i p sa q a \ T h e l u ti ep umpi s to run l br8 secondsal rershu(dow nof W . l0- 1
A d d i ri o n n l l yi .f (h . i 3 s h 3 sru n morethanone rni nul ,the fanl houl d stavon i nde6,
nuely.The fan ma) then,\r!med oifby pushinga separatefan rcserbutton. Iilhe saw
hasrun lessthanone flrnure.rhepumpshouldo offwhen rhe saw is turnedoff. The 8-
O BJ
secondtime delai orTdoesnor iake placfor a runnjngtine of lessthan one minute.

cDe
E Li:
PLC CounterFunctions
:nC5bter lor t

. sr?n3,6sconl
i:d a masterEnab
a
rd N go oii', fan
:1 burron is ag

OU JLINE
1, J Introduclion c 10-l (:a.rer:::lni:l.s
o 10-2ThBasicPI-CCoun(e.

c.rEcrlvDs
A i c end oi ihis chapler, you will be abie tc
L ' scribe thc PLC countef tunc1ioq.
|j r ' .i s o m eo f l he maj orcounti ngtun,:ti onsusedrn ci r;r' :s and .i .i .sser
c ci rcuj l .v ro P rl ccss
. .p l y l h e P L(l counterfuncl i onand associ al ed
' utri l !l
o ,.lply combinationsof counlcr! and timers to P.o.ess cont.ol

o
l:ll FUNCTIONS
PLCCOUN'I'ER

10-1 rNTRoDUcrroN
PLC countershave programming formatssimilar to timer formats.One in
furnishescount pulse!whichthe PLC functionanalyzes,Anotherinput
ou! Enable-reset,asit doesin lhe timerfunclion.Conventional countersrep
by this PLC functioncanbe mechanical, electrical,or eleclronic.Typicalex
plesofsolid-statecountersmaybefoundin manufaclurers'manuals and
texts.
Most PLCs includeboth down countersand up counters,which
similarly.The up countercountsfrom0 up to thepresetcount,wheresomeact
takesplace.The downcounlergoesffom a presetnumberdownto 0, where
actionoccurs,Havingbothup anddown countersenablesa commooregister
keeptrackof a net count,Usingtwo or mofePLC counters can helpcon
processes. The useof diffefentand multiplecountersin industrialapplicalions
discussed in thischapter.

l0*2 THE BASIC PLC COUNTER


Figure l0-l showsthe configuralion
of the basicPLC counterfunclion.
PLCshavea screen of a counterfunctionwith onlyoneinput.However
display
someeheae,somehow,lhere is a $ay to resetlhe counlerin lhe programming
sys!em.A singleinpul thatbothcounisand resetsis impraclical,becausetumi
resetthe funclionto 0 after each pulse:
a singleinput off belweenpulseslr'oLrld
Thissingle-input funclionwouldnevergetbeyonda countof L
Thecoil forma!(B) in 6g!re 10-l operatessimilarly.Countpulsesare by lN
I to UC 32,The setcoun!is 21.Enable-reset is by IN 2. Whena countof 2l is
reached(or exceeded), contact32 energizesoutput74.
ThePLC counterfunctionalconfiguratjon is almostidenticalfor up counteri
anddowncounters(elcepl,ofcourse,onecountsup andtheothercountsdown).
Figure l0-1 illustratestwo typical formatsfor PLC counters.The two inputs.
showncontrol the counteroperation.If lN 002is open,the counteris set to 0.
WhenlN 002is closed,thecounteris enabled.Any timeduringoperationthat IN
002is reopened,the counterresetsto 0.
For formatA of figure10-1,whenenabled,thecounterwill countonceeach
time IN 001goesfrom opento closed.It doesnot countwhenIN 001goesfrodi
closed!o open.Supposewe programa PLC up counterto a presetcount of 21.i
Startilg at 0, the counteiincrementsone numbereachtime the input pulseson.i
When a PLC count of 21 is reached,output CR ol7.will go on. As lN 001
continuesto be pulsedbeyond21,there\iill beriochangein theoulput.It staysori
o
10-3
and the countr continuesto inctemen!,
The down counteroperates like the up counter.In our example,we would
startcountingat 21.As inputpulsesarereceived at lN 001,the counterincre-
oents downward(21,20, 19,etc.)-Whenlhe countreacbes 0, the counteroutput
will energize.Additionalpulsedinputsto IN 001will haveno fu(her effecton lhe
oulpul stalus,
CHAFTEREXAMPLES

0c107
uco!7

.- :: l, lhere
:- --.anregislea
=r help co
-:- epptrcarioo

]"",",",

,"h;:-:
:he programmi (74)
Ourput
, becallse
tumi
3lier eachpul
FIGURE1O-1
?ulsesareby ThePLCCounter
Fuoction
a c o u n to f ? l

:acrup c o un For somecounterformats(notshown),onelinc ofa counte.iunctionin each


ri countsdo block is the enableline.The count sensingis doneby the blockfunctionfrom a
Tle trr'o in specifiedregisteror input in the block. A reset line for rhe counterblock is
.i::f is set to included program.
laterin theladder In allcasestheEnable/Reset linchaspriority
overthecountline,
ia:eiion that
. UnlikethePLCtimeioperation, thecounter operation is normally
notreten-
tive.Opening theenableinput,IN002,at anyrimewill reserrhecounterto 0 for a
! fll goes fror PLC counter.WhenIN 002is reclosed, the coun!hasno! beenretainedas a
. !:: ioun! of 2l restartingpoint. Checkth PLC operationalmanualto sewhelheryour pLC
-.-,1 pulsesoi counterfunctionis retentiveol not,
..f lrvoo
::tl_ It slays
10-3 CHAPTER EXAMPLES
We show six examplesof the use of the PLC counter.The first is for a basic
applicationfor countingevents.The secondandthird examplesusemorethanone
counterfor process'controlcounls. The fou(h thru sixth examplesuse the
counterfunctiodin conjunclionwith lhe timerfuncrion,\vhichwas describedin
Chapter9.
tr6 II.C C()UN]'ERFUNCI'IONS

Ex. l0-l Str igh! countingin a pfocess.Thc countcroutputgoeson


fiGURE IIFS
the sct countis receivedby repetitivepulsesto lhe coun!eri Examplel0-2 Dl
Ex. l0-2 Twocounte.s
usedwitha commonregister
to givethesumof
counts,
Ex. l0-l Two countersusedwith a commonregisterto give the differe
betweentwo counts,
Ex. l0-4 A pfocesswherea timedinlervalis stadedwhena count
preselvaiue,
E! 10-5 A p.ocess where a count of events is ro slar1 afler a fixed ti
-- -jnterval.
Ex. I0-6 A processwherea rateis delerminedby dividinga counrby a
rnte al_

EX.{}lPLE Example10-l in figufel0-2 illustrates lhe iundamenraluseof a pLC count


10-1 Aftcr a certainnumberof countsoccufs,the oulputgoeson. Theou!Dutcan
usedto energize aniodicator.Theoutputstatuscouldalsobeutilizedin ihe ladd
diagramlogicin theformofa contact.Thecounterfunctionis sho\rnfo. ei!her
up couqteror a downcounter.They both performthe samefunctionin
illustralion.
Eilhercounterwill funclionif its enablelineis energized.
Afier rhe
jnputrcceives 18pulses,theCR outputwill encrgize.

UC cc:
cF021 cBOZ;

EXAMPI.i]
10-3
FIGURE 1O-2
Example
l0-1. BasicPLCCounrer
Operarion

E)CdIIPI,E Examplel0-2 in figu.e10-l illustralesthe useof a combinaiionof r*.o counl


t0-2 Supposewe wanted an outpur indicaror !o go on when six of Dart C and eieht-r
part D are on a conveyor. This circuit would monitor rhe prooer counrs Ii 0i
and lN 003are proximitydevicesrhat pulseon whena par1goesbv lhem. Not;
lhat the circuit wouid not indicate more than six or eigh( pans; it !\,ould onli
indicate when there are enough pans.
To repeat the pfocess, lum IN 001 off to reset rhe sr-siem,Then reclosd
tN 001.
I(]-] CHAFTEREXAMPLES

FICUREIO-3
l0-2 DualCountcr
Example

rN003

=:; a :ted

: _:: a:.:r1l
by a ti
PrrtC
ic)

iaPLC
. ne outputcan

PartD
(D )
After rhe

1N 001cR 018 cR 019

018

EXAMPLE Exanple10-3,shownin figurel0-4, concems keeping lrackofihe netrImber of


10-3 parts onaconveluf.Thebumber of going
paats on the conveyoris counted by onc
proximitydevice'scount.The numberlcavingthe conveyofis corinlcdby a
secondproximitydevice's.count. Eachproximitydevicefeedsinforin.ii.,ilrntolts
own counterfunction.The totalnet countis kePtin a holdingregistercommonto
both counters.
An accurateinitialcountis needed.Whenstartinglhe operation,the numbr
ofparls on the conveyormus!be determined. This countnumberis programmed
into the commonregisteri.HRl0l"rlt is normallynecessaryto Put this count
numberin the downcounterasthe piesetnumber.Then.any pansgoingonto the
conveyor pulsetheup counter. Thecounler'sregister (whichis commonlo both
counters) will haveits valueincreasedby oneforeachenteringpart.S;milarly,the
partsleavingdecreasethe commonlegister'scount throughlhe down counter.

-raT<::z=E
l4E PLC COUNl'ERFUNCTIONS lo-l

FIGURtrIO-4 Colnr Counr


E i( a mp l cl 0 -1 . C o u n te | 5U s e d PansCodingOnParlsGolngO11
for a Nel Count --J!00?_________$
o

cFo17
ai

L
IB

tN00t

DC
iN003 c8019
Olt Count

stIo

The numbervalue in registerHR l0l representsthe nurnberof parts on t


conveyor.We areassuming thatno partsfall ofrthe conveyorandnoneare
alo[g the way.
The up counterpresetvalue is irrelevantin this application,lt does
matterwhetherthe counteroutpulsare on or off. The outputon-offlogic is
used.We havearbitrarilysetthe up counter'spresetvaluesto the maximum.

EXAMPLE Examplel0-4 is for a timedprocessthat occursaftera cenainprocesscount er.


10-4 reached.After a countof 15f.om a sensor,a paintsprayis to run for 25 second
Figure l0-5 showsa progmmthat accomplishes
the countand time operation.
o' fIt
EI
EXAMPLE Example l0-5, shownin 6gure10-6, is for a delayedcountingperiod.Id this
10-5 processwe do not wishto startcountinguntil onebourafterthe processsta.rts.
A
tjmer outputco[tact in thetimerrun tineclosesafterthe timeperiod.The closure EXAMPLE h
then enablesthe counterto startcountinginput pulses.Afler a countof 150,the 10-6 a.
output comeson, pi
: :_ ] C l :-1 P i E S .E X A V P LE S 119 t

7
ot 15

,fi- J'l'l
-nn^r.
SpBy.Onror25

l'7*' FTCURE1O-5
Examplel0-4. CountandTimePIo8]am
-f- serro

_irals---\
1500!8

of pans on
d noneare

.tion.It does
n-oF logic is
he maximuft, Counting

processcount
n for 25
| _l|eration
FICURE 10-6
Examplel0-5. Delayof the Stan of the CountinSProcess

EXAMPLE How manypartsper minutearegoingpasta certainprocesspoint?Examplel0-6


10-6 this problem.FiSurel0-7 is a ladderdiagmmschemefor obtainingthe
addresses
productpart flow rate.The timerandcounlerare enabledat the sametime. The
150 PLC FUNCIIONi
'OUNTqX

Closi.g1N0027

ttlOOzzjlSoOzZ
hooe,r- UC0081
Slad Counr
9999
1xe66q\$n'f:" "

lHBor06
J
ro"0000".
FIGURtr1O-7
Example
l0-6. Rare,per-Time-period
program

t".,,",rff J"Tlf:r::::il,t
*lT*i:+rji il:il,rff
:,,:,:?tr."""J::.,:,fl
i;ili"{{,;ii-:l' lir:*:#
ii*h*il#: r
{i,li;l",..ffi
ffffi::'drril
fL+:*::r
*#h
Hn:t:;lf*$n:,
--i
EXERCISES
Dsi8n,
consrruct,
andtesrpLC ci.cuirs
fo. thefolowjngprocesses
t on$,hen
aco!nrreaches
fijl:,ft'lii,fi:jil:d8o 23rherishtisrhen
rosooffwhen
2. A machine,M, is !o be tumed
on eilhef $.he
uptoro.o*
Eos r,ii* I orwhen
coun,
B
-3. ""p lin:j.::r
A fi n , F , i s ro b e l u .n e do n $ h cn".',*i,:;,;li:il

l'*ru*.lir::1,:. j""t1J,iT""llit;iT;
;i:
coun!L eoe

#:::;::":iilJTt',i,"J
" f;:':lli'i:#,;*x
:ili?,"""JJi,.,:nxxi."hlllJ"1,ilil,li3
5iil.,iJ;
EXERCISES

l7 to0 atanytime,lhe$olcnoid is lo bc kcptfromopcrarjns.Onc\(opbuuo..cselsrhc


en(ireprocess,includinsthc solenoids bcinsoff.
5. Rcpeat exeicisc I cxccptthrt whcnF gocskom l7 downro 0, rhccnlireproccss is to
be resctby a start-stop-seal systern.
6. A botrlingprocessfor l2 boulesoperarcsas follows:
Bonlsarecounteduntil all I2 are in positionfor 6llin8.
Whenin positioD in thecarlor.the l2 boitlesarefilled
sjmultaneously
for6.3scconds.
After fillins.lhereis a pauseof 1.8 secondsfo. form to subside.
The 12capsarthenput on andcountedas they areinstalled.
A solenoidthenpushesth completedca on of 12on to a conveyer-The systemh
.esetfor a newgroup(to be reslartdmanually)of 12botllesby a limit swirchrha!
indicatestharlhe crnon is out of the "fi11"positiooandon rhe convcyer.
7. A strckinsandbandinssystem(S) rcquiresa spacer!o be inserted(l) in a srackof
panelsaiter l.l sheetsare stacked.After 1.1more(28total).th stackis to be banded
(B).Addsnso.s andassumed outputdevices asrequired.
8. Reierto exercise 2 andaddthefollowingadditjondstepsto thep.ocess.After banding
is conpleted, thereis a 2-seconddelayfo. thebander to pullback.Then,anidenrifica-
' rionsp.aycolordot (P)is to be appliedro thestack.Spmytimeis 4 seconds.
9. Two feederconveyors (FI andF2)feeda pad ontoonemainconveyor{M). A proxim-
.l"o"o t; ity deviceis at theendofeachfeedefconveyor. Theproximity devicoutputsareled
6 iGsecond aspulses to counters. Eachcounter rhenshowsthecountoi pansbeingput ontothe
mainconveyor. In addition,anotherprorimitydeviceat the end of thc conveyor
= :s opened pulses in response lo pansleaving andthensendsthepulses to anothercountef.
-: :rll Jo not Dcvelop a program
to ha!ea singlcrgister sho$ingrhenumbr counter
ofpa s
ontheconveyor. AssumcthatthereSisref is initially
setto rhesamecountasrhccount
of paftson lhe conveyor.
J ')060is o 1fl. Prcgnman automaticconlrolfor the systcrnsho$nin frgurel0-S.
iE proc?ss

* [q
on lo I

FTGURE1O-8
fof Exercise5
Diag.ram
5s s 80 o{f

,,'tr.".. . Whenlheon bu on p']\hed,a slicker,S)\tanr sracking


's
posilionA. Stackheighiis controlled
plywoodsheers at
by a PLC countrfunctjon,nor a heightsenso..
WhenI2 patu areslacked,theconveyor(CV)goeson andmoveslhe stackto position
B. A sensoris used10 stop the conveyofat B. At B. paint (P) is atplied for I2.5
seconds. Afterpaintingis complcre,theconvcyorisrestartedmanually.The conveyor
! ,- Ole thenmovespans to positiooC. At posirionC thc srackstopsautomatically and rhe
stackis removedmanually.The stopbuttonstopstbeprocessanytime ir is dcpressed.
Assumethal only onestackis on the conveyoral a tim.Add limit switches,etc., as

it- I
Arithmetic Functions

OUTLINE
11.I Inlroduction
o 1l-2 Addirion c 11-3The Repetiri\c
andSubtracrion ll..k .
U-.1 Multiplicalion and Dieision o l1-5 SQUAREROOTandDOUBI-EPRl.:CISION

Oir,iECTIVES
youwill
At thceodof thischapter,
o ,\dJ and subtractnumbersusingthe PLC ADD andSUBTRACTiunctions.
o Explainand demonsrfale how |he PLC handlesoverflowind nesativenumbersior
rlr: ADD andSUBTRACTfLrnclions.
o Nirttiplyand dividenumbersusinslhe PLC MULTIPLY funciion.
o Squarenunbefsusingthe PLC SQUAREfunction.
Find squarerootsusingthe PLC SQUAREROOTfunction.
lil)iplainhow rhe PLC usesDOUBLE PRECISIONto takecareof largenumbers.
o Explainhow DOUBLE PRECISIONcanbe usedfor moreaccuracyil) compulations
b o Apply aUsix arithmeticopelalionsto processcontrol.
o Apply combinations ofPLC arilbmeticfunctionsto processes.

155
Ii 6 \ l) lII{ Il l l Il C F U \! l t, )N S

l 1-1 IN 'TR O D U C 'TION


lllcdiumand largcPLCshavearirhmcric tlnclioncapabiliries.
This chaprer
coversix of thescarilhmcticfunctions
andthcirapDlicatioos.
Thc funclionsto be cxpbincdare ADD, SUBTRACT,MULTlpLy, D
Vi DE. squaring,andSQUAREROOT.Ntanyproccsses needthesearirhmeric
opcrationson a first,conlinuous The pLC cando manvarithmetic
basas.
tronsper sccondfor fast updatingwhcn needed.The usualintervalbelween thir.
arithmelicalfunctionupdatcsis one or two scantimes.
This chaplerwill alsoshowwhcredoubleprecision,the usof two adjacent for i
registers,
is used.Mulliplying two four-digit
numbers togelher
resultsin an eieht:
digitnumber,whichwill not fit intoa four-digit slot.Two slots,or regisrers, oth
usedaulomatically by the PLC for thercsulting number.Thissystemandother valu
opc.alions doubleprecision
requiring alongwith thepLC han.
will beillust.ated, lne
dlingof ncgulivenumbers for eachof rhetuncrions. the
12i l
aP!
11-2 ADDITION AND SUBTRACTION 17.
Figurell-1 sholvsrhc PLC ADD function. 'il ret
For ll-lA, ir addsonly whenthe rt
nablelinechanges fron1off ro on.TheaddilionwjUnot takeplaceconlinuously
just bccause Enableis on_Whenenabled, the numerical valuein the operand-i
r cgiscr is addedro the numer jc rl. - L - i1 r\ e o f c ra n d -tre g ilt e r.T h e ; e s u l(in g

t ll
FIGUREI1-I
ThePLC ADD Funcrion
rR006a

N80041

I 121 034 031 032 |


lF-jc]-rcl-a=)---l
l05 a792 179 I
o
I -l r)ot o N A Nt )5 UB ,r{
f r\ ct . t o N 157

valucthcnappcars in thcspccincd dcstinittion rcgistcr.In munyI,LCs,operand2


c:rnbc a numberor thc valucin a dcsignarco reglslcr.
r:n FigurcI l-lB showsanothcrformutrhatopcrates sinrilrrly_ Thc two num-
ber$to beaddedarccntered in locations l0 andll. Thcresultofihe additionthen
i,ppcu^jn locrrionlt whcn rhe inpur t:t :s encrgizcd. figure fi iC'ih"*i
irnorncr tL,rmrltuundon iomc pLCs.you cJnaLlJmorelh.,ntwo numbers
usine
oncfunclion.Otherwisc you wouldhavcto addtwo numbcrs d;;il ;;:
lhirdnumbcrto theresult,requiring twolinesofprogram. ""d
Throughour ,h" ;;."i;;
: ::c :djaceol examplcsin thischapter,we us(hebtockformaro;ly [or the AbD fu;cti;;;;
: _r:;ran eiSht-:! for theotherfunctions shown.
::tsters,are , Whendoestheoutputcoilcomeon?In somepLCsits statusjs ir.clevant.
_ In
:3.n and olher otherP*LC\) )tcm\.rhecoil \ cncrgtzation inJic"t",."gi,", o*rflo* oi n;"iir;
rhePLc han-; varue.|.of o\ctilo$, lhe coilonly comcron \ henlhe rc,.hi
tg numbcrer--ecd,
Inercgr(lcrc o u n l. ncga p a b ilit yo.t h c v i\ c .ir re mu jno: f f . F o r e \ impl e .
d,.ume
rhedecimJlreti.'crjimil rs9ca9 lf ) oJ ddJ6Jt plu. 568.rhe."-, ;;:
;;:..t.
l.:ll.rsw.thrn lh e re g irt e rl: mir. a n d rh e c o rl$ illn o rc o me t f eo, unm
. , l2ll,wrll
appe,a_rinthc desrinarion rcgister. On rheolhernand,tfresumof s9t: jLrs Si:) ii
',ff;:"',I; 17,605, whichexceeds 9999,so thecoilwill comeon. In rl;"
registe.will read7605,the excessover10.000. "use,
rle'Jesrinattn

ne operand-2 . Noterhatwe areusingdecimalnumbers lhroughout thischapter. Thearith_


meticfunclionsalsoworkfor binafynumbers andolhernumbering systems. you
Ihe resulting m"y c\oo(ean ) n u mb e n n5Sy (lc m.d e p c n d rn ogn . h erc q u irc n c n r, -oi y o u r p e n i c -
ular P LC mo d e t T
. h c o rly p rc c a u rrois n lo u ie lh c . a n c n u mb er i nigy , t e m
rhroughoLrt rherrjrhrnclic fufction.
To 6nd out lvhichregjsrertypes,HR, OR, and so on, can be usedas
oper-
aLriis,consullthc manufacturea s ntanualfoa ),ourpLC.
Figurell -: r.lu,(r,rcsrfe ADD fun-rronfor rwo cxamples.One example
rs
_
fJr r 'e\ulr lesr lhan 99./9.trndlhe olhcr r( lor r re. ,'r g,".ri"r rhanqcg9. "_-
A sampleindustri3lprobl.m for the ADD functionis sholvnir figure
_ ll_3.
Two conveyorsfeeda maincont,eyor,For somereasonwe cannotgct
to the main
conveyor1omakea count.The maincon!e!'or countis dciermincdirom rhe
count
of partsenteringfrom the othc. t\lo con\elors. The coun! on each
feedcr_con-
veyor is dcterminedb)'a counleaiiot sho*i]), The countefson
each fecdet_
conveyofare input-pulsed by a p.o\iinir! dqi.ctof oncc for eachpart lesvingthe
convelors.The coJntof

,*l
p?n. c.1rer,nq the mainconvelor is rhcnclcrerm_incd
by rddrngrhc t$J feeder 'otal
co1!elof counrsusrngrhe ADD funclion.for illL\lra-
t ion..we.monil or lhe rorrl counre\ cn. r0 second..The input of rhe A DD funclion
otr oy pu,.ingrhe {DD flncrion enable..l he counr
I rs pulsedon and immediarely
coulo be plnted oul as shown in 6gurell_3 elery J0 seconds,
Note that lhis addirionmethod is an ahematesolution to a similar problem
in
chapterl0 usingcounrersand d commonresijter,

,! The PLC formarfor SUBTRA.T ir th; (rme ar for ADD, and lhc fLrncrion
operal;on-is

IUnCItOn.
similar.For sLrbtr"crion. oper"ndI js .ubtrdcledfrom operrnd L fhe
resull rs touno ln the dcsrjnarionregister.figure'n_4 sholvsrhe SUB.I
RACT
, \ RI1 I ].\IIJI' IC F ' U N C ' T I0 N S

HFoo75 HR0075
0462
9642 \
Hn0076 Qli
oti
0327
I I
I {
A00030
ao0o30

Oi
H80075
lt80075
4462
9642
Hn0076
4327
HF0076
3471
3
HF0077 Sum H F0077,-(t3,113-l OOOO)
0789-'-
31T3'
A. S0 n !.d e r
e - Sln Over
1 0 ,0 0 0
10,000
TIGURE 11-2
lwo Addition Examptes

ffi1fri;,gfr
5;",31ffi:j;t'i,'ffi
'$:ffi
*#t*d#-il#ffitiffi;r:
input
count
are
ava'ab,".
urr"u,rr,,rr:'ili.,'i,rJnl5i
it*{$ii.[r#
ili"t':jl!:t{rqjt{;,;;i{.iil^"'*:U,-*rn"
il].".""f$
II.2 ADDIIION AND SUB'I'RAC'I
ION 159

PanCounlerlorConvyof
A
ValuPlacedinHB00al
f,t r1----l',r*F
=+ Mainconveyor i- l
I

- r&oo PanCountrtorConveyor
B
VaiuePlacedin HR00a2

On
(HF0043)

r3.10,000)
FIGURE 11_3
UsingrheADD Funclion
for a ConleyorPartCoun!

h addilion,the
'n somePLCS, FIGURE 11-4
:nificantfor a The PLC SUBTRACTFunction

- action differs
J rhe resultis
I is on andthe

ind a negative

A BlockFormat
andonly one
ible for some r2r
1t valuefaom I _*_ .f_ l"- |
againdeter-
jconds,used,
FH"H"HH
10547 16 31 |
for accurate

*_--".-r--r,-.ll-i.- -
160 R] THMITIC FUNCTI'iS

Bctoro n.bt6
B.toro En.bb
HF0132
4642 H R 0t32
4621 \
H R 0 t3 3
621 oit H F0133
7307 of,
HRo134
AnyproviousVatuo
I HBo134
Any Prcviousvalu
I
|

r'1F0132
hF0132
H80133
H Fo133
H80134

3:
hFlol32
8642
1.1F0133
6218
H8013?
4621
H A O133
I
0n o
7307
HF0134
2424 H 80134
H(
2686
A-Diferenc-positive Usl
I' Ditte.ence,
Negarive
FIGURE 1I-5
Two tubtractionExamples

operation.Initializatjonfigures
theinitjalnunberof partson
c0untrnSresulls, conveyor
B inrolne

pa;,$ffi5t****u*f
i::,":r,$d,"j:i:.13il:l?Ji:o
lsil*d,J,:t#F*1;i":T,;,tffi
#:xll#fr
i*lpffi,*l,g,-$"':ffi
II-? ADDMON AND SUBTRASIION

A Conv'or PartsColntol
valu6Placsdin HF0251

El + Mainconvoyor

MainConwyor Colnlsr
valuPlacsdin H80252

Enabl
CountsElsry
30 Ssconds 30Sconds

b
FIGURE 11-6
Usingthc SUBTRACTFunctionfor a conveyorCount

:1tothe -T-----r-- /t
,.6275
HBcno4

ange, HB00o2
base
rickly
smit-
posr-
Hn0003

tgutg

:raJn-
rm is Nol6:NumboBafe In mik (0001Inch)
e set On6mll = 0 001hch
. and TIGURE 11-7
-9 is craphic Rlresentationof Dimensions
, \ l tl l l l Il l :-fl C It.i t!C f tON :i

H F000l
I
.._
n:
H Fooo2 R.
se,Pi nr + upperroreran*= upJiillfur

fiF0001 H8OOO3 HR0005 00


Sel Poi.t - LowerToterance Ur
4250 35 pr

IrF0c!5
Ti

FIGUREI1-8
PLC Operarion
wirhSeipoinr5?id ioie:::.es f

rcxer
r;r;r a"e-er-u
ai3'jrhevappear inHRoo01and tl-4
iiItJ6S;.'ii.liiii,lll
oro,,::o'ilbTili:';::; ",1;"..j;ic*;;tT nr3'|hei'1aiicar
\ arL,es
in HR000
r,
:H::a;'#:l;fl
nili ::;;
ii{,,1!;i':
;?i:il.[*:?:t.{iii:!;;:,
*r'icr'."ou".s
.omp"ii.ln
i;;.i;;;,: i,.,l;:l;1,]l
ilAil;t,#,na.r**nce
"i;;l,['Ji::;'J;:j:ff:::l
regisrers
isdiscussed
inchaprer
rq,*.rrich
coversitre

11-3 THE REPETITIVECLOCK


'Ihc ADD and SUBTRACI

:;:ri:"*::titii
llfu jT,lj:tr
funciions

,';ily;xilsilr
dis
il::
i'",i,'ili;fo
:;*.*:r"*:::LiHr:*:;':ri;,ll""lh:t"r_"nltl*';:
FigureIl_9 showsa repetitive clockarrangement.
A coil turos itselfoffand
on at a very fast rate, about t\ro times thr

*:lir::riri;u:;,}
ir[dT.
i*t*#rii5i,':iiI":'"::"j,i;::
,,,,j:.' ;,[: :"1,,!:.T:".:flT:il:fl"Tli
":'i,"l:.,i"i,'.'il]'::il:1ffi
i r \t( t.tii,t.t( \ rr)] \\t) t)i\'t5t()\ t63

T IG L R E I I_ 9 cF0043
cFoo43 | i- : nr ''
_r-\l i''
It.fe ti ti !e C l o c k a l i f. ri
l+r___
' \_/
_l
* cFoo43 l
_,.1 1 * ro drc!I ro be
i c o n t r n l o u s l yp l s e d

enablingcontact.which is normallyclosed.At lhe end of the first scan,the CR


00.11NC contactrs updrtedrnd opened.On rhe nexrscan,the coil is turnedoff.
Updateat the eod of the secondscrn reclosesthe self-nabling contaci.The
proccssthen repeatsitsclfconlinuously.
Whcn lixed, longer intervalsarc needed.tiners are used insteadof the
repetiiiveclock.Theseintervalsituations arecoveredin chaDter9. The reDerhive
clockcan be Lrsed with olher arirhmeric
iuncrionsbesidesADD and SUBTRACT.
This includesall lunctionsin rhe femninderof this chaptef.The repetitiveclock
can also be used with many other t-unctions lvhich need pedodicupdatingor
aclualion.Number comparisonfunciionsol the next chapterare examplcsof
lurther use of the reperitivcclock.

i l00l and 11*4 NIULTIPLICATIONAND DIVISION


it- 000t, The multiplicationtbrmatis similarto the additionandsubrraction formatsDrevi-
rer values ou(lr d::cu)icu. Fi gLfc ll-10 "noqs tn.'-\lLLTIpLy funcrior.\e discuis.he
:r':eactual blockfunctiononly. OperundI is assigned a fegisternumber.Operand2 can be
i erter 12, anotherregister,or it may be a constant,The fesultof the muLtiplication
apoears
qhen lhc tu-cl;on i, (rtrbled The dcsrjn.rrion
in Ihe desrin-1rioo is,*o r"glrr"r,
:aers intO
wide by necessity.Multiplying003.1by0086lvouldrequifeoniy one register,four
numbers wide, tbr the answer (2064).However, multiplying64j3 by 8933
(57,64.{,649)
wouldfequirean eight-bit,wide slotor two rgisters
to accommodate

The multiplicarion iakesplaceonly whenenablecomeson. Normally, the


corlcomeson lvhenrhe muhiplicarion is compleled.Tbe coil on"offstatebasno
: do not numericalsignificance as it did in ADD and SUBTRACT.
ici oper- A simpleprocessapplication for countingcartonsis shownin figureI l_l l.
:ri_g else The counl from a cafton counter entersthe pLC and is put into lR 0001and then
iolo operandl. Each carion contains12 bottles;therefore,12 is enteredas a
constantin operand2. To keep a consrantcount oi bottle output. the pLC wouid
:..:i and concrsnrllrulr.piyrhecanoncounrbll2.Thedesrinarionregl.ter.HR()00l,\^ill
sholv the numberof bottlesoLrtpureachtime the t'unciionis enabled.A number of
- :: !ou ihese NIULTIPLY functions could be combinedto give a toral plant unir outDul.
Th. concrcnr. l.rch funcrionuoJld be borfe. per cuton.br lhrl pa.lic;lxr
aoti count. A PLC addition program ofall individuelcounts would then sive rhe roral
plant bottiecount.

tr--
\ R f i l l )1 t:I1 C t-U \c .f l o N 5

FlcuR! u-10
lhc M U LT I P LY F u n c ti o n

FIGURE 11-1
The DIVIDE I

N.,",F",,"""',"f
,".";;";i;:::"".,"",
".,,

ffiil;l}:'dJ"i,xT.'fl i:i'fl,'.'',:
rl*'HiHilllr"",'"J"Fi:i::^,'ffi
ililffi
:f i;;:'il1::Xl.':lii ;'i:il1,::'l',",;:tr1ii","#::i
i1:;
:iTil:$

*::*i'i$+l*i#i:tfi
*LT:'g.:,m,,,::m Constanlvatu6
//..-
(F0001)
' oot'='""*t t'""*0",
181FolTult
(0lo81so)
t
ll
MSOB LSDS

fIGURE 11-11
MultiplicationExample
ll-,r NtLLI tfllc \t toN \i\n Dt\ tSti_)N /
r65

cF0127
f ,,".*il-f,"*d=fi-#H'"ff
'*L_dl

FIGURtr 11-12
T1 Squarinsby the MULTIPLY Funcrion

'/ FIGURE11-13
i TheDIVIDE Function
: -]

i H800ts3
6ndHF0034
Tot3lD6rin.tion Inctudes
Hn@61

rannglssimplya
ro operand2 ofa 030 031 032 033
i iten appearsin
I: - 1:. We show H"H"H-X- 034 2@
s srrnilarto the
?-1dI, the divi-
.i rhe division 032 4 033 035 O1O
{.;3in. the divi-
"H=H"H=H
Nor6:Vtloisin0i2 andDcimstis
in033,

siontakesplaceonly at the timeEnableis energized. To facilitatedivision,oper_


andI is two registers
wideandoperand2 is onlyoneregisterwide.Op"."na Z iuu
nonnallybe a registeror a constantnumericalvalue.
In PLCS,the destinarionis almostalwaystwo rgisters\r,ide.The firs!
destinariodregisreris the numericalresultof rhe divisio;. The .".onO ..!iii.i
valueis therernainder in numericalform,Theremainder is not a decimalval-ue. A
numedcalexampleofa divisionis illustratedin figurel1_14.Thedetermination oi
numbervaluein the seconddestinatioo registeris explainedin the figure.
,\tll IH!lL ftc FUNcl toNS
ll- 5

FIGUREII-I,I
FtGL'
DMDE DcninrrionRcgistcr Opsrand1 l Tbe :
ConlcntDe!c.minarion varuinTwoRgislsl3J 48,127
dividsdby 267 I
Operand2 1 x ) 646,,
ConsrarrVatu " .-. 2421 )
.quars 7 zat.itoas qu31s) i 720

VaUsin rhTwoFgisrls
@ | 1720|

For i
FIGURE1I-15 9ysl
Exampleol rh ProcessUseof lfate
theDMDE Funcrion AD .
(HR0078and Haoo7g)

0012
, OnOtzl , ;, OB ol 2s .
\ ,/\FemaLndd/
' r

FigureI I -15 is an exampleof scaling by division.


An analogmeasurement
numcrical value,in inches,is fcd into a pLC inputregister. ft""In"uru."."ni
valueis transferrd (no!shown)withinrhepLC to inpuircgister iN 0078.i; ;;;
rhe_-value-in
feetto outpLrt fromthe pLC into an indicatoidi"id" bt lr;it;;
DMDE function.The result,now in the fequireddimension
registerOR 0124. "ii*,,'"pp*rr'i"-
If rherequired outpu! accuracy is lessthanwhole feet,convcrltheremain_
.
derrntoclecimal tbrm.Thiswouldbeaccomplished by anadded program
(hown):Dividerhenumerical step(not
remainder in OROtZS Uv rZ anapfecie rfre,er'uitin
anotheroulput register,for example,OR 0126.you would thenhave
four-deci-
mal-placeaccuracywhenthe OR 0126outputregistervalueis recognizcd
as ten_
lhousandthsof an inch.

11-5 SQUAREROOT AND DOUBLE PRECISION


FigureI l-16 showsrhe SQUAREROOTfunctionfoundon somepLCs (block
lormatoily). Thenumberwhosesquare rootwe wanlto determine is Dlaced in lhe
sou-rce.
Thesourceinputnumber is conrained in rworecjstersso thalli;;; ;; ;;;
ro 99,999.999 in value.whenenabled, thefuncri""*f*1"", im ,q"^r. ijoi
placesit in the destination.The destinationls one regtster ""5
wide, up to 9999 in
value.Thereis usuallyno remainderrcgisler.
Jupposea processreedsseven_ or eight-placefigureaccuracy,no!just the
normatlycatculatedfour figures.SomeadvancedliC, f,*"
tf,"
"up"fiiiitv-io
l J .\R l , l { rJl l l r\i \ Ir l roU U I I fl (LLL\l r)\

FICUREI I-16
l 648,1 The SQUAREROO'I Funcrion

l
) 1720

391
doublethenumbcrof oLrtputdecimaldigits,for example,from four diSitslo ei8ht.
For morepreciseproceises,thisincreasedaccurJcy maybetequired. The PLC's
systemto increase
accLrracyis calledDOUBLE PREClSlON Figure I I-17 illus-
tratesonemanufacturer'ssystem for carrying
out DOUBLE PRECISION for the
ADD function- your
Consult user'smanual for how yourparlicularPLC does lhis.

,f
or, indeed,whether
it cando at all.
'!

MSDS LSOS

t rinooor_]fHnoootl
ement + t HFoom
I THBooo4l
remenl
To get I rnooos
I
with a
.arsin l--a,'] I
-l
'main- l-Fnoois t Hnoooo
I
p (not
sukin
-deci-
s ten-

block

)eup
I and
l9 in

.! t he FTGURE11-17
iy to TypicalDOUBLE PRECISIONFunclionForna!
F U N C l ' IO N 5

EXERCISES
A ll e .x c rc i \eas s s u meth .u d l n o mbenarc i n dcci mi r ,
form.
l. a J n (rrx c l a b rs i c p L C AD D tu ncri on.U \c i :

*:.:
lnscnl"*:::::l{:}::::r;;q66
rcilrivety
smalnumbcrs
J"llii
1l;J"l,:[ffi hyl!li:.Hl
in HR000,m rli*p,-*rir"'iffi;il;::ft
verify thar rhe resuhingsumin HR 0003is correct
use the nPPropriateoumbering
sysremto accomptish tbe addirion.
Nexr, insen targenumberswhosesume
or HR 0003and
obse.vcrhc resurt.Doest* **,, *"*o*o ljlJ',',lhercapabilitv

' l[".,:"i"lJjii;l[i!"i#1j.::r"?:;:T
;i'"I.::ff
i:'"i",:1:n"il:ilHi:1
p r.h o n th e m a i n c o n v e y o r. F
As an additionajexe.cis,usea rimerto updatethe roral
3. Constructa SUBTRACTfuncrionin a mannersimilaf
rheoperands
thatrcsuh
inaposirive
desrinarion
numt",rG_i"*
very l5 seconds.
to xercisel. Inserrnumbers,n F
a nesarivcanswef.Doesrhe nesariveanswefproduce i'iii._r*
,h; ,;J," "ii""ii,"l,
;:;;;;;is_
LrreI t-5?
4, Two convyors,A and B, ieeda rnainconveyo.,C.
A rhirdconveyor,R, removes
rejecrsa shortdistancedowntbemainconveyor.Th"
f". **"vi" e, i'a,,.
R a,eefth inpurinroholdins regi\rer( ""*"
in rheir-c. c"",i;.ij pLi,,.i,,-",n i.iii""
rhe total output,c, pan colrnt,
As an additionalexercise,usea timer ro updatelhe rolal
ar a rime inrervatof youl
t pLc proErarnfo oq ins,he,r.<rem <nown,n nsurelI r_7 and
::,""p_".i,::::':l:"q
Lnenomrnal vajLre poinL
',-6. orser is^tJ.tj inches.the,oterances-are _0.27ano
-0.27 inches.Show!hatrheresulrins rLL_catculared rjmnsarecorlec!.To funhertcs!
tl" programs_validiry,changerhe ser point and rolerances
_
- a aiff"r"nt
checkrheresults_ "rfu"l "no
6. Repeatexercise5 wirh diffefenttolerancs. Borh loterances are neSative,_0.05 ro
-0.20.
7. A m.rn co eyor hasrwo convcyorsfee,iinfit. Onefeedcrputs
6_packson rhefiain
conveyor;rheorhrfeedsB-packs. Borhfeederconv"yor"t a"" counr"r,rf.,at
nu'lber ofpacksleavinSrhem.Designa prosramto gi""
u.ruf *" *"ni o" "ouni.i".
,i"..i"
conveyor,
8.A:gi*v",y".9-,1, ndr2-packsofcanndsodanterinsir.Eachsizeofanenterinr
pack hasan individualpackquantitycounrerfeedt", pLC
re";;,;;. T;;;;;;*
oany lotal caosareenterinS thecolj "
uo program for mulliplyingand thcn
addingto Sivea total can 'u"tot' ""t "
"ounr.
9. Wehaveanoxrputthrtgivesusa dimen(ion in Inches.
We
di.pl{yed in feerand yirds. Developa pLC prog_am wishlo haverhedimcn:ion
ro ourpurat rfr*e a;men,ionr.
radlruserr!odivision,io.r,oouip,:aa.aon.ai.".,."..:;;,;;;;-...,'..",,
10. Stup a pLCproBram roobrainanor oR 0015rhe ourPutis to 8i!e
a varueba(edon rwo in!u,,, ,"0 {o'J
.\. r equars rhesquarc
ol N -0,1.'li:i':rer of NIpluslhesquareroot
"
U. Developprosramsfor olher math equationsof your
cnoice.Example:N = (J +
UseHR 0001

of HR 0003and

NumberComparison
Functions

islres lt-7 and


rs a... 10.27and OUTLINE
x_To funherGst
Ul-l Inlroducrion
c U-2 Comparison
Functions
E u_J ApplicationExampies

sair\3, -0.05to OBJECTTVES


At the end of lhis chapter, you will be able !o
tr lisr and definerhe six COMPARE funcrionr.
E Show numenc y rhe capabiliLisand applicadon
oierct of the six comparisons.
! ApDry each ot rhe srx numencal COMPARE
funcrionsto solvean applicableprocess
problem.
!_ci anentering
E Apply combinarions
ofCOMPAREfunctions!o do multiplecoftparjsonanalvsis.

T"''*'.^
rE::ji is to give

. :\= (J +
tio \ Llllr-lllLlttlj
!l; fi\r r,r,'rj
ta - | ri"\*
I'RODUCTI()N
lVcrliumand trrge pLCs ha1,e
numbcr(

flir",r,i;*til*ffi
i:;:;,t*rr##f*i*
**'**X"liliil"!d,[#itrklJ'"':i:r'i'.';#ff
ilJ:ii:
*:*:T:*j:j
*:1u$;f**E*i*:';3i.
t2-2 CONIPARISONFUNCTIONS

lruU i:ut--,#
*tf.,r*$.{il,.:,#
;*6=*iEitiiim"n*nmli*+"
,'."*:ii.l.'-*-i.:,1"":
il"1,,::.;i:"JHx::il
H:H:;[T,":,,".T.1,il:
;":::
i",;5;i1',.:ffi j,
j[
il;;;Ti!":iffiH#'#iii.;
r82
a'\or'(:5r
,*iiri*i3i:-
i !'""'^ttru*l
l*,#lai:
fl"t"t
:ill#}$friti+f+iltrf
..,'
#;iilF**.iltii{n*,*'#fr}l[1

I
Clrcuir (cond!.1. when

EQ
Eqra (EO)

EO
ssirrylor
Ale _+ts_
GE
'3
parisonsof (GE )
GE
e may wrshto .--.'-*|-
GE EQ
--1-?

6
rk and horv lhey

FIGURE12-1
ThSix COMPAREFunctions

ss than, greater IIGURE 12-2


nre used,some TypicalPLC COMPARE
ning easief.Ot
Iionsar all.
lc lunctionsfor
rerseor combi-

)nsland3are
s denvedfunc-

l. Then B, the
I
I |NOO71
Enab{6
0P1
0P2
37
are merefore / \
/ lspecfYl

a, ,*

F|--{)-l 0"""
Jf "s,
Go6on wh6n nu.t'b6E

12r 0ts6 \ ozr


of 182.Later
04
H"H-Hxxx p5 01
th block
-.
r onetypeof Va ablo R6ln.e
{canbva abl)
F , rurrr, , ,villlio I riJZir,l.rs

*Nm*iill,l;,ffi

72-3
*****ffi
-
APPLICATION EXAMPI,ES

iifi:;,,#:["##imri*:",-rinilliilff
i'

ir*rEldlftf E]L{}IPLE
E\ A } I P L E e ." ,n p t.r-
.*,,.,,1 n *o ;1^*- ;
g,;i;;i::r*i#i[[i,#l*,n:;',ff
:::.;".::,Ht":
****dffi***ffi
;N'fr#],ffiif4gf
I
ll -.1 llf.rN LX,^tllPL.lts l7J
^1,1'Llc.\
.)*is cntcrcd
T.IGURET2-3
cqual)andIN Exnmplel2*L Equnl--fo
(hercoil-type
COMPAREFunction
.)requaltofor
, I is energized.
Thc lwo num-
bea constant,
ttn numerical
I io the func-

,rl.isonis made.
r. not tme, the
continuously
. In someothea flRo123
on. To make

::rally similar.
i.I COMPARE HFto147
rLrldQerhe coil
Compa son ot Two Numbrg

process
theoutside intoHR 0123andHR 0147for theillustntion.Whcnenabled,
outputCR0l0l wil!comeon anytimethenumbers in thetwo .egisters
areexactly
ionsin PLC equal.
iicarionwith
COMPARE
EXAi!IPLE Examplel2-2 is for the nol-equal-to function.Figurel2-4 showsits program-
ming.In theexample, theoutputis to beon exceptwhenaninputcountis exactly
87. The inputcountis trackedin lR 0062,Operand2 can be program,ned as lhe
COiVIPARE number 0087.lt couldalsobeprogranmed asa register,
HR 0183.Thenunber87
'rnction
(not wouldthenbe inserted into HR 0183.
,as Iheyate
rningcount
res40, the
019is con- FTGUREU-4
emovaland Example
l2-2. Not-Equal-To
otherfunc- COMPARE F!nction
tR0062

operation.
'rd somedo Operand
2
lpter 22.
is case,an
ues do not
NolEqual
re fed from
I
NI ]\1 I,ER C O]vIIj
I \J II\I )N I.U N C,IIoN S

FIC
EX.{illPLE An uulomLrtic pill-bortlc-ltlling
opcr ion h,r5two po\siblcbuttlcsize5 Onc bottl;
l2-3 is ro be fitledto a coun!of 225or more.The oth;r is ro t uuelzs o. more. ihil CC
ernmplc.I2-3. u,<cs r grenrer-rhiln.or-eqrel
lo COMpAREfuncrion. figure f2_l
showsthc funclionto controlrhe pill counrs.The pill counr(co-unter no-t
shown)is fed-PLCfrom an input to lR 0142as lhe boltle is filled.The appropriaie
minimumnumber of pillsforpropefnlling,225or 4ZS,is inserted inroHIi 0i28.4
botll. is put underthepilldispenser (rol shown).Fora smallbottle,the225limii
is pul into HR 0128:for a lae borrle,475 -.
wouldbe enrered inroHR 0128.

FIGURE I2-S
Examplel2-3. Crearer-Than,
or-Equal-ToCOMp.{RE
rFo142 EXAMPLE T l .
Ttt

Opeland
2
NR0128 tti
o

FeEislerselal
i rher225
0r475

As rhebolllesta|1s tillijrg,
En3bleis continuously pulsed, Thecomparison is
unlrueand ourputCR 00j0 is off. Oncethe pill coun! reaches225for the smali
botrle,.CR 0030goeson. Ourpul CR OO3O is condectedto a cap-and-remove
operatlon {notshorn).Thebottleis capped andrcmoved, andthep;ocess is reset
andc_an be repealed. The sanesequence wouldbecarriedout forihe largebotile
wirh HR 0128seral.lii.
. Why not usean equal-rofunctionfor exampleC? EQ wouldprobablywork,
bui wharifrheprocess overshoors?Suppose theiounrsometrowgot roZZdfoittre
snall bor!le.The ill \r.ouldgo on unabared. lf the countgot to 221(or 476for the
large-size),
ho\iever.lhefill processwouldnot eftoneously conlinueil you usethe
CE func on.

EXAMPLE Examplel2-4 is illustraredio figure 12-6. Completedassemblies


productionIine.If an assemblyis removedfor reworksomewhere
flow off of a
alongthe line,
o'
the pan to be reworkedis automaticallycounted.Il there are mori than
ld
assemblies remoredrn a:rhour.a lightin the foreman s oificeis ro tum off. li
Ihereare lewefrhrn l8 rejecl,per hd- rhelitht will remainon. The
reouired
hourty.reser-ro-0sy(temrr ror sho\Ln.tThe only pan of this programriratis
shown.isrhecomodrison po-lron.)Thedefectcountiskeptin HRd06t,operandl.
Theallowable holrly numbe- of defecr:,I8, is insened'rs
ooerand 2 '
l:-i Al'FLlc:\ iicr Ex.\!lPLl,s I_-a

FIGURE T2-6
i'- Cic aaide Examplel2-4. Less-Tlran
r ::e{=. Thi. COMPAREFunclion

a ::Frlpcale :
: I{R 0t?t. A

i R 0r2 8 .

EXAIIPLE Thegreater-thanCOMPARE funcrion, Example I?-5 isillusr=ie::::-:r'e il-;


:'..5 Two comparison functions arerequired for lhisexampleTiisp::::'::e1
tionrequiresa count greater lhan 348 for lheou!putto lurno' l:: :i-::r 'peta_ lrS 1s
insenedasoperand 2 in bolhfunctionsForacountofl'17lie EQ iee.;s
k e e p s ih e c :'::::r'r
: : r"
ri i ' F orl19
-t theoutputof i. B e lo wa c o u n t o f 3 4 S , t h e G E f u n c t io n
or mor;, theoutput
line,
is on, as both conlacts will be closed ior ii3 i:li:'2:'-'r ladder

ioftparisonis
br the small HR0011
-and-remove tFI0o12= 3r3
rcessis reset l i H B oC 11sr
: largebottle 347 ( c"atl <u
2
oporand or I CF:t22 4'
H80012 l!:t LcBaaa a.
)bablywork,
r 226for rhe 38 i ca:ci a.
i 476for the eracrly
i ceaiz c-
youusethe
hR0o11 349 i Cq:':? a-
I CF:t:' a'
j- ce,:*: :.

OpeGnd2
. f ota
,n!:theline,
rre than 18
tum olT.If
ie required
.arn that is
. operand 1. FIGURE U-7
COMPAREFuncri'n
Examplel2-5. Creater'Than
1 76 NL}lIII]R COMP IIISONI:UNC1'IONS

EXA}TPLE Thclcss-thrn-urcqui,l.lo
CUN.JpARE lunction,Exumplct2-6,is shownin 6e;
12-6 I:-8- A proJuctit')n
\y\tcm proJulc\r proJu.ttt"r ."n b" on" oiihr;;:;il.:
red.whrre,or btuc.Th('p.uducrion
i. tjmiredro 148btueunit,p"i a"v. if," U'frg
unitsare countcJby L\jn8x color..en.irive
deleclor.ff," a.t,i.ro.J*ni ir'iJ'
to the PLC into HR 0llt. The maximumdcsiredcount,34S,is insen;J
i;i;
HR OOI2,

HF00r2= 3,18

3.17 [ Cema olt


of j cR0o22Ofi
ress L Ca00?3
On

- - TcF@2r on
""o y { cFoo22
exacr I cFoo23
on
on
o,
34s r CFOO2]
Oi
oI ( CF002?
oir
moreLcRooz3ori
l.rRoo
l2

On il l-180011
s 348

FIGUR,E12.8
Examplel2-6. Less"Than-or-Equat-To
Funcrion
.t
Theiodicatoris on for countsbelow34g.Whenthecountreaches
stayson, andEQ conre(on.Theoutputremain,on. 34g.GE
Wt.n rt !o.i rrl o-rli
mo-eto 349,Ee goesoif. indicaringrharrheproducrion " "ount
lirni,
reached.The outpu!is now off and-willremainof for frigher
f;;;l;;;rr;;;
counis.
- _'-" ---" _!_-
E)LA.MPLI
EXAMPLE ExamplcI2-1. shownin figLrret2-9. i, a multiple-comparison 1r-E
programfor light-
ilg an indicatoronly whc.rlhe counl is bet\reentj
and :2. ,q.
Gi fu-nction ls ul.i
for thelowercount.Anolher GEfunclion is us"a ." i"al""r",i"iii
at 23.IN 00t6enablesrhefuncrions.Betow15,,h.".,"p CE;;;;;;;ft.,'i.;;; ""Jli."i
the outputin the lower ladderline of.
i P PL IC A ' i JO\ LX r\TIP LLS l-

-::- - :::..icr
cF00r7
:rt :-. r:re L09ic'GE
_ : r-:: :5 :ad
15

lN00i0 cH001a
Logic-GE
23 HFt0261

rN0016
c80017cR0018
::
?
*
t- 115ta22)
15andup

I'iGURE 1?.9
rt Examplcl2-7. Multiple-Coorparison
Progmm

l ll""f
When the count, startingfrom 0, reacheslj, the lop GE funcliongoeson.

iJl;is,i8f i,
,il:t*"8,
i,i
:il:i;:5"::1"::li::'
closes.The other
'1 tion hasnot yetcomeon.
the lowerGE func-

Whentheupcountreaches 22,theoutputis stillon.Whenthecountreaches


.n
i. 21,thelowerGE functiongoeson.Its contact in thelowerladderlincopens.The
hes348,CE i)l outputis thercforetumed off at 23and beyond.
goesup one
,:t
o""o
,u"5 .4 EXAMPLE The followingindusirialproblemshowshow COMPAREfilnctionsmightbeused.
u-8 A conveyoris supposed to havcexactly45partson it. You havelhreeindicaling
:1mfor light- lights!o indicatelhe conveyorcountstatus:lessthen45, yellow;exactly45,
rtlonrsused green;andmorelhan4j, red.Thecountofpartson theconveyoris seta! 45each
l2 and is set mohingby anactualcountofparts.Thefearetwo sensors on theconveyor.One
off, keeping is actuatedby parls enleringthe conveyor,and the other is actuatedby parls
leaving.A PLC programto carry out this filnctioois shownin Figure 12-10.
N L \,l i l i ,i { C { l \l i ' \R I5 O\ f l r\a l I(rN S

N 003 D Ct0
II
LOGIC

Y
+ EQ 11

T l N0 0 1 GE 12

t LOGIC

Fof .F lg12. 6

GE
cR12
i
YELLOW
t
Rei. Fig 12-7 _______________
,
GE EQ
cF tl cF 14

RED

FIGURE U-10
Example12-8.PLC Programfor PilorLight Indicatio!of CooveyorPartCount

EXERCISES
ConslructandrestPLC COIVIP-\RE funcrionprogramsfor lhe foilowiogproblemsl
1. A lighr is to cone on only if a PLC counrerhasa valuof 45 or 78. (,m,rj Two Ee
firnctionswith ouipursin paraltel.)
IJ XE R C i S ES
-119

2 . ,\ l i s h r j s ro b e o n i f a pLC ccuntc.docsnor havc vatucsof ci ther2l


or I I
3 . A l i s h i i s !o c o mc on i f th.ce tnput numbershrye the sameval ue. (rrrr
U s rwo
l -!n c ri o n sw i th th c samcrcgi srers and rw o contactsconrro i ng an outpurcoi l .t
4 . A n o u l p u t i s o n i f th e i npurcounr i s tessthan14 or mo.e than4t.
5 . S a m ea s e x e rc i s c1 , but i f l he count i r, 17. thc ourpurrs arsoon.
6 . An o u tp u ti s ro b e o n i I the counrj s bel w cent4 and 41.The counr i ncl udes
34 and 41.
7. Sameas exercise6, but ii !h count is J7, rhe outpu! is ro be off_
LCG/C 8 ,T h e re a re rq o c o o .eyo unrrnpurrndourpurofptrnrenrc r ins
J n d l e .v ,n c ,h e c o n re)or< ..,,.nr\ampte i : 8 foroneconre)or. i h" * " i " ,"
l . J."i
indicatinglishts for the processas fo ows:
Numbef of parts on the conveyoG equat Whire tish!
Number of pa.!s on conveyor #t is sreater c.een ti;ht
Numbr of pans on conveyor #2 is greater Btue figtr
9, Repeatexercise8 excep! tbat the dcsifed lhuation is that conveyor I have
xactty l2
more units on it than conveyo.2. When this siluationis true, a wtrite tieht goes
on. li
conveyor I has tessrhan l2 more pans on k rhan conueyor :, a
Creentighr ioes on. ii
conveyo. I has mo.e than l: morc pads on it rhan conveyor 2, a blLrelighigoes
on,

Ll-gw

.EQ

- -t,ft'
The SKIP and MASTER
CONTROL RELAY
Functions
ta

OUTLINE
E 13-2 TheSKIPFunclion
13-l Inrroducrion andApplicadons c 13-3 TheNI,{STER
CONTROL RELAYFunction tr
andApplications 13-4 The Function
JUlvlP

OBJECTIWS
At the ndof this chapter,you will be ableto
a Descdbethe operationof the SKIP function.
! Describethe opeBlionofthe MASTERCONTROLRELAY function,
D Apply the SK nndMCR functions10operetionaL alplicalions,
tr Describerhe operationof th JUMPfunction.

181
Lt- l

1-1-1 L\'TRODUCTION IIGURE 1]-2


B.-:h:hc SKIP (SK) and MASTERCONTROLRELAY (MCR)functions are sKlP Function
PLC
i,-\.:erfulprogramming tools.The SK funclionallows us to skip, or b),pass,a
.hosenportionof a laddcrsequcnce. Thc coilsandfunctions skippedrcmainin
il:c statcthcywcrcin duringthelist scanbeforeSK wasenabled. SKIPenables
u! to effectivelybranchto a differentporlionof the prog.am.In somepfogram-
riringsyslems, SKIPis callcdZCL (zonecontrollaststatc).
MCR operates similarly.WhenMCR is enabled on, the ladderdiagfam
funclionsnormally.WhenMCR is not eoabled, a specificdnumberof coilsand
funclions arefrozenin theoff position.
Coilsin thefrczenseclionwill rhensiay
off evenif lheir individualenablelinesare turnedon. In somesvstems. MCR
meansMaslerControlReset(notRelay).
Thedifference between thetwo functionsis thatSKIPleaves thenextspeci-
6ednunberof ladderlinesin theirprevious on or off slale.lv[CRrurnsrhe next
specified numbcrof laddcrlinesto theoff state.Ano(herdifference is tharSKlP
is aclivewhenenabled and MCR is activewhennot enabled, Rhichmakcsit
fail-safe.
A JUMPfunctionis included in manyPLCprogramming formats. JUIlP is

I similarto SKIP, with somedifferences. Wilh a JUMP function,an associated


returnabililyallowsyouto returnlaierto lhenextIineof lhep.ogranafrerJU\lP.

13-2 THE SKIP FUNCTIONAND APPLICATIONS


The SKIP (SK) funclion,illuslrated in figure13-1,allowsa pofrionof a PLC
program to bebypassed whenils coilis enabled. Theenable lincof thefuncrion is
energized $hentheskipifone or nore subsequent linesis desifed. In addition!o
pfogramming a coilnun)i.rin !heusualmanner, thenumber of linesto beskipped
is alsospecified aDdprogiammed as shown. t lt t
Figurel3-2 shows! basicapplication ofthe SKIP funclionin a program.
Theeight.line program usidfor illustralion hassevenlineswithoutputfunctions. ljr .
A SKIPfiinctionis incluJ.donthcthirdlineof thceight.WhenlheSK funclionis
off, theothersevenfunclions operatein thenormalmanner. Whenlhesevenlines
corresponding to inputsare on, their outputsare on, and when inpuls afe off, i.
oulputsareolT.For this illustration,the valucfo. numberof lines!o be skipped
will be setat 3.

t'
FIGURE 13.I
The SKIP Funcrion
rr .: rHLshtr,r,LNLlJ-N ,ii6]tt,-Liiia-Ns

'('ll) firnctions ITGUREl3-2


are SKIPFunctionPLCOpcrrlion Lne I tNoos4
.rirp. or bypass,
\rirppcdr(,mrinib
te,l.SKIP cn.rbtes
a I
l-:r
nooss
rn someprogram- I
.j.llddcr
diaSrarn
ilbcr oI coi]s and
l--
I
rN00s6
:ron wiil thenstay
:lc sysrerns,]! CR
f----- r-
,^*.t cRo085
|
r the nextspeci_
rrK lurns the next \
rN0058

r;'"
rrccrs that SKIp I
t#**ffi#R
tr'nrchmakesit

,rmars.
f UMpll
1I cF0o87

I Jt, an associated ..1r-


rrr afrerJUMp. | 'nr*
rN0o61
I
ftio[ of a pLC
t rhefunclionis
. In addirion
ro
r ro beskipped rhe,SKlpfunction(setat J, is turnedon. the 6rst
, _-.when two lineswill
lunctlon asusual.i{owever.thenextrhreeIines,a through 6, wiii 516y
rhcirpre.r'ious 6n sr 6ff i;
in a program. slale.Wilh SKIp on, changing rheinputon_offsrat,-ri feedingihe
ipulfunctions. coilson Iines4 through6 will haveno effecton outputcoils+ rtrrougtr
lnes 4 through,6wiil retainrheirpreviousstates.iines 7 O.Coiison
SK funcrion is and g *iii
operarenofmally,unallected i;
hesevenlines by the SKIP function,s ";";;;
op"ru,ion.ii*r'i-u-n'a'i
ipursare off, could.also be skjpped if we hadinserted a j in pfo""of : i, ,1" nu.l". ifjln"itl
:o be skipped be skippedby the function.When SKlp is turned off, ,fr.
f"aa"i *U'.p"*i"
normaily.
Foranillustration oftheSKIpfunction, we applyit to a production
prodJcrion line.The
line,has eighrstarions. eachofwhi.t p"rfor.'un
lronas rhepfoductcomesdownrheline.Depending ""n on rtreinaividual
"ri.;;i;;;;;;:
pan iLrm-
ber,all of rfe ergh!operalions mayor may nol be setup and c"rriedour.The
pattemofu hether or noLtheoperations arefo besetupandperformed is storedin
registers,asexplained in detaitin chaprer15.E*n l,gii .,"i'f"* i. ."i'"p i"
operale or not,according to regisler
bil staluses. A "f,t " I iaysturnthe
bit of
anda 0 sals rum lhe setupoff. setup'on,
At rhe third rlrrion. 3n inspectiontakesplace.lf rhe pan
. is good,it con-
rnueq down the opejaringline: if it is bad,it is shunted
to a sideconveyorand
, trLL]\J f tri!L truN5

1-_t-i:rj- Aficr .cpair, lhc parl rccntcrsar rhe bcginningof thc convcyor.Thei
rr::i:.1 iow and conveyorlayoutare shownin figure
a partarrivesat thcbcginning '3-3, (norshown)
of thcline,a scnsor delects
"\'ien of the partsat rhe bcginningof the conveyorand causesthc eight
:hc presence I I tNoosr
!=:jcas io bc set up for operation.The sensorcausesregjsterconlenlsto tum ,l l Fr-
r..h of thc cight setup switch contactsChe BP/lR contacts)on or off. Figure Il-4
!:o!r's this setup system on the left, The sctup functions are CR OO4lthrough CR
I aPoool
I tnosou
C+4E.As lhe par{ proceedsdown the conveyof, each operalion js performed(ifset _
up) whenthe part is detected
by sensors
at eachstation.Thesescnsors are lN,.
N f--
0021lhroughlN 0028,asshownoo|he rightof 6gureIl-4. TheoperalionsareCR l I BP0oO2
lRo3o7
0061lhfo,rghCR 0068. I
lf a part is rejected a! stalion 3, i! is shunted to repair. Later, when lhe on
fepairedpart reentersthe conveyor,the setupsofstationsI through3 do not have
rt--
BPoOO3
I
to be reset.Unnecessary resetis preventedby the two SK functions,00ll and I lFo3o7
0060.The two SK functionsare turnedon by a sensorat the repairreenlrypoint. o" l---1F-
I ePoooa
I lBo3o7
ot
l---t F-
ra * r up :r to8
SrUpr4roB
SkipI ro3
I BPooo5
I lFo307
S!alion oi
Fr--
I BPooo6
1 ,t I
o" l---1l---
lF03o7

2 2 -l I ePooo;
I lnosoz
3 3 OfiHts_
I
I BPoooB
I lBo3o7
on Fr-
5 5 I S{-UP

6 6

I a
,f
FIGURT l}4
SKtP APPlica!ion
FIGURE 13-3
SKIP FunctionApplicationLayou!
I]-]'IIIf, SKIPFU]C1'IONANDAPPLICATIONS

j ionveyor. The
56l lJp
I
I
1
: sho*d) detccts I
:iruses rhe eight
iontentsto turn
r|l. Figure I3-4 Slalion
}Jl throughCR Only

i\ .'(1
.rlbl-rned(if set
sensorsare IN
:entrons arc cR

a:er, when the


.-) I do not have
_ rrns, 001I
and
i :eentry Point. ).'

BP0008
ln0307

st-Up

. 140307
Typlcalnegisrer (8 Bit)
8+ 21

}'

FIGURE T}-4
SKIP ApplicationProsram

i.
I
iKIP AN D \lASl ER CONTROL REt.Ay FUNC. O^-S
tl

-t -r-J THE IIIASTERCONTROLRELAY FUNSI'ION


.{\D APPLICATIONS
TheMASTERCONTROLRELAy (MCR)function opcrarionis simiLLf
!o {hcSK
f,rnction._
Figurcll-5 showsa rypicalMCR function.Whcnirs cnabtclin;;; l\t(
energized,it !urnson. WhenMCRis off, lhc numberof follolvin8 laddcrdiagram
Iincsspecifiedare turnedoff. In contras!to the SK operalion.*hcre tincsiuere
skipped,the MCR turnsrhe foUowingspecifiednumb;r of lines!o rhe otfsraiel
sh,
FTGUREI3_5 coL Number
The MCR Function /-.-

i tNo073 ooo3 |
i ,, enabl e /-\\
h\ N .a@ o' r_es
| - I obetL..eaor
fo,
Figurel3-6 showshow the MCR funclionoperatesin a program.Thereare
eightIines.Thethirdlineis theMCRfunction. Theothersevenli-nesarecontact_
coilfunctions.For fail-safereasons,the MCR mustbe tumedon to be inaclive.If
thefunctiongoesoff for somereason, it is activeandturnsthespecind linesoff,
also.WhenMCRis oa, theothersevenlinesoperate normallv. tvhcnMCR.is off,
thenextthreelines,4 through 6, areturnedofT.Linesl, 2, 7. and8 areuneffected.

FIGURE 13-6
NlCRFunctionPLC Operation
I
1

Three ines laevocaby

t
' I -.1 IIIE Il .\ S | f, ! C {J)l I R OI. kLl .A t l j U N (' f tON .\),rD /\l l ' l .tC A I l o \ s lv

With MCR o[, tbefcis no way to lurn on coils4 rhrough6 by encrgizing thcir
cnrblcIincs.WhcnlvlCRis turnedol-f,theladdcroprates in thenormalmanncr.
rlarlo thc SK A production linc examplcsimilarto thc SK example will bc usedfor thc
-nrblc linc is MCRapplication illustmtion- Thcrearcag|Iincightproduction stations.Whclher
.j\jcr diagram cachstulionoperates for a givcnpartnumbcrastheparlgocspastdepends on lhe
sctup(notshown).Eachstation's operation is initiated by proximityswitches at
he olf sttrle. eachstation. The proximityswirchs arc IN 0081throughIN 00E8.Figurell-7
showstheproduction Iinelayoutandproduclflow.
Station5 is an inspeclionstalion.Rejectedparts are shuntedto a repair
convevor' A-&!19!1q:!!9PgILl!9qlgrslblc-orYeJlr. \Vhelritleilterr it trms
on lN 0011,whichlu.nson andsealsan MCRrelav.CR 002,1. Thefirstfivesteps
are lhereforenot fepealedfor tbe part. because the first five operalionsare pre-
venledby lhe MCR. Whenlhe part gets!o s(ation5, lhe MCR is unsealed,
enabling nalions6lhrough8 to function.Theselaslthfeestepswerenot per-
formedlhefirsltimethrough, butarenowperformed to complete theprocess. The
.:n.Thereare
MCR programfor theseoperationsis shownin figurel3-8.
5 are conlact_
;e inactive.lf
ed linesoff,
IICR is off,
unaffccted.

,tt'tl Slalion

1
a
2

_.J 5

6
132is oll

FIGURE I3_7
MCR ApplicarionLayou!
{ND \Ir\SI'I]RCoNl'R0L I{ELAYFUNClIONS l; l( ; t ilall l. l- 9
rhr J U ivlP Funcrr

FIGURE1.]_8
\!CR Application
Prosram
cR0
MC F0o2l
0005
t^,ie"
MCF00?1tN0085
i,n.'A tb

trc@l

l:.11r!o\

lNo085

1N0086
FIGURE 13-I{
Th JUIVIP-TO
tN 0087
Funclion

1N0088

t3-4 THE JUMP FUNCTION


SomePLCshaveJUIIP in rheif-:rronal capxbilities. JUMpoperates muchthe
sameaSIn computerxnd mlcroprocessor programming. Thereare two typcsOf
JUMP:nonretumandreturn.Figurel3-9 showslhe nonrelumJUMp funclion.lf
input l2l is on, lhe programwill jump to the next line in whichan LBL inDul is
found.Other$iserheprograrn conlinues to rhencxtline.Thedifference beiween
SKIP and JUMP is that SKIP specifiesa numberof lines to be skipped.For
JUMP, as with SKIP, the intermediate linesremainin their previousstate.
Anothertype ofJUMP is rheJUMP-TO-SUBROUTINE functionshownin
figurel3-10. As with JUMP,the programskipslinsunril the next LBL input is
found.Then,the progmmgocsline by line until it findsa RET line. Whenit sees
theRET line, the programrerurns!o the nextlineafterthe orieinalJSRtine.This
JUi\,'l
P-TO-SU BROUTINE is u:efulro pedormrcperir;ve opciations\Iirhourre-
peatingthemin the program.This requiresother programning(not shown).
rI(;LRE I]-9
thc JUiUPF|t|lcrion
+
17
H4.
121
1#
03
121oN.
121
-I
t8
G
+
19
I

20
2
21
127 011
3
22 t8L_-H
04 0a

HH
5 I
o
6
TIGURE13-10
ThJUMP-TO-SUBROUTINE
Funclion Li.21
t
I

tesrnuchthe , 107
lwo typesof
P function.If 1C{l
LBL inputis

ikipped. For
.rsstale.
1 o
ionshownin 110
I-BL input is
when it sees
SRlire.This
:s withoutre-
snown).
E I ERC ISES
l F or rh e l l ,h d d .r l i n c p fo g n ,mi r tigufc t3_ , i nscd rbrccS K i .uncri ons
onc at ! ri me.
T hc 6 rs tp ro b l c mi s ro s k j pJ i n c sI rh ro!!h j . 1
*'i,i":,r,n,,,
Il:llll j:,1"- rn',.r,..,,.t"",'ii:#fi
iTl[ :ill'ilifi
;:;H:.
nu(litecrrhc uu(\'arus nrc!
;::lJi."# li:ili:l ; T. :i;:li.:l ;.1 ; '"'""hou'J
and
arso
rherinc ,, ,t,i,,i,i".,.''ii#"1?',1:l;jl,,liiJl,",il""hJlj"l.j?
3rhrougn
bot h l re ru rn e do n l

FIGURE13-1I
Diasramfor Excrci5eI

I
2. Repesr exerciseI usingrte UCR iunctioninsladofrheSK iunclion. WhenMCRis on,
allMCR-desisnared lincsshoutdbeoii. Addirionatiy. *v ii"i:, i"p"i
slatusfor lvlcR.conrrotlrd
linrsshouidhaveno e ecr "r,"nr;"e "o"i,"i
on rrsourput.
Repal theaddedproblcmin erercisel. irsjngIICR insread of SK.
Devisan I{CR sysremro con(rolrhe assembly lineshownin frEurell_12. All lJ
starionsarero funcrjonas serup by oncof t*o ;egi""". Sr,"n,"j i"if
o"n, or. ,."i

o.v
-"i;'"^"
--Fid._ 2 3 5 8 9 10 rl 12 t3 14 15

On On Or On
'o On Oil On On 3t 3 t 3 t g 3 t 3 t 3 t $ 3smail
t#3t
Las

pafldnA s ro.a oiod_cror la I a.d snonpans.


pane,rB is ,orano.her
prodrclor tatandsFo'rpars
FTGURE13-l2
Diagam for Exercisel
Itx uR c tsu s

down the line. Shortp:rns$t all 15 opcrations,it spccined.Lines 6 rhrouSb9 ate


omiued.lbrlhe tallp.rts only.Therefore,hnveoperations 6lhrouSh9 turnedofTby an
MCR fuocrionwhcnn tall pansgocsby. Tall pans ardetectedby a limir s\rirchjust
io skipl i n e sSa nd9. aftc. sralionJ. Aner srarion9, anothcrliftit swilchunscalsthe MCR function,so rhe
nert parr,whclherlargor small.i5 rgain setup for aUopentions.
I L pre vi o u sl r at us :
4. Exptainhow JUMPdifers from thc SKIPor (he MCR function.
L l ioe S a n d 9 s k ip

o
.' hrn tllcR is on,
l|ol tin'sinput

i rJ_12.AI lJ

o
Data Move Svstems

OUTLINE
14-1 InkoduclionE 14-2 Thc MOVE Functionand Applicarions: 11-3 triovinc
LargeBlocklofDala o 14-{ Tableand RegisterMoves

OBJE TIVES
A( the endof lhis chapter,you wiil be ablero
o Dcscribethe MqE function.
o ApplytheMO\!function to indusrrial ,r c. rlbri.(.onwrrhorhcrPLC
problem.

o Describethe BLOCK MOVE function.


E Apply the BLOCK MOVE lunctionto indusrrialproblensin combinationwirh otber
PLC functions.
DescribthTABLE-TO-REGISTER MOVE CIR)andREGISTER-TO-TABLE
MOVE (RT)functions.
Apply thc TR and RT functiolrs.
l),\ f.\ \t()vI sYsl [!ls

14-l INTRODUCTION
All compulcrsy\lcm\, in(luJi1! PLe.. h...e thc inlctnlltirbilityto
move dsra
numhcr\. dnJ bit) liom onc Iocrlron o .rnolhcrJuring computer
smallerPLCs.the movingof daraffom onc rcglrr", ,o o*,t "p";",;;.'il
int"rnoitl ir'.lm.j
ou( automrtically.The movementof dalirIikcs placc,but we ", cannotmonitor
;;
conlrol ils opcralion.
In mediumand larSerpLCs, prografirming functionsare availableto conlrol
_
dalll movcment.The PLC's programmable data movestake datafrom one place
and move_itto another.This chaptefexplainsthrce typesof these
dat; ;;;i;;
programming functions.Fjrsl, rhechaptercovers$e ba;ic systemof.""i;; ;;:
regrsrerI conlentsinto one othe. register.The basicMOVE function
taies a
word, blre, or group bit palternfroorone placeand movesil !o
another.Som;
PLC syslemsuse a CET/PUT formal insrcadof MOVE. We use MOVi.
The secondtypeof PLC datamovcinvolvesmovinggroupsofdata
from two
or mofc con<ecutive registcr(ro Iso o more other con.ecuiiveregisrers.
(ecord rypeis u(u.,ll)dc.ignaredI. BL/ thii
CK MOVE in pLCr. f, rnor-..
Lrive groupofregisrers darr pJrrefn) u anorherconsecurive ".onr""_
cr""o
Some PLC fofmalscal lhis FILt-TO FtLE. We u.e BLoCK"MCiV;. '
"i;;i:;;;..
Ihc thi.d type of dala move involvcstwo subtypes.One type sequentiallv
movesdarafrom designared groupregrslers inro a singleregister.ihi. i.
T-A.BLE-TO-REctSTER move. SomepLC formatscartrh-isFtt_E-fO-WOnDl ""ii.J-l
We LrseTABLE,TO-RECtSTER.The orhersubtypetakesrhe datavalue
from a
sinBleregisterrnJ mo\e. r) rJlLe ,..-rcr :s nofmallyuaryinglsequenriatiy-i;
a
ponion ol r rdb c. The )cqJenr.rt-ro.c. re ofr.n aesigniteaJ;; il;1;;
This is calledthe REGISTER-TO-TABLEo. FIle_fO_Wdnl -i
f"""ii"".-W"
REGISTER-TO-TABLE. "r.
Inill moves,the conlenlsof rhe originalsoufceregisterare retained:you
essentrr'lythen.duplrcare the ro_rcc Jegister'\value i^ ,.gi.t.r. C."_
ver5r-ry. (neoeslrnatrOn "*,f,".
fegl(ter.v htch-eLeive5the duplicated new dala,loseSits.
prevlousvalue.In otherwords,the ofiginalvaluein the receiving
registerbefore
rhe move is normally lost. tf you wish to keep its original valu-ef;.;4";;";-
addilionalnrogrrmmingr( need"dro dul)ljcare and sroreir elsewher.bef; rb.
move.
,

t4-2 THE MOVE FUNCTION AND APPLICATIONS


FigureI4-l showsthe elenrenls of a \IOVE functionin blockandin coil format.
We discussonly the blockfofmalin thischapte..Wt rf," fr""ti-
ffir""i'l'"
o,
throughIhe enablecircuir,rhebir p]lle-1from rhe"" specifed.our..-r"gii,..-i;
duplicated in thespecifiecl
de"t:naI|o- rcg:,,er.
TherourcereAister is unc-hanped
le oc\flnaIlonregt\ter
pttrern
i. fep-rcrdanJ 'ort whenrhene\,\,alueis bro;lht
.r
in. The functioncoilgoeson rvhenrhe\1OVEfuncri""i;.;;p;;.
operalioncanbe usedto interiocktrIOVEf il;:ii
iriovE
runction
i. ti,"pilg.".. j:fl"J:,j:ill:
i",*r"iiil'.J:IJI:':,jffi
l 1 -l l H E IIOV t IrU N C ' l l ON i \N I) r\l )l ,l .l C .\l l ON :i

TIGUREI,I_I
Thc MOvE Funcrion
tF0r07

. :.t af ii aol oR1123

.:a :rio!ing
-:or rng one
':t lakes a
.ef, some
026 078
- ' E.

iers. This H"H"J 16 l6


'registers. Wnen 121ison,Vatlein
:. tocation026{16)isduplicard
lefiecrivety
lEnstoned)rotocarion
078,
scilFa
'.woRD."
re from a contmdjctorymoveswhen only one is desired.For example,two moves to the
rially10a sameregi5rercJnnottrke pl3ccat the ).rmcr'me
intervals, The llpcs ofregistersthatareaccessible by mo!es var!,amongpLC models.
Sourcelocationsare generallyinput registefs, outputregisters,holdingregislers,
or inicrnalregistcrs.Sourcesalsoincludeoutpurandinput groupregisters.Desti-
nationlocationsare the samc,excepttha! input and oLrtpu!registgygroupsaro
cr. Con- usuallyno1availableas destinations,
. losesits. In chaptef9, the limer programexamplesall useconstantvaluenumbersfor
'cr before time inlervals.ln PLCs. it is possibleto usea register'snunericalcon!enrfor rhe
timinginrerval.For this situalion,lhe numericalvalue ofrhe holdingregjsteris
fore the specifiedas the time inlervaLin the time. funcriodalblock.
lr is ol-lennecessaryto quicklychangethe time intervalof a proccsstimer.
We canaccomplishthe changeby varyingth numericalva.lueofthc timer'stime-
inlervalholdrngregistcr$ irh rhe MOVE function.
Figure1.1-2sholvsan applicalion ofthe MOVE functionwhereeitheroftwo
valuesof time may be noved into a PLC timer. The two different limes are ? and
Either
timemaybeenrered
intorherimefbyctosins
niiF6n
jister is
,'jr'"T$j:j,rji-rffil#ary).
We wiLlgivea second example of singleregister
moves,thistimeusingan
ranged, addilionprocess.Suppose that tbe PLC ADD functioncan operateonly with
--rought holdingregislersasoperands. Suppose, also,thalthenumbefsto be addedenter
he coil lhe PLC inlo iopu! registers,not holdingregis,ters.
Furthermore,lhe resultof rhe
additionis to go out of lhe PLC into an outbutregisler.PLC datamovesare
lhcreforerequiredto accomplishlhe totalregisterconfiguration.
196 i) \ t.\ U()vtj syS jtiII.5

MVO072
T
HR005l lar
is
H 8o10t
at

0000 ooo0 o@o o 1 t7) rh.


ftFt005l

FIGURE I.{-4
_ - "' _ t' l lvlOVE-Addi!i!
/ H80101
I
0000 0000 oooo 1111 {1sJ
H R 0101
HF0052

FIGURE 14_2
MOVETimingExanrple

",--|"**l
\F;l
o

FIGURE 14-3
MOVE*Addirion Sysrem
1.1-l IHt Nt{)vEtju\clloN AND APPLIC,\llr)NS lt)1

:a-. Figurc l4-l showsa rcgistrdcsignxtionproblcmin block ditrgramform


Thc two numbcrsto bc addcdcnlcr thc PLC in inpul rcgistcrsThc dlta must be
transferredto holding regislersbetbrc addilion can take placc. Atter thc additioo
is made,thc rcsultis localcdin a holdingrcgistcr.Thc outpu! of the additionis
reqoiredto appearin an outputregislcr-AnotherMOVE lrxnsferis thcn rcquircd
at the output.
:_a Figuae i.1-4 illusttates how lhc PLC would be programmcd lo accomplish
the lotal additionprocessof this examplc.lN 0007closufccauscsone Sroupof

T]GURE 1.I_4
MOVE-Addition Pros|am

",*,
]**-
R0c52

A OD 0160

H 80142
.:-r
:J H 80143

I
I tN 00171N 0018

1N 00181N 0017

0
D.\ l.\ Ir()v[ 5\ 5l ff,ts

T.",";il.:lT:
i:lH::
:|Jfj.',:tr.t*".ll#t.#!",:i,i:";.:ilJ,,J,r
14-3 MOVING LARGE BLOCKSOF DATA
14-4

d*si+ttlqri]Tftiil*,i.: *iitr
ffi *ittttt'*,,,.,,,",11ll:rl;;iru,.,+f
iiffi*T'Fll*si*,*rtfll;r
j:lw*i,*::i:ili;'J.'::i,
:::,j:.,i
J:::.f:,;:
:x,:l,:l,;xn:J:ii1,;:
:.ll",,lir:x#:
rF i;f
;:ru:i';:llil
:j:ll::;;,",:f ,:fix:
::iif
ff;:':'i"i::"#i:'"1
:,'"Til
JlL*'.':l
xfi3;?l;';+""*:i:li:lFit
Data

rFoo$
f----\ onorzo Coilgoesonwhendatatrom
a I 10rclistersarclranstered.
I I I I \
rr---____-_ I _.
tNooo7 aT(

Hl rnoos+| I I o*,' I I
F*-_l-1.-_1.------iJ

,1-i,
rFoo62 oRo137
I | | |
Aclton
FIGURE 14-5
BLOCK TRANSFERFuncrion
l t-!

cJ:prl a;l: ;.i'. i. 5c urjlizcdin lhc mj,jdlcoi thc lfullsttf_.cih oi!t drlir eid .c*.
Jala i!oLld be in lhe rcccivingregisrers. $hich could praC!c. sonr. oper^iioiral

l1-4 TABLE AND REGISTER}IOVES


In the previously describedtwo-move functions, we first moved data from one
regrsterto anotherregister.Then we moveddatafrom one consecutivercaister
:: i; ea i .:i i l e groupto anorherconsecutive registergroup ofequrllength.A lhird lypc of;ove
:: f Ji .ti o n s. involvestablesand a singleregisler.The TABLE_TO,RECISTER(TR) function
-,: have o n l y movrs data sequentially from a specificd portion of a large listjng of data lo a
.rrs{ It4 birs)
singlefegister.Conversely,the REGISTER-TO-TABLE{RT) funcrion moves
data sequenliallyout of a singleregisrerinto a specinedpofrion of a table of
regrsters.
:e funclional Figure14-6 showsin block diagramfofm how the TR functionmovescla(a.
r lasr register In atypical application,the recejvingregisteroperatesa numberof machinesby
5 requirethe bit picking,which is completelydescribcdin chapter15.As differenrrablcresisr;r
:lipteusesthe
fittems arc movedinto the receivingregisrer,rhe machincr'on.off pr,telni q.tt
rlrstcr chansc,

nplete.The I
rhe output
.rrtionto its
rion. If the
F.-.l
l;;;l
r :l \ / sp.,,t"a
T-:::-"_-l
t **-t =-;\J \,r, OesrrnaronB eq,sre r

rffil =_".:,:;7
F;l
r""-.;l
t;;-l
t - "* ' t
FIGURE 1,1_6
TABLE-TO-REcISTER
MOVESysrem
: 0r l sYstIrts

m,*#m*i*tr''n'trd*
tl:,,1:,r"
l.:g.X.t j
inpLrro^rhe
nr"nin ru".,;on. btockfsrhepoinLer
rocation,
foundin
n ;;;,iiiiii'",liiilii;,ii",l",ii
il:1,1;li:l:l.Ji::"
."vsi""" ;."",",.;",..::T,,""ll:
i:il1;j.::,,T"i:L:.^""jp"'p"-"'
"'""';"i-ri;";.:;ii
eilj,;:H'i::il1ilX:.nff:
i::,11:'n:::.:,1',::^r"'-'""i'
/u, "i
succesevedala valuer is .pec:fiedas
_,,,rc a fouflh ir nput to the functional
block.

J;
ffis$m**+*zuffi
lli,yfrllr]i,llglABLE-rRr)
f:."::i:,ii'T
runction,s
; :'ifa's;"i'i-;i ;,1":
s,m,rar
t'''e'*"'q'i*:'ir;';;;;':rotherR function.
;;i#JJffi;,X:?:'"';::.,i:rt
" ";::,'i:l:"1:"ii i;l;i;lH"d:I'J-"ri
'"ii''"i'in.,"0,,
i;:::iLT,i:
jlff:::";,:1",:i;1LI:::T'rt"Jrili:ei#"^i'
jt iii;"#'li iif
:;'j"iT"T::::'L!:
:::T::i_.::
fff,i.l:::l::",::"f,::,a"i,;",, :,.e;,,'"";);:;,lil",Xll ilii:
l,i.iiii,iii;f,o,j!
flhe
;i,i;llli;";,.:::l::.,:,".u" ""iii*p"'r"i:;:ru;Uil::l?f
"f.i :rl;li:
i;::'"1',::,:l:.',:'*'ll,:T
from *f,;.f, l:
onc rcgisrer
j::Jl::, #'"ilffix
,f,. a"," i" ,o {'L,ij'JJ'ffi
.o...
:l#::
.o,ra
i:rell:l:l:1,:: t. ,r,"p..;oJi.
,."odrns
o|dara.
p,ogiimmcJ;;l*r,t
i;;i:":;;:Uri".:';;'jXXl.,jl"?iii:i1;ij,::g:,:::?i.:
parameter.The

FIGURE14-7
TheTAALE.To.REoIsTER
MOVEFuncrion
i r ir iar=
I
F*l
-.::r :R 110.!J
I
f"--l
I
:1- i:r"ild in
i-,-:nito the
I
I
.,.|''.'. t"-* I
:. desrination
3 funcrional
l-;*'" I ["*;l
-
rhe middle
_:gis!er. The
:gisterwhen Speciliod Last --------t
t"".'"1
itepped.The
'on lransfers
F;l
rus:,fiPtumed
F;,l
nction, the I
function, It FIGURE14-8
ofconsecu- REGISTER.TO'TABLE
MOVESystem
.-8.
The inpur singleregister's changing
valueis constantly aslheProcesschangcs, Thisregis+er
l4-9,Table is usedasthesource, To recordils valueevery10seconds for 5 minutes,we need
e endis the 6 tirnes5, or 30,registerslo recordlhe rquired readings.
seqLlential The func-
,n operates lenglhneds
tion'ssteplineis pulsedevely l0 seconds. The tabledeslination
on specifies to be 30registers.The 10-second arethenrecorded
intcrvalresults in order.The
30 sequential valuesappearin orderin the specified sericsof 30 dcstinrtion
:le register rcaistrs.
ne!er.The

FIGURE 14-9
-v._TF0327
1 |
| The REGISTER-TO-TABLE
MOVE Function

l'f
ll
al
E XERC ISES

'' l,i"'.';iJJ;ii:;i".'j:J'|""flfi:'.', :rn inRsurc


r4-r0. jrsoperarion.
Durios rhr

i*i,:+:l*:'l#Tfr
f;*-*lhll$-ltlw-'irWl;
jiif
*:r;rim*,"1"#i
n*ffi
:#!:*"j,ilil-:#:,l.'"?lTlt:
FIGURElJ-10
Diagramfof Exerciser
L
t

' }ffi3T':'*Hfd"r#rlj;$jjrrih:"1il:i,'"'ff-*""
o
*H,i'""'ll."llf'il{":#,ii."'i"t:ffi
:,i}lft;itt",'-'#iiflti3
^f OFs

'l E
oP1
fl
aP2

O6st,

"f
TIGURE 14-11
a Diasramfor Exercise2
AdvancedIntermediate
Functions
I

15 UtitizingDigital Bits
t6 The SEQUENCERFunction
17 Matrix Functions

)
Utilizing Digitat Bits

OUTLINE
li
15-1 InrroducriooE 15-2 Bit Patteftsin a Rcgistcro l5-3 Changinga R.cister Brr
SratusE l5-4 Shift RegisterFunclionsE l5-5 Shift R.gist.r APPlicalions

OBJECTIVES
At the nd of this chaptr,you will be ablelo
o Desc.ibe$e PLC dieitalbit conrol systen.
E Describelhe BIT PICK CONTACTfunction5nd ils use
E Use digiralbits to tum outputson and off,
o Modiiv and controldigitalbils in a register.
o Use shift r.8islersto movedigilaLbiis within and lhrouShregisters
E Apply digitalbit regislersystemsto processcontrolprog|ans-
!T L L l z l i ! i L l C l l .\L Irl l S -----, It

. Flr
15-1 TNTRoDUC'rroN BI
Ilos! PLCsarecaprbleof wofkinswithdisitalbi!s.Insrcad of controingoutput
devicesfronr individualcontacts,these PLCSuse .gisre.bits in groLrps.For
exanpl,if theon-oli5rarus of l6 mrchines musrbeconrrolted,just oneof rhet6
bitsin a l6-bitregislercouldcontfoleachof rhe 16 machincs. If thereare lj7
machins!o turn on andoff. only l0 of thesel6-bit registersare neededlor on-off
contfol{157/16 = 9.815,or 9 recjsters pluspartof a l0th one).By conrrast, a
contact-coilladdercontrol wouldneed l5T ladd.linesin lhe Drosram. tr
The PLC not only use\ a fixedpattemofresisrerbirs,but caneasilymanipu-
latand chlnse individualbits.The PLC canpick, set,latch,and manipularethe :. in
individualbitsin chosenregisrers. It alsocanshifrrhe.egistercontentsto lhe right
or letl. Registershifls can be set to move rhe bits one posirionper input putse,
Shiftsnay alsobe se! for muhipleposilionmovemen!(two, three,or more).This
multiplebh shiit functionis otlen designated the N-bi! shift. LI
Functionsdiscussedin othf chaplersalso play a pad in processconrrol
with digital birs. For example,MOVE enablesyou !o replacrh entireregisrer
conlentsin orderto chsngerhe l6 oulputcommands. If youwantan on-offDallem fIGURE 15-3
changed,shiit in an appfopdalenewregisterpanem.Ivlovesoi darainto registers Ten OutPutsC(
can be done for one registefonly. but darainovescan be madefor a onsecutive RegisterBlls
seriesof manyregisters.
The digitalbit sysremrstheioundation oi mulriple machine contfol.The bit
systmis usedexlensively in all rypesof auromation sysrems. Oneverypowerful
bh controlsystemis rhedmm controller sequeic.fdiscussed in chspref16.

t5-2 BIT PATTERNS IN A REGISTER


In somePLCS,theinrernal slo!sfor memofyand;eration arecaltedaddresses.
In others,lhe slorsare caLledregisrers.This chaplerusesthe word r?giJrel. 15-3
Previouschaptersdealr wiih r.rsingnumericalvaluesin registersfor pLC
function operation.This chaptris nor concernedwith a registefs numerical
value,but only its binarj/bit pauernslatus,tha! is, its parremof t's and 0's.
For exanple, stan wirh the registerbir settingshownin ngure l5-1. A bil
patrernhasbeeninsendinlo rhe registerby callingit up on the scteenandthen
keyboard-inserting its desiredbit values.For illustrationpurposes,the register
bitsin HR 0207havbeenarbitra.rily givenrhevaluesshown.HR 0207now hasan
equivalentbinary code decimal(BCD) valueof ?851and an equivalentdecimat
valueof J0.801I hereBCDanddecimal valuesoreirelevanrat rhi\ Doinl:onh
rhebinar) parremsbownrs rseful.Binarybir parrerns canbeappliedro (andfrom)
any type of regisler,notjust holdingregisrers.
Supposeyou wish ro haveoutputsCR 0081and0082controlledby a register
bit status.To have CR 0081conrroldby bit 1l in HR 0207and CR 0082con_

FIG(RE15-t Ortr rooo o.ot ooor rF o2o7


Register
with a BinaryValue
ti I cfiANclNti ,\ liEclsTIiRIlrf s] \fus

FI G LRE I 5 _ 2
BI T. PI C K C O N T \ C T C o . r r o l
lrollingoutpur

By contrasr,a
rrolledby bit 12,you woulddesignale the con|aclsas sho\\nin figure15-2.A
eaiilymanipu- menuappears whcnyou presstheconlactkeyon theke!boardInsleadofchoos-
ins CR or IN, as you hale beendoing.in thiscale voLr*ould .hooseBP.
nts lo the riAhl Takethe6rst!enbitslf.om theriehtis standard) andusethemIo controlten
:f jnputpulse. outputs,as shownin figurel5-3. Theoutpuiswitha feedefbil of I wouldbe on,
andthosewith 0 bit rvouldbe off. lf you modiiy HR 0:07to anotherpattemoibils,
rheoutputswouldchangeslatusaccordingly. An approprialeBP conlacls) stem

FIGURE 15-3
:F
Ten OutputsConlrol]edby Ten
RegisterBi!s ESij i; ;;; *sam *
= 2, = = =: P anem
)nlrol.The bit
rl+ t f lt f
0 0 0 0 0

t6 15 14 13 12 1110 9 8 7 6 5 4 3 2 1

ed addresses.
| /e3!sret. 15-3 CHANGINGA REGISTERBn srATUs
Iters for PLC
r's numerical Supposeyou wish to changebh 4 in HR 0207fron 0 to 1. Call up rcgisierHR 020?
's ard 0's. on the screenandcompletelvrcwnte hs bit pattern PushingReturnwould insert
e l5_l. A bit lhe patierninto the PLC CPU Otherwisemovethe cursoroverbit 4 and change
reenand lhen bit I only. This changeprocessis veiy siow
Bit staluschangesaremorequicklyaccomplishd by usingoneoflhree PLC
, rhe fgister
l7 now hasan functions.Theseare BIT sET (BS),BIT CLEAR (Bc)' andBIT FOLI-ow(BF)'
aleni decimal We illustratelhe tuit funclion usingthe founh bit of holdingregisterHR 0207
0207 ^
is set ro 1 (if idt
is poinrionly when the BS functionis enabledin figure 15-4, bit I of HR
r
I to (andfrom) was not already a 1). Tuming th function off would have no further effect on the
bit-i! would renain a l.
tby a rgister The BIT CLEAR funclion,shownin figwe 1J-5, hasthe oppositeeffectof
lR 0082con- BIT SET. The examplein figure l5-5 operateson bil 5 of HR 0207 When en-
abld,|he BC tunctio; wouldihangebit 5 irom I 100. Ifvou hadappliedBC to bil
6, nothingwould havehappned; becausebit 6 is alreadya 0 Whe[ BC is tumed
off, nothing further happens
:ta G r rLIZI\C DtCtfnL Brts

FIGURE 15-.r BSO004


Thc 8lT SET Funcrion rNoo63
J -X'l
i.".l';'---t=t

Permanonlly
ch6ng6dlo a 1"
whenBS0@4is tumedon

0 0 0 0 0
Slthg

FIGUREI5.5 EC0o05
TbeBIT CLEARFunction rNoo64 HXot
I I
Ft___--___{H
lcra,ln
rrnq i
-

Peman6ntly
chenged lo . ,O'
ln3n ACOOOS
isturnedon

HBO?07
Sning
t
BCO0O6/
H8O2O7
ls tumdon

FIGURE15-6 8F0004
The BIT FOLLOWFunction rNoo65 '13t t
H|._-___--_-_-{H.
sevclegr
:o ! I

o 0 0 0 0 0 1
C H ' \r" C I\C { i tE C IS fE R Il fI S T.\TLS

Thcrcir onemorcbit,operatins tuncrion,lhe BF, of BIT FOLLOw. func-


rion.Go backto bh 1 of HR 0207.Fisurel5-6 showsrheBF tuncrion asaDotied ro
rhisbir. Whenenablcd, rhetunctionsctsrhebi! ro L Whendisabted. o. off. rhe
funcrionsersthe bit to 0. Noticehow BF diftcrsfrom8S ,lndBCi on andotf are
bothacriveand signi6cant in rbe BIT FOLLOW function.
. Figure l5-7 iliusrrrtesan application
usingbi! sratuschangesfor BS, BC,
andBF. Thapplication involves a bonrd-pajotins
processtha!us;s$e bir modifi-
caiion functions.Whire, squxrboardsare to be paintedred in cearainareas.
Thereare I6 squaresectionson the board,as shown.Thcrar I6 sprayguns.one
aboveeachof the l6 scrions,thal sprayperfectsquafesthrougha template.
Whenthe spraygunsked) operarein the patiernofthe originalHR 0207.the
red/whitepalternwill be as shown.A bk of I wouldcaLrserhecorresponding spray

Vz
".2 %
,% v,
'2. %,
0 0 0 0 0 0
1 6 1 5 1 4 1 3 1 2 i 1 1 0 I 6 7 6 s 4 3 2 t +8 i l
HF0207 NlJmbr

BPOOo1

Sp.ayGun

8P0002

8P0003

Elc.
BP00r5
iiroio;
J
b BP0o16
NAO207

pLCCo.rrol
IIGURI 15-7
Spray-PairtPattemdd Progam
L t il llL\ t r Dlt ili \ L llll S

cha.gas rromBhl6 ro reo

W 3l 2
i
/z 7/z./,
6 3
o o
I
r <-

'z 1 6 1 5 1 4 1 3 1 2 1 1 1 0 9 3 7 65 Bit

'/l' %: HF0207

BCoors

T -_1
-
;, -

1---
I "fl"
f---r -
FIOURE15-E
SFray-Paint
Revised andPrograft
Parte.n

to lake olace.Eachspfaygun s oPeration is controiled bv a correspooding PLC


outputcoil,whichis controlled by a PLC contactasshown The inPutconlact is
aesidleaUv two specified linesi a reeisrer number lineand a bir number line
Notetha!youcouldusean outpulSroupfgisterinslead of l6 outputcoils.This
illus!rationuses individual output corls
As board model patlernsare changedthroughoutthe day' the red/white
patlernswill change.For examPle,squarel5 is to be changediiom red lo white'
ihis changemay be made(permanentlv) bv applvingthe BC functionas shownin
figure1j-8. To changesquare 3 from white to red' applyaBS funclionto bit 3 To
.ttung. squu." 10 back and forth rpeatedlv belweerred andwhite' applv a BF
functionas shownin lhe fi8ure
A word of caution:Using BF on the samebit as BS or BC can cius
bo problems;forexampLe, if both BC andBF werworkingon bit 7 of HR 0207'the
BF wouLdprobablyoverridethe BC in most PLC models

15-4 SHIFT RECISTER FUNCTIONS


The shift registcrfunctioosenablethe operatorto movedigitalbits wiihin and
throughSHIFI RIGHT, SHIFI
throughth PLC registers.This is accomplished
LEFT. ROTATE, and NIULTIPLE SHIFT. This seciiondiscusses eachof those
funciions.
ri-i 5tirFf R[cr5 fER I]uNcfloNs

1N0052 oriarr t; _ o
Optiona:ON/OFFwrh rhe
i 1N0053
* ait

I 1 0 0 1 0

FIGURE15-9

Figur 15-9 showsthe operationof a SHIFT RIGHT (SR)function.rhis O


xplanationusesonly one regislei,Later sectionsshow how to use more lhan
one.Thereare normallythreeinputsto the functionalblock.The botlom input is
normallythe enablinginput,as in previousPLC funclions;th middleinput deter-
mineswhethera I or a 0 is insertedinlo th rgisterwhenshifting;andwhen the
rop inpui is aclivated,the registershiftsall bitsonepositionto the rightanda new
bit is addedon the lft,
Whetherthe bit in the vacatedregisteron lhe left becomesa I ora 0depends
,.cndrngpLC on whetherthemiddleinpul wason or offwhen the shift look place.Ifthe middle
pur contactis dataline is oo, a I is enteredandfor off, a 0. The patlernin figure15-10illustrates
:lumberline. 'how to use a shift register!o produclhe originaivalusin HR 0207shown in
,urcoils.This figure lj-l. A shift is made 16 times.This ilLustration startswith all0's in th
registr,Th registermight have had any otherpatlem; it would not a.ffectthe
!he red/while final paitem, sincall previousbi! l's and 0's are pushedout after 16 steps.
red to white. Anothrimportantpart of this SR functionis that the coii, or output,slatus
n as shownln may follow the statusof the bi! on lhe right- A I producesan outpxt on, and 0
)n ro bir 3. To resuls in outputoff. Ifoutput statusdoesflot follow the bit leaviflg,,youmay bii
:, apply a BF pick the lastbit of the shift register.A lalerapplicltionxplainshow outputon_off
is used.The biis arenonnaUylon whentheyarepushedoff to lhe right; however,
C can cause in theroratfunction,whichw r beo
be savedand.eused
F HR 0207,the :T":::"iHJi:
Now supposewe needto control45 machinesor functions.Sixteel bits arc
not enoughlo conlfol lhe procss;lve needto shilt throughthree registersto
coverthe45 ourpursb!,placinglhe number3in thefunclioflblockthatasksforthe
numbrof registers.lf we pu! HR 0207in as lhe startingrgistef,we shift through
s within and iIR 0207,0208,and 0209.Muhiple registershiftingis showr in 6gure l5-11.
}HT, SH]FT SHIFT LEFI (SL) functionsoperateexactlylike SHIFT RIGHT, excep!
lharbit starusis insertedonthe right.Thebitsshiftto the left andlaveon the leit.
The ourputcoil slatusnomally thnfollows!h statusof the last bit on the lefi.
L
/,'-
/t:tj

t "'",',-,"-
-,rts rz qr:-l r"'r^Ll s I LNol\2 oa!9-!9
, r5la11! --i-T

i ,r1'Jl e""t'"
0

zofr
0 ' i. l" r,_,.,r=
lolo rrc*E,li,.TB.ecr
3 on ;\.1,
ofl
the!L
5 MO\
I
goT.
1 paf,l
I
on

I 011

10 oll

r1 oll

\2

13 On
o\t\o1o
ffi, ,')-,=- lo
oi
,.l l f
0 0 \--rr
FO .5 On
, 0 1 0 0
, lo lo
olt

I'nli.ii"i';;'* u*"'"
slGuRE 1s-10

;::;;:*r;x*,uf*"+iiilTh*:r{i:l'r
*.*,,t*,*o :**: r*k[*$p.rtE4i':f i*$"j
a';'-'*""
**{':*"..:'"t*"",i*$r':i+tl*i:
;
,Sljil:rl;.
jiv':i':'1}:;"*llr;*:x''i-'i"nu.
"';"Ji: l:::lll:
l^:.,i:"1t,"'l'JlX
ffit",**ii*
I5 ,,I J JFII
F' TR E OIS TE RFU N C ' | ION S

F IG L R E 1 5 _ 1 1
SH IF r R IGH TR EC ISTE R -trl ul ti pl e
R egi ste6

menr:r repeared dgrinrnd rgainas a resJhof theru:or.a(:.reenr! system.For


-
thepauemq oJldha!e ro ce recnrefeo
rhcpr\io;s shiftregrstcrs. ma;-allyor b1 (J
\lOvE lor eachrimethroughrrhe ROTATEfLnctron:trr. rutornatrcally repeti-

ROTATE functionsare ROTATE RIGHT {RR) of ROTATE LEFI CRL).


ROTATE (yrtemscan be of Iwo othergenerat\5e.. :rll-regrrreffeenlryor
panial-registerreeolry.The fullregistersystems reentri coinr .an only be a! the
beginning of r fegister.
With ]6-bitregisters, lroumun shiflthrough32, 48, 64,
and other multiplesof l6 bils, With the partialrentryiipe. you may chooselhe
exac! numbrof bits needed.For example,if you needoily :7 bits, you could

* i
orRe.l I
^'.--_|
(2) ( -=f-"":-| I

- ,68,ur I J
---------------
I

-____,
[ \___
-1
a
@
again.This ,t*rn/\-)
ich is found
ns example FIGURE 15-12
The REGISTERROTATE Funclion
l-rttrzt:rt,Dtelrtt s Is
w hi ch i s the Il th bi ! The P oi nl
re e n te fth e i n i l i a l rc g i * c ra l thel i _mi nu1-l 6poi nt
;;i;.:;:'l;li;:.:;i,l :ili ;, hlFi-Ji;""i'.^,
?':',:': : y,r..L
:;.i;';" :,t'.,"' *: u, t re'J bc
miun( MLFt:
rJbereo L-rr-
;J;
r,".',",";l
llimr sr;l I*;-;rlltiiii::r :i.J:i,-ih:gl*i i.;Jii
N'
" -' ""

lffS[::,*:l'J$::fili,iiliii#""1;,lix;;',i'iiri"ri*",
*.'--F- oi*."
tou"
-"a" ",
"*,pr". lh"'t: ",Tb:i ;t:lj;jlili;i; f ,,x111,1"1!l,il
lf :}ff:::ilJ:xi: :;f :::;:l;'i:iJli:!.,.reand af,er pa,,ems
resis,er ar
ii"*"'"ne-"" Ls-r: .T:i5;';i:iil'ji:iiffi'ji'i,$l,lio"'" ..,'.
numberins
.i"p'., ir," ri' iden;ncarion
,",' aliiilii r'iI'n"rl ",n,n
in
svsle"' arr'or

m*1"*i;m."*,1'*i*,*+';.""r*',*{;ii:
i;il;tn";'t;'
i::"'T';:"i;;ru;;';i;
:;*iH:,';:i:Lii:
3::1"":i'I't

1N0207

i-;;
tsr-
*?:on
I
[---1r

ro
a 0

Functioo
i1!Ll""1iil1"t'.t'., RIcHr
:- ir ra-: laciSTERFL\CTIO\5

bit.Thepoint
'
JHIFT LEFT
)eledIIULTI-
L). or N-BIT
'shili registe..
rn thantheSR
: at a time,N, shllt lear Shifi Flghl
tatLForan
heriheserial-

of ihift regis-

, the total bit


1 lhrough48,

identificaiion

ou

lrlhlblt Shllt . l.at Muhlbll Sh{i - Flghl

fIGURE 15-14
SHIFT REGISTEROperationSummary
U l l L l Z l \C D l G ffr\L Il ff5

15-5 SHIFT REGISTtrRAPPLICATIONS


The 6rsl shitl registefapplicalioncxampleinvolvescontrollinga light Pailc'n'
FicLreL< lj th;q\ .In lfrJngemcnt ol liEht'to Ei\c I RJ'hrnEmorrn; rrow
.o*'toLn"right
rr',"1 Frch hghtis connecred ro a PLC inprr Icrminrl'
"-ir.,n
'r-,oh terminat is tv
conrrottd a bit locaiion in the 1wo shown As the bit
'egislers
prtterr mo\e\ to.rhe
o.rLcrn,rre mo'earu LneIight oncsteDrt r time. hc leh'
'pnr-These'enls;nLheregistcriareprogr\sivel)morc''ltorhcnehr'rndlhen
ui io ttren"*t ,egltler; o s ar; i.itiallv enteredinto the mptiedslots-As lhe bits
niove.the liehleJiamppattemprogressivlv movesio the dght ln this svstem'a
compteteanow {exampie 1 through 7) does not moveall at once(io 3 throushl4)l
(
if't" tiet'teatolnpsprog.essto the nex! arrow' oneai a lime. startingai lhe top L'
thn2, etc,),

O1 O,. 422
O,u Or "
O,o O,' O2o
o" o o'' o25
05 O,, O,e Oue
06 O, 3 Oro An
O7 o,. o ,'

Nor used . delaybelorerslan


17 1819 2Q 2\ 22 2 3 2 4 2 5 2 a 2723 I
| | ----^-111 ,-taot11

1 2 3 4 5 6 7 8I r0 1112 13 1415 16

Sev6n1 s oaded'nilralyOlhefbts 0"


t Fegist.rSYsld(SR)

FIGURE 15-15
FlashinsArrow ?atternand Registers
ililFt Ral]t\|Er.(\Pt,ir( itu,\Ls
jri

.. r***lrffip$ffiliifr
il:H';: ;j'"jllT..,:
+;""::i.T-l,":;, ",:il,.,
lrhroughl4);
at :herop (1, *fu
i,n*im[*"i",:*pr*
*]:,:f
il
0002

St6ppingSFoISO

Lrght2

Lighl 3
I
t
L 9rrt27

Q Lrghl28

FIGURE 15-16
PLC Programfor FlashingAnow Movemnt
L i l l -i z l \c l )i c l f,\ l - Bl f5
0l
: ac oE F !1 ,
J^
rlr rror
erio rr 3:
ST
r ..r .-. sos
l\
-,-
N u m e d rs t"l\
3
-o: .r.ir r rrr-rr lrrr
dor dol dor dash dash dash dot dol do1
ra'raa l-aaa

i| llllll
a.aar aaaaa

-'.u-.. --n--.
Plnctuatio. and Othor-.3--
Slgns

.-i"sl-
c.ron -:"Jllll-
5mcolon
ili1l":i:i",1
OloratonMar$ L . . . 1 1 ...1 ...1 ..'l
1 'll l'll '
*o/ th!.:a
ra I alna. "..1
space spacs - - spacos
*g:ll-T* uT"l's*..."J8i..
aaaar - a ra

1. oash {-) s $ree I mes as ong as aor fJ


2, One spac6 berweenaols a.d oas.es
3. Two spacesbMeen enqs
4, Th.e spacesb6Nee. *ords
5, Four spacssbeMeensenGnces
Motso Cod6 Rulo.

flF0175

1 T
1F0052

o ol0 0 0 0 0 0 0 ol, 0 0 0 0

s s
I
FIGURE 15-17
Mose Codein SR RegisterFoml
C
S H IFT R E C IS ' I' E R
.\P P LIC A TION S 22L

0150coil on lor eachstp.Thiswill causea I ro bc reinsertedintothe initial


-sos
ilot. For a 0, lheoutputis otfanda0 lvillbe.eloaded. Al the endof Sl steps,wc
afe re{oaded as shoen.
lf y-ouhaduseda ROTATERICHTfunction, rhereloadinswouldhavebeen
il automaric steps.An alternate outpurschemeiof fr-qufe 15-16couldbe on
uslngoutpulgrouPreersters.
Thesecond erampleofrhe ureofrheshiftregine.funcrion involvescontrolling
a codeoutput-The application inlolvesusingihe SR {or SL) registrand the
outpul coil insleadot the individualbils tor conrroland indicating.lt uss th
orlrputa5a ]lorse codeindicarorto a light or a buzzer.In the Morsecodesystem,
eacblerreris assigned a docdashconfiguration as shownin figufe15-17.Fouow
I rh\Io.se coderules!o put dors.dashes. andinre.!alsin rgisrers. A dor is 1 on-

1l
.
l l. lil
i l'lR00s1

H F0175

shlit ghr

0002
_-T--T--l
0ll 0

a
FIGURE 15-18
MorseCodeShift RegisterProgram
L i tL tz t\(i I)l o t1 .\J , !i tf5

w rd e (l ) i L n d ! d a rh i s I dn-bi ts w l dc \nfronn,LrcspccinBL\ ad,led:.1.111


b e tw e c nl c rtc l :1rn d words.
The fcsulrinspatrcfnlbf lhe inrefnlrrionat
disrress symbots SOS(SaveOu,
Shjp)rspurin inputrcgisterl!tR 00j | I-tR00J:;n ttrefigure.
The birparternig
' IF .r "rnd
mJ \c l rn !. ,\,o HR ... l -:.rnJ' r' -,.. 1' r< rLgi \(er^:r." fe,hc-,.,.,," u,ui r,. i
r:C h | o n c o u rp u r. T h( rL. rt Inc JurpJ on.vi t p: crn -epr$cnrs rnc c" Je pa,_ y".

Figurc l5- | IJshowsthe PLC programto producethe codedourput.Tuming


on INr00l0will movethe comptete codedp:ruerntiom !h tn *g;L" t"r" i;l ?
-woHRresr.re\'th<n.rrrrjnSort\00t
two HR registefs. Then,turnineon IN 00ll'en:rbt<\
enablesthSRfunctio;
rhe iuncr.on th; ,i:;i.
,,n. rtre
andsra.ts
an.t
pLlrirs inrcrTh. rimer(r1'r. ( in rhLSRrniftt,necru\! :. bir ro bc n.er.eoini;
theSRrvc") 0 j .ccJno, \:nJc,neL.mefi. \e.J. j .0 ot.r.econo. to( onebrrl
$ill b< 0i re o1d. tJ ng. .no r.n,,nrp- 0.r.,. Lj tecund,tone -
- approp,;ie ,
intervnls rrc addedberwee.dorsanddashes. To sp".Aup o.,to":ao.n tr." ,"i" 1:
o[ codeourpur,the rimcf s rimeinteryalmay be changed. IIGURE 15
Oncethel: bils havebeenshifiedin_rhemessase js olef We thenhaveon ..:
o. off signals fof thc outpu!.dependin-q
on theSR d:uatineserring duringshiftinj.
Fo. SOS.we must retoadihe HR parremsinro the IR regisreria-gain and srait
o\ er. \ r rl(rnrre rIh( -.t, rJ ofo.c.r.re.Lou! t-ep-oerrmmi.]r.n ROTAI E.
RiGHTregister system.shich reloads conrjnuou:tr. "

EXERCTSES
T h e frrs (rh .* c h rp re .e xe!.,ses.r. rpcl j ..ri onsi or r.3;rer bi r con$otproeE moi ns.
Includea ske(choi rhe har.js3.ene.dedior erchexerc,*. * ,""tr * lo. ti," p."ei",i.
l . A p ro d u cm do$. a0 3sseobtrl i ne (harhas l"*
r o v e sc o n ri nuorsL! j srl rj ons.S et u, a
.egNter,co_n(oLled producrionltoe for rhe palle:nlor produciA onty. The A parter;
is
s h o l v ni n ff8 u .etj - i 9.

23 5 10 l1 12 13 15
ofi or ofl O n oti On oft Of o'l Or ofl
B ion oil on ofi oft On ott ori
Ofl O. otl otl On ott ort
FICURE I5- 19
Diagrln fo. ExercisesI add 2

2. Nex!. threep.oducrsare s.Drdowna ts,stationproductiontine.They de product


A of
exefc'seI , and producrsB andC. The scheduleof which stalionsareo. o; oII for
eacjr
oi the rhreepfoducls is shownin ngure tj_19. A selectorslritch is set according
to
which producris dolvf,rhe p.oducrionline. Desisda pLC cncuit ro produceih;
-qoing
hree producrsto the .equiredparlems_
3. The.ede lwo producrio. tins.Eifter line may produceproductsA, B, or C.
Expald
your prograntfrod exercisesI atrd2 io confol fte two lines.
EX EIl ( ]IS E 5

ofshiir rcsistes- Asain includea hard$3':


The lindl thrte cxercisesarc aPplicationi
the !olr'rtron'
skelchand a PLC pfogramrbr
oi n
.:';": :'J.;'; ,;;" ' Lr ) moJeh ':i::
s;:..".,".,"'":lt:':,'::;
: I: '^"'i)":::":i:'::'il.
"rcdu:c
OS (SavcOur
:.1:;ij:I:Jl;;li:li,'fi;':,.;i";
i; :,; ; ;."';;''.*" " Tff;"'t'"T l::
;::i'i:iil:"TJ::i
m oJ e b e r n gp r o l u ! " , " .
u qqitcn(.
i t c h ( . rrn.tr ( rct
n r L ,fJJ "rc ,".
' . : '.
."
oi\!!_IND(N-"1-1"-
" i:::i"i; "l*lllili l'"lli
, ._dj"..enb,eJbr r u nn r n sr h e ka r ch
d,y.
d, y . JJ.l ": ; ; ; - . . . e m " . r h \ F I,i, t ) a n o SL fo ano
r d,r\ e mr br;-embt) r sL fol
I J *r E l
r t , cn D l y o p e r a r o o \ : n r e \ e h e 1 . : : : ^ - ': 1 , , , " s R r n . r s L r - n ct,o n s.
ro'r*r' sRandsLiunctions
:i::::il':i:';:lilJ ::;;p"n'-^ 't'c ".
utpur.Turning ""er'"'
dl rz tr to ts ro

r dor(onebil)
g. Appropriale

"*"'.'"''
FIGURE15-20

luring shifting.

in a ROT,A.TE- i,*l':',It,:
11ilr+l11iil:""rrJr*:,,.';.;..omp,iih.his'alion
i::;l"J:l:jJ "J:l,Ilil,ll;";,:;;,;,;;-."
FIGURE 15-21
Diaeramlor Erercile 5
eeo a o a
-l
o
3On
2On
10n

' i'"""":'*i!lir: i':'i'*


i'T:ii:;
l*:*:iiriih:J"tl:il:*11*"-
iuf.""T:fii:
B, o r C. E x pand
The SEQUENCER
Function

OUTLINE
16-1 IntroductionE 16-2 Elect.omechanicalScquencing
o 16-3 The P!.C
SEQUENCERFunctionand Applicaliona 16-4 Timins and ChaininsSequencc$

OBJECTI'!'ES
A! the end ofthis chaprr,you will be ablto
,
o Compa.ethe advantages and disadvantages ofa conventionaldrum switch whh the
PLC DRUM CONTROLLER/SEQUENCER function.
o Describethe lrogram layoutofa PLC SEQUENCERfunction.
o Constnrcta matrix for a process-outputstareversusintervaland tim.
E Prog-ama SEQUENCERtuncdoqinro rhe PLC.

o o Inseftrine inreflals inlo PLC SEQUENCERprog.ams.

n5
276 fl r 1 l S IIQ U EN C IRF U r,.' Cl lO\

16-1 INTRODUCTION
Th PLC SEQUENCERfunctionis otlen calledrh DRUM CONTROLLER
function-We uselhr tunctiondcsignarion DR, instead
of SQ, whichhasal.eady
bcendcsignalcd ior squareroot.The SEQUENCERconcep!hasevotvedfrom
the mechanicaldrum s!r'itch,which is an importantconrroldevice,bu! the PLC
SEQUENCERiunctionhffidleslarsesequencins conlrolprobtems moreasily
thrn does the drum ssitch. Anothcf advantageof lhe PLC is that irs SE-
QUENCER programminsis relativelystraightforward and userfriendly.
Traditionaldrum swirchesare manuallyoperated.Ii a timing of the steps
beingconlrolledby rh drum switchis.equircd,manualoperarion rjmedby a
clock is nceded.The PLC SEQUENCERfunclionscanopemlebtweenstepsby
programmed timesequencs.Thischapter explainshowthePLC SEQUENCER
tunctioo operatesand can be appliedto conifol problems.SomPLCSuse the
TABLE-TO-REGISTERor FILE'TO-WORD lunclionsas an altemaliveto rhe
SEQUENCERlunclion.Howver,lhesefunclions arenotrs complete or versa-
tile as the SEQUENCERfuncriondescribedin this chapter.

16-2 trLECTROMECHANICAL SEQUENCING


Figure 16-l shows a small, eleclromchanical drum conrfoller.h is a three-
position,six"elecirical-terminal
device.lts elecrricalinlernalconnectionsare il
lustratedin figure 16-2 for eachof irs rhfeepositions.How is rhis drum switch
usedin pfocessconlroll Four motor-reversing applicationsareillusrraredin 6gure
l6-3. Motor reversingis accomplished by reversingany two leadsfo. lhree-phase
AC, reversingthe start leadswith respectro the mainladsfof single-phase AC,
or reversingihe fild leadswith respctto lhe arraatureleadsfor DC.
Darm switchs limiredto a maximumof sevenposirionsand about 12
pairsof contacts. The^re
swilchescannothandla p.ocess wirh27 devicesand 138
sleps,for example,uniike th PLC SEQUENCERfunction,which can easity
handlethe 27-by-138control and more. The eleclromechanical drum swirch in
figure16-1. however,hasone major advanlage. It is a good,economicalcontroL
devicefo. handlirgappljcalionswith a fixed sequenceand a timhednumberof
a FIGURE 16-1
Electrcrnechanical
Drun Swirch
;tN'll!
r--LL.
-!---lrrtrD!

'."'"*u"
llll"l,u.',i"1"'-
.ROLLER

{
{
ri lh PLC
I
rar its SE-
3lv
)f the steps

QUENCER

*.$*$*ry;*tltn
LCs use lne

r is a lhae'
'ctionsare il-
drud switch
ratedin frgur
)rthree'Phase
;le-phaseAC'

and about 12
u"'
)vicesand 138 3 Pha.6 ' 3
wl'' Lolor "***'"5ii'ilii""*
ich can easily
rum switch in

ted numbef ol

Shud
Ot,""rCuli"nl' IA
S'ri.s l/loror
Olr.cl Cutr'nt '

tj"o.t}*ll,i*, 16-r
rorFisure
^*r""'ons
U I:N C E RF U N Cl l ON

AICURE 16-4 LampA Lep B Lanp C


Light PatternSequcnce
I
0

0 o

Figure showstheopenoaclosedstatusof ththreerogelcswircbes


^16-5
of thefive for each
requiredsequential
pattems,
As an atternativeto usingiogglcswitches,$e threelighlscouldbc con-
nccted-tothe ourputof a pLC usingrhecoil/conlacrsystem. as show!in 6cure
16-6.Inpurscouldbe programrned as shownwilh 6v: ;il ;i'.h.:.;.";.;
eachpattern.ClosingINO0lwouldresultins.qucncepa(cm l,IN @2,panernZ,
andso on, up tfuoughlN 005,resuhing in pattem5,_
FIGURE 16-5 L]
Tog8leSwitchLighrpatrem
Conlrol 16-3
B
] c

c
|-o-o-

ft*
I
c
a(
|{+
l*="- c

c
' ' H l r' l c . r.L l :\, I R r" .1.' \ \\D \D oLl \-l r-\
',

N 001
2 rN 002
3 N003

5 N005

.i
hown id fi8ure
rchs,one for
002,parlern2, FIGURE 16-6
PLC Coil/ConractLiehr PaIremcontlol

16-3 THE PLC SEQUENCERFUNCTION AND APPLICATION


Now, supposelhat inneadof a threeby flve sequence, you have lo program14
4?
oulpurson-offrhrough steps. Using toggles
as in Figurel5-5 or a PLC codtact
coil s.vslemfor conlrol would b a longand complicaldsystem Howevf,pro-
grammingthe systemwith a FLC SEQUENCERfunction,is relativelyeasv.A
typical PLC funclionis shownin Figurc 16-7.ThEreare th.ee inputsl
Step circuit Eachon pulsestepsthe functionto the next HR pattern
:l Resetcircuit Eachon pulserselsback to the first HR
o. I
I Enablecircuit Whenon the functlonmay be stepped,and nol whenoff.
whh four piecesofinfor-
Th SEQUENCERiunctionblock is programmd
,,: :
i. Number of slepsto be sequenced through
The slartingrcgisterusedfor the seqLrence
Sreppointerlocalion,an HR that showswhicb stepyou are on
Destinationis th OG register,a groupof HRs that are to be confolled on
and off by the SEQUENCERtunction.
:JO ' T H EI.IQ U EN C E RF U N C I.IoN

] '''i':'
r_
f-] 011
'Y'
f------r f-
lvr
m!lipteconta6ls cFo17rhElgh cF('32

FIGURETG7
Typical
PLCSEQUENCER
Function

601,,,0r
10
02...0101
603,..0010
604.,,0001

3
5
6
6

I
c

flGURX 16_8
PLC SEQUENCERFudctionandpatremfor lie Light Sequedce
1 6 -l ' ,fuE P LCi i r L E \ -i rt !a fto\ r\t.

Fi surc l 6-6 i hons ho* tr-eP LC S E QI-E \C E l . aJi j i i cr.ou iJ bc uscd t i) r


- ve-pal l en.ori :fol A ti e.l hc :' " nci i l r. l : ...,rfa;: ned. t hc on- of a
o u r three-l i ghl fi
b i t patl ernsafe i n\eri ed i n(o i h. regi rtef! u!cd :: ::c se.!e:1. e. . 1 ser ies of
re q ui redregi strpattefn5. al ongi l l h l hc funci i .i ai ' ri i -_r.::-.nn r ns.is shown in
F i gure l 6-E .
P rogrammi ng fot motenepi and outP u(s$oLrl ' r:e l .:: :tmilar l] Fo. exam -
p l e, a 47-rtpproB r:rmi or I,1oul D utsw oul d ha!e i i . :r:i ai i .:: oi in t he block
p ro grammedw i th the numbefr:. The speci fl ed!l an r.,.r:i .: .Jr: c lHeanvwher e
th re arc 46 more unusdregi sl efsi ol l ow i ng. l f6i l l i j :rl i j :tri i: - q. egisler , t he
s e ri esi nvol vesregi nen 601l h.oLrgh fl 7. P oi ntfand OG ;::r: l r . e: in t he block
032 a re programmed as requi fed.Then, appfopri al e!i t !.::' :i :: -;r: :. t e r ut int o t he
47 resisters, HRs r,0l through 47
A s the S E QU E N C E Ri un.ti on operates.the o!::u: D R C F.- 16oolv com es
o n at the l asi sl epa5 an i ndi cri rr. W e show hos i hi i :-'r:. r :r : : : ir r e er am ple.
w e funher i l l ustral eLheuj e oi the S E QU E \C E R a:::::.: : : . r ppl) - 'ng t o
't
c o ntrol of a di shw asher.W e a:i ume that l he di sh\t:i i c. r3i :,\ f unct ionst hat
must be turnedon andoff peri odi cal l(an y acl ualdi sh\ asi e: l :a-'ior e ) Theseaf e
O, tr Soap releasesoienoid
E Input val v i or hol sare.
o Wash-impellefoDersiio:
tr Drain water lalve
E D rai n punp motor
o H eai el menli or ci ' j i .i g:1.| e
l6- 9 Ther e
The oprati onal pal l eni .i i he i j i shi asi 3' i r s' ' c{ :1 :i Figur e
ner' : :l fegi sl er::o rcni :oi l he f' :xer r ' O n t h of
a re t t st" ps.fl erefot.. 'ight Ls
" .r:3rsi .: pal tern i or di sh$asber sequenclng
the fi gurc, the rcqui red ' orreci required on-oif
shown. Ttre tt HR bit !al:.Er' afe programmed ro malch the
p"irerns ior sr.p On:j :h. :in 6 bils oi lhe l6 in each fegistef ar needed in
"ucfr
our illustration.
previously
The dishwash.Ireq'tre:r.:is controlledby lhe functionalblock
l shownin Figurel6-1.
aisfrwurneri*ampt..
I-re
in :Us
I e-j:s in
.\ljnple
rhisfigure
the
rre'hosen
stepping of the
so thxl
next
they
inierval
mutchthe
would be
accornplished bv man'.]itr.lnlire a sqitch to lN 001,the step circuh
-- -
A. tnor" piogzo for our dishwashercontrol is shown in Figure
dish-
fe-rO. *e sfro" a pr..gr:"nnedtime of four seconds''\'luallv in the
"ompt.,.
*art s
op..,lon. i;. ,ine ould obviously be much longer' we use four sec'
". " p.csl?trr'$i exampLe, !'ou won t have to warr long lo run
onds so lhat if lou
Aioiti.'narlr' Lhere s sran^top r\r(em to enableLhe
,i."""i ,r'" '
".r."; ,i. ,-J oi:n< I I rIeP\'S(rn mJ'I be d(D'e"edIo reslartrhe
ro .ror.,
"ecu.n.e *.'.""..9 I l (eos-re proeramr'd^ro^^corple e
t.q"....,
", -git Solernrl ng L( uurr vrc''
1l Drocers sr.o' T" ,::(r:uje I\e 5earence s ops b) U1'L
'r
rhehst (tepir llaF.(oL\ou.:'DatIl-eel('enth'reD LheLrserlj"!ceqJence nerertlKes
a: l:re irLtrlr you ger Lo srep ll The lrdd<r or
place.Srof rate. rh::
figure 16-10is
-T H ESE L rE \a L l < F L \C t tO l

(
|J-|
000
0t to fiR253

Oltpurs+ 6 5 ,1 3 I
1t
x6y ?3. .. 17
x+on +1
Ba n k + o ft +o otoc2
FTGURE16-9
DrshwasherFuncrionMarrix and ReEisterParrernt

I L PushSlart (momntarybutton)jCR 0039goeson ana seals.


2, Sequencer andtimerenabled; process on step1.
3. A-flter150seconds,limer pulseson-off, steppingDR. (Nrrer If set uDfor
. demonstralionuse 10 seclo shortendemoosrration time.)
4. Repeatfor stps2 throughI L
5. Whn DR stepsto srep12, DR comeson. CR 0019is unsealed.
-6. Ladder is rsetand readyfor step l.
7. WheneverStop k depressed, the systemslopsandresets.(This mav or
may not be iafe.OLherpro8ramming -rry be nece.caryro sropthc ;ro-
cessat ihe steDrt !s on )
You may also want each step to have differntrimes.If lhe times are all
muliiples_offourseconds,you canuserepeatregistersandlenSrhenrheprogram. t6-4
Assumethai the stepshavetime intervalvaluesof8, ,1,12,andso on, as shownin
figurt6-ll. The prognm couldbe lengihenedas shownin the figurro accom_
mo-date thesedifferenttjmes.The PLC programfor thismultipleintervalis shown
in figure 15-12.
1\rr, Il l \l \l ]1, Ll l Ur'-)'lCIi lt5
i l .-r rsr' ,o

o",oiFF -_ f+
cF0039 0F0040
s"a
f-,-]HP
T5004l

rR259

Noles:Do nol usanY


reqsrorlo. mor|hanoneplrpose
Se eclco' a.d llnclLoniumD's
rnd arenol usedelsewheretorexaftpe
asoneol ho OG sefes

I FIGURE 16-T|]
Sequencerwith Time! P'rlsins

s.
ofmuhiples'
timesinsread
r youwan!variable vou
'j If set up for
rogerherOne !\oxld
sequencer ffi:':r"r'.";T;::i'T:;
ooeiat'nq

:aled. irri*irun:'l;tr;L{H!'ii:[i:#i!,''
".r

o**'u-'
r
(, -s may or
Ji'fii,i',iiil.ii;"
:r'Jiil":""::il::iliTlL
times are all 1.6-4 TIMING AND CHAINING SEQUENCERS
i".'6
l"'#lj.;#
ilil:Tilii'::*:1[J::TA"d: :"'H:'.:l:f
i[jlij:^",::*
lt'6i
ljm*i'::;I;":n'",x::i:l'illiil H"x1,'1:1il
i,":'.ffi
I l l tr 5 Il L E N C ERI-U N C 1' ION

F IC U R !] 1 6 -II
s .q u rn c .r N IUri p l e ti o c

0 0001 0000 _l-


0 0001 0000 HF'252
000 0110 I
31
-!!
00 -qr
tq _tF2!5- l
0110 HR256
t0 0000
']e257
HF25A
I
-;-
5 01 o00o HR?59
01 0000
-HF2;i
i
0o 0110 HF262
00 0110 H4263
E
00 01ro
_ !9 _!J1g HF265 e'
-H-_F2G6-

I
0o 1000
00 r 00o HR26
0o 0110 NR269
- ---3+H+l+ff+I
I
oo 0001I HF?72
00 0001i HF273

- - -3e I
o0 @01 | HF274
a
-ar#l#;+
I
00 0001| HR2?
i{

I
LogicSFImOn-Samea! In Ftq,l-10
DR
CF00rl(l
I rsoo<r
srep f-----l F

F*'-F
l "*
I CF@9
Ensbrsl__JF

]-rher-Sameasin Fig.16_10

FIGURD 16-12
PLC Proe:mmfo. Fielre t6_ll
sil Pan;rn SequercerBolh-

12
-HF2i

-HF2E

269

I -!E2LL
2 1.1F0352
I
15
II
t I
10. I
HA0362
12

**.""
Jf",'"1""''.",
!li"u"ll
i?il#*ii,ii,ll"ii!+"","iff:ii:n#l!,-
i"ii"T j;$tfllfj[',[q
'*r'iti:li::,;ruillt]l'tilit. t *'
't^'e 'equerc
"eedio
::::r;*l*::;i*ihihiii::r;*Hrff ';:T':r":
ilJr;:tli:r::;,tiiir[:,i:"iij
jti$..;Til:":::
i.,x;;::
ffi-lri$"1il:;ii:iii;m
fu
lxlt:i'l,+:1i""ffi
SI r ] li J jNajljR FU\ lC l l O t

I Enerna!.eds
(DaraEnlry On =0)
-1 Orr Sreo C.la Eitry On= r Ofi- Ol
B c 0 E_- lPRValle)
o{t oft atl oll
2 orl ot'i : cF an o' r cr
-3
oft Cn ci C. an on
cn cri ai ci c. 12! secon
-r
eeg'nnfg wilhlhe seqLencerresel:Whe. the T ''s . t u - " - " .
soo rnsrlctiongoes Ttue slep 1 s in(ated: a s r n er m e - . h v e ns c c s 4 ! e . . e :
olrpursAlh.olqh E areofi Aheradwettm
oi 5 seco.ds (assumn!SOO remainsTr!e). D u f n qr r r er n e r . a l : : : i c ! . a , s r e : : r l l r e S O n s l r u c l i o n
slep 2 beqns: outpursB a.d 0 go On Afier 4 re se On oinl
20 seconds,slep 3 begns: ollpu a and c r . ! i r : r 'c : ! . : i ; r d r e s tfre
go On.Aher60soconds. srep4 begi.s;ourpuls p r o g a m m e d. F L r . a r a . r : : e : : : e r
B a.d C go Ofi olrplr E goes On. Aller 10
seconds3 cof,relLonbn rs sr on and lhe
cycrorcoeaisw rh step 1.

( o a taE .rry rOi


= 1 On oala Enh/:on = ' cl . 1 .-a.s:.-s
-0 ) i ::Isal i sj i ed
a c o E
on oti oll ott Otl Ol1 Cr" =::- s:ee h's
2 ott ofi ori d;-; ---..: s cfr c.y
-- oft
On
-r
Th6PRv6lu6s sera( 1 lor achsiep(the Ihis sqlen.r movasrromsrep:. s1e.
ryprc6cas6)Bgrnn ngwthsrpJ,o!tpursA 6s lho time-dvn SOO seaue.ce.
rhroughE areof Alrra Fats-Tru lransition
ol rhsoo nstrucrion occuE sl6p2 s in Dlang lh lime th.t a padcllar sle. ., :-: sc ::.,:i:-
a enclioutpltsB andD 9o On.Aitra 2nd
rE.sltion,sip3 is n 6ll6cttoltput3A andC
is ln erlscl rh -plrq.!3i6d sal s : r + :-
wh6.theslatlsot{erna nputsA.fioe_c:: -T::.-.s 1-:-
qoo. Atlera3dlranslrLon, stp4 istnettecll programndrnpuldata tor lhar sret
ourpulsB andc go ori oltpuiE so6son,
ahera4lhtans ion,acomptouon bitiss6lon
andlho cyclrep6ats wirhstepI

FIGURE 16-14
Four SequercerOptions
Iri I fl l l l N r , ANl) fH.\lNl\d 5t U IN C E R S

sarirficd bit is turnedonr whenoneo. morcb(s do not mrlch lhe inpuGsalislied


bit is ofi. The thirdSQI optiontunclionis timedrivcn xs is optionone,and the
fbu|1hSQI optionis eventdrivcn,as is oPtrontwo
The pfogram funclion lhat controlslhese sequenccrsis shown in figure
16-lJ in ladilerform rrthe.lhonblockform,as wasthc firstformat.Rungsl, 2.
and3 controllhe sleps.RungsI and'1tellthetunctionwherelo stop.Rung6 is
i_D,r,soN onry usedto resei the functionback!o the bginningat the firn regjster.
Basicsequencefunctionshavsizelimits.To obra'nmoreslepsisequence.s
canbe "chained.' Thesinsle-funciion outputcapabililv mavbe 8 o. l6 bitswide'
and8 or 16ouipu!terminals cancontrol onlv up to 8 of 16machines. Iflhere are
29 machinesto tum on and off, even a single l6-bit Pfogram will nol \To.k. To add
mofeourDut capabrlity, you musl chain, or expand. the number of bits across-
Somefo.malshavea placein thpfogrrmor anaddless register10expandthebit
caDabilit!. \!hen 3 codekey of numbris insertedit wilLaulDmaticallv expand
the numberof ou!pu!;.Othtiormals,suchas the one shownin figure16-16'
musthavepa.aileliunctionsprosfammed in. Figu.e l6- l6 showshow 29 outputs
canbe conlrolled from a l6-bit iunction fo.mnt. Two iunclionsarerun in paralLei
The exlm li bi!s are conrrolled by the scond funclionalblock
Theothersequen.er dimensron mayneedmorestepsfor a process thanone
program blockcontaint.Sequencers canhave6+, Il3, 256,andothernumbers oi
stepsperorogramblock.depending on theformat and PLC model. Suppose &ere
is a 128-slep funclionlimilior onebasicfunction.tfyou need277steps.voumust
chain3 functiontroglhrio run the process: ll3 plus 128plus21 slepsof lhe
lhird iunction.Chainingis ac.omplished b! slartingIhenextsequencer afterthe
lastslepof ihe !re!ious one .{ s2r,,io do thisfor oneiormalis shownin figure
16-17.

IIGURE 16-15
LadderC ontcl
S e q u e ncer
$ Diaslam
UENCER FUNC'I'ION

Machhe -_-"""2:Z':#,"?;1,
Numbe, 1614 1210 36 42
15t3 119 75 31
0 0 0 10 l T o 01001010 rlr1 1000 0101 tJ00
2 0000 01T1 1 0 1 1 1 0 1 0 1t 1l 0101 1001 0l0l
3 0000 1111 1 1 1 1 0 0 1 0 0000 0100 1010 0000

I
20
I HFsior OF02
I siadlngar Htu51
t HFsrorDFo2s
I StarlinSal HF25l

HF25I sysien,Fasr.ndnabt
cncuirs
a6 alsoident@1.
HF250

IIGURT 16-16
ExpandedSeqlencer
Conrrclfor ManyOutputs

FIGUNN
Dilgra[1

o
E XE R C l S l -l s

T50001

0010
HR0203= 20

HF0199 H80203= 15

OFOO!3willcoiltol oulpulsCROOr7
0010 thrclghCRO032 assps.lriedn HR0O01
lhfo0ghHFtoo10,wjlhlh6 nietoa
btwnstePs63spc,idby ih slps
oloF0002,

oG0o02

fTGURE 16-17
ControLlor Many StcPs
ExpandedSequencer

EXERCISES
l proefam Progmn
1. Placerhenachinemalrix shownin fisure16-18in E PLC sequencer
operadon
for manual,event-actuated
Numbr
Machins
Frc;REr6-u
for ExerciseI
Diaeram I 76543 , _:
1 -On
2 On On
3 on-of,
on on on On o.
-5
6
T
6 -On
T H E 5 E U EN C E RF U N C TION

2 . Ad d i n d i v i d u rL tl m eror rh emachi .cp.obl emi d cxerci se ttbreachsrep,usi ngrhesa.ne


(i mei n re rv rl rb re rc hrtc p .l hen rcprogr.nthc probtcmusi nsvaryi ngti des,mul ri pl es,
or !!.iablcs. Jependingon your particularPLC progrumfo.mar.
3. Creat. u opcrxriois schemcfor a washcr/drye.combimtion,usjns tisu.e t6_8 for
relcrenc.. Programa sequence.to run rhe washrdfyp.ocess.Make surethe p.oeram
stopsrt the end ofrhe cycle.It shouldnor repearuntila reserswirchis actuated.0r'd?"j
Do not usc acrurl rimesin minutcslbr the program.Usc seconds.Orherwisc.p.oeram
c h e c k o uta
t k e sh c l fa n h o uror l ongr.)
.1. Chaina PLC ror chiined ourpurslo.4 or 5 intervats.Exceedthe numbe.ofoutpur birs
fl r o n e D " :rrm b l .c l fo -e{ i mpl e. i f rhel :mi rr. E . usen. C hro.eyourorn pa ern

5 . C h a i dr P L C tb . c h a i n e d
stepsfor 4 or5 ourputbi rs.E xceedl hen!mberofoutD u!steD s
ro _o rc p ro c rrmo l o c x .to r e^rmpl erfrhel i mi rr.tt8.u:e B 5.A sdi n,choosel ouro;n

6. ExrraCredir:Combinethe systemoiexercises4 and5 andchainborhourputbirs ac.oss


a n db o tho u l p u rs te p sd o w n.
7. Comparelhe SEQUEXCERfunciionof this chapterto the TABLE-TO-REGISTER
trlncron oi Chapter1.1on dala move sysrms.Whar are rhe advanrases
oi rhe SE-
QUENCER tuncrionover rhe TABLE-TO"RECISTERiuncrion?
Mafrix Functions

IO-RECiSTER
cf the sE-

OUTLDiE
17-1 Inrroduction: U-2 Applring Vatrix Functionsto Reduce?lograrnLength tr
17-3 The .{ND a.d OR }latrix Functionso 17-4 COMPLEMENTand COMPA-RE
ivlatrixFunctions: 1?-5 ConbinationMatrix OPeralions

OBJECTT1TS
Ar rhe end ofihis chapler.you wilLbe able !o
a Defin. rhe conceptsofrhe COMPLEMENTand CoMPAREfunctions.
E Desc.ibeihe PLa nalri)( constructionsysiefl in relistr form.
o Desfibc and programrhe followinsnatrix tunctions:AND, OR, XOR,
C O \IP LE } IE N T,C OMP A R E .
E Use marrixtunclionsin combinationto sihulatecombination Eatessuchas NAND
and NOR.

247
NI r \TRJ X FI - I N' TI ( ] NS

L7-l IN'TRODUCTION

ln.Ti,fi itxiJt
:'ff;lli T:H;,:tTtl
:"::;1,"1.,
iff,:,:?ili
:"#,i:.I+:,itl
il#*lf,Iffi
ffi ,:',3*r*:;#ru"#:"
:it#ii.il*ri:*[tt*i:"::r,:,$
t7-2
if, 6..Itl$ Iti"T+I FUNCTT
oNsro REDUCE
Suppose
.",.,:
i,;,.r"".
i#* ft:[if?d{ftit+""_",:T;l
!ou had20; oilortights.eachof v
::r:1::
rr",
ji:'ln::T:*:lti:tih:T**=t*,"i'"
i."lll :ijz""i"rp're'*'
4 ;;;i*rxlr[
;i1: r;:;:'rrr-';;:
ffi fli:lljhl#
rir.ifu
tuk;.*:ilr*fff*,T *;: ;inl
:,T,T;
,"1E$*i:f:1,+,';i'',';ffi
i".r;#1;IjiIi{r"j;Hn
ff ;[i::*:
;*:tl*:llti*im:. ""*?i.:':ii"'x'J:fi
t7-3 THE AND d\D OR }L{TRX FTT_CTIONS

liT",:,'":,,r"T
;iJ$l:il,T."ffi::..,"'"'J:3iEilii:
;:ffi;,"""T::,ii};
The upper rection of ffgure I7__rsho!,

6ffi g1
;*;;;r1;kll;;lli
::ihifrT# $i*H:l.
ff :.l'",-#i;::'"'"il,i
::t"1,:
?'.1:H;:",ffi"t.*;i;{l,l"l',fl"r;:
-n1r ; rr \,' D l-i1i-!!):l lll
' lllll

It h of two
- 1., w n lwo
)r a conven-
of program-
]trl ANAND
x function 1NO3O5 NO45 cR50
ts on or off,
atus(l or 0)
In! ano tnen
cR506
tN@a6 1N6C6
n if eithror

3 processas
availableas rN@7
tN@?
-1HF

A AND
|l :! .ln four
MGUBE 17-1
Long Reperitivehoe$ms

of matrixB.
D situation,
nalrix C.
FrcuRulT l I 1 N 0 2 1 71 N 0 2 1 3
F o trrO u tp u l rw i th l ' w o Srri cs

tN0219 1N0220

rN0221tN0222

iN0223 IN0224

-z.^>
'ror,, '--, I I ;-..
'"or.nI
rN022 ,N0223
| ,i,0..,
tN0222 '^orro
l....* ")0,0, "oo,ou
N0224 cqo1o9 cBo1.o

H80206 HF020 I n"oro,


*"0.0,I I
f1F0210 HFO212 raoar oH00770F0078
I lHRor'1 l_"]
FIGURE 17-3
NlarrixAnangementior Figure l7-2

flGURE I7-4
Two-by-TwoAND Analysisfor
Figure lt-l

HF0002

HB00o3

Notused-
Statusln evant
FIGURX 17-5
A PLC Malrix For 53 Functions
24
]'HL U\D,\\D L)R \1 \IRL\ LLN.fIt)\S

ln aciurloocfxtion.the inDurdata-or strlrus. is conhincdin lwo sedcsoi


fcgisters. The AND opcrntion fbr ihr lwo scricsthentakesptace,andthe results
afe put in anotherseries of regislers. Thisdalais ihenmovcdio outputrgisters.
'lhe cquivalcn! registeroperation is shownin the lowerseclionof figurel7-3.
FigufeI7-4, a matrixAND operation, assumes !hatsomeof the input:jare
on and sone afe ofi for figure l7-3. The rcsultingoutputsshowna.e dcle.mined
by the PLC multipleAND analysis.
You havc usda 2-by'l matrixtbr tbur AND tnnctions.Next, supposeyou
had53 coils,eachwith lwo seriesinputsfor actuation.lt wouldlak a long time
nnd a lot of PLC memoryto p.ogramth 106contactsandthe 53 coils. Usingthe
AND matrix syslemmakesprogramming a lot more straighlforward.A typical
PLC use5sijiteenl6'b( fegistefsto sivea 2i6-bii matrix.Usinglwo input regislel
mat ccs and one ourput matix does up to 256 AND funcrionsa! once. This
illustralionusesonly 5l of th 256svailableregisterbits and four regislers.
Fisure ll-5 showshow to usetbur of the I6 registersavailableto perform
lhe 53 AND functions.lell the PLC how many registefs will be usedin the
operation:in this case,lour. We uselhreefull reeistersfor the 6rst 3 x 16,or 48,
bits. The last5 bits go in the firs! par! oi the next (fourth)reister.This IeavesI I
unusedbits in !h foLrnhregistef.This way, the othef 13 registersare nol in'
volved.thussavrng memorY.
Assun someon and someoff statuses for thc 53 input AND matrices.The
resulrsoi the marrir operationappearin anothermatrix,as shownin figure17-6.
Holv is the PLC pfosrammedto do lhe PLC AND operation?Figure 17-7
showsa typical PLC AND function.The coil is assigneda numberin the usual
=----- The A\D functionis caded outwhenihe iirputis tumedon. asin most
manner.
otheriuncrions.The illusrrationshowsa generalblockconfiguration anda lypical,
1 specilic,progranrmed AND function.h igure l7-7, you must also lell the PLC
l0
which regisrersro useby speifying th lBs!registerof eachgfoup of inputsand
rhe outpul. Someprogramsystemsspecifythe first register.not the last.In this
case,the registersusedt'oreachpan aretheonespecinedplusthe previouslhree.
The coiLof all malrir iunciionsgoeson when lhe functionalopemtionis

Matrir sizevanesamongmanufacturefs. Maximumallowablesizealsovar"


ies,dependingupon the type of recistersused.Figure17-8 showsone m^nufac-
rurer'spermissiblevariations.
The OR malrix operateslike the AND matrix, exceptlhat the bils in two
matricesafe comlafed on an OR logic basisinsteadof by an AND analysis
Figur17-9usesthesame53onandoffpatterns thatwereusedforAandB inrh
AND examplein figure 17-6.The resullsin matrix C ar now determinedon an
OR basisinsleadof an AND basis.
Figure l?-10 is a typical OR fiinclion layoLr!.The size limitation of the
mairix variesin lhe samemanneras the AND, as shownin figure 17_8.Opera'
tional Drocedureis essentiallvthe same.
The EXCLUSIVE ORsate(XOR)is somewhatlike lhe OR function,except
lhai the ourpu!is not on whenbolh inputsare on. The outputis off when neither
vA frilx FUlclloN5

32lli r0 1 2 9 2 A 127 26 2a 24t23 22 21

a d- |46 J 5l44 4tla2|d 16tts|3.I13


l40l3sIlsl3-

3 2)3 1 3 0 l 2 9 l 2 2 l 2r 26l 2al 2! , 23: 22"2.

y4?146 a 1 4 . dl l 42l ..l d0l t9,:3!l - 16,3st3J tJ B

a!l 5al a2:srt50l .9

oco00i

oG00023 2 l J 1 l 3 0 2 sl 2 ! 127126125124123t22t21

oaooo3I 4pI 471.16


| 45I 44143I 42| 4i 10| 3e136| 37I 36 35I 3! I 33

oG0004| 64

FICURE17.6
AND MatrixResults

FIGURE 17_7
TypicalPLc AND lvlatrix
F IG U RE I7-8
T t p i c rLA l l ow rbl eP l -CN i rtri x
Si rc b y R egi srer TyP t

IG

OG

TIGURE 1?.9
OR NlatrixResults

16l 151.4.13r' 2, | .o sl 3 7l 6L5l 4LrL!

113| 17
32| 31130| 2e| 2s | 27| 2612512412312212112a11e

.s I4/ i6 l .! I d! | 43 | d2 | d , !o | 3e | 33 , 3- , l6-3i l :111j:

54153152| 51Is0149

111i01s ls IzIjLi-Ll-Lj-!3
161151.11131121

' l 2l 3,Jol 29 2s 27126 2si 2412312212120l 9 181' 7

hpoo 2 | i 8 | ! 7 1 4 6 | d 5 4 ! | 4 l | 4 2 , 4 - L . o I 3 s I l 8 l 3 7 l 1 6 l 3 s I l 4 | 3 3

De$ina on Marh
ocooolI 16 | 15 | I 4 | 13 | I 2 | 11 I 1o I e Is | 7l6l5l4l3 l2l 1

I o c o o a2 J?13r| 30l 2912s127,2612524 23| 2212112019l 3I17

ocooo3,-e I 47| 46I d5| e | 43, 42| 4,'9,j!--!!lll9]eljlJl

]**.
DestinatonEnd
M ,\T R IX F U N C ' I' ION 5

FIGURE 17.I(J

oG0004
t

. 6 ' s I d 13 . 2 1. t 0 o a '_ ( ) 4ll 2


| I I L I I

32 3. 130129 2A121 2 6 1 2 5 1 2 4 2 l i - - 2 9liel '


-C

d8t . _ 16 4s t d! 43 l d 2 l 4 l c 0 t 3 9 33 17l36ljr J!l3r


o
t7-4
5r * 52 5|50 49

1 2l r
16115114113 o 9l -16 5 1 3 2

_
I
H F 0 0 1 13 2 | l ,3 0 2 9 1 2 8 2 7| 2612al 24123| 2212t 20! 9, 3

B
H F 0 o 1 2a8 l d7l a6 l c s 1 44 l ! 3 11 2 14 . 14 0 13 9 1 3 8 | 3 7 13 6 l 5 3 4 1 3 3

s4 53 5215r s0| 49

oG0001 ' 6 t1 5 t1 4 1 1 3 1 1 2 1 1 1t101e| 3l 7 t6 | 5 | I | 3 I 2t'

oG0002 3 213 1| 3 0 12 s t 2 8I 2 " | 26| 2st 24I 23| 22| 21| 20t .e t.8 | .-

48 | 47 | 46 | !5 | 44 | I 4r | !1 I d0 | 3s I 38 | 37 | 36 | 35 | 34 I 33

oG0004| 64
L7-5
FIGURE 17-11
XOR Malrt,{Results
l--5 Cr'i\rts]!,:f!l! MA IR I\ ' ]P E R .\] !2!:

F IGU R E 1 7-'
XOR Matdx Functron

ococ04
T

:i:r;frii*l:{r:
ru*siririin
*,*,"- -l:linitir r'"n'ope'
s/e'lm' J
i'iffu::''
::-iJi,iiill."t*,'ff"-^"JJl::";f
FUNCTIONS
11-4 COMPLEIIIENT AND COMPARE M'q'TRIX

j:r+:T:l"s$lji+'f"1$"il'lr:l
I jlxiilts ;iliJ:i ;i .'"":i
!lltili I;J,:,T,1T,::',"il*Xi[J::X::;and
in6sure
isshown li-14'Limiis
'" '"1T!"?" ,""","" r"r CoMPLEMENT
a **"ilX:".i:?ll:}"'Tf;: logicisthecoMPARE runction$hichcompares
g*w"t'L"'t
}n*:;
ffi"#t :x*,'il"Jf ?J,ll ""
i?:;""'"'r'"""
ril::::
-"-iru,:irnin:,:;i:';'.*s:l;#l't: #T#l:
l':il'J:
:"*;ii'filir'r"
::*,*i*,1**ifil:'#::{':l'" "'"''''^,
O i:,."i tif::x.ln'*#;1i",',;':'.i",':ls:
rf,'#.'ri:il
operalionsmanual

17-5 COMBINATION MATRIX OPERATIONS


can!:-conbil:9.:o-le1:::i'":1?::1"+f::
matiixoperations
several
e"';r'n* '""1't:lll"i^':":."ii-I'1
;i'li:;iin;,:"i:ii'rirj
The NANU gate u rur'.-'-
's
,'__,]n.";"r,
opentrons
17-18.
matrixNAND, programtwo malrix ",,t,owninfigure
TIAI'RI,\FUNC'IrcNS

' 6 ' )l J l ' r1 .2 e sl 7l 6t)t4tr


' .0 2tr

1 2 l 3 l :0 l 2 9 2 8 2 7J26 2al 2a 2312212j | 20t., B ,t7


Oiq n
4 8 1 1 7 1 4 6 1 4 54 4 l 4 3l 12l 41
l 40 l 3s l 3sl 37l 36t35 t34 t33

!1l5lls2 sr tso 4s

oG0001

oG0002 32 3r I 30 2s| 28| 27I 26| 2s | 24 23 22 21 2a B 1s 1j


] | | | | I | |

oG0003 J 3 d - 1 .5 1 4 5 l c 4 l 4 3 l 42
i .' l do I 3el .tr37t36t3st34t33

oG0004 54| 53 52t 5t I 50t49

T.IGURE17-13
COMPLEMENT MarrixRes!lrs

FIGURE 17-14
The COIIPLEME!"T F!ncrion

oG0o04
I

FIGURE17-15
o
COMPAREFuncdonTruth
Table c I
0 1
0 o
lb-rtel:.ri I tu:r N!\ I F L\ oPIR\ ll]'N5

l -t l rl ro,2el 2s 7 16l 25 241-l l 2-12 I.0l ' 91 13

4I47 46|45| 44|43I42I41|4oI3e133I371!9lI]llg

s4 53 52 511s0149

32 3113a2el2s l27l 26| 25| 241231l3]l-f!):3


B
,s I d. 46r1. I !d I drI d2l., I .o-11,_?!L:I3Jl:]j1l

lroor:

I
oG0001 rrlrol9lslT

1-sra ri
ocooozl 32| 311!o l 2sl 2sJ27| 26| 2s12112312312,1I ?01 l L

148147146145144143142| 11J40| 3el3ol37


ocooo3 36135l3'1131 ["r:r
l
flGURX 17-16
' CoMPARE Matnx Resuits

cPor13
FIGURE 17-17
The COMPAREFunction

I
Mr\' T R IXF L N C ' | ION S

.""\,".r iNoF...._,-_" *":r-.-


ilii,i"ll;I,x.,."
l^- ll" llrql ln'nol
L_tr l fi l L:1]
First the AND mairix operarionis performedirom lwo inpur
matrices.The resuk
rs ptaceqrn an ourputmatrix.Next,theAND outputrnatrix
is comptemented Uf
the COMPLEMENT madx function.The finaloutpur E
trom tireCOllpletvtiNi
funcLron ii rhe NAN D resuttfor rheorisinrtrwo marflce
I nc ) UR m-rfix operarionjs at"or comoin"rion
oi rBoconre- J(:\e marrir
operations. The resultsof an OR marrixare run througha CO\|PLEMENT
matrix.Th.complemented l
resulringvaluesare rh" rvOn .,r-rrri"iilr"'"._"".i'vi
matices.Figufel7-t9 showshow thisfunct 1
rh Processis
srmrlnrto rhe previousryo"r",,o"o *o*o rui""l,i""prcgrammed t

fi:i,:"-T;?."...,""
1
!r

.
E"HE"--E
In_versions
of inputsare accomplished
by usinga COMPLEIllE\T irnction
iJ;f":1:1,:'":i,':;,*irur:u:;:i::l:ki;,f:-::#:.
b<rof MOvE funcrions
or otherdati movesystems
avarablern thepLC frnc:ion
list.TheEXCLUStVEOR funclionmay be usedro p..folIn
","f.i,...0rp,..

EXERCISES
The followingtwo nat.ices are to be usedfor exercsesI thrcuh
?:

Mlirix I
I00llrl00l
0 001
001t0001 1l I
rlt00lt110 0
{, 1010001 011
00 I 100
ll0l1l00 10
0001001011 0 0rl
0000000110
I ut0
1010101001 0 001
0 lll
I

LiXillt ClS I l 5

C'
1. AND A and B to dcternrinematlix
2 . OR A ai d B to,.l ctermi nc ortdx D '
3. XOR A and B io detemine mattix E
I NANoI
:1. COivtPAREA and B io determinemltrix F
I Fsur'I c H' and J
."n"es A, c and E !o deierdi'e marrices
i. .oiittu"t"t
K
6 . N AN D B JndC Lode' ermrl emrrrrx
7. NOR A antl C to deiermine matrix L
i. The fesult
lemntedby proeramming rh'n on a PLCI
Exadine the follovios exanpLesbv
IPLEMENT
8 . F i g urel t-6. A N D
9. Ficure l7-9 OR
{PLEMENT 1 0 . F i g u rel r-l l . X OR
originaltwo 1 1 . F i g urei 1-Ii C OU P LE ME N T'
O . F i g u re17_16C OII{ P A R E '
11. Figure l?-l8 }"AND
1 4 . F i e ureLr-19,l OR
ii .*". *'."*.'.',:,i *r 1::e-t liiffi'JJ
:tl.'r",":';llll'ii-l,iii;lil
a n 3l vsrs r* o i ul l cgrs(erspN sl tal
$rl l requrrc cone- ror et aci
nr-" l i j l no b' rneP Lc compal etheresul ts
" " " J" i ' " , " ;1"

NT function

nI Dea num-
LC funciion
:ive comple-

o- I
I
I
0
I
0
I
t
AlternateProgramming
Languages

OUTLINE
18-1 Inroduction : r&2 L2id.r Logic and Beyond: 18_3 BASIC: A StepUp E
1E-4 C|afccr:f tlj8n'Le.el P:o-c:'sminsLanguagelor PLCS

OBJECTN'ES
At the cnd of $i5 chapt.;. lou triI be ableto
o Explainwh! ladderloejc nar not be suitedfor mofeelaboratePLC machineand

o Dcscribelhc advdlas.s dd lidilalions ol BASIC as a PLC Prosamtninglanguag


E Describerh. si( n2gis of pro8rdmin8 usingthe Crafcellanguage
E Discu$ rhe advanlzgesof p.og-enhg a PLC in a highlevel, gEphics_based

E Descrjbehow PLC proe!?lMing in a hishlevel lansuage.suchas Gnfcel, is

E7
3 A L ' I' ER ]\AT EP R OGR A M)' IN CLA TC U ,\C E S

1F1 INTRoDUCTIoN
Ladderlosic remainsthc dominan(progrrmminglansuagefor todav s-PLCs' at
leastin rh; UnitedStates.I{ore than 30%of all PLC progrxmmingin the United

18-3

ifldusrdaicootrol.
ln lhischaplef.we bginwkh a brieflookat theoriginsofladderlogicwhile
examininga felv of its morc obviouslimitations Next. *e take a slep up and
exploretheBASIClanguage asaPLC in-lineprogramming-loolFinally'i!isonto
an'analysis PLc languaS-crafcet-,
of a full-bl;wn, high-lvel,graphics'basd
ftat was developedin Europeand hasrecentlyspreadto lhe United States

78-2 LADDERLocrc AND BEYoND


As we have.een lhroughoutthil texl ladderlogicis a naluratextensionofolder
relayiogic. Wilh ladderlogic,Ihe progr3mmerdescribesan imaginaryrelay net'
."1i. ir"r'.r' or process
machine
tacrriat rle oesired conlrol
" ".i*"'i "ire'in

concunefltprocessrng 1sa$o occurrmg.


why shouldthis be a problm?Becauseladderlogicis pnmarily a concur-
language.True, with the useof lhe latchingcontacl lt
rent (parallel)processing
l! - l 815iC A STEP LP

alsobecomes a sequen!ial (sries)pfocessing languase. Ye! as the ladde.logi.


pros|ambecomes more complex. it nlso beconresmore confusing
Wha!is needed,manyin th fieldnow agree,is a lansuage tha! allowsa
prosrammerlo speciiy,simply and preitrably in graphicform, both squential
:::aa: le Rit h: a andconcuffentmachineor processactivily. At leas!onesuchlanguage, Cmfcet
cando thisnnda whollot more.aswe shallseeshortly.But 6rs!.le! us lookat
the familiarBASIC as a PLC programmins language.MaybeBASTCis rallv all
tha! is neededlo solvethe sequntial/concurren!aclivily probLem.

dvenrof rhe da 18-3 BASICI A STEP UP


The fi.st PLCS,with their o.igin in the late 1960sat Cenerallvlotors.wer, of
cou.se.programmedin laddrlogic ln lhe mid 1980s,the engineeringside of
CeneralMotors, as well as Ford and Chrvsler,slartedaskingfor BASIC or
)l high-level,
us advancedBASIC pfogramming. They wantedto programiheir PLCs in 3 higher-
level, moreuser-friendly languaSe-
But why chooseBASICI BASIC (Beginner's All-PurposeSvmboliclnstruc'
c r thartoday tion Code)is a procedrl/allanguage that is easvlo useandcanbe dvelopedand
ng--ges,languag nrn on smallpersonalorindustdalcomputerslt consistsoflines oftexl foming
stalemenls lhat !ell thecomputefhow to perform,stepby stp.Thesesourcecode
starmentsa.e then automaticallycolnpiledinto object(machine)code thai the
fl addr logic computetacluallY executes.
ake a stp up For allitseaseofuse.however, BASIChasproblems.lt is relativelyslow'it
. Finally,it is on lacks!hecontrolstrucluresneededfor sophisticated structu.edProgramming' aod
gtiage-Orafcet it is said ro produce 'spaghetli' codin which i! is difficultto visuaiizeall the
UnitedStates. . interlinks.WhenBASIC gersbeyonda standardpageoi !ej(t.manypeoplefind it
nearlyimpossibleto rad
Nonirheless,todat s compiledBASIC doesovercomesomeofthese objec_
tions,andLrnlikeladdefloeic.BASIC is primarilya squential. no! a concuffent'
pfogramminglanguage.Sincerl is beingusedto p.og|ama numberof loday s
raginar,relay PLCS.le! s takea cLoser look.
Like all computeflanguaees, BASICconsistsofan instructionsel. A partial
listingof a BASIC instrucrionset is shownin figufel8-l Allhoughsuchinstruc-
'tLonsdo not corresponde\actl! lo ladderlogicsymbols.therearesimilariliesFor
'orld machin
1 3llel,ac t |v it y .
xamDle.the LET instruciion\(ould b usedlo assigna numbervalue variable
Thus,ifa conractis represenled by lhe vadableX, the stalement LET X = I
P at ^ time. It mansthat the conlaclis cloied. TheIF andTHEN instrLlctions work togeth.!o
Ln! .ltaneously (normally open)
simulatethe oulpul ladders!mbol. Saya ladderrunghas N a O.
, and fieD eject (X) contac! is closed,lheoutpu! is energized.
ssingtakesplace contacl andan oulputOal.Whenthe
The IF/THEN pair eslabLishes a condilionthat.esultsin a specificoutput Hereis
the BASIC pfo-qramthal accomplishes this stmpletas&
n differenlparts),
1,0 RET! X
imarily a conc :,_l TF Y =]i TH FN Y =fl
alchlng contact MI X=1 THEN Y=1,
AL T E R n _ A T E
PR O C R rnttti \c LA f," C U A GE S

F IGU R E T E -I
A Panial BASIC InstrucrionSer
LE T N P IT 18-4
lHEN
TIMERON

TME R S TOP

DivelbissCorporation,of Fredericktown,Ohio, has been offeringa com-.,


piled BASIC, calldBearBASIC, to run with rheirpLC machinesfor sJmetlme.
A sampleprogramusingtheir Bar BASIC is shownin figure l8_2. The progid
implementsa sysremwith two switchesand two counters,with a counrir b'einc
lncremented w-henthe conesponding swirchis closed.Ifyou havehadanyexperil
encewith BASIC, y,o! shouldbe ableto figurethe programout in no rime.'
AlthoughBASIC and other procedurallanguages, suchas C, are goingbe- i
yond. ladderlogic in a numberof pLC programmingenvironments,iimuit
be I
rememberdrhatBASIC is still prirnarilya sequenrial language.SequentialpLC
taskscanbe handledby BASIC, but wheoasked!o deatwithlarallei problemsit
often becomesoverwhelmed.
If ladderlogic is good for parallelprocersingand BASTCrs good lor series
prccessrng.ob!rouslywhar it neededis a PLC languagethar will excel
ar borh.
We needa language thar wil go beyondLellingrhecomputerlo, ro do somelhinc
anclInsteadtell ir widr u e wanrdone.Grafcet,\rhich we look ar nexr, may be ai
answer,

1oo r N.EcER c( r )

1 3 9 !{ o ).0 r c (1 r.0 / ral rrrrl r. tb.

ll9 cr lr c,J) .1 , hc;.hnt c.u.E .!


199 Dir Nf .c., r j" r ", c(r'
ii
j

e { r ' .! flEN si ri .r

TIGURE IE-2
A Ber BASIC Plosam (CounesyofDivelbissCoa.)
18-4 GRAFCET:A HIGH'LEvEL PROCRAI\lMlNG
I,ANGUAGE FOR PLCS

::"i::,:ii"',lfi :"i:1"IiT:T[:f,H::T,]llil",L:;f 'filxlxff


desisn
in
,"::
Europe
i.'r.'L-'"i."'n* o"-'. Ihe't"ndrrdlor \trucrured'utomrrion
*fi :J#l'#Ti:"lit
*:,:i*::ii[:ru:i: li.YH::'::ir'iiiT:
ilii::i:".i.,'lm
m,iililitl;tr;:"f; :::':i::
:":::'iT,'if;',I:
en offeringa c
ff rtlfkn;
iilrmtii::*;i"Iiiffiil.xi{#.ff
PL C auromari cal l ! l L al l ow ! you to edrt

l8-2. The
l,: ilriir;:*::':
ilJrir,:r*t' llill".'ill'iii'i1l.?
+':u;fi -oe!

and Idec PLC5. to namethe main manufacturers'


*-
;;' ;"dd uppii""tio* a"uetopm"nt
Lvehad any
C
l ra s es. Fi l st, usLn-q adepas edi ror' a a/a/ TrJ:;T,:.t;::'"h:';'"''rl-^t';-,:

15 , are gohg
Lments,it
,::'.'i:'i,l.:':?.1ll
:"ii:li:::*;;:i:;lt,;:.',','.ux;:ff soesoa-r'ne
?ii,"i.i".."a. tar''",od"droInetarsetPI c Frfh theDlogrnm
;e, Sequential
)arallelproblems
il:tr*-
tiltJ, ,in'll#mu:"'"lx
:",",',ff :;:;7
ll'f:,;:7;,?:","
; e."*i"ro.-; i..
tr'.r
: is goodfor
will excelat \l"l;';"';'.H.':;:ru:,?".-j:".*J"J:l""iiill1-",'that.'sesa
with3napprication
w" iLr""ti"te
*" ";i;;;;;i,Jq"'r"" (se6gure 18"3)'Th
",:lti:i;
,"i"i-"t an objec! from on level to the next
ai next, may be
;l'iffii:ff[:l
#l***:;i:;ll.f:tm:"'l*:::l"H"l,Ti''ff
-.i*

1, RAISE: Raiselhe ann


2. DOwNi Lo*er the arm
3. OPEN:Olen lhe arm
4. CLOSE: Ciosetbe arm
Here is ho\r the Sraphis created:
is !h slartingpoint of the
Ane.An initialrrep (step l) is creaied' which
sraDhtseefigure I8-4A) The transiiron
t;-'iu
' i,.o"rn a crarh mu't be separatedbv a l/a'rrrior'
transirion ll"u' transfemns conrrol
."i tr,r* follo*s-th
".ii'",*-irt.
ftom one 'tep to rhe nexl rseefigure 18-48\'
nlee.ivervtransition inrurnhasa'lcef.
withatrueor falsevalue-Thetnggerconk *stinc;:;ffiT11j'ff#:l:
leht
,r,r" tt'" transiti;; h our it is thetrue/
robotappLicaiion'
J,i""i"
"i
falsevariable"shn" (seefigure18-4C)
26? A L ' IE R N AT EP R OC R -{ MMIN CLA N GU A C E S

FICURE I8-3 FI
Robot Ar.n Positions E
F

GR IPC LOS E D

GNIPCLOSED

G F IPO P E N E D

Forl. Next, slep 2 is crcated.The numberis automaticallyincremented


includedwith the step(seefigure18-4D).
Fiue. Every step conlainsan dction.The actionis a conlrol statementthat .
controlsoutputs,Wher a given stepis active,lhe control evaluatesadd
performsthe actionassociated with the step.ln our example,th actiodis
''ARIVLDOWN" (seefisure 18"4E).
ts

TIGURE IE-4
Editinga Graph(Co!fiesy of ll lll

ffil
L___Jl
il
B

llt
r#

FI
:T"---_-
il
+ D

ffi
[=Jt

i;-l
t:l
E

figure18-5'
Si;r.The graphsequencis compleredas sho$n in
. td ro the beginnins and wait for lhe
irrrr.-ir1"'*"",'irt" .retum and the
we"ntroLiei
areale a trn( letqeen lhe last tmnsitjon
next "stan itput.
rnitialstePrseefr$re 18-61
The graphhas now beenProExammed
iitt'rt rtre qapt rs anal\zedIo cfe:( for gtaph errors li thereare
' incremented ** .::.?;',;t;iJ;::
"."
:";;ii.;;;';:Jj;j,1":?qi;'j: j:r,.'t'
roi stalement ,ion. f. i.* t].vt"oi.t und a fcs sccord' of compilingis all iI takes 1ntl:"':
to e3taDrrsn
qirdow s l apDearsiLh in-formarionabouttbe
.rol evaluatesanil ii. u"i"r",..'o"1.it, is dooe d {\ee figure
*d details
nple,the action ,ppi.",i"". t.fuai"e ""t"i"g, .,to' *tt'ugt' "Dphcalion
r8-7).
264 ALTERNATE PROCRAMlI IN.C LAI.C UACES

.4
FIGURE 18-5
G a p h Se q u e .c eC o m p l eted t! | G;"^ "-;
EDrloRs
I
L_:l
-l-
-i_
i-l CLOSE-GRI!
Plc
I

Doc'I4ENr
a=. I
urlt rrrEs
l- 1
Exrr
I
l
Next, slage3, we translateAe appiicaliar. which meanswe eenerate "--
chine"specific objecrcode!o run a pariicularpLC. Tle sourcecodefo. lhe TIGURE18
lation is the dalabasejust creared.In our robot ann eramDt,rhe Allen,Bradelv CraphChec^
PLC 5 rs the targetPLC
When the translationis complere.rhe CadeFasoftwarepackagelists
wamings,errors,andfatale.rofsduero p.oer-.r.:i1i:1g errorsno! dtecredin slagi
I or 2 fsee6gure18-8r.

FIGURE18.6
TheCompltedcmph proSrarn
(Counesy
of Fanic)

I r.q-.r:crr

CLOSE GRI'

o
OPEN CRIP
fl^lcu.cr ron"tG 4E
;i
ffi@@G'itT=--"*^!!!llrl
iE-r
t
i--o,:"."' cuteu
rePort
-(OOOOg:O0tl1
<!sc>--APPMatlon

5
5
o
9
2

U{ 1 IT !lIES

____)
los codrands-
.e!tr're' H"],!t.#t?>

) generate
:ode for lhe llllJ&lloi'**"
' ".o'
packaglists any uea,e-,ead)-tgrp:oc":]j:r'#'
Berore : "::H.":I:'it1[:t?iffT
'- '
pnv)'."''
n delectedill stage toLhe
iJ*ii''"'"i''""''""4
t"::i*H:::l1""i'ill
- ii";'fi
, **,.*,!," ['5'
i;fu
:!.::'#:.\i,:;gi:liitdizlf
pm5
::'l:::ll:ift!jj
r,:il;:,::.t';:
"'";$.:Til"'ln'i.,
:'i[J:,TJf.tl;t'oo".'""
i]';.,i'"i'-',,'"
:'jHi::::i:la'lt'.'r'ru:!'"
It"'i"-i' i"
"oo"ot
,I 1

::::::-i:::T:---
t'i*"f,*}i.i"*""*"*' {ota1 a' nhgs:
o
0
o
I i:::l ?:::i";""..'
r**srjccEss**'

l to contlnue'
Pless ao!' key
AL T E R N A' I' EP R OOR AMMIN C
LA N C U A C E S

t.

_t t-t t -(

6.
_t t-l I

lR la y 2 r lc 4s a r h sFrle 6ct.I 7Loslc Bconpare9Sh/Sq


F4 .5

FIGURE 18.9
PadialLadderLogicfor Robo!Arn (Courtesy
ofFamic)

Finally, as an optioo, in stage6 you can, with half a dozo ke!'strokes,:


eeneruteand dispLaythe ladderLaqiclot yo]urappliEatior,Figurel8-9 showsa.
partiallydisplayedladderdiaCran.
Wiil 6rafce!, and other sequenlialfunctionchan languages, replaceladder
logicforPLC prog.amming in the yearsto come?Thereis defifliteiyamovein thar
- direcrionar (he hrgirend. wherelargrPLCSwirh powerfulprocessingand pro.-
grammingabiliriesexist.yet it is unlikelythat suchhr-gh-levellaDguageswill evr.:
supplantladder logic, even at this upper nd. WlEt is fleeded,it seems,is a
choice, Engineersand techqiciaNwho want to programin langua8es such as
Crafcet(or BASIC for that mattEr)shouldbe ablto do so, Nonetheless, a person:
on the plantioor shou.ldbe ableto usethe old standby,ladderlogicprogramming,;
to aid in lroubleshooling.The idea, then, is to add more process-oriented and
cha,rtlanguagesro the samemachines.Then engineerscan designin a process.
flow diagram,andthe maintenance iecbnicianwillstill haverelaydiagamsto use
for naintenanceand repairwork. Don't throw away your ladderlogicdiagrams
just yet.

EXERCISES
1. Interviewindusry personneltofind out what theylhink aboutladderlogicversushiglr-
LevellaneuaSssuchas Crafcet.
2. Obtaina PLC proeran lr,ritlenin BASIC and anaLyzeit, line for line.
7n7
E XE R C IS E S

deterdinewhai progrannrnglanguaSes'
l. Codlacthalf a dozetrPLC danuiacture6and vith
' r.ei. ,heir machinesare compatibl
ii"il"Jo*
"',i,., PLC programminslan-
on !h'ee high'level sr^phics-based
l. OUtarntn" specificalions

orru d srph for a robotlrm thar would


5. U5insrne inlormJtion'upplieo n hit chaprer'
reLeae
s t rn dt' he l op. sri p no' e to th<botromand
arm (hJI would
6- rnformaLion iupPliedtn thr"chaprer'd'as a &-dphfor a robor
" Usinslhe qodesreesco up andrhenrel eas<'
i t. u.' " . e;p-;otate
"."i

dozenkeys
surel8-9
ges,replaceladdl
itely a movein
andpr
rocessing
languageswill
led, it seems,is
iangua8ssuch

ogrc

esrgnm a
ay diagramslo
der logic
a

AnalogPLC Operation

OUTLINE
andSyslems E 19_3PLC
l9-1 lnroduction: 19-: TypesoIPLC AnaloeModuLes
I"i"r-Sie.a n**ttg : ii-'l BcD or Data
Muxibit E
Prccssine 19-5
Exzspl.sof PLCAlzto! Ourpur ^Pplicalion

OBJECTrlS
At the.nd of rhischapter,]ou edlbe able!o
o Differeodateb.teeen discreiemd ealog oPlation ofa ?LC'
E Lisi md defde!b. v&iousmajortvpesof PLc analog inpulsdd outputs'
E Descfibe thedaraflowandnunber co.veniobs involvedin PLCanalog
operatloo
E Conven input io
sisnalq a folm usablebv inpu! m'dues
E Convert outputmodulesiSnals to usablevalues for outPutdevrces'
E D.scribeibe irt.mat PLC for
oPeration analos I/o oPeration
o Prosama PLCfor usewith bothBCDandbinarYanalog svstens'
E Appt themalogPLCtunclion'so!ratiotr to indusaialproblens

269
to ANALOG PLC OPERA'IIOI

t9-L INTRODUCTION
This texl hasso far dealtwiih discrelePLC operationrinput andoutputnatuss
havebeenon or off. Thischapter considersanalogPLC ope.arion. AnalogPL
controlcan be usedro controla.y o.ocesswiih variablesas a contrclconsi
a.ion.Many mediumandla.gePLCsareablelo deaiwirh analogsignalsashaving
discrctefunctions.For analosoperatron, rhelevelof a PLC inputsisnalis sensed
by an analog input modul. ln 3ddirion. the level of the outpul can be a vafiabkl
valuesent !o lhe processfrcm an analosoulput module.Th PLC analoginput
capabiliry
enables you to monito.luch delicesas thermalindicalo.s,pressure
transducersilctricalporentiometers,
and many othr data inpul deviceswirh
varyingsisnalvalues.OutputPLC analo-q conlroldvicescanbe polilioned at
manyinlermediale posiliors.
Ttis ourpurconrrolconlrasts
with discrereconkol,
w h i c h o p e ra te so n l ." a" t i ts i * o er(i ei i res.
BC D P L C a n a l o gi n pui 3i i c.!rrur \al !e rangesafe di vi dedi nto a nLrmberof
s i e p s . B C D a n a l o si n !u i deri c.5 i nci ude:humb$heel s.encodefs.and Ihe l i ke.
A n a l o g o u tp u r d e v i . s . oni foi :u.h i e;i crs ar di grralnul r.tberi5e!en-i
. esment'
displat/s,andstepper moior:
PLC analog.apabrliiies allo{ mani lifTereotactionsfor onesinglinput,
dependingonlheinpul svalue.Foferample.aprocessin*hichl0ligicareused
to indicarehorvfull a tank is in ii,. incremenlsneedsonly one analoginput and
drscreiesystemneedsl0 on-otr sensorsand 20 inpul5.Analog
oulputprog|amshavesirnilaradvantags: for example,a singleanalogourpurcan
positiona vaLvein manydifierenlposilions.
Analogcapabililyenables youro conrrolconiinuousprocesses in suchindus-
tris as chemicaland petrolum.Ary nunber of variabLeinput signalscan be
receivedby a PLC moduleandlhenprocessed mathgmaticallyby the CPU.The
resuhiflganalogvalueor valuesarc theDsentto an output moduie.The analog;
oulput modulsignalthenconrols a variableprocessor processes,

19-2 TYPES OF PLC ANALOG MODIJ'LESAND SYSTEIIS


Analog PLC systemsarc of two gneraltypes: the BCD and the straielit
numerical.
TheBCD analogPLCsyslemis somelimes calledthe rnultibittype.(Chaptr
22 coverslhe BCD numberingsystemin detail.)Figurel9-1 showstheopemtion'
ofa thumbwheelinDutto an inDutBCDmodule.BCD codesarbfd intolhe PLC:,
input nodule fiom the thumbwheel output.Other possibleBCD-typeirpurs areli
bar-codereadeNand eocoders. A BCD outpu! moduleis also shownin figuei:
19-1. In this case,BCD codesare fed fron the output moduleto a numerical
indicalingdevice.BCD outputdevicesincludesuchthinSsas digitalnumberdis-
plays,variablepositionactuators.
andsteppermotors. 19-3
The othergenralPLC analoesystemis the slraightflumerica]type. Some
for lhesesystemsareshownin figurel9-2. '
typicalrangesofthe modulesavailable
The PLC nume.icaltypeof modulis usedfor a largevarietyof inputdevices,the:
z'l
:JT ' ptc r .:r cc stcr r r Ploclssir c

sco BCO
3

I
---'1 I
rg iignalsas ha
putsignalissen lil =l
,ll
-)
' PLC analog
-l

.I
I =
inputdevices
ro be posilioned

ed into a numbr.
ders, and the I

,\. : singl
tl 'I
FIGURI 19-I
:h 20lightsare
AnalogBCD Iiput and OutputSvslems
re analoginput
20 inputs.
e analoSoutpur

esses in suchi TT,TTT:i"!:i!:lir


iii.:,iiii:',.:"j.Jn
:'t.*"*Fii;ll#11
lpur flgnarscan
y by the CPU. ;iil: J:lli":"Tf;
u;::':l1l itiii$"':'"'#1t"'?8":fili,:i:
signals.The morc complicatedanalogsyster
oodule,The
*"'-:l'.'il::ilI"JiliLi'..
****,,.,a",,,iliTill_tii'i:i""
::T'::il'^:il":,il::';'ffi:il:i :ff"' ,"tomo,e
sreps. nearrv
i, more
STEMS
ii..*.,a",";Tl-"rjf
""::f:HiTjj"'"'ffi j::
l:-;,'ir..-"'"1.;
) and the st "ppi""J.i
tibit type.
iliil:l'"li:[.ilx,'"",'Htrli{if
i"';:',H1nfu::m:E
t*tttr,,*,t.'t*, uovou r'".
lilflJ"iti,"iJ;"'; co". "r.o ".,,,
so many ihat cosl
rc into lhe I *ptto vour processwith precision'bui not
CL-.tpe inputs ""o"d "onooi
becornesProhibiliv

digitalnumber PLC ANALOG SIGNAL PROCESSING


19-3
rerical !ype. S orsisnaring
rhesensor ii:'iffili5,i:i":ii::ii'Ji1]I:x"
d*t"*-"f".1"lT
rowdin figure I
?T:.T,lli
iT;xti:ii:y:i: rr'"i.p*',
lliJJ'Ti'"Jli;;;:;"'i".p*
"'oa'i".
272 AN AL OC P L C O P ER ATION

FIGURE 19.2 7_!l:


Typicrl Analoe UO Module II
_L
I
0\

upper-limitsignalvaluemuslalsobe matchedto the upper.limitelctricalvalue


the input moduleby usingan intermediale signalcooversion.Similarly,the ou fIGURE I9-4
moduland the outputsnust havethir signalsappropriatelymatchedby a c
vertef, Intermediatevaluesmusi also be linearlj/matchedby the converters
bothinDutand ouiDui.
' The input signalsavailablhave ro be convertedand scaledro matchaII
availablmodule.For example,you havea signalthat varisf.on 0 V ro 78 VAC,
with 78 V fprseniing1002,inpur voltage.You decideto use a 0-5 VDC inpurl
module.The.efore,you mustconve( 0-78 VAC toa ljnar0-5 VDC, as shownin
figure 19-a. The DC voltagefd from the converterinto lhe module is then
convertedto a digiul number.This digitalnumberis sntfrom the analogmodule
!o an input registerin the CPU, as shownin lhe figure.
How doeslhe input conversionwork? For illustration,trac 3l VAC, The
conveftefanalr_zes the portiol of78 that 3l represents.This is 0.397.The con:
vener, which you must designand supply, puis out a DC voltagethar is this
proporiionofJ VDC. This DC value,1.987V, is sentto the input module.Assume

Oigilal

t
120 120
112.5 15
105 105 14
13
12

I I th
;l

I I
145 I ll
30 :l
15
3
2
1
l"ff".."
0 + o i a l s l i n g + 1 0 0 9. 0+ oigital-100%
lrucAn.lo

FIGURE 19-3
AnalogSignalConversionro Digital Steps
I

illi-Flc rr rroc src!.1!!!_S!!!_:fr-q

+' 'f --
I,l_-l :;'.:;,1 - I _--:.!ii
- I _-1j#:',.
l r'--ll(eH
ttt_ _ L -:-

s.]-.,* . -*
-- lj .,rr".: . '",
nii lectricalvalue '*:.
i ! Ac

Simila.ly, theo TIGURE19-4


) marched by a AnaloglnputSignalPa$ andvalues

a value up to 256 in
lhnt the input moduleis an eight'bitbas,which can hold
irom0VtoTSV
se a 0-5 VDC [{u*:";[lll 11;'i11i:ll
Hlr':"]:i":i\itliil;1H":::tifl,iiTi;l
-5VDC,asshown * pe'rectrv
isnot whn
rinear
l nodul is "i:::ii?i"?ll'illli*1,i:.ili"H#i:;"'
orrhis "nd
svstemoiiltli!;,l,fiii;,l,llilll
tr,.cpui"""iu", auro.rheaiium+
3;i11;.""iil ,""T:1J:ililil"J?#," and
,024
have 40e6steps,
trace3l VAC.
s is 0.197.Th
-ou,d
'ilXii.* .isnrl fromrbecPU Loan oulputanalosdevice?
i"to";ii';ttoo..
,n. ser

I^*:;;;rynsnii!.ff'diy;
voltagethat is ".,,0,rt

r}.r:r$ltlil+,k
-ro
i5ffii,1iT:13-,j,JHJ'll'i,'lifil,"l;; v,
t"
ii:
+ro
v.
ffi'ti'l*rui:*::ll:i;'l:,"11"*'"I;il',:t"1,:1"1
"i
",'^"e"
*
:,;'"'".";* sumoftwo analoginputs'
shownin fieure19-6 ln outputmeteris to indicaieth
vatuesgo throughconversionand rhen !brouchthe i'put module
itre two in-puL

:*:l':lxuj:*"st'l,i:rufll:ffi
llx;lJJ":lT"J;il11
Ili
?1,!l:
i';:"J^,lll
l3i,'i"liui;#i"'1il
:l*tlru;f*t ""';l,ili
FIGURE 19-5
Analog Output Signal Path and

Lrvv*
S =ore.*:o= s _*
"
"1".",
271 A N A L O C P L C O P ER AT ION

-ErRo
lRor
\1 1 -f:l

r*, I I
,,',\l I mudule
I
.il"l' F " ' l" i
Ll U opr Lr''\-.1

I I opr | I lo .^ ' l I
5 v Dcllemifurs | 156 --
+,t I t lrD6r
r o r ll I l, L o ll I
I I
,r- loRorI iIl
't I
oFi rLE

= p1 1 3 ,5y = 1 .eye*
_11 56

= l) .s 1 8 " 5
V= 1 .6 ,r
v*
fr = o ;n* o n ,r o =
6lt
,r!!
fIGURE 19.6
Analog ADD Application
fic
iilustralion,17V and42 VAC ar addedandconvened,givingan outputof7.
to the merer.The neter full scalecouldbe serat 2limes78,or 156VAC, to
input and outpul scaies,
Figure i9-7 showsa block diagramof the conversionprocess,alongwj
rwo numerical xamples. Thir modulehasI0:r sreps.ourir couldhavehad5
4096,or someotherpower of 2. Theseare lypical valuesfor the module'sdl
sions,
I
I

1 .1Amp+ l O O% 1OV + 256 |


| | r I L+ oulp!17 i
g'rry+ Aratys,sI
L ,l F+ outpLt6
oAmp- 0% 0v- 0' |
-,m".]- - -1.'" -
t, *" 'r.61 ,s6-\rll"i""-
o.a Atp 12.7"11 "" 1A6l
7.27! 186/ ourpur,7-ON
* u- o rv Eo n+ l ..* ' 16
o .sa m o 4 s .4 % i 4 sl v' )61
-
[ ov,.ourl ur* & oN 19-5
oAhp o%J o,l
I ov o\romi on

FTGTJRE 19-7
AnalogInpurSysrem
f'

211

1 9 -5

+ 50v

,t
2SA
iI
l
-l I
tI
I
.10-
1 I

i l*i_- vatle 62"4OPen-.


_ri 6X/ o4 1 a g ++1 2 v +
6;4,6
-
t1o
-
+ 12\

1"""i"5,13,;1',.,..

.;lt **:,ndltits$;'#
g an output of7
: 156VAC,to ,,""iffi H:i'?iHt[*
*"r*+:il;riiill*i:i"":;if
analog ol'lput tYslem
process,along_r

)r lhe modulgs

's4
ffi**t+***ffiff*
llt*iittllt*l'*"mt:"yltt'.';'mir
fd*{T{}}l;r
'#ill;i{}Tkft
:l{,+ff oF PLc ANALoG
our:::f
EXAMPLES
APPLTCATIoN
19-5
'^iffi
t-
rhenpu*and.'u.p'r'[s"o**"'st'":J*"#
i,i"illil;li'lil#:a;
n6 {\ALOC PLC OPER.]iIO\

fE-
:rI

B C O7 3 6 8 .* 0111 0011.0110 1000


BcoloBinaryConv. t o
I
= ehary7363 0Oo1 1100 1100 1000 i
Muhiplybyo.s I
= ginary3684 0000 1110 0r10 0100 I
BiDaryio Bcoco.v. I
= B C O3 684 0011 0110 1000 0100

I
I

FIGURtr 19-9
BCD(Multibir)InputandOurputSystem

discretemodulesmay be usedin combinationwith analogmodules.Furt Fll


multiple inputs and outpulscan be irvolvd. To illustratal1of theseco E)
tions would requircmany examples.
This sectionpresentssix examples,four of which have multiple inputsl
of anaiogPLc operalions.Theseexamplesare
outpuls, as rptesentative
Ex. 19-1 Analogin/discreteout
Ex. 19-2 BCD in/discrteout
Ex. 19-3 Analog in/analogor BCD ou!
Ex. i9-4 BCD in/BCD or analogoul
Ex. t9-5 Two anaiogin/two analogout
Ex. 19-6 Two BcD in/two analogoul

E)L{MPLE The examplegivn in figure l9-7 was analogin and discreteout. Th


19-1: valuesfurthr illustratelhe example.The problemis to have one output gol
ANAIOG when a cenain level, 0.5 amps,is reached,and anoiheroulput on when !
IN AND aflperagei! berween 0.8and 1.1amp'. To accorplishths. useLheinput
DTSCRETE withcomparisonfunclions.(Thecomparisonfurctions arecovercdin chapter
OUT For the first output.usea GE function.Sincethe secondconditionhas
limits, it needstwo comparisonfunctions-in ihis case,gratertlafl and
than. Figure 19-10 for example19-l ilhstrates how to programthe PLC
accomplishthe requirdcompaisonsand energizeapproprialeoulputs.
a

ll^*"*'"''*'
i3-
T"o"YlE IN0033
Anps: o s

Amps: 0 8

Eoor
GE0112

G80112

dules.Furthe
I of ihese
i3-ll"'o"'ou'
H-."HS
Amps:0.5
/e multiPleI
examPlesare

AnPt :0 8

EQ OT
GEO 112

iete . Th figut
\ve !; output 99
i oulput on wn91 aP2
v
; use the input
Dveredin chapteri
r GE0112
]nd conditionhas

,rogram the
iate outputs
TA AN AL OC Pt_ COP Ek AT ' l O:1

trXAMPLEA problemsimillr to exanpll9-l is illustrated


in exanplel9-2. The inputi
19-21 BCD rhumbwheel (harcounlsup ro 9999.Ifrhe inputis 3750orabove, output
BCD TN to go or. [f thc inpu! is berween6200and8542,output7 is to go on- Assume
AND the input datais receivedin resisterlR 0006in lhe CPU. As previouslystaied, EXAMPLE In
DISCRETE CPU works in binarytthrfore,you must first conver!the lR 0006 9-4t wl
OUT binary. ResisterHR 0045will receivethe convrtedvalue.Thereafier,the c BCD lN su
padsonfunctions are thesameas in eramplel9-1. Fisurel9-ll showslhe BI
AND BCD
programmingfor this BCD compa.isonproblem. OR
ANALOG *
EXAMPLE For xamplel9-3, an analogsignalof 0 10 l0 vollscomesin througha con OUT PI
19-3: to an inputmodule.The sienalis ro be scaledto l/5 of its valuby theCPU
AN-{LOG thensentoul throughan outputmodul.The ouiputis alsoto be senlto a
IN AND outputdisplay Fi-qurel9-12 illustrateshow the PLC can be prosrammecl
ANALOG
OR BCD
OUT
I I
1024

BCO

I'IGURE 19-U
Example19-3:Aialog In/analogo. BCDOut.A. DalaFlowDiasram-
B . P LC
I9-5 APPLICATION EXA|V{PLESOF PLC ANALOC OUTPUT n9

nally !o accomplishone or both output conditions The analossignalgoesou1


i9-1. The input
directly.The outpulsignalto th analogoutputis first convertedlo BCD andthen
sentto the BCD display.

h lR m06 vafik EXAMPLE ln this exalllple,19-4, a BCD input,0 to 9999,is receivedby an inpu! module,
19-11 whichplacesthe valuereceivedinto regislerlR 0004.A fixedvalueof 180is to be
BCD TN subrractedfrom the valuereceived,and th rcsultis to be sentout to a 0-9999
AND BCD BCD output dispiay.Addilionally,the outputvatueis to be placedin a 0- to 20'
OR milliampanalogoutput modul.Figure 19-11illust.atesthe PLC Progtamming
ANALOG necessary to accomplish$e transferofthe originalinput value,iess 180.Appro_
ue h), rhe CpU OUT priateBCD-to-binaryconvrsionsare includdin the program.

BCD/BIN
|l;;
I ollput I
I
-1ao
odrc6 I
I I
BIN/BCD

| ^sco I
l -*' l
BCOio ehary

tNo037
-l HF02o7
aP.2
1t8t

o80067

L m .B . P LC FICURX t9-13
E:(dple 19-4: BcD In/BCD or AnalocOut.A. DaraFlow Diaellm. B. PLC Program
2N ANALOG PLC OPERATION

EXAMPLE Examplesl9-5 and l9-6 bothhavemultipleinputsandoutputs.They could


19-s:
TWO
ANALOG
IN,
IIATHE-
had more lhan lwo inputsand a singleoulpul, but in this illuslrationboth
pls use two inputsand lwo ourputs.
Examplel9-5 in figure19-14hastwoanaloginputswhosevaluesare
ulatedin the CPU. For illustrriion.the valuesareboth addedandsublracted.
sum is outpu! !o oneanalogoutpu!.andthe differenceis sentoul to another.
MATICAL inrernalprogrammingto performth mathematical manipulations is also
t
t
MANIPU.
LATION,
TWO
ANALOG
OUT
^_*@
"-@

oF0107

5U80208

tFor02
oR0106

nGUR.E 19-14
E)(asplel9-5r Two Ana-log
In, Add andSubtract,
Two AnalogOut.A. DataFlow
Diagam. B. PLC Prog.am
r

r_--:::::-'l
-Lla:l
irrr. They could
-@

I andsubtracted. I

ationsis also
M
A+e=c
C-155= 0 I

D90031

BCOlo Sina.Y
o80032
rN@72

BCOIoBLrary

(A t B )

80003.1
N0072

oc0001
AOO035
1N@72
A+B=C

sa0036
c-155 = 0

HF0093
8D0037
tN@72
HFOO93
oG0002

FIGUR.E 19-15
Examlle 19-6: Two BCD in, Multiplicaiioo,Additiod.Subtraction,Two AnalogOu!.
A. Data Flow Diagram.B. PLC Progmm
?al
uz ANALOC PLC OPERATION --.--'

EXAMPLE Examplelq-b. shownin frgurei9- I5. is similarto exampleI9-5. lt hdsIwo


L9-61 inputsand lwo numericalanalogoutputs.You could also mix and matchan
TWO BCD andBCD inputsandoutputswith liltle diificulty.ln example19-6,the nrsl out
IN, is the productof the inpuls and the secondoutpul is th sum, ninus 155.
MATHtr. produc!is.ead on rcadoutX and the sum. minus 155,on readourY. Again,t
MATICAI, PLC procramto performlhe malh functionsis shown.
MANIPU.
LATION,
TWO
ANALOG
OUT

EXERCISES
t. Drsw ad outpurgraphio. a l?'srepa5-bi0ourrur similarro thoseshosn in figlr 19-3.
144volts k 100%.The input connslFdon is rh sanc 4 nsure 19-i. Detemine thc.
voltageilanSc)ior dial jetines ol l-i. rJ..16. and ?E.si
ourpul digilal4lep-indicated

2, If the inputEraphcurvein frsurcl9-l *cl! noniined.6 shosn in ierre l9- l6. eould
th output be linarwith .espec!to dial scftin8: Er:_iain.

FTGURT$-16
Diagramfor Exercise2

3. Referto fiEurel9-4. TEce 61.5V throushthe syslem.


4. Refe! to figure 19-5. Supposemultiplicationwe.. by 0.5 instead of 2. The digital
numbrwould be 51. Trace5l $roueh lhe sysh.
5: Refe. to fiB!rc 19-6. Tr@e for inpuls of 22 vAC for valve A and 3 1 vAC for valve B.
For exercises6 throush8, assume
d Input volts 0 to 80.
o Input module volts 0 to 5,
tr Binary has 128lteps.
r
EX ER C IS E S 243

9-5. Ir har two Fo. exercises6 through8. includethe loLlow'ngin eachansqer'


a D r-$ r ol otk fro$Jrcsl rmds.n l i sure.9--
r9-6.rhefi.sl E Draw thc requiredPLC ladderproeramas rn the chapre!example.
um.minus155. o Tmce a numbe.,ii requested,throughrhe comDutarional sysremsimilar to the
tracinecaniedou! in flsurel9-7.
6. The linear input ot 0 to 80 vofts is to be disphyed on a 9999'm.x,nrum_coudt BCD
output.Trace 32 voLtsthroughrhe syste6.
7. Repea!exercise6, changingthe outputto a linea.0 to ll volrs Tce 5l vohs input
throughthe sysled.
8. Two linea!inpu! sienaLs of0lo.l voltsare to be dultipLiedand the resultput oul oo a
lined output of0 to 150volts.Tnce the numbes if lhe inpuGlre : 85 and 1 45 volts
9. Two BCD numbes ee !o be inputled The firsr is to be dividedb,vIh second The
resuliis to be shownon an outFutBCD display.Tracethe conputationilA is 458and
B i s 35.
10. Thcre are th.eeBCD inputs,A, B, andC. The outpu!is to be A plus B minusc on a
BCD display.Tracelhe computation for an A, B. and C of d:5 231,and 61, respec_
: I9-3- Dterniin.
i 45. 46, and
11. Thereare two BCD inputs.IfA exceeds355,output f is lo go oni if B exceds187,
outpul G is to go oni ii both exceedtheir lisred numbe.s.ourput H is ro 8o oni
in nsurel9-16,
orherwise,no ourputsarto be 0n.

ad of 2. The
7

NetworkingPLCs

"j iii'-"ifi'i''"'li"-"'-'"
i1'ji:i'""Jlf
lfitir*t*".*,1"ff::
::#::T':'..'"',.',*
:t'li:.]^l'"'"
l *a'
**,"*"
*;lliilfr:iit-ffiTll"'"'."",jj
"'"**'*"
"'}*'"***r''ra*'
it{i,ifft''I.,:tr,,t*t'-t'xftt}l
246 N EIw O R KIN G P L C s

20-l INTRODUCTION
This chapterdiscusses lhe .ole of lhe PLC in networksystemsA discussion
of indust.ialcontrol and whe.e the PLC fits is cove.dfirst. Next, compuler-l
integratedmanufacturing(CIM). a nelwo.k-basdmanulacturingsystem,is di$:
cussed.A generaldiscussionof network communication,includingpresently
availablelechnologies,iollows.A specificPLC conlrollris shownnex!.Finally,
industrialexamplesof networksystmswilh PLCs are iilustrated.

20-2 LEVELSoF TNDUSTRIALcoNTRoL


Figure 20-l is a triangleshowingthe gn.allevels of control ofan industrial
factory. At rheborom. only humancontrolis invoived.At the rop, very invol
compuleranalysisis usd.Most smallerindustrialopemtionsgo up rhroughleyl
3. Larger factoriesar incrasinglyat level 4. Vefy large,multiplantoperations
are generallyat lvel 5. A brief dscriptionof eachlevel of cont.olfollows.
Level I is the machinlevel.An exampleis a lathewith manualconlrolsfor
movinglhe cutte. throughits path.Conlrol is manualwith cranks.The lalhe may.
have po!!er assislsfor morecuttingpower, but control is manual.

/ rocr racioryconro
\,/ producriodconFol
// *h.d\tinE

c o u p . o n r o L*o r k c . , ,
/

. / Manulrconsorl
*hilq d.vic.,codponcnr
/

FTGURE21L1
Control Syslen LeveLT.iangle
r

2 O-2 LE V E LS OF IN D U S TR IA LC ON T8!! u1

Level 2 is reachedwhenelectricalor olher conlrolsareadded Levl 2 can


be dividedinto three sublevelsas shown in figure20_1.Supposean electronic,
,i . N ex t , computef-based controloperatedthe lathe.Sucha conlrolfo. automaticfeedrate
t ng system,is for culling the metalwouldbe lelel2A This level2A ratewouldbe automalically
In c luding set fo( achpart machind.Level 2B is rcachdwhencontrolsare programmd
for machiningmore lhan one part The conlrol pattemfor eachpan is calleduP
from a mastercontrol as required The masterconlrol hasbeenprprogrammed
for eachpart. The third sublevlis 2C, programmable controL.At level 2C lhe
machining pattern for ach part is programmed in by an operator'Whena part s
machiningp.oSramis fifst used,eachstep and motionis reco.ddas the process
o.osretses. The lteps4ndmolions(e noredin memory. Thenextlimethesame
ouJ ir to l" machineo, rhe part machining prc8ram is rccdued liom memor/
" each time the pan is to be made
ihis recallproceduresavsredoing the setup
Machining pattems fo. many differnt parls can be stored nnd recalled as neded
go up throughle goesup
Note lhat as you 80 from A lo C of level 2, the cosi of installation
uttiplanloperatio
accordingly.The costofmore controlversusthe possiblebenefitsmustbe consid-
red in detennininse.onomicfeasibilitv
The lathelni Level I is where nelworkingbeginsto be involved Levl 3 involvescon-
necLing the controrof rqo or morcindi\idualmachines or delrce\lo work to-
gether.An exampleof this level is controlling a robot to load a latheas well as
;ontrolline the Lathe s operation A mastr controller is needed to coordinatethe
two individualcontrollersof the robot and the lathe ln many manufacturing
ooerationsmore lhan iso devicesare coordinated.An xamplemight be on an
auromobileassemblvline. Conveyorspositioners,foboticwelders,and inspec-
tion devicesare coordinaled*ith a masiercomputer.Suchgroupsof machines
and devicesare calld,ork .elh
Level 4 of automalicconlrolinvolvesa numbrofwofk cellshookedup !o a
masler,coordinatingautomaticcomputercontrol The enthefactoryis underthe
control of a large mastercomputer.The mastercomputerlakesan order from
salesinput, checksfor raw malerialavailabilityin invniory,and preparesa
oroductionplan. ft then causesthe requiredparts !o be made,by runningthem
ihroughthe_appropriate operadonsin the plant.The mastercomPuterdoessuch
other;horesas reorderingan appropriateamountof rllv materialas it anticipates
rhe need.The mastercomputeralso carriesout such tasksas schedulingpart
manufacruring in a givenwork cellfor ma-ximum machineutilization.Oneresultof
proper control at this Levelis rduced amounts of raw materiaiand in-process
invintory. Inventory takes up factory floor space as well as addinglo costs
Le;l 5 is one more slepinlo sophisticated manufacturing. At this level' a
compulerlooksat pastdemandforeachproductandprdictsthe numberofitems
$at will be neededat eachrime of the month or year. Salesforecastsare also
factoredin. The productto be manufactured is then scheduled andmadeaccord'
ingty.This level gets into an area calld arrifcral intell!8.tr.s, at a high cosr' An
aniiysis has to be made to deterfir]n whethr people can make lhe samepredic"
tion; a! lowr cosl ancl with comparable accuracy On resull of proper use of
ieveL5 would be rcducedfinishdmaiedalinventory,if salesandproductionare
2U PLCs
NETwORKINC

matchedp.operly. Another resul!would be timely availabilityof a


prompl delivery.Other consjderadons, suchas the lime !o buy raw malenal
Iowestcost, would be includedin the compu!rprogramat level 5
lin

20-3 TYPES OF NETWORKING pr

Computef-integratd nanufacturing(CIM) is a philosophyfor integratingh


ware and softwarein sucha way as to achievetolal automation.Allhough
companyhasits own ideaofwhat CIM .eallymeans,mostfollow a pattmsimi d,
to lhat in figure 20-2. In this diagnm, dedicaledprocessingtasks are
distributedarounda faclory. As compulersare funher removedfrom th I
manufacturingarea,thir funclion shiflsirom real'timecontrol toward su
t
Ii is generallyagreedthat at leastthreelvelsof computerintegmtionafe
requiredfor CIM to work rheceLlleuel,the atea leuel,ard \heplant leuel
level has ce(ain tasks \tilhin its range of responsibility.Cll controllers,
exampie,aie genefallyresponsiblefor dataacquisitionand direcl machinecon-
trol. Area contrcllersare assignedthe tasksof rnachineand tool managme
maintenance tracking,malerialhandlingandtracking,andcompu!r-assisted sim-
ulation and designfacilitis.The pisnFlevlcomputrsare responsiblefor such
thingsas purchasing,accounting,materiaismanagemeni, resourceplanning,and
repon genelatron.
' 94renyou developa CIM system,it is bestto startat the lowestlevel Refer
to figrre 20-2. Begin by completelydevelopingthe controlfor one cell. Then do
the next cell, and so on. Then developth areacontrollers.Only when lhe cll
controllersflrqctionproperlyshouldyou developlhe plantcontrolier.lmplegt|n-:

FIGURf, 2O-2
Tasksin a Plan!According
ofProcessing
Distributiod to Funcrion
?39
!F !!IwoB5]!!
:o-r rY-PE!

ffi*o*ffi
ri i o i a
:u_Yraw material
cvel 5.

or lntegratrng
lion. Although

1g tasks are
ved from the

ffi**ffi
*.ffi
lell controll$,

il ma

esponsiblefor

lowestlevel. Refer
I onecell.Then
Oniy whenthe
ntroller.Implemel'i

'"'J.
rft
fi*lt....;Itm**1il+;:x
290 NETWORKINC PLCs

nalesactionwithin the cell hasspecialhardwa.requirements as wll as


softwarerequirements.Spcifically.such a computermust have ftultiDle
palhs(I/O ports)throughwhichi! maycommunicate wilh rhevariouscellde patiol
Traditionally,ceUcontfol hasbeen accomplishedwith PLCS,which oped
designedfor this very purpose.A CIM structure,howvr,requiresthat the
coordinato.scommunicalewhh othr cell controllers.as well as with the Each
controller.The languageof the PLC is somewhatrestrictingin rhis resp vides
addilion,mostPLC languages do nol lendthemselves well to analysisand
keepingtasks.
With lheseproblemsin mind,mostPLC manufacture.s aredveloping
wilh gratersoftwarecapabiiity.A recenroutgrowthof this effor! is a comp noth
.zled z ceLLconttoller.Cell controllerscombinethe soflwaresophistication plac
PC with the I O handl.ng capabrliry
ofa PLC. Sy\remssuchas theAllen-Bmdta pria
Vista 2000 or !h EclipseMV/4000,producedby Data Genral,are mar
specificallyas cell-controlcomputers. We will be discussingSquareD ceu
r r ^ ll. r s la' ' r

Again, lhe PC shouldnot be ovrlooked.Many third-pafty


p.oduci,/Ocardsdesignedto plugdirectlyinlo th expansionslotsofmost
These cardsper{ormdata-acquisition functionsas well as data conversionij
power conlrol. A PC equippedwith specialsoftwarepackages and I/O cards
emularemany of the popularPLCSin use today, and it can aLsoperform of
computalionaland communication lasksrquiredof a cell conkoller, ph
Compurersare evenbeingimplemented at the devicelevel.That is, si
chip rnicrocon!.ollersare beingembdded in "inlelligenr" machines.Basically ch
microcontrolleris ihe maniageofaCPUto programanddatamemoryand ch
I/O componenls.all on a singlepieceof silicon. The Intel 8797,for e rh
conrainsa l6-bir CPU. aLongwith 8.192byles of EPROM (usr-p
read-onlf,memory),212bytesofrandomaccssmenofy (RAM), a lo-bit
to-digitalconvenr,a fuilduplxseriall/O port, a pulse-widthmodulared ai
andfour 8-bi!l/O pons, ail in a single68-pinpackage.Devicesofthis type are, p'
th lruest snse.complelecomputersystems,havidgall lhe powerofrheir
counterparrs(!Cs). Their capabilityis, of course,limiled by the numberof
mentsinleeraledonto the chip. F
(
The cotrceptof a microcontrolleris nothingnew. In iact, (
havebeenusedin suchdevices askeyboardsandpdotersfor years.Theirappli
tion in industry.however,is quite new. They may b found in applications
rangefrom intellignt!emperature transmittersto multiaxisroboticend
With high-speed32-bi!microcontiollers now beingdeveloped,the futur
Provevery interesring.

20-4 NETWORK CO}ftILNICATIONS


The key to successfulimplementation of CIM is communicationcompatibility
all the compurersinvolvedin ihe process.This, in fact, posesquite a
problem. Although commulrcalionstandardsdo exist, each computer
r
?0-,1 NEiwoRK coMMUNIC{llll 291

md\ u<ea oirfLrenr qrndJro ln rJJrr.on.r. rnele\c. ol )ophislic,r;on of com'


m,r;Lr'.on.ncrex.e.. theneed rbr more \ophi\r'c-ted'tJndrrdr ari'er' tr xnrrcr-
rjr h:\e athiPle
problcm, Ihe InremarionalSrand-'J' Orta-rTatron I lSOr hac de\el-
;ar;onof
'hi, i"' *t'"r l. cxlcdopPn \vspa\ inteaoanP fi OSI' Tne OSI i'a
irh pL(\ \hich r io"J . rn"O"r ' fi8Jre :0-l'
( nloa.r for communicatron nelworkJrch'tecIUre "ee
, reqBit\ lNtthe 'J".*r.v.,
iactr Iaver represents a aifferentlevel of commonicniionsophislication and pro-
videsthe necessarvsupporlfor the layers above it' lmplementing such an archF
ing in *a\ !.sP to the
ti"tur" uffo*r rtt" o"".lo connct virtually any dala commuoication device
nerworkandbe a\suredof compdtibilil)
prolocol rs
t aredcR$Ping: Buried within eachOSI laye! are communicatio0Plolocols '{
q
selof rulesb) hcn com'runrc"rion * i l ldke
s effon \\ .t $ompl nornlne *o" ritatun ugtee'l-Jp;n
-Protocols
otace. eri,Lat all communicat:on leveL' trndare 3)e gned Io lhe appfo
;riate OSI Lavraccordinsto levl of sophisiication'
' To ilLustratethe needibr protocolsat ditferen!levels considefthe s'mpl
how lhe
g Sql!rl!' D cell action of makinga telephonecall There must be someconventionfor
tli dlowable bandwidlh ofthe channel and lhe sienal Ivls
*ir"t oi"
"o"*J,"a,
tn" sequenceof signalexchangemus! be eslablished Tha! is the
N"*t.
"""J. ofoial-tone Iransmirston. dixl-pul'eor Iouch-lone detecrror' and -rngrng
btsrtl raost l sequence
has
or iusy sign.lrransmFsion murtbe clearLv definqdFinrlll "hen connectron
govem humxn dralogue rJke o\ er' There dr'- hree level'
esaftl l. (\ arrds beenmrd;, rherulesthar
;i;;i;;"i' in lhis exa;piei phvsical' transmissionand user' Noie tha! th
*"r.."r pro,iaesttrenecessaru suTpoflfor LneIIrn'mr\sionprotocol
"triti."r Addilionrllv rs
ivel. Ii.'t ii, *ttict'lniu.ntuppoosttteuserprotocol 'itheph)scalprotocor
p'otocols should be unaffected That is'
ichines,llt\sicallY, changed,ttre transmissionand user
*i,ltin r"v"" tttould be transparertto the other lar-ersThis principleis
"tuni"" of OSI
8797.ti\t "^' essnce
the -io
(user. a'"t", otiv f"v".s l, 2, and 3 of th OSI modelhavebeenclearlvdefined
Layers4 through - w l co,r'din themorecomplex
.\0,a (r"hrr andsuccessfully implemenred
La\efIcontcin(ph)srcal_rrnK
r Eodul{lod aoDlication protocols rhataresureIo be developed
pliro.of.-''ftot. thatde6nesuchthingsas signdllevelandconn(cIion conven-
s ofthis llFg are'

the n{rl\hdrof
FIGURE 2O-3
OpenSystemlnlerconnection
(oSI) Model for Network
.als.Thcir'
n aDpli{lllons
x [l(lollect(
. '.Iiitlllfq sqo

doEc()rnfltibili
292 N E Il V O R KI!C Pt.C s

tions.ProtocolsRS-212C andRS--]22 areexamples thalwould6t intothis 20-5 CE


Layer:, thc dxtalink layer,containsprotocols thatrddfesssuchproblems
ci.cuitestablishment,tnnsmission sequence. anderrorconlrol.Protocols such (pn
SDLC. HDLC, anJ EISYNCbelonsrn rhi' l")er. The ner$orklrler /lryer
defrnesproceduresfor dala .ouling. packci switching,3nd error rcovery. isl
X.25protocolis ihe mostpervasive in thislayer. tht
Severalprotocols canxistin eachOSI layer.Thisability,in fact.is
allowsthe networkto suppo( sucha vafietyof dilIefentcomputers.A pa.licr
industriaicompute.may requireX.25,SDLC, and RS-212Cto accomplish
communication linKi0norher mayIeqL:reX.:5. BiSYNC.rnd RS-,12:.Al
the communication paths through the OSI layerswoulddiffer.bolh co
llz
woulduseihreelayers,and-more important-bothcouldusethe network. pl
The OSI network-architecture modelis by no meansthe only attempt u
ne!wofk standardization. Severalothernetworkarchitcctures.calledproprietary p
networks,arecurrentlybeingused.lnlrnational Business Machines (lBM) prc-
motesirs Systems NetworkArchitecture (SNA), DigitalEquipment Corporalii
(DEC)marketsa systemcalledDieitalNelwo.kArchitecture (DNA),andB t
roushs Corpo.ation has inlroducedBu.roughsNetwork Arhiteclure(BNA)
Theseoetworkarchitectufes resemble theOSI mod1. differingonly in th n
br of layersinvolvedand,of course,the nomenclatufe One disadvantage of
lhesepfoprierary architeclures is that theytendto lock the userinto produals:
from a singlevendof.For xample, SNA is desiened afoundlBlvl mainframes;
andDNA is dsigned to suppodDEC miniomputers. The OSI architectur, on
the othefhand,is designed !o accommodale pfoductsfrom any vendor.
Generally, physical networks can be classifiedas eide area net\rotks
(WANs) ot locaLarea net),otks(LAt\;s).The diffefncelies in lhe transmission
distanceand,thereiore, in lhe proximiry ofthestarions to eachother.virtuallyall
plantsandfactoriesfall into lh LAN caregorr' . althoueh differentfactorieswithi[
lhe samecompanymay communicare o!er a WA\.
A L,{N may be charactrized br_irs merhodof slationaccess.Two access
melhods are in common use raday nndon acceis and token dccerr. Random
access is a methodby whichall starionslisten ro thetransmission lineandwait :
a rfansmission.
until rhe lin is frce beforeatlempring If a collisionoccurs,all
rransmitringstationsshuldo\v0and\vaitlb. the nert opportunirr.(o rransmit.Tfu
method is called cattieFsense nuLtiple access \nh collisiai dctection (CSMAI
CD). Protocolssuchas ETHER\ET (inrroduced
by XEROX)uselhis lype of !
a c c e s sa i l h e k a n s p o n l e vel of i he OS I model . :
_:
Token access is a merhod by \,"hich possessionof a rDken (a special code
The tokenii passed
line)allossa stalionto rransmit.
sentalongihe transmission
fro m s u ri o n ' o rra rj o l u n ti l rt rea.h< \ one $rLn a rcr(cge :o.eno f\a( i (al ron
then removesthe token and replacesit with a [rameoi dara ro be transmi(ed.
transmission,
After successful th stationplacsrhetokenbackon lhe line,and
the token procedsto th nex! station.This methodaliowseachsrationan equal
chanceto sendda!a. GeneralMoto.s Corporalions !lanufacruringAutomation
Protocol(MAP) is a transporiproiocollhat usstokenaccess.
r .l

]U - 5 C E LL C ON TR OLB \ P LC N E TW OR K S 293

uldfit inlo this z0-5 CELL CONTROLBY PLC NETWORKS


A mnnufacturing cell is a grorp of automatedprograrnmable machineconlrols
rDrorrcmmdble controllers. robols.etc I designeo Io $ork loSether Loper{orma
complete mrnufucturing or ptoccs\_febteJ lask Thefuncrronoiacell conLroller
is to coordinateandovrsethe operationofthe machincontrolswiihin the cell
ility, in fact, i throughits communicaiionand informalion-processing cap3bilitiesCell control
canpiovideyour companywith the unpfecedented opportunilv io ralizeflexible
C to accomplis com;urer-integraledmxnrtucluringrClMrbJapplvrngfaclor)floorrnlormati
d Rs-422.Al real-iime. fhe reruhii impro ed pldnlefficienc)andpfolit
fer, both The SquafeD MinicellConlfoileris MS'DOS'compatibleand factofv
hardend,and conlainsup to on megabyteof RAM memoryfor application
th e only at oroeram:. p.u. an :d,liLronal512KB' of oa(IerJ-b.,cked RAV ior 'toringe\ecu_
i;". The con'rollerand a rvpic.rl cel, afe shovn n frsure20-d A
lachines(IBM) ."" "-",".'.
mulr.trnc io" bo"rd incorporrle\ CCA ECA "nd HercJles Er-Phi't
"rrr,i
;aDabilitv, and a builr-infloppy disk controller. There is .oom fo. three additional
ipmentCo
'e (DNA), and I IBM AT-compalibleboardsfor improvedflxibilitv Th NliniCellControlleris
r 'ecrure(BN capableof opetatingwith any SY/MATE" or Screenware2'"softwarepackage
ne.wnly in the for SouareD.
lne disad ih MinicellControlisalsocapable ofactingasa garewav to Alln-Bradlev,
userinto p Gould.Oenral Eiectfic, and otheiprogrammable controllefs when Squa'eD Cell
Conrrol software (CeULink"') is utilized.lt !hus makes communicalion possibl
i IBM
)SI archilecrure,l berweenthesedevicesand SY/MAX@programmable contfollers to form an inte'
ny vendor. ii sraredauromalion controlscheme
A Ira r.nga1d ndu'Idalworkcellis sho*n:nfig-te:0-5 Thecellconrsins
two CNC'Con;olledmachins,a latheand a milling machine.Th abbreviatiofl
orhef.virtual CNC standsfor.or?prrter numericalaontrcl. ft appliesto machinetools of all
types.suchas lathesand millingmachines,The CNC dsignation indicalesthat a
machineis controlledby computer,oot manuallyot electricallv ThP partsoflhis
work ce.lareas follows:

issionline and L conveyor


A compuler-controlled
L A CNC Iathe
lY to transmit.l 3. A transverserobotwith PLC contrcl !o load andunloadthe lathe
4. A CNC nilling nachine
() use this typei j. A pick-and'place(PP) robot with PLL conlrol lo load and unload
rl rhemill
6. A SCAiA robot for drilLingor snall assenblyoperationson the con-
he tokenis veyorrrighl)
send.That 7. A masierPLC !o coordinatethe conveyorand-the otheriwo PLCS
8. A computer-controliedsroragefack (ASRS)AutomaticWarehouse
:k on tbe line, 9. A computerprogramto keeptrack of the locationof achpart in the
sroragerack
uring Automati 10. A ma;lercomputerto overseelhe wholeoperalion(ClM cootrolslaiion)
I L Safetydevicesandinterlocksas requircd

. : - " 8 *q 6 t d 6 a e : l
ffi
t-r
I
1
i'\
\ " i"
\\

\i
1-

o ff
flGUR.E

FTGIr'RE?O-{
CIII C.[ C...Friler]dd St*dlitoot (Coudesy of SquareD Compey)
r \

q-F ,31?Bl.
inI Hu
l|l I L tl
tfl llslt
fl tF
jn _t!-
rt-l -.4,
[HI
' d l lh ILIIL

sYEIco 4 3l - 4 5f r6F
'+

FIGURE20.5
Industial andTrainineWork CI](Courtesvof Amalrol'Inc )
7

t \ET]VORKINC PLCS

A nelworkfor ovrallcontroLfor the celi in figure20-5 is shownin


20-6. The netlrorkcan be ofdifferentconfigurarioos, depending on the work r
sequenceand the complxityof manufacturingthe pan or parts. Three mqi
formsofpossiblenetworksareshownin figure20-6. A is a simplstarconfigli
tion in whichall pans communicate direcilyandonly with themastrco[rrol.
a semr-s1ar" in whichgroupsofdevicescommunicate wirh the centralcontfblj
is a commonlyfoundbustypein which majormachinesandgroupsarecon
!o a commonbus.The advantage ofC is tharindividualsectionscan
with each other without going throughthe mastrcomputer,This gives
flexibilityandfastercommunication times.The disadvantage ofC is rharprc
mingis morecomplicatedwith a common,sharedbus. Bustifie sharingin
programming for time inte.valsof bus time and is morxDensive.
Inrerlocks. saieiJrwircher.andorheraux:tL'y de,icei areatroinvolvedi
ihe cell. Thesedevicesarenot sholvnin figufe20-5, andtheirconnectjons are not
slrowdin igure 20-5_
An industrialworkcel is shownin fisu.20-7. This larsework cell is part of
tr manuf"cturineoperxrionto fabdcaretargecompLrercabrners.Ihe equipment
shownis a multistarionrobotic-fabrication work cell. In rhiswork ceLl,two robots
o.
are utilizedfor final weld assemblyof rhe compurercabinets.Th .obots have
individualconlrollers.Theirindividualconrrolle|Sarunderrheovefallcontrolof
lhe cell mastercomputr.Other cll eqLripmenr,
L
such as th conveyors,is also

-4-4
"17'rt, '-llfrg]lration
r{q.z for Cltit

FrSo- 20
r

1s. Thre

ientral
ps are

This gives
I is that
I snaflng

e also involve'

vork cll is
s. The equipmer

ire .obotsha
overallcontrol

(cooritrued)
Figot.20-6
3 'jF-T'#ORK1NCPLCs E

FIGURE20.8
CIM fot Exercis

FIGURE 2O-7
,adustrialWork Cell (CounesyofABB Robotics,Inc.)

lnder the conlrol of rhe cell's mastercompurer,The robot on the lft pe


spol weldinS.The other robot, on th right, subsequently pedorms arc (bead)
,eldinCon rhecabrnelr.The cell is reprograrmablefor differenrmodetsofc
rurer cabinetsas thel, comeirto th cell area.Th nelwork system(not shown)
lor lhis cell is quirelargand involved.

xERclss
t- ln your own words,desc.ibethe five ievelsof controland iheir intenelatio.ship.
Describewherethe PLC doesand doesdot fir inlo the five levels.
DefineCIM, plan!conrrouer,&ea conrolle., cetl conrrotler.and nicrocootro er.
DifferentiatebetweenWAN and LAN.
Skelchstd, seni-srd, andbusnerworksfor the work c! shownin ngure20-8. Robot1
hkes parrsfrom e inpu! corveyor and puts lhem in the lathe. Wher th lathe is
r
E XE R C IS E S

flGURE 2O-E
CIM ior Exercises
EI
A
c, K*
[-"J
| "*" l
FC-5n
J vi3ion

throughlurning,pads are Pu! onto convevofI or 2 bv robot l, depending on the pan


nurnber.WhiLenoving on outPut conveyof 1. theparl is checkedbv a vhion inspclion
Forconveyor2, fte ps.t is removedfronthe convevorbvrobot2' machinedbv a mili,
andrclrimedto the conveyorby robo!2 At the endofoutpul convevorsLand2' robot3
puts Enishdpans in boxeson oulputconvevor3.

n the left

)nt modelsof

irurc20-8.Robot
/'

PID Controlof
ContinuousProcesses

OUTLINE
21-1 l.rroduction o 21-2 PID Principleso 21-3 TypicalProcessConrol Curves
21-.1TypicalPLC PID Functions

OBJECTTVES
Ar rhe end oi this chapler,you will be dbleto
o Briefly describeproPonional,int8ral,and derivalivecontrol.
o Describehow the abovethrecontrolsystemsare combinedfor etlectiveProcess

a Lisr and skelchlhe responsecurvesofineffectiveprccsscontrol.


E Showand sketchlhe responscuNe of a goodprocesscontroLsvsten .
o Genemllydescribethe PLC PID function.
302 P ID C Oi \' IR O L O F P R O(E S S FS
' ON TI).JU U U 5
zt-r INTRODUCTION
All ofthe processesshownin the text so far have not beenofrh continuous
thrt is, lheseprocessexamplseithrare on or off. or lravel linearlybetween
points.By continuous process, we meanonein whichtheoulputis a continuou !io
llow. Examplesare a chemicalprocess,a rellningprocssfo. gasoiin,or a
machinwith continuousoutpirt of papronto rolls. Processcontfol fo. I Tt
continuousp.ocesses cannotbe accomplished fast enoughby PLC on-offco is
Fu(hermore,analogPLC controlis alsonot effctiveor fastnoughby PLC tir
offconlrol. Furthermore,analogPLC controlis alsonol effeciiveor fast e
The controlsyslemmostoften usedin conlinuousprocesses is PID (proporti
integrafderivative)control. PID control can b accomplishedby mechani
pneumatic,hydfaulic,or electroniccontrolsys!msas well as by PLCS. t,
Many medium+izePLCSand ali large PLCShave PID conrrolfun ti
which are able to accomplishpfocesscontrol effctivly.In lhis chapter.we tI
discusslhe basicpdnciplesof PID control.We then explainlhe effectiveness S
PID controlby usingtypicalprocessrespo.securvsand showsometypicalloop
contfol and PID functions.
Loop and PID conlrol ar dsignations used interchangeably by d
manufacture.s. Actually, someloop controlsare not strictly the PID type. How-
e !e r. a rru me th e y a re l he same.

21-2 PrD PRTNCTPLES


PID standsfor Proportional-lntegral-Derivative.PID is an effectivecontrol sy
tem for continuousprocesses that pedormstwo controltasks.First, PID c
keeprrhe ourpurat a set le\,leventhoughvaryingprocessparamete$may
setpoi t._!.gj_ond,
Iq causgthe oulpu! to vAryfrqqr!h!-d_e!i!_ed PID prompd
accuralelychangesthe processivlfrom ofle set point lvlto anothersel
level. For background,we briefly discussthe cha.acteristicsof achof the
conrrolcomponents:proportional,intgml,afld derivalive.
Proportionalcontrol, also known as ratio control is a control system
correcrsrhe deviationof a processfrom the sei level back towardthe set po
The corecrion is proportionalto the amountof error. For example,suppose
havea serloinr of 575CFM in an air flow sysiem.lf the flow risesto 580CFM, a
conective signalis applidto the conkollingair vent damperto reduceth flow
backro 575CFM. Ifthe flow somebowrisesto 585CFM. twice th deviation
set poin!, a conecrive signalof four timsthe magnitudewouid b applie'd
correcdon.The largerconecdvesignalthorticallygivesa fasterretum to
CFM- ln actuatiry,the fas!conectionis not precis.You rtum 10a nw setpoint
a! the endofthe correction,for exaflple,i76.5 CFM, not 575CFM. Proportional
controldoesnot usuall!,\:,orkffectivelyby itself, resultingin an offseterror. i
To retum the flow ro the originalsetpoint, inte$al control, alsoknown as
rcset conlrol. is added.Nole tha! inlegralcontrol cannolbe usdby itself. Re-
member,with prcportionalcontrolonly, we hadan outputerrorfrom our original

\
r
t0l

i]-f: eto rrtlicPles

r:ls-**i*,*i:iii'l:'iffi
il;lii$ii.i;":.i
ut is a conti .*,[:*$p**r;it*[i*$],}t
ihil:';:*il*::;:il?i;lli^''illil'l...,...c.n,r.,F
LC on-off
roughby
ve or fast
PID (
dbyme

*$#p*[*m*$*
*ffi**ff
r this chapter,
re effctivene isulirized'Ihroushac
sometYPical

Dlyby ;l,.Tffit", t::$:'


le PID tYPe.

:ectivecontrol
. First, PID

, PID promptly
lo anotherset
of eachof the

)lvard fte set


iample,
risesto 580c
! to reducetheI
itl .xiationf
,bulo appue!
oe
ro
fasterretum
CFM. Propotu
ro an offset elror
irol, also knofil PrDcon*uer
usedbY itself' I *.oJoTt#* t " t'oot
--t

304 I R D L OI L ON II:" JU OU SP R OC E S S T:
PID C O :.J

')a oillto|] |

l,-l,,

I Erdr.nhcodFlhl

FIGURT 21'2
GelealConrrol
S),stem Punp
Diagram-Hydraulic

the set point flow. lfthe dial is chanSedto a new stting,the functionofthe PID
systmis !o reachlhe new set poinl as quicklyand accuratelyas possible.

2l-3 TyprcALpRocEsscoflrRol, cuRYEs


To illustratesomeof the possiblesystemresponsecurvesfor prccesscontrol
systems,lve will use the elctromechanicalsystemshown in figur 2l-3. By
responsecurves.in this example,we meanoutput positionversus time, The
curves!o be shownare for varioust]?es of controt,includingPID.

\ t
/

Eldncal Poqor 10Folale

*nn ."*.",
ilf,uu,"X",ilnt",".
"to

I *""';?i#;i**;:l::i:,ri:l;l*liit'Ji
l";m;T:l1"lx"i'#"1
:ii,',,',#i:#:[TT",'*;ln:;:[:l::ll
;
;$*nkiilmi:tx*l",lm'r
{lt{[sh"';'$[1i*
i*=q*:t;*dH*:1"""*ffi
'.;'f.,*Th
..",{ti:;"'.";.m*x?f::i**fi
$^""'"""fl
trifu
*ffiii*l*n
*:,i'linfi
dft1i:tl'itt*i*":itffi
/. rssible. loer
FIGURI 21_{
Positon_
ConlroL
Idal_Posidon ro"n,on
LLrfte
'ng
D'9rses

n 6gure2l-3. 23456
ElapsedTime ln Seonds
!PID,
J06 P ID C ON T R OLO F C ON TIN U OU SP R OC E S S S

FIGURE 2I-5 104"


Typical ResponseCu.ves

o'
23456
ElapsedTime in Seo.ds

2l-4

DesrdFnai
P""'* -:-- /*Yl- \-r'+-
Positton i /
't ---_-
/
Poshlon- 3 jec. rind +

Dsi.ed
Final
% sl on -:l -----
Posoni ,._- i
-l -i
posirion
- : sec. Time* 12 mn
D

-";;;;;--;--7-pcv\/\l
oesnedFinai , /\ /.\
^ ^
Positlon
I I /
,l /
Posion- s ic. rime *
1

: .r-_-r
r\ PrcAL!!q9!ql!!!ry!l

FICURE 21-6
ldal PID PosilionControl

for accurateand prompr


controlcharacteristic
thesecurvesshowsan acceptable
"p"'"9;'**p"n*", PID conrrolobtains,themost idealresponsepossible--not
in figure2l-6
*rt"il ii" s"t, *" .an do A cune for lhis conrrolis shown
-uN

2l-4 TYPICAL PLC PID FUN-CTIONS


eloopcontrolPlDiLnctionThi) function conrrols:1
Figure2l--isarepte'enlaLi is specifiedin lhe
roop numoer
rdentii\'ns
ii'O r"".t:." thair, nor 'hokn A (r'e r)
rhis time in seconds
ii*t. utaji. ;." in the blockr) " :o 'pcifred fteqLenc) coil P soes
l.ii,"iilili'" orocedure
.onrrollinc'he-LPddre
'".."r i" en:o ed CorlQ goes
on rhe update timeis rcached
on otrenrhet.rncrion "hen
is shown
complexhv
oi inlermediare 2l-&
in fieure
'"'"T iiSil,r ,ro t runction
contror the PID
s"."^Piii;;;;; ""rion
;;e preu:ou't;'no*nLooj "ith
DIDiuncli^nalone
iunirion.fni'e:ampteJ forIhe are
descriptions
Thefuncrions oi the inpuls andfunctionaL
oLrtputs'

' "Et't-,it. oru"ttunctionEnableline


-F-
I
J
I
*3i""1ii:,T:;i:i'lli!:'"1T?lii?'lii"",n""*
I
Or,tputs
P-the coil numberassrgned
Q-an oJrpulImir coLlusedin the logrc

FIGLRE ?]..7
Funclion
Typical LooP_ControL

-
30E PID C O N ' IR O LO F C O N TIN U OU SP R OC E S S E S

N G U R E 2 1 .8
Typical PID Function --t PY

INPLJT
--l
SETPT
oY

IOAIN

DCAIN

DB

CHOMX

Functional Desctipt ions ahd values


PID numbef-lhe PID blockidentiication number
INPUT*the reeisterin which the processvariableis stored
OUTPUT-lhe regislerin which the outputalgofilhmis stored
SETPT-rhe regisrerin which the se! poin! is srored
ERROR-the regislerir which the valueof ERROn = (SETPT -

DB-the reisterfor the dadbandvalue


CHGlvtX-the regisle.in which lhe maxjmumallowablerate of change

PGAIN-the registerin which proponionalgainis stored


IGAIN-rh regisrerin which the iniegralierm is stored
DGAIN-lhe reelsterin which the proponionaltrm is stored
Most of the functionsin the block are written as a percentageof the
point.The blockvaluesmay be programmed as constantsor movedin from other
registefs.DB. deadband.is effectivelythe toleranceyou can live wilh for the
process(in prcent).Th lasl threefunctionalblockinpursare adjustedfor tuning
lhe systemin operalionfof optimumprocesscontrol
A morecomplexPlDfunclion is shownin fignre21-9.A lvorksheet(instruc-
lion set)for lhis functionis shownin figure21-10.The PID functionis designated
Loop controlin this format.This funciion,whenproperlyenabledby input con-
racts,performsPID analysisand control.The enabledfunctioncomparesthe set
point wirh lhe p.ocessvariabie.If they diffef by more lhan a presetvalue, an
/ ..

F6,r6ncNumber----_l

LL
LT XXXX
9!.1i9!l9.tlL oiinos th. rirral
(LT) runcion as beinga l@p

Sd Ponr This valle 15lh6


desiredvaluot the p.oc6ss

consiantvalueor b6 storodln

. Ho ding F6gisr.r (HR)

ProcassVadab6.This s lh

indepndnlvanableinrc ved
To adival maFueuallofl arc n lh prccessundrdonvor'
ca$ade dodes,it is.eo$ary lhis n b sloredr a
ro do$ fie apprcpnab clnlacl
. Ho dinq Fsrer (HF)

lh6 calculal6lnFul mlsr b


c os6d ro !5 the L@plo

o!1p!t. Tlrisis lhs ollpul ol lha


;A;:i co.l.oll6r usd to drlve
th rine odeciing dEvlco lo
adiustlre processunor
conlol, This .s be slord |n a

. HoldinqR6gslr (HFl)
. OurputRosisrel(oR)

Loon Tsb End,thls sp6cilles


:,j
rhe last ho dlng fegisterL. th
-!n!ln! table contalning dala r6qulrod
lor loop conkol oprallons-This
may noi b lssihan 1F0032
.3r!r8e of tie of groat. rhan the hiqhsl
r. 'in Eam oj holding gister a%ilabl6 in lh
i- - with for givn prccssor.Thls labl is
always32 holdhg regislrs
l o n g .( l n l l q ! r e 21 - 1 0 ,
HHXXXX-31is lhe b6ginning ol
the table a.d HFXxxx is lh

rd bYmput
FIGURE21-9
PIDPLCFunction
t

:l@ oadband{0 - Msr

C E C56i!!d tr Froet r2 r1 10 9 43 21
t6 15 1413
TT-rn rrrn TTTT]
-TTI-I
ruodes ecled 1 = 0i!ariv6 0n PV scled

-F!F.drd
FOFCON
ESERVED

FESEAVEOFOR FUTUFELJSE

FOFFI]TUFEUSE
FESEBVEO
FESEBVEOFOF FL]TUFEI]SE

FOFFUTUFEUSE
FESEFVEO

FIGIRE:I-IO
PID rLC ]rsrrrctioo Se'

Das könnte Ihnen auch gefallen