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RIWZDUH
GHVFULEHGLQWKLVPDQXDO
5HSURGXFWLRQRIWKHFRQWHQWVRIWKLVPDQXDOLQZKROHRULQSDUW
ZLWKRXWZULWWHQSHUPLVVLRQRIWKH$OOHQ%UDGOH\&RPSDQ\LV
SURKLELWHG
7KURXJKRXWWKLVPDQXDOZHXVHQRWHVWRPDNH\RXDZDUHRI
VDIHW\ FRQVLGHUDWLRQV
$77(17,21 ,GHQWLILHVLQIRUPDWLRQDERXWSUDFWLFHV
RUFLUFXPVWDQFHVWKDWFDQOHDGWRSHUVRQDOLQMXU\RU
GHDWKSURSHUW\GDPDJHRUHFRQRPLFORVV
$WWHQWLRQVKHOS\RX
LGHQWLI\DKD]DUG
DYRLGWKHKD]DUG
UHFRJQL]HWKHFRQVHTXHQFHV
,PSRUWDQW,GHQWLILHVLQIRUPDWLRQWKDWLVHVSHFLDOO\LPSRUWDQWIRU
VXFFHVVIXODSSOLFDWLRQDQGXQGHUVWDQGLQJRIWKHSURGXFW
(WKHUQHWLVDUHJLVWHUHGWUDGHPDUNRI,QWHO&RUSRUDWLRQ;HUR[&RUSRUDWLRQDQG' LJLWDO
(TXLSPHQW&RUSRUDWLRQ
'DWD+LJKZD\3OXV'+3/&3/ &3/&//
((DQG(DUHWUDGHPDUNVRI5RFNZHOO$XWRP DWLRQ
$OOHQ%UDGOH\LVDWUDGHPDUNRI5RFNZHOO$XWRP DWLRQDFRUHEXVLQHVVRI5RFNZHOO,QWHUQDWLRQDO
&RUSRUDWLRQ
PLC-5 Instruction Set Alphabetical Listing
6HH7DEOH$IRUJXLGHOLQHVRQFKRRVLQJWKHDSSURSULDWHLQVWUXFWLRQIRU
WKHRSHUDWLRQ\RXZDQWWRSHUIRUP7DEOH%OLVWVVRPHH[DPSOHV
Table A
Choosing an Instruction Category
count counter
sequence sequencer
PID PID
Table B
Example Operations
Summary of Changes
New Information Added to 7KHOLVWEHORZVXPPDUL]HVWKHFKDQJHVWKDWKDYHEHHQPDGHWRWKLV
this Manual PDQXDOVLQFHWKHODVWSULQWLQJ
7RKHOS\RXILQGQHZLQIRUPDWLRQDQGXSGDWHGLQIRUPDWLRQLQWKLV
UHOHDVHRIWKHPDQXDOZHKDYHLQFOXGHGFKDQJHEDUVDVVKRZQWRWKH
OHIWRIWKLVSDUDJUDSK
1RWHV
Preface
Conventions 7KLVPDQXDOXVHVWKHIROORZLQJFRQYHQWLRQV
8QOHVVRWKHUZLVHVWDWHG
Classic PLC-5 processors PLC-5/10™, -5/12™, -5/15™, -5/25™, and -5/VME™ processors.
VME PLC-5 processors PLC-5/V30™, -5/V40™, -5/V40L™, and -5/V80™ processors. See the
PLC-5/VME VMEbus Programmable Controllers User Manual for more
information.
3URWHFWHG3/&SURFHVVRUVDORQHGRQRWHQVXUH3/&V\VWHPVHFXULW\6\VWHPVHFXULW\LVDFRPELQDWLRQRI
WKH3URWHFWHG3/&SURFHVVRUWKHVRIWZDUHDQG\RXUDSSOLFDWLRQH[SHUWLVH
:RUGVLQVTXDUHEUDFNHWVUHSUHVHQWDFWXDONH\VWKDW\RXSUHVV
)RUH[DPSOH
>Enter]; [F1] – Online Programming/Documentation
:RUGVWKDWGHVFULEHLQIRUPDWLRQWKDW\RXKDYHWRSURYLGHDUH
VKRZQLQLWDOLFV)RUH[DPSOHLI\RXKDYHWRW\SHDILOHQDPHWKLV
LVVKRZQDV
filename
0HVVDJHVDQGSURPSWVWKDWWKHWHUPLQDOGLVSOD\VDUHVKRZQDV
Press a function key
1RWHV
:LWKWKHVHLQVWUXFWLRQV\RXFDQDGGUHVVELWVLQDOOVHFWLRQVRIGDWD
VWRUDJHEXWWKHH[DPSOHVLQWKLVFKDSWHURQO\VKRZKRZWRDGGUHVV
ELWVLQWKH,2LPDJHILOHV
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
,I\RXXVHUHOD\W\SHLQVWUXFWLRQ27(27/RU278ZLWKLQGLUHFW
DGGUHVVHVWRVHWRUUHVHWDELWLQWKHFRQWUROILOHRIDEORFNWUDQVIHURU
PHVVDJHLQVWUXFWLRQWKHUHPD\EHFRQIOLFWLQJUHVXOWV(YHQWKRXJK
WKHELWLQVWUXFWLRQLVH[HFXWHGWRVHWRUUHVHWDELWLWVUHVXOWPLJKWEH
RYHUZULWWHQE\WKHEORFNWUDQVIHURUPHVVDJHRSHUDWLRQWKDWVHWVRU
UHVHWVWKHVDPHELW7KHVHDUHDV\QFKURQRXVRSHUDWLRQV7KHODVW
RSHUDWLRQWRVHWRUUHVHWWKHELWLVWKHYDOXHWKDWLVVDYHGLQWKH
GDWD WDEOH
If the Input Sensor Is: Then Its Corresponding Input Image Bit Is:
<RXSURJUDPLQVWUXFWLRQVLQODGGHUORJLFWRPRQLWRUELWV8VHD
ORJLFDODGGUHVVIRUWKHELW
7KHRXWSXWLPDJHILOHFRQWUROVWKHVWDWXVRIDFWXDWRUVZLUHGWRRXWSXW
PRGXOHWHUPLQDOV
If the Output Image Bit Is: Then Its Corresponding Output Is:
<RXSURJUDPLQVWUXFWLRQVLQODGGHUORJLFWRFRQWUROELWV
Rung Logic
$VHDFKFRQGLWLRQLQJLQVWUXFWLRQLVH[HFXWHGWKHDGGUHVVHGELWLV
H[DPLQHGWRVHHLILWPDWFKHVDFHUWDLQFRQGLWLRQRQRURII,ID
FRPSOHWHSDWKRIWUXHFRQGLWLRQVH[DPLQHGIRUDUHIRXQGWKHUXQJ
LVVHWWRWUXH7KHUXQJPXVWFRQWDLQDFRQWLQXRXVSDWKRIWUXH
LQVWUXFWLRQVIURPWKHVWDUWRIWKHUXQJWRWKHRXWSXWIRUWKHRXWSXW
WREHHQDEOHG
Examine On (XIC)
Description: :KHQDGHYLFHFORVHVLWVFLUFXLWWKHPRGXOHZKRVHLQSXWWHUPLQDOLV
ZLUHGWRWKHGHYLFHGHWHFWVWKHFORVHGFLUFXLW7KHSURFHVVRUUHIOHFWV
WKLV21VWDWHLQWKHGDWDWDEOH:KHQWKHSURFHVVRUILQGVDQ;,&
LQVWUXFWLRQWKDWDGGUHVVHVWKHELWWKDWFRUUHVSRQGVWRWKHLQSXW
Example:
WHUPLQDOWKHSURFHVVRUGHWHUPLQHVZKHWKHUWKHGHYLFHLV21FORVHG
I:012 ,IWKHSURFHVVRUILQGVDQ21VWDWHLWVHWVWKHORJLFIRUWKLVLQVWUXFWLRQ
WUXHLIWKHSURFHVVRUILQGVDQ2))VWDWHLWVHWVWKHORJLFIRUWKH
07 LQVWUXFWLRQQRWWUXH
If you find an ON condition at bit I:012/07 in
the input table, set this instruction true. ,IWKH;,&LQVWUXFWLRQLVWKHRQO\FRQGLWLRQLQJLQVWUXFWLRQRQWKHUXQJ
This bit corresponds to input terminal 7 of a WKHSURFHVVRUHQDEOHVWKHRXWSXWLQVWUXFWLRQZKHQWKH;,&LQVWUXFWLRQ
module in I/O group 2 of I/O rack 1. If the input LVWUXHLQSXWFORVHG7KHSURFHVVRUGLVDEOHVDQRXWSXWLQVWUXFWLRQ
circuit is true, the instruction is true.
ZKHQWKH;,&LQVWUXFWLRQLVIDOVHLQSXWRSHQ
7KHH[DPLQHRQLQVWUXFWLRQLVWUXHRUIDOVHGHSHQGLQJRQZKHWKHUWKH
SURFHVVRUILQGVDQ21RU2))FRQGLWLRQDWWKHDGGUHVVHGELW
If the Bit Is: Then the Instruction Is: Bit Logic State:
on true 1
off false 0
Description: :KHQDGHYLFHRSHQVLWVFLUFXLWWKHPRGXOHZKRVHLQSXWWHUPLQDOLV
ZLUHGWRWKHGHYLFHGHWHFWVDQRSHQFLUFXLW7KHSURFHVVRUUHIOHFWV
WKLV2))VWDWHLQWKHGDWDWDEOH:KHQWKHSURFHVVRUILQGVDQ;,2
Example: LQVWUXFWLRQWKDWDGGUHVVHVWKHELWWKDWFRUUHVSRQGVWRWKHLQSXW
WHUPLQDOWKHSURFHVVRUGHWHUPLQHVZKHWKHUWKHGHYLFHLV2))
I:012
RSHQ,IWKHSURFHVVRUILQGVDQ2))VWDWHLWVHWVWKHORJLFIRUWKLV
07
LQVWUXFWLRQWUXH,IWKHSURFHVVRUILQGVDQ21VWDWHLWVHWVWKH;,2
LQVWUXFWLRQWRIDOVH
If you find an OFF condition at bit I:012/07 in
the input table, set this instruction true. ,IWKH;,2LQVWUXFWLRQLVWKHRQO\FRQGLWLRQLQJLQVWUXFWLRQRQWKHUXQJ
This bit corresponds to input terminal 7 of a WKHSURFHVVRUHQDEOHVWKHRXWSXWLQVWUXFWLRQZKHQWKH;,2LQVWUXFWLRQ
module in I/O group 2 of I/O rack 1. If the input LVWUXHLQSXWRSHQ
circuit is false, the instruction is true.
7KHH[DPLQHRIILQVWUXFWLRQLVWUXHRUIDOVHGHSHQGLQJRQZKHWKHUWKH
SURFHVVRUILQGVDQ2))RU21FRQGLWLRQDWWKHDGGUHVVHGELW
If the Bit Is: Then the Instruction Is: Bit Logic State:
off true 0
on false 1
Energize (OTE)
Description: 8VHWKH27(LQVWUXFWLRQWRFRQWURODELWLQPHPRU\,IWKHELW
FRUUHVSRQGVWRDQRXWSXWPRGXOHWHUPLQDOWKHGHYLFHZLUHGWRWKLV
WHUPLQDOLVHQHUJL]HGZKHQWKHLQVWUXFWLRQLVHQDEOHGDQG
Example: GHHQHUJL]HGZKHQWKHLQVWUXFWLRQLVGLVDEOHG,IWKHLQSXWFRQGLWLRQV
WKDWSUHFHGHWKH27(LQVWUXFWLRQDUHWUXHWKHSURFHVVRUHQDEOHVWKH
O:013 27(LQVWUXFWLRQ,IWKHLQSXWFRQGLWLRQVWKDWSUHFHGHWKH27(
LQVWUXFWLRQDUHIDOVHWKHSURFHVVRUGLVDEOHVWKH27(LQVWUXFWLRQ
01 :KHQUXQJFRQGLWLRQVEHFRPHIDOVHWKHFRUUHVSRQGLQJGHYLFH
Turn ON bit O:013/01 of the output image table if GHHQHUJL]HV
the rung is true. Turn it OFF if the rung is false.
$Q27(LQVWUXFWLRQLVVLPLODUWRDUHOD\FRLO7KH27(LQVWUXFWLRQLV
This bit corresponds to output terminal 01 of a
module in /O group 3 of I/O rack 1. FRQWUROOHGE\SUHFHGLQJLQSXWLQVWUXFWLRQVWKHUHOD\FRLOLVFRQWUROOHG
E\FRQWDFWVLQLWVKDUGZLUHGUXQJ
7KH27(LQVWUXFWLRQWHOOVWKHSURFHVVRUWRFRQWUROWKHDGGUHVVHGELW
EDVHGRQWKHUXQJFRQGLWLRQ
If the Rung Is: Then the Processor Turns the Bit: Bit Logic State:
true on 1
false off 0
Latch (OTL)
Description: 7KH27/LQVWUXFWLRQLVDUHWHQWLYHRXWSXWLQVWUXFWLRQWKDWFDQRQO\
L WXUQRQDELWLWFDQQRWWXUQRIIDELW7KLVLQVWUXFWLRQLVXVXDOO\XVHG
LQSDLUVZLWKDQ278XQODWFKLQVWUXFWLRQZLWKERWKLQVWUXFWLRQV
Example: DGGUHVVLQJWKHVDPHELW
O:013
:KHQ\RXDVVLJQDQDGGUHVVWRDQ27/LQVWUXFWLRQWKDWFRUUHVSRQGV
L
01
WRDWHUPLQDORIDQRXWSXWPRGXOHWKHRXWSXWGHYLFHZLUHGWRWKLV
WHUPLQDOLVHQHUJL]HGZKHQWKHSURFHVVRUVHWVHQDEOHVWKHELWLQ
Turn ON bit O:013/01 of the output image table SURFHVVRUPHPRU\,IWKHLQSXWFRQGLWLRQVWKDWSUHFHGHWKH27/
if the rung is true.
This bit corresponds to output terminal 1 of a
LQVWUXFWLRQDUHWUXHWKHSURFHVVRUHQDEOHVWKH27/LQVWUXFWLRQ:KHQ
module in I/O group 3 of I/O rack 1. UXQJFRQGLWLRQVEHFRPHIDOVHDIWHUEHLQJWUXHWKHELWUHPDLQVVHW
DQGWKHFRUUHVSRQGLQJRXWSXWGHYLFHUHPDLQVHQHUJL]HG8VHWKH278
LQVWUXFWLRQWRWXUQ2))WKHELW\RXODWFKHGRQZLWKWKH27/
LQVWUXFWLRQ
:KHQHQDEOHGWKHODWFKLQVWUX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QWKHSURFHVVRUFKDQJHVIURP5XQWR3URJUDPPRGHRUZKHQWKH
U
SURFHVVRUORVHVSRZHUDQGWKHUHLVEDWWHU\EDFNXSWKHELWLVUHWDLQHG
01
LQWKHVWDWHVHWE\WKHODVWUXQJRIWKHODWFKXQODWFKSDLUWKDWZDVWUXH
Turn OFF bit O:013/01 of the output image table
if the rung is true. 7KHXQODWFKLQVWUXFWLRQWHOOVWKHSURFHVVRUWRWXUQRIIWKHDGGUHVVHGELW
This bit corresponds to output terminal 1 of a EDVHGRQWKHUXQJFRQGLWLRQ7KHUHDIWHUWKHELWUHPDLQVRII
module in I/O group 3 in I/O rack 1. UHJDUGOHVVRIWKHUXQJFRQGLWLRQXQWLOLWLVWXUQHGRQW\SLFDOO\E\D
27/LQVWUXFWLRQLQDQRWKHUUXQJ
true off
false no change
Description: 7KH,,1LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWZKHQHQDEOHG
XSGDWHVDZRUGRILQSXWLPDJHELWVEHIRUHWKHQH[WUHJXODU
IIN LQSXWLPDJHXSGDWH
Example: )RULQSXWVLQWKHORFDOFKDVVLVWKHSURJUDPVFDQLVLQWHUUXSWHG
RRG ZKLOHWKHLQSXWVRIWKHDGGUHVVHG,2JURXSDUHH[DPLQHG7KLV
IIN VHWVWKHLQSXWLPDJHELWVWRWKHFXUUHQWVWDWHVRIWKHLQSXWVEHIRUH
Where: WKHSURJUDPVFDQFRQWLQXHV,IWKHSURJUDPUHDFKHVDQHQDEOHG
RR = I/O rack number ,,1LQVWUXFWLRQZKLOHDEORFNWUDQVIHUZLWKWKHORFDOFKDVVLVLVLQ
00-03 PLC-5/10, -5/11, -5/12, -5/15, -5/20
00-07 PLC-5/25, -5/30
SURJUHVVWKHSURFHVVRUFRPSOHWHVWKHEORFNWUDQVIHUEHIRUHH[HFXWLQJ
000-177 PLC-5/40, -5/40L WKH,,1LQVWUXFWLRQ
000-277 PLC-5/60, -5/60L, -5/80
G = I/O group number (0 - 7) )RULQSXWVLQDUHPRWHFKDVVLVWKHSURJUDPVFDQLVLQWHUUXSWHGRQO\
001 WRXSGDWHWKHLQSXWLPDJHZLWKWKHODWHVWVWDWHVRIWKHLQSXWVDVIRXQG
IIN LQWKHUHPRWH,2EXIIHUIURPWKHPRVWUHFHQWUHPRWH,2VFDQ7KH
When the input conditions are true, update the LQSXWVDUHQRWVFDQQHGEHIRUHWKHSURJUDPVFDQFRQWLQXHV
input image word corresponding to I/O rack 0,
group 1. 3ODFHWKHUXQJZLWKWKH,,1LQVWUXFWLRQLPPHGLDWHO\EHIRUHUXQJVWKDW
H[DPLQHFULWLFDOLQSXWELWVXSGDWHGE\WKH,,1LQVWUXFWLRQ
)RUWKH,,1LQVWUXFWLRQ\RXRQO\QHHGWRHQWHUWKH,2UDFNQXPEHU
DQGWKH,2JURXSQXPEHU\RXGRQRWHQWHUDILOHQXPEHU
$77(17,21 'RQRWHQWHUDQDGGUHVVWKDWLQFOXGHVD
ILOHQXPEHUVXFKDV,7KHSURFHVVRULQWHUSUHWVWKH
ELWSDWWHUQIRXQGDWWKDWDGGUHVVDVWKH,2UDFNDQG,2
JURXSQXPEHURIWKHLQSXWVWRXSGDWH8QH[SHFWHG
RSHUDWLRQZLOOUHVXOWZLWKSRVVLEOHGDPDJHWRHTXLSPHQW
DQGLQMXU\WRSHUVRQQHO
)RUPRUHLQIRUPDWLRQRQ,2VFDQQLQJDQGEORFNWUDQVIHUVVHH
FKDSWHU
Description: 7KH,27LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWZKHQHQDEOHG
IOT
XSGDWHVDQ,2JURXSRIRXWSXWVEHIRUHWKHQH[WQRUPDORXWSXW
LPDJHXSGDWH
Example:
)RURXWSXWVLQWKHORFDOFKDVVLVWKHSURJUDPVFDQLVLQWHUUXSWHGZKLOH
RRG
WKHRXWSXWVRIWKHDGGUHVVHG,2JURXSDUHH[DPLQHG7KLVVHWVWKH
IOT
RXWSXWFLUFXLWVWRWKHFXUUHQWVWDWHVRIWKHRXWSXWELWVLQWKHRXWSXW
Where:
LPDJHWDEOHEHIRUHWKHSURJUDPVFDQFRQWLQXHV,IWKHSURJUDP
RR = I/O rack number
00-03 PLC-5/10, -5/11, -5/12, -5/15, -5/20 UHDFKHVDQHQDEOHG,27LQVWUXFWLRQZKLOHDEORFNWUDQVIHULVLQ
00-07 PLC-5/25, -5/30 SURJUHVVWKHSURFHVVRUFRPSOHWHVWKHEORFNWUDQVIHUEHIRUHH[HFXWLQJ
000-177 PLC-5/40, -5/40L
000-277 PLC-5/60, -5/60L, -5/80 WKH,27LQVWUXFWLRQ
G = I/O group number (0 - 7)
)RURXWSXWVLQDUHPRWHFKDVVLVWKHSURJUDPVFDQLVLQWHUUXSWHGRQO\
001 WRXSGDWHWKHUHPRWH,2EXIIHUZLWKWKHFXUUHQWVWDWHVRIWKH
IOT
RXWSXWLPDJHELWV7KLVPDNHVWKHVHVWDWHVLPPHGLDWHO\DYDLODEOHIRU
When the input conditions are true, update the WKHQH[WUHPRWH,2VFDQZKLOHWKHSURJUDPVFDQFRQWLQXHV7KH
output image word corresponding to I/O rack 0,
group 1.
RXWSXWVDUHQRWVFDQQHGEHIRUHWKHSURJUDPVFDQFRQWLQXHV
3ODFHWKHUXQJZLWKWKH,27RXWSXWLQVWUXFWLRQLPPHGLDWHO\DIWHU
UXQJVWKDWFRQWUROFULWLFDORXWSXWLPDJHELWVWREHXSGDWHGE\WKH
,27LQVWUXFWLRQ
)RUWKH,27LQVWUXFWLRQ\RXRQO\QHHGWRHQWHUWKH,2UDFNQXPEHU
DQGWKH,2JURXSQXPEHU\RXGRQRWQHHGWRHQWHUWKHILOHQXPEHU
$77(17,21 'RQRWHQWHUDQDGGUHVVWKDWLQFOXGHVD
ILOHQXPEHUVXFKDV27KHSURFHVVRULQWHUSUHWVWKH
ELWSDWWHUQIRXQGDWWKDWDGGUHVVDVWKH,2UDFNDQG,2
JURXSQXPEHURIWKHRXWSXWVWREHXSGDWHG8QH[SHFWHG
RSHUDW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DSWHUVHH
$SSHQGL[&
Using Timers
%HIRUH\RXSURJUDPWLPHULQVWUXFWLRQV\RXQHHGWRXQGHUVWDQGWKH
SDUDPHWHUVWKDW\RXHQWHUIRUWLPHULQVWUXFWLRQVDQGKRZWLPHU
DFFXUDF\ZRUNV
,PSRUWDQW <RXFDQXVHDQ\WLPHUILOHQXPEHUIURPWR
KRZHYHUWKHGHIDXOWWLPHUILOHQXPEHULV,I\RXZDQW
WRVSHFLI\DWLPHUILOHQXPEHUDVDQ\ILOHEHWZHHQDQG
RWKHUWKDQWKHGHIDXOW\RXPXVWILUVWGHOHWHWKH
HQWLUHGHIDXOWILOHIRUWKDWQXPEHUDQGWKHQFUHDWHWKH
WLPHUILOH)RUH[DPSOHLI\RXZDQWDWLPHUILOHQXPEHU
DVILOH\RXPXVWILUVWGHOHWHWKHHQWLUHGHIDXOWELQDU\
ILOHDQGWKHQFUHDWHWKHWLPHUILOHDVILOH
7RDFFHVVDWLPHUVWDWXVELWSUHVHWRUDFFXPXODWHGYDOXHVWRUHGDWWKH
WLPHUFRQWURODGGUHVVXVHWKHIROORZLQJDGGUHVVIRUPDW
7KHVEVSHFLILHVDVWDWXVELWPQHPRQLFVXFKDV'1
,PSRUWDQW 7KHSURFHVVRUVWRUHVWLPHUVWDWXVELWVDQGWKHSUHVHWDQG
DFFXPXODWHGYDOXHVLQDELWVWRUDJHVWUXFWXUHWKUHH
ELWZRUGVLQDWLPHUILOH7
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
T4:0
EN TT DN internal use only Control word
for T4:0
preset value (16 bits)
7LPH%DVHGHWHUPLQHVKRZWKHWLPHURSHUDWHV7DEOH%OLVWVWKH
SRVVLEOHWLPHEDVHV
Table 1.B
Available Time Base Values
3UHVHWVSHFLILHVWKHYDOXHZKLFKWKHWLPHUPXVWUHDFKEHIRUHWKH
SURFHVVRUVHWVWKHGRQHELW'1<RXPXVWHQWHUDSUHVHWYDOXH
IURP7KHSURFHVVRUVWRUHVWKHSUH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: Is Set When: Indicates: And Remains Set Until One of the
Following Occurs:
Timer Enable.EN (bit 15) the rung goes true that the timer is enabled • the rung goes false
• a reset instruction resets the timer
• the SFC step goes inactive
Timer Timing Bit .TT (bit 14) the rung goes true that a timing operation is • the rung goes false
in progress • the .DN bit is set (.ACC = .PRE)
• a reset instruction resets the timer
• the associated SFC step goes inactive
Timer Done Bit .DN (bit 13) the accumulated value is that a timing operation • the rung goes false
equal to the preset value is complete • a reset instruction resets the timer
• the associated SFC step goes inactive
,I\RXVHWWKHGRQHELW'1XVLQJDQ27(LQVWUXFWLRQIRUH[DPSOH
\RXFDQSDXVHWKHWLPHU7KH(1DQG77ELWVUHPDLQVHWEXWWKH
DFFXPXODWHGYDOXHGRHVQRWLQFUHPHQW7LPLQJUHVXPHVZKHQ\RX
FOHDUWKH'1ELW,IWKHUXQJJRHVIDOVHZKLOHWKHWLPHULVSDXVHGWKH
WLPHUUHVHWVDVQRUPDO
,I\RXFKDQJHWR3URJUDPPRGHRUWKHSURFHVVRUORVHVSRZHU
EHIRUHWKHLQVWUXFWLRQUHDFKHVWKHSUHVHWYDOXHWKHIROORZLQJ
RFFXUV
WLPHUHQDEOH(1ELWUHPDLQVVHW
WLPHUWLPLQJ77ELWUHPDLQVVHW
DFFXPXODWHG$&&YDOXHUHPDLQVWKHVDPH
7KHQZKHQ\RXVZLWFKEDFNWR5XQPRGHRU7HVWPRGHRUSRZHU
LVUHVWRUHGWKHIROORZLQJKDSSHQV
Condition: Result:
Figure 2.1
Example TON Ladder Diagram
I:012 TON
TIMER ON DELAY EN
10 When the input condition is true, the Timer T4:0
processor increments the accumulated value
of T4:0 in 1-second increments. Time base 1.0 DN
Preset 180
Accum 0
TT 01
T4:0 Sets the output when the timer is done timing O:013
DN 02
When bit I:012/10 is set, the processor starts T4:0. The accumulated value increments in 1-second intervals.
T4:0.TT is set and output bit O:013/01 is set (the associated output device is energized) while the timer is timing.
When the timer is finished (.ACC = .PRE) T4:0.TT is reset (so O:013/01 and the associated output device is
de-energized) and T4:0.DN is set (so O:013/02 is set and the associated output device is energized). When the
accumulated value reaches 180, the .DN bit is set. Or if the rung goes false, the timer is reset.
Figure 2.2
Example TON Timing Diagram
ON
Rung Condition OFF
ON
Timer Enable Bit
OFF
ON
Timer Timing Bit OFF
ON
Timer Done Bit
OFF
Output Device ON
(Controlled by Done Bit) OFF
3 minutes ON
Delay
Timer Accumulated Value 2 minutes
(Accumulator)
180
120
0
Timer Preset = 180 16649
Description: 8VHWKH72)LQVWUXFWLRQWRWXUQDQRXWSXWRQRURIIDIWHULWVUXQJKDV
EHHQRIIIRUDSUHVHWWLPHLQWHUYDO7KH72)LQVWUXFWLRQVWDUWV
TOF
DFFXPXODWLQJWLPHZKHQWKHUXQJJRHVIDOVHDQGFRQWLQXHVWLPLQJ
TIMER OFF DELAY
Timer
EN
XQWLORQHRIWKHIROORZLQJFRQGLWLRQVRFFXU
Time base DN
WKHDFFXPXODWHGYDOXHHTXDOVLWVSUHVHWYDOXH
Preset
Accum WKHUXQJJRHVWUXH
DUHVHWLQVWUXFWLRQUHVHWVWKHWLPHU
WKH6)&VWHSJRHVLQDFWLYH
7KHSURFHVVRUUHVHWVWKHDFFXPXODWHGYDOXHZKHQWKHUXQJFRQGLWLRQV
JRWUXHUHJDUGOHVVRIZKHWKHUWKHWLPHUWLPHGRXWRUQRW
This Bit: Is Set When: And Remains Set Until One of the
Following Occurs:
Timer Enable .EN (bit 15) the rung goes true • the rung goes false
• a reset instruction resets the timer
• the SFC step goes inactive
Timer Timing Bit .TT (bit 14) the rung goes false and the • the rung goes true
accumulated value is less than • the .DN bit is set (.ACC = .PRE)
the preset • a reset instruction resets the timer
• the associated SFC step goes inactive
Timer Done Bit .DN (bit 13) the rung goes true • the accumulated value is equal to the
preset value
,I\RXVHWWKHGRQHELW'1XVLQJDQ27(LQVWUXFWLRQIRUH[DPSOH
\RXFDQSDXVHWKHWLPHU7KH(1DQG77ELWVUHPDLQVHWEXWWKH
DFFXPXODWHGYDOXHGRHVQRWLQFUHPHQW7LPLQJUHVXPHVZKHQ\RX
FOHDUWKH'1ELW,IWKHUXQJJRHVIDOVHZKLOHWKHWLPHULVSDXVHGWKH
WLPHUUHVHWVDVQRUPDO
,I\RXFKDQJHWR3URJUDPPRGHRUWKHSURFHVVRUORVHVSRZHURU
WKHSURFHVVRUIDXOWLQWHUUXSWVWKH72)LQVWUXFWLRQEHIRUHLW
UHDFKHVWKHSUHVHWYDOXHWKHIROORZLQJRFFXUV
WLPHUHQDEOH(1ELWUHPDLQVUHVHW
WLPHUWLPLQJ77ELWUHPDLQVVHW
WLPHUGRQH'1ELWUHPDLQVVHW
DFFXPXODWHG$&&YDOXHUHPDLQVWKHVDPH
7KHQLI\RXVZLWFKWR5XQPRGHRU7HVWPRGHWKHIROORZLQJ
KDSSHQV
Condition: Result:
$77(17,21 %HFDXVHWKH5(6LQVWUXFWLRQUHVHWVWKH
DFFXPXODWHGYDOXHGRQHELWDQGWLPLQJELWVRIDWLPLQJ
LQVWUXFWLRQGRQRWXVHWKH5(6LQVWUXFWLRQWRUHVHWD72)
WLPHU
'XULQJSUHVFDQWKHIROORZLQJKDSSHQV
WLPHUWLPLQJ77ELWLVFOHDUHG
DFFXPXODWHG$&&YDOXHLVHTXDOWRWKHSUHVHWYDOXH
Figure 2.3
Example TOF Ladder Diagram
I:012 TOF
TIMER OFF DELAY EN
10 Timer T4:0
When the input goes false, the processor starts
incrementing the accumulated value in T4:0 in Time base 1.0 DN
1-second increments until the input goes true.
Preset 180
Accum 0
TT 01
T4:0 Resets the output when the timer is done timing O:013
DN 02
When bit I:012/10 is reset, the processor starts timer T4:0. The accumulated value increments by 1-second intervals as long as the
rung remains false. T4:0.TT is set and output bit O:013/01 is set (the associated output device is energized) while the timer is timing.
When the timer is finished (.ACC = .PRE), T4:0.TT is reset (so O:013/01 is reset and the associated output device is de-energized)
and T4:0.DN is reset (so O:013/02 is reset and the associated output device is de-energized). When the accumulated value reaches
180 or when the rung conditions go true, the timer stops.
Figure 2.4
Example TOF Timing Diagram
ON
Rung Condition OFF
ON
Timer Enable Bit
OFF
ON
Timer Timing Bit
OFF
ON
Timer Done Bit
OFF
Output Device ON
(Controlled by Done Bit)
OFF
OFF Delay
2 minutes 3 minutes
Time 180
120
Description: 8VHWKH572LQVWUXFWLRQWRWXUQDQRXWSXWRQRURIIDIWHULWVWLPHUKDV
EHHQRQIRUDSUHVHWWLPHLQWHUYDO7KH572LQVWUXFWLRQOHWVWKHWLPHU
RTO
RETENTIVE TIMER ON
VWRSDQGVWDUWZLWKRXWUHVHWWLQJWKHDFFXPXODWHGYDOXH
EN
Timer
7KH572LQVWUXFWLRQEHJLQVWLPLQJZKHQLWVUXQJJRHVWUXH$VORQJ
Time base DN
DVWKHUXQJUHPDLQVWUXHWKHWLPHUXSGDWHVWKHDFFXPXODWHGYDOXH
Preset
Accum
HDFKSURJUDPVFDQXQWLOLWUHDFKHVWKHSUHVHWYDOXH7KH572
LQVWUXFWLRQUHWDLQVLWVDFFXPXODWHGYDOXHHYHQLIRQHRIWKHIROORZLQJ
RFFXUV
WKHUXQJJRHVIDOVH
\RXFKDQJHWR3URJUDPPRGH
WKHSURFHVVRUIDXOWVRUORVHVSRZHU
WKH6)&VWHSJRHVLQDFWLYH
:KHQWKHSURFHVVRUUHVXPHVRSHUDWLRQRUWKHUXQJJRHVWUXHWLPLQJ
FRQWLQXHVIURPWKHUHWDLQHGDFFXPXODWHGYDOXH%\UHWDLQLQJLWV
DFFXPXODWHGYDOXHUHWHQWLYHWLPHUVPHDVXUHWKHFXPXODWLYHSHULRG
GXULQJZKLFKLWVUXQJLVWUXH
,PSRUWDQW 7RUHVHWWKHUHWHQWLYHWLPHU¶VDFFXPXODWHGYDOXHDQG
VWDWXVELWVDIWHUWKH572UXQJJRHVIDOVH\RXPXVW
SURJUDPDUHVHWLQVWUXFWLRQ5(6ZLWKWKHVDPHDGGUHVV
LQDQRWKHUUXQJ
This Bit: Is Set When: Indicates: And Remains Set Until One of the
Following Occurs:
Timer Enable Bit .EN (bit 15) the rung goes true that a timing operation is • the rung goes false
in progress • a reset instruction resets the timer
Timer Timing Bit .TT (bit 14) the rung goes true that a timing operation is • the rung goes false
in progress • the .DN bit is set
• the accumulated value is equal to
the preset value (.ACC=.PRE)
• a reset instruction resets the timer
Timer Done Bit .DN (bit 13) the accumulated value is that a timing operation • the .DN bit is reset with the
equal to the preset value is complete RES instruction.
,I\RXVHWWKHGRQHELW'1XVLQJDQ27(LQVWUXFWLRQIRUH[DPSOH
\RXFDQSDXVHWKHWLPHU7KH(1DQG77ELWVUHPDLQVHWEXWWKH
DFFXPXODWHGYDOXHGRHVQRWLQFUHPHQW7LPLQJUHVXPHVZKHQ\RX
FOHDUWKH'1ELW,IWKHUXQJJRHVIDOVHZKLOHWKHWLPHULVSDXVHGWKH
WLPHUUHVHWVDVQRUPDO
,I\RXFKDQJHWR3URJUDPPRGHRUWKHSURFHVVRUORVHVSRZHURU
DSURFHVVRUIDXOWLQWHUUXSWVWKH572LQVWUXFWLRQWKHIROORZLQJ
RFFXUV
WLPHUHQDEOH(1ELWUHPDLQVVHW
WLPHUWLPLQJ77ELWUHPDLQVVHW
DFFXPXODWHG$&&YDOXHUHPDLQVWKHVDPH
:KHQ\RXVZLWFKEDFNWR5XQPRGHRU7HVWPRGHWKHIROORZLQJ
KDSSHQV
Condition: Result:
Figure 2.5
Example RTO Ladder Diagram
I:012 RTO
RETENTIVE TIMER ON EN
10 Timer T4:10
When the input is true, the processor starts incrementing
the accumulated value of T4:10 in 1-second increments. Time base 1.0 DN
The timer values remain when the input goes false. Preset 180
Accum 0
Figure 2.6
Retentive Timer Timing Diagram
ON
Rung Condition OFF
ON
Timer Enable Bit
OFF
ON
Reset Pulse
OFF
ON
Timer Timing Bit
OFF
ON
Timer Done Bit
OFF
ON
,PSRUWDQW <RXFDQXVHDQ\FRXQWHUILOHQXPEHUIURPWR
KRZHYHUWKHGHIDXOWFRXQWHUILOHQXPEHULV,I\RX
ZDQWWRVSHFLI\DFR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DQRQ]HURYDOXH
WKHLQVWUXFWLRQVWDUWVFRXQWLQJIURPWKDWYDOXH,IWKHFRXQWHULV
UHVHWWKHDFFXPXODWHGYDOXHLVVHWWR]HUR
Count Up (CTU)
Description: 7KH&78LQVWUXFWLRQFRXQWVXSZDUGRYHUDUDQJHRI±WR
CTU
(DFKWLPHWKHUXQJJRHVIURPIDOVHWRWUXHWKH&78
COUNT UP CU LQVWUXFWLRQLQFUHPHQWVWKHDFFXPXODWHGYDOXHE\RQHFRXQW:KHQ
Counter WKHDFFXPXODWHGYDOXHHTXDOVRUH[FHHGVWKHSUHVHWYDOXHWKH
Preset DN &78LQVWUXFWLRQVHWVDGRQHELW'1ZKLFK\RXUODGGHUSURJUDPFDQ
Accum
XVHWRLQLWLDWHVRPHDFWLRQVXFKDVFRQWUROOLQJDVWRUDJHELWRUDQ
RXWSXWGHYLFH
7KHDFFXPXODWHGYDOXHRIDFRXQWHULVUHWHQWLYH7KHFRXQWLVUHWDLQHG
XQWLOUHVHWE\DUHVHWLQVWUXFWLRQ5(6WKDWKDVWKHVDPHDGGUHVVDV
WKHFRXQWHU
This Bit: Is Set: And Remains Set Until One of the Following Occurs:
Count Up when the rung goes true to indicate the • the rung goes false
Enable Bit .CU (bit 15) instruction has increased its count • a RES instruction resets the .DN bit
Note: During prescan, this bit is set to prevent
a false count when the program scan begins.
Count Up when the accumulated value is greater than or • the accumulated value counts below the preset, either
Done Bit .DN (bit 13) equal to the preset value by using a CTD instruction to count down or changing
the accumulated value
• a RES instruction resets the .DN bit
Count Up when the up counter has exceeded the upper • a RES instruction resets the .DN bit
Overflow Bit .OV (bit 12) limit of +32,767 and has wrapped around to – • counting back down to 32,767 with a CTD instruction
32,768. The CTU counts up from there. with the same address
$77(17,21 3ODFHFULWLFDOFRXQWHUVRXWVLGHDQ0&5
]RQHRUMXPSHGVHFWLRQVRIODGGHUSURJUDPWRJXDUG
DJDLQVWLQYDOLGUHVXOWVWKDWFRXOGOHDGWRGDPDJHG
HTXLSPHQWRUSHUVRQQHOLQMXU\
Figure 2.7
Example CTU Ladder Diagram
I:012 CTU
COUNT UP CU
10 Each time the input goes false to true, Counter C5:0
the processor increments the counter
by 1. Preset 4 DN
Accum 0
C5:0 Tells when the count is reached (ACC > or = PRE) O:020
01
DN
C5:0 Tells when the counter overflows +32,767 O:021
02
OV
I:017 Reset the counter C5:0
RES
12
Figure 2.8
Example CTU Timing Diagram
Counter preset = 4 counts
ON
Count-up enable bit
OFF
ON
Done Bit
OFF
Description: 7KH&7'LQVWUXFWLRQFRXQWVGRZQZDUGRYHUDUDQJHRIWR
CTD
±(DFKWLPHWKHUXQJJRHVIURPIDOVHWRWUXHWKH&7'
COUNT DOWN CD
LQVWUXFWLRQGHFUHPHQWVWKHDFFXPXODWHGYDOXHE\RQHFRXQW7KH
Counter GRQHELW'1LVVHWDVORQJDVWKHDFFXPXODWHGYDOXHLVJUHDWHUWKDQRU
Preset DN HTXDOWRWKHSUHVHWYDOXH:KHQWKHDFFXPXODWHGYDOXHLVOHVVWKDQWKH
Accum SUHVHWYDOXHWKHGRQHELW'1LVUHVHWZKLFK\RXUODGGHUSURJUDPFDQ
XVHWRLQLWLDWHVRPHDFWLRQVXFKDVFRQWUROOLQJDVWRUDJHELWRUDQ
RXWSXWGHYLFH
7KHDFFXPXODWHGYDOXHRIDFRXQWHULVUHWHQWLYH7KHFRXQWLVUHWDLQHG
XQWLOUHVHWE\DUHVHWLQVWUXFWLRQ5(6WKDWKDVWKHVDPHDGGUHVVDV
WKH&7'LQVWUXFWLRQ
This Bit: Is Set: And Remains Set Until One of the Following Occurs:
Count Down when the rung goes true to indicate that the • the rung goes false
Enable Bit .CD (bit 14) counter is enabled as a down-counter. • a RES instruction resets the .DN bit
Note: During prescan, this bit is set to prevent
a false count when the program scan begins.
Count Down when the accumulated value is greater than or • the accumulated value counts below the preset
Done Bit .DN (bit 13) equal to the preset value. • another instruction changes the accumulated value
• a RES instruction resets the .DN bit
Count Down by the processor to show that the down • a RES instruction resets the .DN bit
Underflow Bit (.UN) (Bit 11) counter went below the lower limit of –32,768 • count back up to -32,768 with a CTU instruction
and has wrapped around to +32,767. The CTD
instruction counts down from there.
$77(17,21 3ODFHFULWLFDOFRXQWHUVRXWVLGHDQ0&5
]RQHRUMXPSHGVHFWLRQVRIODGGHUSURJUDPWRJXDUG
DJDLQVWLQYDOLGUHVXOWVWKDWFRXOGOHDGWRGDPDJHG
HTXLSPHQWRUSHUVRQQHOLQMXU\
Figure 2.9
Example CTD Ladder Diagram
I:012 CTD
COUNT DOWN CD
10 Each time the input goes from false to true, Counter C5:0
the processor decrements the counter by 1.
Preset 4 DN
Accum 8
C5:0 Tells when the count is reached (ACC > or = PRE) O:020
DN 01
C5:0 Tells when the counter underflows -32,768 O:021
UN 02
Done Bit
8
7
Counter Accumulated Value 6
5
4
3
0
16637
Figure 2.11
Example CTU and CTD Logic Diagram
I:012 CTU
Count up pushbutton
COUNT UP CU
10 Counter C5:0
Preset 4 DN
Accum 0
I:012 CTD
Count down pushbutton
COUNT DOWN CD
11 Counter C5:0
Preset 4
DN
Accum 0
C5:0 Tells when the count is reached (ACC > or = PRE) O:013
DN 01
C5:0 Tells when the counter overflows +32,767 O:013
OV 02
C5:0 Tells when the counter underflows -32,768 O:013
UN 03
I:017 Resets the counter C5:0
RES
12
Figure 2.12
Example CTU and CTD Timing Diagram
ON
Count Up Pushbutton
OFF
ON
Count Down Pushbutton OFF
ON
Reset Pulse
OFF
ON
Done Bit
OFF
5
4 4
3 3 3
2 2 2
1 1 1
0 0
Counter Accumulated Value
Count Up Preset = 4
Count Down Preset = 4 16652
Description: 7KH5(6LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWUHVHWVDWLPHURU
FRXQWHU7KH5(6LQVWUXFWLRQH[HFXWHVZKHQLWVUXQJLVWUXH
RES
When Using a RES Instruction for a: The Processor Resets the:
,IWKHFRXQWHUUXQJLVHQDEOHGWKH&8RU&'ELWZLOOEHUHVHWDVORQJ
DVWKH5(6LQVWUXFWLRQLVHQDEOHG
,PSRUWDQW <RXFDQXVHDQHJDWLYHSUHVHWYDOXHLQD&78RU&7'
LQVWUXFWLRQLI\RXLQWHQGWRXVHWKH5(6LQVWUXFWLRQ
+RZHYHUQRWHWKDWWKH5(6LQVWUXFWLRQVHWVWKH
DFFXPXODWHGYDOXHWR]HURZKLFKPD\VHWWKH'1ELW
DQGSUHYHQWWKH&78RU&7'LQVWUXFWLRQIURPRSHUDWLQJ
WKHQH[WWLPHLWLVHQDEOHG
$77(17,21 %HFDXVHWKH5(6LQVWUXFWLRQUHVHWVWKH
DFFXPXODWHGYDOXH'1ELWDQG77ELWRIDWLPLQJ
LQVWUXFWLRQGRQRWXVHWKH5(6LQVWUXFWLRQWRUHVHWD72)
LQVWUXFWLRQXQSUHGLFWDEOHPDFKLQHRSHUDWLRQRULQMXU\
WRSHUVRQQHOPD\RFFXU
Figure 2.13
Example RES Ladder Diagram
I:012 CTD
COUNT DOWN CD
10 Each time the input goes from false to true, the Counter C5:0
processor decrements the counter by 1.
Preset 4 DN
Accum 8
C5:0 Tells when the count is reached (ACC > or = PRE) O:020
DN 01
Use the On
If You Want to:
Instruction: Page:
Test whether one value is greater than a second value GRT 3-6
Test whether one value is less than a second value LES 3-7
Test whether one value is between two other values LIM 3-7
Pass two values through a mask and test whether MEQ 3-9
they are equal
Test whether one value is not equal to a second value NEQ 3-10
,PSRUWDQW <RXFDQFRPSDUHYDOXHVRIGLIIHUHQWGDWDW\SHVVXFKDV
IORDWLQJSRLQWDQGLQWHJHU<RXVKRXOGXVH%&'DQG
$6&,,YDOXHVIRUGLVSOD\SXUSRVHV,I\RXHQWHU%&'RU
$6&,,YDOXHVWKHSURFHVVRUWUHDWVWKRVHYDOXHVDV
LQWHJHUV)RUH[DPSOHLIWKHYDOXHDW1LV
GHFLPDODQGWKHYDOXHDW'LV%&'WKH
FRPSDULVRQRI1 'HYDOXDWHVDVIDOVH7KHLQ
%&'WUDQVODWHVWRWKHLQ
GHFLPDOWUDQVODWHVWR
7KHSDUDPHWHUV\RXHQWHUDUHSURJUDPFRQVWDQWVRUORJLFDODGGUHVVHV
RIWKHYDOXHV\RXZDQWWRFRPSDUH
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: 7KH&03LQVWUXFWLRQLVDQLQSXWLQVWUXFWLRQWKDWSHUIRUPVD
CMP FRPSDULVRQRQDULWKPHWLFRSHUDWLRQV\RXVSHFLI\LQWKHH[SUHVVLRQ
COMPARE :KHQWKHSURFHVVRUILQGVWKHH[SUHVVLRQLVWUXHWKHUXQJJRHVWUXH
Expression 2WKHUZLVHWKHUXQJLVIDOVH:LWK(QKDQFHG3/&SURFHVVRUV\RX
FDQHQWHUPXOWLSOHRSHUDQGVFRPSOH[H[SUHVVLRQ
7KHH[HFXWLRQWLPHRID&03LQVWUXFWLRQLVORQJHUWKDQWKHH[HFXWLRQ
WLPHRIRQHRIWKHRWKHUFRPSDULVRQLQVWUXFWLRQVHJ*57/(4
HWF$&03LQVWUXFWLRQDOVRXVHVPRUHZRUGVLQ\RXUSURJUDPILOH
WKDQWKHFRUUHVSRQGLQJFRPSDULVRQLQVWUXFWLRQ
Table 3.C
Valid Operations for Use in a CMP Expression
– subtract 12 – 5
– negate – N7:0
** exponential 10**3
(x to the power of y) (Enhanced PLC-5 processors only)
:LWKWKH&03LQVWUXFWLRQDPD[LPXPRIFKDUDFWHUVRIWKH
H[SUHVVLRQFDQEHGLVSOD\HG,IWKHH[SUHVVLRQ\RXHQWHULVQHDUWKLV
FKDUDFWHUPD[LPXPZKHQ\RXDFFHSWWKHUXQJFRQWDLQLQJWKH
LQVWUXFWLRQWKHSURFHVVRUPD\H[SDQGLWEH\RQGFKDUDFWHUV:KHQ
\RXWU\WRHGLWWKHH[SUHVVLRQRQO\WKHILUVWFKDUDFWHUVDUH
GLVSOD\HGDQGWKHUXQJLVGLVSOD\HGDVDQHUURUUXQJ7KHSURFHVVRU
GRHVFRQWDLQWKHFRPSOHWHH[SUHVVLRQKRZHYHUDQGWKHLQVWUXFWLRQ
UXQVSURSHUO\
7RDYRLGWKLVGLVSOD\SUREOHPH[SRUWWKHSURFHVVRUPHPRU\ILOHDQG
PDNH\RXUHGLWVLQWKH3&WH[WILOH7KHQLPSRUWWKLVWH[WILOH)RU
PRUHLQIRUPDWLRQRQLPSRUWLQJH[SRUWLQJSURFHVVRUPHPRU\ILOHVVHH
\RXUSURJUDPPLQJPDQXDO
Table 3.D
Character Lengths for Operators
math binary +, –, *, | 3
OR, ** 4
AND, XOR 5
LN 3
Example:
CMP O:013
COMPARE
Expression 01
The CMP instruction tells an Enhanced PLC-5 processor: if the sum of the values in N7:0 and N7:1 is greater than the sum of the
values in N7:2 and N7:3, set output bit O:013/01. (The total number of characters used in this expressions is 3.)
)RUPRUHLQIRUPDWLRQRQHQWHULQJFRPSOH[H[SUHVVLRQVVHHFKDSWHU
Equal to (EQU)
Description: 8VHWKH(48LQVWUXFWLRQWRWHVWZKHWKHUWZRYDOXHVDUHHTXDO
6RXUFH $DQG6RXUFH%FDQHLWKHUEHYDOXHVRUDGGUHVVHVWKDWFRQWDLQ
EQU
YDOXHV
EQUAL
Source A
Source B
Example:
EQU O:013
EQUAL
Source A N7:5 01
Source B N7:10
If the value in N7:5 is equal to the value in N7:10, set output bit O:013/01.
)ORDWLQJSRLQWYDOXHVDUHUDUHO\DEVROXWHO\HTXDO,I\RXQHHGWR
GHWHUPLQHWKHHTXDOLW\RIIORDWLQJSRLQWYDOXHVXVHWKH/,0
LQVWUXFWLRQLQVWHDGRIWKH(48)RULQIRUPDWLRQRQWKH/,0
LQVWUXFWLRQVHHSDJH
Source B
Example:
GEQ O:013
GREATER THAN OR EQUAL
Source A N7:5 01
Source B N7:10
If the value in N7:5 is greater than or equal to the value in N7:10, set output bit O:013/01.
Source B
Example:
GRT O:013
GREATER THAN
Source A N7:5 01
Source B N7:10
If the value in N7:5 is greater than the value in N7:10, set output bit O:013/01.
Example:
LEQ O:013
LESS THAN OR EQUAL
Source A N7:5 01
Source B N7:10
If the value in N7:5 is less than or equal to the value in N7:10, set output bit O:013/01.
Example:
LES O:013
LESS THAN
Source A N7:5 01
Source B N7:10
If the value in N7:5 is less than the value in N7:10, set output bit O:013/01.
Description: 7KH/,0LQVWUXFWLRQLVDQLQSXWLQVWUXFWLRQWKDWWHVWVIRUYDOXHVLQVLGH
LIM RIRURXWVLGHRIDVSHFLILHGUDQJH7KHLQVWUXFWLRQLVIDOVHXQWLOLW
LIMIT TEST (CIRC) GHWHFWVWKDWWKHWHVWYDOXHLVZLWKLQFHUWDLQOLPLWV7KHQWKHLQVWUXFWLRQ
Low limit JRHVWUXH:KHQWKHLQVWUXFWLRQGHWHFWVWKDWWKHWHVWYDOXHJRHVRXWVLGH
Test FHUWDLQOLPLWVLWJRHVIDOVH
High limit
<RXFDQXVHWKH/,0LQVWUXFWLRQWRWHVWLIDQDQDORJLQSXWYDOXHLV
ZLWKLQVSHFLILHGOLPLWV
Entering Parameters
7RSURJUDPWKH/,0LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJ
Parameter: Definition:
Low Limit a constant or an address from which the instruction reads the
lower range of the specified limit range. The address contains an
integer or floating-point value.
Test Value the address that contains the integer or floating-point value you
examine to see whether the value is inside or outside the
specified limit range.
High Limit a constant or an address from which the instruction reads the
upper range of the specified limit range. The address contains an
integer or floating-point value.
,IYDOXH/RZ/LPLW≥YDOXH+LJK/LPLW:KHQWKHSURFHVVRU
GHWHFWVWKDWWKHYDOXHRI7HVWLVHTXDOWRRURXWVLGHWKHOLPLWVWKH
LQVWUXFWLRQLVWUXHLIYDOXH7HVWLVEHWZHHQEXWQRWHTXDOWRHLWKHU
OLPLWWKHLQVWUXFWLRQLVIDOVH
true < ------false------ > true
from -32,768 . . . . . . . . . . . . C A . . . . . . . . . . . . to +32,767
value B < < value B
LIM O:013
LIMIT TEST (CIRC)
Low lim N7:10 01
Test N7:15
High lim N7:20
If the value in N7:15 is greater than or equal to the value in N7:10 and less than or equal to the value in
N7:20, set output bit O:013/01.
Description: 7KH0(4LQVWUXFWLRQLVDQLQSXWLQVWUXFWLRQWKDWFRPSDUHVDYDOXH
MEQ IURPDVRXUFHDGGUHVVZLWKGDWDDWDFRPSDUHDGGUHVVDQGDOORZV
MASKED EQUAL SRUWLRQVRIWKHGDWDWREHPDVNHG,IWKHGDWDDWWKHVRXUFHDGGUHVV
Source PDWFKHVWKHGDWDDWWKHFRPSDUHDGGUHVVELWE\ELWOHVVPDVNHGELWV
Mask WKHLQVWUXFWLRQLVWUXH7KHLQVWUXFWLRQJRHVIDOVHDVVRRQDVLWGHWHFWVD
Compare PLVPDWFK
<RXFDQXVHWKH0(4LQVWUXFWLRQWRH[WUDFWIRUFRPSDULVRQELWGDWD
VXFKDVVWDWXVRUFRQWUROELWVIURPDQHOHPHQWWKDWFRQWDLQVELWDQG
ZRUGGDWD
Entering Parameters
7RSURJUDPWKH0(4LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRU
ZLWKWKH IROORZLQJ
Parameter: Definition:
Source a program constant or data address from which the instruction reads an
image of the value. The source remains unchanged.
Mask specifies which bits to pass or block. A mask passes data when the
mask bits are set (1); a mask blocks data when the mask bits are reset
(0). The mask must be the same element size (16-bits) as the source
and compare address. In order for bits to be compared, you must set (1)
mask bits; bits in the compare address that correspond to zeros (0) in
the mask are not compared. If you want the ladder program to change
the mask value, store the mask at a data address. Otherwise, enter a
hexadecimal value for a constant mask value. If you enter a hexadecimal
value that starts with a letter (such a F800), enter the value with a
leading zero. For example, type 0F800
Compare specifies whether you want the ladder program to vary the compare
value, or a program constant for a fixed reference. Use 16-bit elements,
the same as the source.
MEQ O:013
MASKED EQUAL
01
Source N7:5
Mask N7:6
Compare N7:10
The processor passes the value in N7:5 through the mask in N7:6. It then passes the value in N7:10 through the mask
in N7:6. If the two masked values are equal, set output bit O:013/01
Description: 8VHWKH1(4LQVWUXFWLRQWRWHVWZKHWKHUWZRYDOXHVDUHQRWHTXDO
NEQ 6RXUFH$DQG6RXUFH%FDQEHYDOXHVRUDGGUHVVHV
NOT EQUAL
Source A
Source B
Example:
NEQ O:013
NOT EQUAL
Source A N7:5 01
Source B N7:10
If the value in N7:5 is not equal to the value in N7:10, set output bit O:013/01.
(Continued)
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Enhanced PLC-5 down if the value is < 0.5, up if the value is > 0.5,
and to the nearest even number if the value is =
0.5. If this value is greater than 32,767 or less
than –32,768, the processor “wraps” negative
(32,767, –32,768, –32,767, –32,766, etc.). For
example, if you have an ADD instruction with a
result greater than 32,767, the overflow bit is set,
the sign bit is set, and the result is negative:
32,767 + 5 = –32,764.
,PSRUWDQW ,I\RXDUHXVLQJDQ(QKDQFHG3/&SURFHVVRUDQGDQ
DULWKPHWLFRSHUDWLRQJHQHUDWHVDQRYHUIORZWKHXSSHU
ELWVDUHORVWEXWWKHORZHUELWVDUHFRUUHFW,I\RXWKHQ
SHUIRUPDORJLFDORSHUDWLRQRQWKHORZHUZRUG$1'RU
25\RXFDQJHWWKHSURSHUUHVXOW$OVRXVLQJWKHFDUU\
ELW\RXFDQGRPXOWLZRUGDULWKPHWLFLHDGGWZR
ELWZRUGV
I:012 ADD
]
] ADD
10 Add the lower words of value1 and value2. Source A N7:1
Source B N7:3
Dest N7:5
I:012 ADD
AND
]
] BITWISE AND
10 Capture the carry bit. S:0
Source A
Source B 1
Dest N7:4
I:012 ADD
]
] ADD
10 Add the high word of value1 to the carry bit.
Source A N7:0
Source B N7:4
Dest N7:4
I:012 ADD
]
]
ADD
10 Add the high word of value2 to this sum. Source A N7:2
Source B N7:4
Dest N7:4
:KHQ\RXXVHFRPSOH[H[SUHVVLRQVLIDQ\RSHUDQGLVIORDWLQJ
SRLQWWKHHQWLUHH[SUHVVLRQLVHYDOXDWHGDVIORDWLQJSRLQW6HHWKH
H[DPSOHLQWKH³([SUHVVLRQ([DPSOHV´VHFWLRQRQSDJHIRU
PRUHLQIRUPDWLRQ
Description: 7KH&37LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWSHUIRUPVWKH
CPT
RSHUDWLRQV\RXGHILQHLQWKHH[SUHVVLRQDQGZULWHVWKHUHVXOWLQWRWKH
COMPUTE
GHVWLQDWLRQDGGUHVV7KH&37LQVWUXFWLRQFDQDOVRFRS\GDWDIURPRQH
Destination
DGGUHVVWRDQRWKHUDQGDXWRPDWLFDOO\FRQYHUWVWKHGDWDW\SHDWWKH
VRXUFHDGGUHVVWRWKHGDWDW\SH\RXVSHFLI\LQWKHGHVWLQDWLRQDGGUHVV
Expression
7KHH[HFXWLRQWLPHRID&37LQVWUXFWLRQLVORQJHUWKDQWKHH[HFXWLRQ
WLPHRIDQDULWKPHWLFORJLFRUPRYHLQVWUXFWLRQLH$''$1'
029HWF7KH&37LQVWUXFWLRQDOVRXVHVPRUHZRUGVLQ\RXU
SURJUDPILOH
$IWHUHDFK&37LQVWUXFWLRQLVSHUIRUPHGWKHDULWKPHWLFVWDWXVELWVLQ
WKHVWDWXVILOHRIWKHGDWDWDEOHDUHXSGDWHGWKHVDPHDVWKH
FRUUHVSRQGLQJDULWKPHWLFORJLFRUPRYHLQVWUXFWLRQ)RUH[DPSOH
UHIHUWRWKHGHVFULSWLRQRIWKH$''LQVWUXFWLRQWRVHHKRZWKHVWDWXV
ELWVDUHXSGDWHGDIWHUD&37DGGLQVWUXFWLRQLVH[HFXWHG
Table 4.C
Valid Operations for Use in a CPT Expression
Copy none copy from A to B enter source address in the expression enter
destination address in destination
– subtract 12 – 5
(12 – 5) – 7 (Enhanced PLC-5 processors)
* multiply 5*2
6 * (5 * 2) (Enhanced PLC-5 processors)
– negate – N7:0
** exponential * 10**3
(x to the power of y)
Table 4.D
Character Lengths for Operators
Uses this
This Operation: Using this Operator: Number of
Characters:
math binary +, –, *, | 3
OR, ** 4
AND, XOR 5
LN * 3
1 ** exponential (XY)
Enhanced PLC-5 processors only
2 – negate
3 * multiply
| divide
4 + add
– subtract
7 OR bitwise OR
Expression Examples
6LQJOH9DOXH7KHH[SUHVVLRQ6451ZLWKGHVWLQDWLRQ1
WHOOVWKHSURFHVVRUWRWDNHWKHVTXDUHURRWRIWKHYDOXHVWRUHGDW1
DQGVWRUHWKHUHVXOWDW1
0XOWLSOH9DOXHV:LWK(QKDQFHG3/&SURFHVVRUV\RXFDQDOVRXVH
IXQFWLRQVWRRSHUDWHRQRQHRUPRUHYDOXHVLQWKHH[SUHVVLRQ
FRPSOH[H[SUHVVLRQVIRUFRPSXWHDQGFRPSDUHRSHUDWLRQV
&RPSOH[H[SUHVVLRQVFDQEHXSWRFKDUDFWHUVORQJVSDFHVDQG
SDUHQWKHVHVDUHFRQVLGHUHGFKDUDFWHUV)RUH[DPSOH\RXFRXOGHQWHU
DQH[SUHVVLRQVXFKDV
Example:
I:012 CPT
]
] COMPUTE
10
Destination N7:20
Expression
(N7:1 * 5) | (N7:2 | 7)
If the input word 12, bit 10 is set, multiply the value of N7:1 by 5. Divide this result by the quotient of N7:2 divided by 7.
If N7:1=5 and N7:2=9, the result is 25. (The result is rounded to the nearest whole number because the constants 5 and 7
were specified as whole numbers.)
:KHQ\RXXVHFRPSOH[H[SUHVVLRQVLIDQ\RSHUDQGLVIORDWLQJSRLQW
WKHHQWLUHH[SUHVVLRQLVHYDOXDWHGDVIORDWLQJSRLQW
Example:
I:012 CPT
]
] COMPUTE
10 Destination N7:20
Expression
(N7:1 * 5.0) | (N7:2 | 7.0)
If the input word 12, bit 10 is set, multiply the value of N7:1 by 5. Divide this result by the quotient of N7:2 divided by 7. If N7:1=5 and
N7:2=9, the result is 19. (The result is rounded differently because the constants 5.0 and 7.0 were specified to 1 decimal place.
7KHLQVWUXFWLRQSHUIRUPVWKHIXQFWLRQV\RXVSHFLI\EDVHGRQD
PQHPRQLF:KHQ\RXHQWHUWKHH[SUHVVLRQHQWHUWKHPQHPRQLFDV
WKHSUHIL[WRWKHDGGUHVVRIWKHYDOXHRQZKLFK\RXZDQWWRRSHUDWHRU
DVDSUHIL[WRWKHYDOXHLWVHOIZKHQHQWHUHGDVDSURJUDPFRQVWDQW
,PSRUWDQW )ORDWLQJSRLQWQXPEHUVDUHELWYDOXHV,QWHJHUVDUH
ELWYDOXHV7KHLQVWUXFWLRQDXWRPDWLFDOO\FRQYHUWVWKH
GDWDW\SHVIRXQGLQWKHH[SUHVVLRQWRWKHGDWDW\SH
VSHFLILHGE\WKHGHVWLQDWLRQDGGUHVV
$77(17,21 ,IWKHH[SUHVVLRQRUGHVWLQDWLRQ
DGGUHVVHVUHTXLUHFRQYHUVLRQIURPELWWRELWGDWD
DQGWKHYDOXHLVWRRODUJHWKHSURFHVVRUVHWVDQRYHUIORZ
ELWLQ6DQGVHWVDPLQRUIDXOW67KHUHVXOWLQJ
HUURQHRXVYDOXHFRXOGOHDGWRDGDQJHURXVVLWXDWLRQ
0RQLWRUWKLVELWLQ\RXUODGGHUSURJUDP
7DEOH)OLVWVWKH&37IXQFWLRQV\RXFDQXVH
Table 4.F
CPT Functions for Number Conversion
FRD from BCD Converts from BCD to integer (supports 4-digit BCD
numbers)
SQR square root Takes the square root of the number; accurate to 6
significant digits
<RXFDQXVHWKHDERYH&37DULWKPHWLFIXQFWLRQVZLWKLQH[SUHVVLRQV
RUDVVWDQGDORQHLQVWUXFWLRQVVHHWKHLQGLYLGXDOLQVWUXFWLRQV
GHVFULEHGLQWKLVFKDSWHU
Source 7KH6RXUFHPXVWEHJUHDWHUWKDQRUHTXDOWR±DQGOHVVWKDQRU
Destination HTXDOWR,ILWLVQRWLQWKLVUDQJHWKHSURFHVVRUUHWXUQVD!NAN!
UHVXOWLQWKH'HVWLQDWLRQ7KHUHVXOWLQJYDOXHLQWKH'HVWLQDWLRQLV
DOZD\VJUHDWHUWKDQRUHTXDOWRDQGOHVVWKDQRUHTXDOWRπ
ZKHUHπ
Table 4.G
Updating Arithmetic Status Flags for an ACS Instruction
Example:
I:012 ACS
]
] ARCCOSINE
Source F8:19
10 0.7853982
Destination F8:20
0.6674572
If input word 12, bit 10 is set, take the arc cosine of the value in F8:19 and store the result in F8:20.
Addition (ADD)
Table 4.H
Updating Arithmetic Status Flags for an ADD Instruction
Example:
I:012 ADD
]
] ADD
10 Source A N7:3
Source B N7:4
Destination N7:20
If input word 12, bit 10 is set, add the value in N7:3 to the value in N7:4 and store the result in N7:20.
Example:
I:012 ASN
]
]
ARCSINE
10 Source F8:17
0.7853982
Dest F8:18
0.9033391
If input word 12, bit 10 is set, take the arc sine of the value in F8:17 and store the result in F8:18.
Example:
I:012 ATN
ARCTANGENT
]
]
10 Source F8:21
0.7853982
Destination F8:22
0.6657737
If input word 12, bit 10 is set, take the arc tangent of the value in F8:21 and store the result in F8:22.
Description: 7KH$9(LQVWUXFWLRQFDOFXODWHVWKHDYHUDJHRIDVHWRIYDOXHV:KHQ
AVE
WKHUXQJJRHVIURPIDOVHWRWUXHWKHYDOXHDWWKHFXUUHQWSRVLWLRQLV
AVERAGE FILE EN DGGHGWRWKHQH[WYDOXHZKLFKLVDGGHGWRWKHQH[WYDOXHDQGVRRQ
File
Destination 6HH7DEOH.IRUVWDWXVIODJVIRU$9(LQVWUXFWLRQ
Control DN
Length
Position (DFKWLPHDQRWKHUYDOXHLVDGGHGWKHSRVLWLRQILHOGDQGWKHVWDWXV
ZRUG6LVLQFUHPHQWHG7KHILQDOVXPLVGLYLGHGE\WKHQXPEHU
RIYDOXHVDGGHGDQGWKHUHVXOWLVVWRUHGLQWKHGHVWLQDWLRQ
Table 4.K
Updating Arithmetic Status Flags for an AVE Instruction
$QRYHUIORZFDQRFFXULI
WKHLQWHUPHGLDWHVXPH[FHHGVWKHPD[LPXPIORDWLQJSRLQWYDOXH
WKHGHVWLQDWLRQLVDQLQWHJHUDGGUHVVDQGWKHILQDOYDOXHLVJUHDWHU
WKDQRUOHVVWKDQ±
,IDQRYHUIORZRFFXUVWKHSURFHVVRUVWRSVWKHFDOFXODWLRQVHWVWKH(5
ELWDQGWKH'HVWLQDWLRQUHPDLQVXQFKDQJHG7KHSRVLWLRQLGHQWLILHV
WKHHOHPHQWWKDWFDXVHGWKHRYHUIORZ:KHQ\RXFOHDUWKH(5ELWWKH
SRVLWLRQUHVHWVWRDQGWKHDYHUDJHLVUHFDOFXODWHG
,PSRUWDQW 8VHWKH5(6LQVWUXFWLRQWRFOHDUWKHVWDWXVIODJV
Entering Parameters
7RSURJUDPWKH$9(LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRU
ZLWKWKHIROORZLQJ
)LOHLVWKHDGGUHVVWKDWFRQWDLQVWKHILUVWYDOXHWREHDGGHG7KLV
DGGUHVVFDQEHIORDWLQJSRLQWRULQWHJHU
'HVWLQDWLRQLVWKHDGGUHVVZKHUHWKHUHVXOWRIWKHLQVWUXFWLRQLV
VWRUHG7KLVDGGUHVVFDQEHIORDWLQJSRLQWRULQWHJHU
&RQWUROLVWKHDGGUHVVRIWKHFRQWUROVWUXFWXUHLQWKHFRQWURODUHD
5RISURFHVVRUPHPRU\7KHSURFHVVRUVWRUHVLQIRUPDWLRQVXFK
DVWKHOHQJWKSRVLWLRQDQGVWDWXVDQGXVHVWKLVLQIRUPDWLRQWR
H[HFXWHWKHLQVWUXFWLRQ
/HQJWKLVWKHQXPEHURIZRUGVLQWKHILOH
3RVLWLRQSRLQWVWRWKHZRUGWKDWWKHLQVWUXFWLRQLVFXUUHQWO\XVLQJ
Enable .EN (bit 15) on a false-to-true rung transition to indicate that the instruction
is enabled. The instruction follows the rung condition.
Done .DN (bit 13) after the instruction finishes operating. After the rung goes
false, the processor resets the .DN bit on the next false-to-true
rung transition.
Error .ER (bit 11) when the operation generates an overflow. The instruction
stops until the ladder program resets the .ER bit.
,PSRUWDQW 7KH$9(LQVWUXFWLRQFDOFXODWHVWKHDYHUDJHXVLQJ
IORDWLQJSRLQWUHJDUGOHVVRIWKHW\SHVSHFLILHGIRUWKHILOH
RUGHVWLQDWLRQSDUDPHWHUV
$77(17,21 7KH$9(LQVWUXFWLRQLQFUHPHQWVWKH
RIIVHWYDOXHVWRUHGDW60DNHVXUH\RXPRQLWRURU
ORDGWKHRIIVHWYDOXH\RXZDQWSULRUWRXVLQJDQLQGH[HG
DGGUHVV2WKHUZLVHXQSUHGLFWDEOHPDFKLQHRSHUDWLRQ
FRXOGRFFXUZLWKSRVVLEOHGDPDJHWRHTXLSPHQWDQGRU
LQMXU\WRSHUVRQQHO
Example:
I:012 AVE
]
] AVERAGE FILE EN
10 File #N7:1
Dest N7:0 DN
Control R6:0
Length 4
Position 0
R6:0 O:010
]
]
EN 5
R6:0 O:010
]
]
DN 7
R6:0
RES
If input word 12, bit 10 is set, the AVE instruction is enabled. The values in N7:1, N7:2, N7:3, and N7:4 are
added together and divided by 4. The result is stored in N7:0. When the calculation is complete, output
word 10, bit 7 is set. Then the RES instruction resets the status bits of the control file R6:0.
Clear (CLR)
Description: 8VHWKH&/5LQVWUXFWLRQWRVHWDOOWKHELWVRIDZRUGWR]HUR7KH
CLR
GHVWLQDWLRQPXVWEHDZRUGDGGUHVV6HH7DEOH/IRUVWDWXVIODJVIRU
CLEAR &/5LQVWUXFWLRQ
Destination Table 4.L
Updating Arithmetic Status Flags for a CLR Instruction
Example:
I:012 CLR
]
]
CLEAR
10 Destination N7:3
If input word 12, bit 10 is set, clear all of the bits in N7:3 to zero.
Cosine (COS)
(Enhanced PLC-5 Processors Only)
Source 7KH6RXUFHPXVWEHJUHDWHUWKDQRUHTXDOWR±DQGOHVVWKDQ
Destination RUHTXDOWR,ILWLVQRWLQWKLVUDQJHWKHSURFHVVRUUHWXUQVD
!INF!UHVXOWLQWKH'HVWLQDWLRQ7KHUHVXOWLQJYDOXHLQWKH
'HVWLQDWLRQLVDOZD\VJUHDWHUWKDQRUHTXDOWR±DQGOHVVWKDQRU
HTXDOWR
,PSRUWDQW )RUJUHDWHVWDFFXUDF\WKHVRXUFHGDWDVKRXOGEHJUHDWHU
WKDQRUHTXDOWR±πDQGOHVVWKDQRUHTXDOWRπ
Table 4.M
Updating Arithmetic Status Flags for an COS Instruction
Example:
I:012 COS
]
] COSINE
10 Source F8:13
0.7853982
Destination F8:14
0.7071068
If input word 12, bit 10 is set, take the cosine of the value in F8:13 and store the result in F8:14.
Divide (DIV)
Table 4.N
Updating Arithmetic Status Flags for a DIV Instruction
Example:
I:012 DIV
]
] DIVIDE
10 Source A N7:3
Source B N7:4
Destination N7:20
If input word 12, bit 10 is set, divide the value in N7:3 by the value in N7:4 and store the result in N7:20.
Description: 8VHWKH/1LQVWUXFWLRQWRWDNHWKHQDWXUDOORJRIWKHYDOXHLQWKH
LN 6RXUFHDQGVWRUHWKHUHVXOWLQWKH'HVWLQDWLRQ6HH7DEOH2IRUVWDWXV
NATURAL LOG IODJVIRU/1LQVWUXFWLRQ
Source
,IWKH6RXUFHLVHTXDOWRWKHUHVXOWLQWKH'HVWLQDWLRQZLOOEH
Destination
!-INF!LIWKHYDOXHLQWKH6RXUFHLVOHVVWKDQWKHUHVXOWLQWKH
'HVWLQDWLRQZLOOEH!NAN!7KHUHVXOWLQJYDOXHLQWKH'HVWLQDWLRQLV
DOZD\VJUHDWHUWKDQRUHTXDOWR±DQGOHVVWKDQRUHTXDOWR
Table 4.O
Updating Arithmetic Status Flags for an LN Instruction
Example:
I:012 LN
]
] NATURAL LOG
10 Source N7:0
5
Destination F8:20
1.609438
If input word 12, bit 10 is set, take the natural log of the value in N7:0 and store the result in F8:20.
Description: 8VHWKH/2*LQVWUXFWLRQWRWDNHWKHORJEDVHRIWKHYDOXHLQWKH
LOG
6RXUFHDQGVWRUHWKHUHVXOWLQWKH'HVWLQDWLRQ6HH7DEOH3IRUVWDWXV
LOG BASE 10
IODJVIRU/2*LQVWUXFWLRQ
Source
,IWKH6RXUFHLVHTXDOWRWKHUHVXOWLQWKH'HVWLQDWLRQZLOOEH
Destination
!-INF!LIWKHYDOXHLQWKH6RXUFHLVOHVVWKDQWKHUHVXOWLQWKH
'HVWLQDWLRQZLOOEH!NAN!7KHUHVXOWLQJYDOXHLQWKH'HVWLQDWLRQLV
DOZD\VJUHDWHUWKDQRUHTXDOWR±DQGOHVVWKDQRUHTXDOWR
Table 4.P
Updating Arithmetic Status Flags for an LOG Instruction
Example:
I:012 LOG
]
] LOG BASE 10
10 Source N7:2
5
Destination F8:3
0.6989700
If input word 12, bit 10 is set, take the log base 10 of the value in N7:2 and store the result in F8:3.
Multiply (MUL)
Example:
I:012 MUL
]
] MULTIPLY
10 Source A N7:3
Source B N7:4
Destination N7:20
If input word 12, bit 10 is set, multiply the value in N7:3 by the value in N7:4 and store the result in N7:20.
Negate (NEG)
Description: 8VHWKH1(*LQVWUXFWLRQWRFKDQJHWKHVLJQRIDYDOXH,I\RXQHJDWHD
QHJDWLYHYDOXHWKHUHVXOWLVSRVLWLYHLI\RXQHJDWHDSRVLWLYHYDOXH
NEG
WKHUHVXOWLVQHJDWLYH6HH7DEOH5IRUVWDWXVIODJVIRU1(*
NEGATE
LQVWUXFWLRQ
Source
Destination ,PSRUWDQW 7KHFRPSXWHLQVWUXFWLRQVH[HFXWHIRUHDFKVFDQDVORQJ
DVWKHUXQJLVWUXHLI\RXRQO\ZDQWYDOXHVFRPSXWHG
RQFHLQFOXGHWKH216FRPPDQGVHHFKDSWHU
Table 4.R
Updating Arithmetic Status Flags for a NEG Instruction
Example:
I:012 NEG
]
] NEGATE
10 Source N7:3
Destination N7:20
If input word 12, bit 10 is set, take the opposite sign of the value in N7:3 and store the result in N7:20.
Sine (SIN)
(Enhanced PLC-5 Processors Only)
Table 4.S
Updating Arithmetic Status Flags for an SIN Instruction
Example:
I:012 SIN
]
] SINE
Source F8:11
10
0.7853982
Destination F8:12
0.7071068
If input word 12, bit 10 is set, take the sine of F8:11 and store the result in F8:12.
Description: 8VHWKH645LQVWUXFWLRQWRWDNHWKHVTXDUHURRWRIDYDOXHDQGVWRUH
WKHUHVXOWLQWKHGHVWLQDWLRQ7KHVRXUFHFDQEHDYDOXHRUDQDGGUHVV
SQR
SQUARE ROOT
,IWKHVRXUFHYDOXHLVQHJDWLYHWKHSURFHVVRUWDNHVLWVDEVROXWHYDOXH
Source
DQGSHUIRUPVWKHVTXDUHURRWIXQFWLRQ6HH7DEOH7IRUVWDWXVIODJV
Destination IRU645LQVWUXFWLRQ
,PSRUWDQW 7KH645LQVWUXFWLRQH[HFXWHVRQFHIRUHDFKVFDQDV
ORQJDVWKHUXQJLVWUXHLI\RXRQO\ZDQWYDOXHV
FRPSXWHGRQFHLQFOXGHWKH216FRPPDQGVHH
FKDSWHU
Table 4.T
Updating Arithmetic Status Flags for a SQR Instruction
Example:
I:012 SQR
]
] SQUARE ROOT
10 Source N7:3
Destination N7:20
If input word 12, bit 10 is set, take the square root of the value in N7:3 and store the result in N7:20.
Description: 7KH657LQVWUXFWLRQVRUWVDVHWRIYDOXHVLQWRDVFHQGLQJRUGHU7KLV
LQVWUXFWLRQLVH[HFXWHGRQDIDOVHWRWUXHWUDQVLWLRQ
SRT
SORT FILE EN ,PSRUWDQW 0DNHVXUHWKHILOHOHQJWKYDOXH\RXVSHFLI\LQWKH
File
LQVWUXFWLRQGRHVQRWFDXVHWKHLQGH[HGDGGUHVVWRH[FHHG
Control DN
Length WKHILOHERXQGV7KHSURFHVVRUGRHVQRWFKHFNWKLV
Position
XQOHVV\RXH[FHHGWKHGDWDILOHDUHDRIPHPRU\
,IWKHLQGH[HGDGGUHVVH[FHHGVWKHGDWDILOHDUHDWKH
SURFHVVRULQLWLDWHVDUXQWLPHHUURUDQGVHWVDPDMRU
IDXOW7KHSURFHVVRUGRHVQRWFKHFNWRVHHZKHWKHUWKH
LQGH[HGDGGUHVVFURVVHVILOHW\SHVVXFKDV1WR)
Entering Parameters
7RSURJUDPWKH657LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJ
Parameter: Definition:
file the address that contains the first value to be sorted. This address can be
floating point or integer.
control the address of the control structure in the control area (R) of processor
memory. The processor stores information such as the length, position
and status, and uses this information to execute the instruction.
Enable .EN (bit 15) on a false-to-true rung transition to indicate that the instruction is
enabled. The instruction follows the rung condition.
Done .DN (bit 13) after the instruction finishes operating. After the rung goes false,
the processor resets the .DN bit on the next false-to-true rung
transition.
Error .ER (bit 11) when the length value is less than or equal to zero or when the
position value is less than zero.
$77(17,21 7KH657LQVWUXFWLRQPDQLSXODWHVWKH
RIIVHWYDOXHVWRUHGDW60DNHVXUH\RXPRQLWRURU
ORDGWKHRIIVHWYDOXH\RXZDQWSULRUWRXVLQJDQLQGH[HG
DGGUHVV2WKHUZLVHXQSUHGLFWDEOHPDFKLQHRSHUDWLRQ
FRXOGRFFXUZLWKSRVVLEOHGDPDJHWRHTXLSPHQWDQGRU
LQMXU\WRSHUVRQQHO
Example:
I:012 SRT
]
] SORT FILE EN
10 File #N7:1
Control R6:0
Length 4 DN
Position 0
R6:0 O:010
]
]
EN 5
R6:0 O:010
]
]
DN 7
If input word 12, bit 10 is set, the SRT instruction is enabled. The elements N7:1, N7:2, N7:3, and N7:4 are sorted into ascending
order. When the sort operation is complete, output word 10, bit 7 is set.
Description: 7KH67'LQVWUXFWLRQFDOFXODWHVWKHVWDQGDUGGHYLDWLRQRIDVHWRI
STD
YDOXHVDQGVWRUHVWKHUHVXOWLQWKHGHVWLQDWLRQ7KLVLQVWUXFWLRQLV
STANDARD DEVIATION EN H[HFXWHGRQDIDOVHWRWUXHWUDQVLWLRQ6HH7DEOH8IRUVWDWXVIODJV
File IRU67'LQVWUXFWLRQ
Destination DN
Control
Length
7KHVWDQGDUGGHYLDWLRQLVFDOFXODWHGDFFRUGLQJWRWKHIROORZLQJ
Position IRUPXOD
Standard 2
Deviation = SUM((xi – AVE(xi))
(N – 1)
:KHUH
680 ±VXPPDWLRQIXQFW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URYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJ
Parameter: Defines:
file the address that contains the first value to be calculated. This address
can be floating point or integer.
destination the address where the result of the instruction is stored. This address
can be floating point or integer.
control the address of the control structure in the control area (R) of processor
memory. The processor stores information such as the length, position
and status, and uses this information to execute the instruction.
Enable .EN (bit 15) on a false-to-true rung transition to indicate that the instruction
is enabled. The instruction follows the rung condition.
Done .DN (bit 13) after the instruction finishes operating. After the rung goes
false, the processor resets the .DN bit on the next false-to-true
rung transition.
Error .ER (bit 11) when the operation generates an overflow. The instruction
stops until the ladder program resets the .ER bit.
,PSRUWDQW 7KH67'LQVWUXFWLRQFDOFXODWHVWKHVWDQGDUGGHYLDWLRQ
XVLQJIORDWLQJSRLQWUHJDUGOHVVRIWKHW\SHVSHFLILHGIRU
WKHILOHRUGHVWLQDWLRQSDUDPHWHUV
$77(17,21 7KH67'LQVWUXFWLRQPDQLSXODWHVWKH
RIIVHWYDOXHVWRUHGDW60DNHVXUH\RXPRQLWRURU
ORDGWKHRIIVHWYDOXH\RXZDQWSULRUWRXVLQJDQLQGH[HG
DGGUHVV2WKHUZLVHXQSUHGLFWDEOHPDFKLQHRSHUDWLRQ
FRXOGRFFXUZLWKSRVVLEOHGDPDJHWRHTXLSPHQWDQGRU
LQMXU\WRSHUVRQQHO
Example:
I:012 STD
]
] STANDARD DEVIATION EN
10 File #N7:1
Destination N7:0
Control R6:0 DN
Length 4
Position 0
R6:0 O:010
]
]
EN 5
R6:0 O:010
]
]
DN 7
R6:0
RES
If input word 12, bit 10 is set, the STD instruction is enabled. The elements N7:1, N7:2, N7:3, and N7:4 are used to calculate the
standard deviation. When the calculation is complete, output word 10, bit 7 is set. Then the RES instruction resets the status bits of
the control file R6:0.
Subtract (SUB)
Table 4.V
Updating Arithmetic Status Flags for a SUB Instruction
Example:
I:012 SUB
]
] SUBTRACT
10 Source A N7:3
Source B N7:4
Destination N7:20
If input word 12, bit 10 is set, subtract the value in N7:4 from the value in N7:3 and store the result in N7:20.
Tangent (TAN)
(Enhanced PLC-5 Processors Only)
Table 4.W
Updating Arithmetic Status Flags for an TAN Instruction
Example:
I:012 TAN
]
] TANGENT
10 Source F8:15
0.7853982
Destination F8:16
1.000000
If input word 12, bit 10 is set, take the tangent of the value in F8:15 and store the result in F8:16.
Table 4.X
Updating Arithmetic Status Flags for an XPY Instruction
Example:
I:012 XPY
]
] X TO POWER OF Y
10 Source A N7:4
5
Source B N7:5
2
Destination N7:6
25
If input word 12, bit 10 is set, take the value in N7:4, raise it to the power of the value in N7:5, and stores
the result in N7:6.
1RWHV
7KHSDUDPHWHUV\RXHQWHUDUHSURJUDPFRQVWDQWVRUGLUHFWORJLFDO
DGGUHVVHV
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: 8VHWKH$1'LQVWUXFWLRQWRSHUIRUPDQ$1'RSHUDWLRQXVLQJWKHELWV
LQWKHWZRVRXUFHDGGUHVVHV
AND
BITWISE AND Table 5.C
Source A Truth Table for an AND Operation
Source B
Destination
Source A Source B Result
0 0 0
1 0 0
0 1 0
1 1 1
Table 5.D
Updating Arithmetic Status Flags for an AND Instruction
Example:
I:012 AND
[
[
AND
10 Source A N9:3
Source B N10:4
Destination N12:3
Source A
N9:3 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Source B
N10:4 0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
Destination
N12:3
0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Description: 8VHWKH127LQVWUXFWLRQWRSHUIRUPD127RSHUDWLRQXVLQJWKHELWVLQ
WKHVRXUFHDGGUHVV7KLVRSHUDWLRQLVDOVRNQRZDVDELWLQYHUVLRQ
NOT
NOT ,PSRUWDQW 7KH127LQVWUXFWLRQLVQRWDYDLODEOHRQ3/&
Source VHULHV$SURFHVVRUV
Destination
Table 5.E
Truth Table for a NOT Operation
Source Result
0 1
1 0
Table 5.F
Updating Arithmetic Status Flags for a NOT Instruction
Example:
I:012 NOT
[
[
NOT
10 Source N9:3
Destination N10:4
Source
N9:3 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Destination
N10:4
1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1
OR Operation (OR)
Description: 8VHWKH25LQVWUXFWLRQWRSHUIRUPDQ25RSHUDWLRQXVLQJWKHELWVLQ
OR
WKHWZRVRXUFHVFRQVWDQWVRUDGGUHVVHV
BITWISE INCLUSIVE OR Table 5.G
Source A Truth Table for an OR Operation
Source B
Destination
Source A Source B Result
0 0 0
1 0 1
0 1 1
1 1 1
Table 5.H
Updating Arithmetic Status Flags for an OR Instruction
Example:
I:012 OR
[
[ INCLUSIVE OR
10 Source A N9:3
Source B N10:4
Destination N12:3
If input word 12, bit 10 is set, the processor performs
an OR operation on N9:3 and N10:4 and stores the
result in N12:3.
Source A
N9:3 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Source B
N10:4 0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
Destination
N12:3
0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
Description: 8VHWKH;25LQVWUXFWLRQWRSHUIRUPDQH[FOXVLYH25RSHUDWLRQXVLQJ
WKHELWVLQWKHWZRVRXUFHVFRQVWDQWVRUDGGUHVVHV
XOR
BITWISE EXCLUSIVE OR Table 5.I
Source A Truth Table for an XOR Operation
Source B
0 0 0
1 0 1
0 1 1
1 1 0
Table 5.J
Updating Arithmetic Status Bits for an XOR Instruction
Example:
I:012 XOR
[ EXCLUSIVE OR
[
10 Source A N9:3
Source B N10:4
If input word 12, bit 10 is set, the processor performs Destination N12:3
an XOR operation on N9:3 and N10:4 and stores the
result in N12:3.
Source A
N9:3 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Source B
N10:4 0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
Destination
N12:3
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
1RWHV
7KHSDUDPHWHUV\RXHQWHUDUHSURJUDPFRQVWDQWVRUORJLFDODGGUHVVHV
RIWKHYDOXHV\RXZDQW
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: 8VHWKH72'LQVWUXFWLRQWRFRQYHUWDQLQWHJHUYDOXHWRD%&'YDOXH
,IWKHLQWHJHUYDOXHLVJUHDWHUWKDQWKHSURFHVVRUVWRUHVDQG
TOD
VHWVWKHRYHUIORZELW,IWKHLQWHJHUYDOXHLVQHJDWLYHWKHSURFHVVRU
TO BCD
VWRUHVLQWKHGHVWLQDWLRQDQGVHWVWKHRYHUIORZDQG]HURVWDWXVELWV
Source
Table 6.C
Destination
Updating Arithmetic Status Flags for a TOD Instruction
Example:
I:012 TOD
]
] TO BCD
10 Source N7:3
Destination D9:3
If input word 12, bit 10 is set, convert the value in N7:3 to a BCD value and store the result in D9:3.
Description: 8VHWKH)5'LQVWUXFWLRQWRFRQYHUWD%&'YDOXHWRDQLQWHJHUYDOXH
&RQYHUW%&'YDOXHVWRLQWHJHUYDOXHVEHIRUH\RXPDQLSXODWHWKRVH
FRD
YDOXHVZLWKODGGHUORJLFEHFDXVHWKHSURFHVVRUWUHDWV%&'YDOXHVDV
FROM BCD LQWHJHUYDOXHV7KHDFWXDO%&'YDOXHPD\EHORVWRUGLVWRUWHG
Source
Table 6.D
Destination
Updating Arithmetic Status Flags for a TOD Instruction
7KH)5'LQVWUXFWLRQZLOOFRQYHUWDQRQGHFLPDOQXPEHUZLWKRXWDQ\
HUURUFRQGLWLRQ)RUH[DPSOHLID³&´LVLQWKHVRXUFHLWLVFRQYHUWHG
WR³´HYHQWKRXJK³&´LVQRWDYDOLGGHFLPDOQXPEHU
Example:
I:012 FRD
]
] FROM BCD
10 Source D9:3
Destination N7:3
If input word 12, bit 10 is set, convert the value in D9:3 to an integer value and store the result in N7:3.
Degree (DEG)
(Enhanced PLC-5 Processors Only)
Example:
I:012 DEG
]
] RADIANS TO DEGREE
10 Source F8:7
0.7853982
Destination F8:8
45
If input word 12, bit 10 is set, convert the value in F8:7 to degrees and store the result on F8:8.
Radian (RAD)
(Enhanced PLC-5 Processors Only)
Example:
I:012 RAD
]
] DEGREES TO RADIANS
10 Source N7:9
45
Destination F8:10
0.7853982
If input word 12, bit 10 is set, convert the value in N7:9 to radians and store the result on F8:10.
7KHVHLQVWUXFWLRQVRSHUDWHRQELWLQWHJHUELQDU\RUIORDWLQJSRLQW
QXPEHUVWRPRYHRUFRS\ELWVEHWZHHQZRUGV7KH090LQVWUXFWLRQ
XVHVDPDVNWRHLWKHUSDVVRUEORFNVRXUFHGDWDELWV$PDVNSDVVHV
GDWDZKHQWKHPDVNELWVDUHVHWDPDVNEORFNVGDWDZKHQWKH
PDVNELWVDUHUHVHW7KHPDVNPXVWEHWKHVDPHZRUGVL]HDVWKH
VRXUFHDQGGHVWLQDWLRQ
:KHQURXQGLQJIORDWLQJSRLQWQXPEHUVGXULQJDPRYHWRDQLQWHJHU
ZRUGWKHSURFHVVRUGRHVQRWFRUUHFWO\URXQGQXPEHUVOHVVWKDQ±
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: 7KH%7'LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWPRYHVXSWRELWV
RIGDWDZLWKLQDZRUGRUEHWZHHQZRUGV7KH6RXUFHUHPDLQV
BTD
XQFKDQJHG7KHLQVWUXFWLRQZULWHVRYHUWKH'HVWLQDWLRQZLWKWKH
BIT FIELD DISTRIB
VSHFLILHGELWV,IWKHOHQJWKRIWKHELWILHOGH[WHQGVEH\RQGWKH
Source
Source bit
'HVWLQDWLRQZRUGWKHSURFHVVRUGRHVQRWVDYHWKHRYHUIORZELWV
Destination 7KHVHRYHUIORZELWVDUHORVWWKH\GRQRWZUDSLQWRWKHQH[WZRUG
Destination bit
Length 2QHDFKVFDQZKHQWKHUXQJWKDWFRQWDLQVWKH%7'LQVWUXFWLRQLVWUXH
WKHSURFHVVRUPRYHVWKHELWILHOGIURPWKHVRXUFHZRUGWRWKH
GHVWLQDWLRQZRUG7RPRYHGDWDZLWKLQDZRUGHQWHUWKHVDPHDGGUHVV
IRUWKHVRXUFHDQGGHVWLQDWLRQ
Entering Parameters
7RSURJUDPWKH%7'LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJ
Parameter: Definition:
Source the address of the source word in binary or integer. The source
remains unchanged.
Source bit the number of the bit (lowest bit number) in the source word from
which to start the move.
Destination the address of the destination word in a binary or integer file. The
instruction writes over any data already stored at the destination.
Destination bit the number of the bit (lowest bit number) in the destination word
where the processor starts copying the bits from the source word.
Example:
Moving Bits Within a Word
BTD
Destination Bit Source Bit
BIT FIELD DISTRIB N70:22/10 N70:22/3
Source N70:22 15 08 07 00
Source bit 3
Destination N70:22 1 0 1 1 0 1 1 0 1 1 0 1 N70:22
Destination bit 10
Length 6
13384
Example:
Moving Bits Between Words
BTD Source Bit
N7:020/3
BIT FIELD DISTRIB 15 08 07 00
Source N7:20 0 1 1 1 0 1 1 1 0 1 N7:20
Source bit 3
Destination N7:22
Destination bit 5 Destination Bit
Length 10 N7:022/5
15 08 07 00
0 1 1 1 0 1 1 1 0 1 N7:22
13384
,PSRUWDQW %LWVDUHORVWLIWKH\H[WHQGEH\RQGWKHHQGRIWKH
GHVWLQDWLRQZRUGWKHELWVDUHQRWZUDSSHGWRWKHQH[W
KLJKHUZRUG
Move (MOV)
Description: 7KH029LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWFRSLHVWKH6RXUFH
DGGUHVVWRD'HVWLQDWLRQ$VORQJDVWKHUXQJUHPDLQVWUXHWKH
MOV
LQVWUXFWLRQPRYHVWKHGDWDHDFKVFDQ
MOVE
Source 7DEOH%GHVFULEHVKRZWKHSURFHVVRUXSGDWHVWKHDULWKPHWLFVWDWXV
Destination IODJV
Table 7.B
Updating Arithmetic Status Flags for a MOV Instruction
Example: 7RSURJUDPWKLVLQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWKWKH
IROORZLQJ
MOV
MOVE
Source N7:0 Parameter: Definition:
Destination N7:2
source is a program constant or data address from which the instruction
reads an image of the value.
You can also use a symbol, as long as the symbol name is more
than 1 character. The source remains unchanged.
destination the data address to which the instruction writes the result of
the operation. The instruction writes over any data stored at
the destination.
Description: 7KH090LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWFRSLHVWKH6RXUFH
WRD'HVWLQDWLRQDQGDOORZVSRUWLRQVRIWKHGDWDWREHPDVNHG$V
MVM
ORQJDVWKHUXQJUHPDLQVWUXHWKHLQVWUXFWLRQPRYHVGDWDHDFKVFDQ
MASKED MOVE
Source <RXFDQXVHWKH090LQVWUXFWLRQWRFRS\,2LPDJHELQDU\RU
Mask
LQWHJHUYDOXHV)RUH[DPSOHXVH090WRH[WUDFWELWGDWDVXFKDV
Destination
VWDWXVRUFRQWUROELWVIURPDQHOHPHQWWKDWFRQWDLQVELWDQGZRUGGDWD
7DEOH&GHVFULEHVKRZWKHSURFHVVRUXSGDWHVWKHDULWKPHWLF
VWDWXV IODJV
Table 7.C
Updating Arithmetic Status Flags for a MVM Instruction
Entering Parameters
7RSURJUDPWKLVLQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKH IROORZLQJ
Parameter: Definition:
Source a program constant or data address from which the instruction reads an
image of the value. The source remains unchanged.
Destination the data address to which the instruction writes the result of the
operation. The instruction writes over any data stored at the destination.
Example:
MVM Destination
MASKED MOVE N7:2 Before Move
Source N7:0
Mask 1111000011110000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Destination N7:2
Source Mask
N7:0 F0F0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Destination
N7:2 After Move
0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1
13360
1RWHV
Length the number of words in the data block on which the file instruction
operates. Enter any decimal number 1-1000.
Position the current word within the data block that the processor is accessing.
You generally enter a zero to start at the beginning of a block.
Mode the number of file words operated on each time the rung is scanned in
the program. The mode lets you distribute operation on the complete
block of words. Specify one of the following:
• for All mode, type an A
• for Numerical mode, type a decimal number (1-1000)
• for Incremental mode, type an I
For more information about the different modes, see “Choosing Modes of
Block Operation” on page 8-5.
Destination the address where the processor stores the result of the operation. The
instruction converts to the data type specified by the destination address.
Expression contains addresses, program constants, and operators that specify the
source of data and the operations to be performed.
If you enter the index prefix (#) for a destination or expression address,
the processor accepts it as the address of the first word of a block to be
operated upon. The processor assigns and uses the offset value in
module status to process the block address. If you omit the # prefix, the
processor accepts this as the address of a single work to be operated
upon.
$77(17,21 ,QVWUXFWLRQVZLWKDVLJQLQDQDGGUHVV
PDQLSXODWHWKHRIIVHWYDOXHVWRUHGDW60DNHVXUH
\RXPRQLWRURUORDGWKHRIIVHWYDOXH\RXZDQWSULRUWR
XVLQJDQLQGH[HGDGGUHVV2WKHUZLVHXQSUHGLFWDEOH
PDFKLQHRSHUDWLRQFRXOGRFFXUZLWKSRVVLEOHGDPDJHWR
HTXLSPHQWDQGRULQMXU\WRSHUVRQQHO
)RUPRUHLQIRUPDWLRQRQLQGH[HGDGGUHVVLQJVHHWKHFKDSWHURQ
DGGUHVVLQJGDWDWDEOHILOHVLQ\RXUVRIWZDUHXVHUPDQXDO
Status
Length R6:0
Position
Status
Length R6:1
Position
Status
Length R6:2
Position
13370
$77(17,21 'RQRWXVHWKHVDPHFRQWURODGGUHVVIRU
PRUHWKDQRQHLQVWUXFWLRQ'XSOLFDWLRQRIDFRQWURO
DGGUHVVFRXOGUHVXOWLQXQSUHGLFWDEOHRSHUDWLRQSRVVLEO\
FDXVLQJGDPDJHWRHTXLSPHQWDQGRULQMXU\WRSHUVRQQHO
7KHFRQWUROVWUXFWXUHVWRUHVWKHIROORZLQJLQIRUPDWLRQ
6WDWXVELWV
/HQJWK/(1RIWKHEORFNZRUGV
3RVLWLRQ326RIWKHZRUGVWKDWWKHSURFHVVRULVRSHUDWLQJRQ
7KH)$/LQVWUXFWLRQDQG)6&LQVWUXFWLRQHDFKKDVLWVRZQVHWRI
VWDWXVELWV6HHFKDSWHUIRUWKH)$/RU)6&LQVWUXFWLRQIRUD
GHVFULSWLRQRIWKHVHVWDWXVELWV
FAL
FILE ARITH/LOGICAL EN
Control R6:5
Length 4
Position 0 DN
Mode ALL
Dest #N28:0 The # prefix for the destination address and the
ER absence of a # prefix for the expression address
Expression N27:3
establish this as a word-to-block operation.
FAL
FILE ARITH/LOGICAL EN
Control R6:5
Length 4
DN
Position 0
Mode ALL
Dest N28:0 ER The absence of a # prefix for the destination
Expression #N27:3 address and the # prefix for the expression address
establish this as a block-to-word operation.
FAL
FILE ARITH/LOGICAL EN
Control R6:5
Length 4
DN
Position 0
Mode ALL
Dest #N28:0 ER The # prefix for the destination address and the
Expression #N27:3 # prefix for the expression address establish this
as a block-to-block operation.
7KHIROORZLQJH[DPSOHVKRZVJHQHULFGDWDPDQLSXODWLRQVXVHGZLWK
ILOHLQVWUXFWLRQV( H[SUHVVLRQ' GHVWLQDWLRQ[ RSHUDWLRQ
Moving Data
E D E D E D
Operating on Data
E D E D
E D E D
E D E D
E D
16617a
Block x Block = Result
All Mode
,QWKH$OOPRGHWKHHQWLUHILOHLVRSHUDWHGRQEHIRUHFRQWLQXLQJRQWR
WKHQH[WUXQJRIWKHSURJUDP7\SHDQ$IRUWKHPRGHSDUDPHWHU
ZKHQ\RXHQWHUWKHLQVWUXFWLRQ
Word
Data File One Scan
512
14 Word File
525
16639
2SHUDWLRQEHJLQVZKHQWKHUXQJ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[HFXWLRQRI
WKHLQVWUXFWLRQ
(DFKWLPHWKHUXQJLVVFDQQHGWKHLQVWUXFWLRQRSHUDWHVRQWKHQXPEHU
RIZRUGVHTXDOWRWKHUDWH\RXHQWHUHGIRUWKHPRGHYDOXHXQWLOLWKDV
RSHUDWHGRQWKHQXPEHURIZRUGV\RXVSHFLILHGE\WKHOHQJWKYDOXH,Q
WKHODVWVFDQRIWKHUXQJWKHSURFHVVRUPD\RSHUDWHRQOHVVWKDQWKH
QXPEHURIZRUGV\RXHQWHUHG
File
Word
Scan #1
512
5 words
Scan #1 516 Scan #2
517
14-Word Block 5 words
16641
,PSRUWDQW $YRLGXVLQJWKHUHVXOWVRIDILOHLQVWUXFWLRQRSHUDWLQJLQ
QXPHULFPRGHXQWLOWKHGRQHELWLVVHWEHFDXVHWKHGDWD
ZLOOEHLQFRPSOHWH
7KHIROORZLQJWLPLQJGLDJUDPVKRZVWKHUHODWLRQVKLSEHWZHHQVWDWXV
ELWVDQGLQVWUXFWLRQRSHUDWLRQ
Rung is true at completion Rung is not true at completion
Multiple program
scans Multiple program
scans
Condition of rung that
controls file instruction
Execution of instruction
Operation complete The processor turns off Operation complete The processor
enable and done bit and turns off done
zeroes position value. bit and zeroes
position value.
16642
:KHQWKHLQVWUXFWLRQH[HFXWLRQLVFRPSOHWHWKHGRQHELWLVWXUQHGRQ
,IWKHUXQJLVWUXHDWFRPSOHWLRQWKHHQDEOHELWDQGGRQHELWDUHQRW
WXUQHGRIIXQWLOWKHUXQJLVQRORQJHUWUXH:KHQWKHUXQJLVQRORQJHU
WUXHWKHVHELWVDUHWXUQHGRIIDQGWKHSRVLWLRQYDOXHLV]HURHG
,IWKHUXQJLVQRWWUXHDWFRPSOHWLRQWKHHQDEOHELWLVWXUQHGRII
LPPHGLDWHO\DQGRQHVFDQDIWHUWKHHQDEOHELWLVWXUQHGRIIWKHGRQH
ELWLVWXUQHGRIIDQGWKHSRVLWLRQYDOXHLV]HURHG
2QO\DIWHUWKHHQDEOHDQGGRQHELWVDUHWXUQHGRIIFDQDQRWKHU
RSHUDWLRQEHWULJJHUHGE\DQRWWUXHWRWUXHWUDQVLWLRQRIWKH
UXQJ FRQGLWLRQV
Incremental Mode
,QFUHPHQWDOPRGHPDQLSXODWHVRQHZRUGRIWKHILOHHDFKWLPHWKH
UXQJJRHVIURPQRWWUXHWRWUXH7\SHDQ,IRUWKHPRGHSDUDPHWHU
ZKHQ\RXHQWHUWKHLQVWUXFWLRQ
File
Word
File Word
1-Word Operation 1st Rung Enable
Word #0 512
1-Word Operation 2nd Rung Enable
Word #1 513
1-Word Operation 3rd Rung Enable
Word #2 514
Word #3 515
Word File
16
7KHIROORZLQJWLPLQJGLDJUDPVKRZVWKHUHODWLRQVKLSEHWZHHQVWDWXV
ELWVDQGLQVWUXFWLRQRSHUDWLRQ
One or more
program
scans
Condition of rung that
controls file instruction
Execution of instruction
([HFXWLRQRFFXUVRQO\LQDSURJUDPVFDQLQZKLFKWKHUXQJJRHVIURP
QRWWUXHWRWUXH(DFKWLPHWKLVGRHVRFFXURQO\RQHZRUGRIWKHILOHLV
RSHUDWHGRQ7KHHQDEOHELWLVRQZKHQUXQJORJLFLVWUXH7KHGRQHELW
LVWXUQHGRQZKHQWKHODVWZRUGLQWKHILOHKDVEHHQRSHUDWHGRQ:KHQ
WKHODVWZRUGLQWKHILOHKDVEHHQRSHUDWHGRQDQGWKHUXQJJRHVIURP
WUXHWRQRWWUXHWKHHQDEOHDQGGRQHELWVDUHWXUQHGRIIDQGWKH
SRVLWLRQYDOXHLV]HURHG,IWKHUXQJUHPDLQVWUXHIRUPRUHWKDQRQH
SURJUDPVFDQWKHILOHLQVWUXFWLRQLVQRWH[HFXWHGLQVXEVHTXHQWVFDQV
DIWHUWKHWUDQVLWLRQ
,PSRUWDQW ,I\RXDUHRSHUDWLQJRQDQHQWLUHILOHDYRLGXVLQJWKH
UHVXOWVRIDILOHEORFNLQVWUXFWLRQXVLQJLQFUHPHQWDO
PRGHXQWLOWKHGR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VZLWKDVLJQLQDQDGGUHVV
PDQLSXODWHWKHRIIVHWYDOXHVWRUHGDW60DNHVXUH
\RXPRQLWRURUORDGWKHRIIVHWYDOXH\RXZDQWSULRUWR
XVLQJDQLQGH[HGDGGUHVV2WKHUZLVHXQSUHGLFWDEOH
PDFKLQHRSHUDWLRQFRXOGRFFXUZLWKSRVVLEOHGDPDJHWR
HTXLSPHQWDQGRULQMXU\WRSHUVRQQHO
Table 9.B
FAL Operations
Copy none copy from A to B enter source address in the expression enter
destination address in destination
– subtract 12 – 5
(12 – 5) – 1 (Enhanced PLC-5 processors)
* multiply 5*2
6 * (5 * 2) (Enhanced PLC-5 processors)
| divide 24 | 6
(24 | 6) * 2 (Enhanced PLC-5 processors)
– negate – N7:0
** exponential 10**3
(x to the power of y) (Enhanced PLC-5 processors only)
Enable .EN (bit 15) by a false-to-true rung transition and indicates the instruction is
enabled.
In incremental mode, the .EN bit follows the rung condition.
In numerical and ALL modes, the .EN bit remains set until the
instruction completes its operation, regardless of the rung
condition. The .EN bit is reset when the rung goes false and the
instruction completes its operation.
Done .DN (bit 13) after the instruction has operated on the last set of words.
In numerical mode if the instruction is false at completion, it resets
the .DN bit one program scan after the operation is complete. If
the instruction is true at completion, the .DN bit is reset when the
instruction goes false.
Error .ER (bit 11) when the operation generates an overflow. The instruction stops
until the ladder program resets the .ER bit.
When the processor detects an error, the position value stores the
number of the word that faulted.
:LWKWKH)$/LQVWUXFWLRQDPD[LPXPRIFKDUDFWHUVRIWKH
H[SUHVVLRQFDQEHGLVSOD\HG,IWKHH[SUHVVLRQ\RXHQWHULVQHDUWKLV
FKDUDFWHUPD[LPXPZKHQ\RXDFFHSWWKHUXQJFRQWDLQLQJWKH
LQVWUXFWLRQWKHSURFHVVRUPD\H[SDQGLWEH\RQGFKDUDFWHUV:KHQ
\RXWU\WRHGLWWKHH[SUHVVLRQRQO\WKHILUVWFKDUDFWHUVDUH
GLVSOD\HGDQGWKHUXQJLVGLVSOD\HGDVDQHUURUUXQJ7KHSURFHVVRU
GRHVFRQWDLQWKHFRPSOHWHH[SUHVVLRQKRZHYHUDQGWKHLQVWUXFWLRQ
UXQVSURSHUO\
7RZRUNDURXQGWKLVGLVSOD\SUREOHPH[SRUWWKHSURFHVVRUPHPRU\
ILOHDQGPDNH\RXUHGLWVLQWKH3&WH[WILOH7KHQLPSRUWWKLVWH[W
ILOH6HH\RXUSURJUDPPLQJPDQXDOIRUPRUHLQIRUPDWLRQRQ
LPSRUWLQJH[SRUWLQJSURFHVVRUPHPRU\ILOHV
13366
Destination (#N28:0) Where to write the data (the # indicates that the operation is to
be performed on a file)
Expression (#N27:3) Where to read the data (the # indicates that the operation is to
be performed on a file)
:KHQWKHUXQJJRHVWUXHWKHSURFHVVRUUHDGVIRXUHOHPHQWVRILQWHJHU
ILOH1ZRUGE\ZRUGVWDUWLQJDWHOHPHQWDQGZULWHVWKHLPDJHWR
LQWHJHUILOH1VWDUWLQJDWHOHPHQW,WZULWHVRYHUDQ\GDWDLQWKH
GHVWLQDWLRQILOH
1st move
FAL
2nd move Word 29:5
FILE ARITH/LOGICAL File # N29:0
EN
Control R6:6
Length 5 Word 0 Word
DN
Position 0
Mode INC 1
Destination N29:5 ER
Expression #N29:0 2
5th move
3
4th move
4 3rd move
13372
Mode (incremental) To copy one word each time the rung goes true
Expression (#N29:0) Where to read the data (the # indicates that the
operation is to be performed on a file)
:LWKHDFKIDOVHWRWUXHUXQJWUDQVLWLRQWKHSURFHVVRUUHDGVRQH
HOHPHQWRILQWHJHUILOH1VWDUWLQJDWHOHPHQWDQGZULWHVWKHLPDJH
LQWRHOHPHQWRILQWHJHUILOH17KHLQVWUXFWLRQZULWHVRYHUDQ\
GDWDLQWKHGHVWLQDWLRQ
$ZRUGWRILOHPRYHLVVLPLODUH[FHSWWKDWWKHLQVWUXFWLRQFRSLHVGDWD
IURPDZRUGDGGUHVVLQWRDILOH7KHZRUGDGGUHVVFDQEHLQWKHVDPH
RUDGLIIHUHQWILOH
+ add | divide
– subtract – negate
* multiply 0 clear
)RUPRUHLQIRUPDWLRQDERXWRUGHURIRSHUDWLRQVHHFKDSWHU
timer 0 to +32,767
control 0 to +32,767
$QHUURURFFXUVZKHQWKHUHVXOWRIDQRSHUDWLRQH[FHHGVHLWKHUWKH
ORZHURUXSSHUOLPLWRIWKHGHVWLQDWLRQZRUGLQZKLFKLWLVVWRUHG7KH
RYHUIORZELWLVVHWLQWKHSURFHVVRU¶VVWDWXVILOH67KH
LQVWUXFWLRQDOVRVHWVWKHHUURUELWLQWKHVWDWXVE\WHRILWVFRQWUROZRUG
328 0 10 0 338 0
150 1 32 1 182 1
10 2 1 2 11 2
32 3 147 3 179 3
First Scan
0 4 99 4 99 4
45 5 572 5 617 5
1579 6 300 6 1879 6
620 7 42 7 662 7
800 8 19 8 819 8
1243 9 1000 9 2243 9
Second Scan next 10 words
Third Scan next 10 words
Fourth Scan next 10 words
//
//
//
//
//
//
Tenth Scan last 10 elements 99 99 99
13386
Subtraction Example:
16655a
:KHQWKHUXQJJRHVWUXHWKHSURFHVVRUUHDGVHLJKWHOHPHQWVRI
LQWHJHUILOH1ZRUGE\ZRUGVWDUWLQJDWHOHPHQWVXEWUDFWVD
SURJUDPFRQVWDQWIURPHDFKDQGZULWHVWKHUHVXOWLQWR
GHVWLQDWLRQILOH1VWDUWLQJDWHOHPHQWDOOLQRQHVFDQ
Multiplication Example:
FAL
FILE ARITH/LOGICAL EN
Control R6:2
Length 16
DN
Position 0
Mode INC
Dest #F8:16 ER
Expression
#F8:0 * #N17:0
//
//
//
//
//
15 15 31
15290
:KHQWKHUXQJJRHVWUXHWKHSURFHVVRUPXOWLSOLHVYDOXHVLQILOH
)E\WKHFRUUHVSRQGLQJYDOXHVLQILOH1XVLQJLQFUHPHQWDO
PRGH2QHPXOWLSOLFDWLRQLVSHUIRUPHGIRUHDFKIDOVHWRWUXH
WUDQVLWLRQ7KHRSHUDWLRQUHTXLUHVWUDQVLWLRQVVWRULQJWKHUHVXOWLQ
ILOH)
Division Example:
FAL
FILE ARITH/LOGICAL EN
Control R6:2
Length 16
DN
Position 0
Mode INC
Destination #N13:0 ER
Expression
#N11:0 | #N12:0
Fourth Transition 45 3 9 3 5 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
//
//
//
//
//
//
15 15 15
17955
:KHQWKHUXQJJRHVWUXHWKHSURFHVVRUVWDUWVWRGLYLGHYDOXHV
VWDUWLQJDW1E\WKHFRUUHVSRQGLQJYDOXHVLQILOH1XVLQJ
LQFUHPHQWDOPRGH2QHGLYLVLRQLVSHUIRUPHGIRUHDFKWUDQVLWLRQWR
WUXH7KHRSHUDWLRQUHTXLUHVWUDQVLWLRQVVWRULQJWKHUHVXOWLQD
ZRUGILOHVWDUWLQJDW1
$IWHUUXQJJRHVWUXHWKHVTXDUHURRWRIWKHILUVWZRUGVLQWKHILOH
EHJLQQLQJDW1LVFDOFXODWHGDQGWKHUHVXOWLVZULWWHQLQWKH
GHVWLQDWLRQILOHEHJLQQLQJDW1(YHU\WLPHWKHUXQJLVVFDQQHG
WKHUHDIWHUWKHQH[WIRXUZRUGVDUHFDOFXODWHGDQGWKHUHVXOWZULWWHQ
WRWKHGHVWLQDWLRQILOH7KHSURFHVVRUUHTXLUHVDWRWDORIVFDQV
OHQJWK PRGH WRFRPSOHWHWKHLQVWUXFWLRQ
Logical OR Example:
FAL
FILE ARITH/LOGICAL EN
Control R6:4
Length 6 DN
Position 0
Mode 2
Destination #B5:24 ER
Expression
#I:000 OR #B3:6
$IWHUUXQJJRHVWUXHWKHSURFHVVRUSHUIRUPVDORJLFDORURSHUDWLRQRQ
WZRZRUGVEHJLQQLQJDW,DQG%7KHUHVXOWLVZULWWHQLQWKH
GHVWLQDWLRQILOHEHJLQQLQJDW%(YHU\WLPHWKHUXQJLVVFDQQHG
WKHUHDIWHUWKHQH[WWZRZRUGVDUHFDOFXODWHGDQGWKHUHVXOWZULWWHQWR
WKHGHVWLQDWLRQILOH7KHSURFHVVRUUHTXLUHVDWRWDORIVFDQV
OHQJWK PRGH WRFRPSOHWHWKHLQVWUXFWLRQ
7KHSURFHVVRUH[HFXWHVORJLFRSHUDWRUVLQDSUHGHWHUPLQHGRUGHU)RU
PRUHLQIRUPDWLRQDERXWRUGHURIRSHUDWLRQVVHHFKDSWHU
Description: 7KH)6&LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWFRPSDUHVYDOXHVLQ
FSC
VRXUFHILOHVZRUGE\ZRUGIRUWKHORJLFDORSHUDWLRQV\RXVSHFLI\LQ
FILE SEARCH/COMPAR EN
WKHH[SUHVVLRQ:KHQWKHSURFHVVRUILQGVWKHVSHFLILHGFRPSDULVRQLV
Control WUXHLWVHWVWKHIRXQGELW)'DQGUHFRUGVWKHSRVLWLRQ326ZKHUHWKH
Length
Position
DN WUXHFRPSDULVRQZDVIRXQG7KHLQKLELWELW,1LVVHWWRSUHYHQWDQ\
Mode IXUWKHUVHDUFKLQJRIWKHILOHV
Expression ER
<RXUODGGHUSURJUDPPXVWH[DPLQHWKHIRXQGELW)'DQGWKHSRVLWLRQ
326WRWDNHDSSURSULDWHDFWLRQ5HVHWWKHLQKLELWELW,1VRWKH
LQVWUXFWLRQFDQFRQWLQXH
6HOHFWKRZWKHSURFHVVRUGLVWULEXWHVWKHRSHUDWLRQRYHURQHRUPRUH
SURJUDPVFDQVE\\RXUVHOHFWLRQRILQVWUXFWLRQPRGH)RUPRUH
LQIRUPDWLRQDERXWPRGHVRIILOHRSHUDWLRQVHHFKDSWHU
8VHWKLVLQVWUXFWLRQWRSHUIRUPRSHUDWLRQVVXFKDV
VHWKLJKDQGORZSURFHVVDODUPVIRUPXOWLSOHDQDORJLQSXWV
FRPSDUHEDWFKYDULDEOHVDJDLQVWDUHIHUHQFHILOHEHIRUHVWDUWLQJD
EDWFKRSHUDWLRQ
Enable .EN (bit 15) by a false-to-true rung transition and indicates the instruction
is enabled.
In incremental mode this bit follows the rung condition. In
Numerical and All modes, this bit remains set until the instruction
completes its operation, regardless of the rung condition. The .EN
bit is reset when rung conditions go false, but only after the
instruction has set the .DN bit.
Done .DN (bit 13) after the instruction has operated on the last set of words.
In numerical mode if the instruction is false at completion, it
resets the .DN bit one program scan after the operation is
complete. If the instruction is true at completion, the .DN bit is
reset when the instruction goes false.
Error .ER (bit 11) when the operation generates an overflow. The instruction stops
until the ladder program resets this bit.
When the processor detects an error, the position value stores
the number of the element that faulted.
Found .FD (bit 8) when the processor detects a true comparison. The processor
stops the search and also sets the inhibit .IN bit. The .FD bit is the
output of the FSC instruction.
:LWKWKH)6&LQVWUXFWLRQDPD[LPXPRIFKDUDFWHUVRIWKH
H[SUHVVLRQFDQEHGLVSOD\HG,IWKHH[SUHVVLRQ\RXHQWHULVQHDUWKLV
FKDUDFWHUPD[LPXPZKHQ\RXDFFHSWWKHUXQJFRQWDLQLQJWKH
LQVWUXFWLRQWKHSURFHVVRUPD\H[SDQGLWEH\RQGFKDUDFWHUV:KHQ
\RXWU\WRHGLWWKHH[SUHVVLRQRQO\WKHILUVWFKDUDFWHUVDUH
GLVSOD\HGDQGWKHUXQJLVGLVSOD\HGDVDQHUURUUXQJ7KHSURFHVVRU
GRHVFRQWDLQWKHFRPSOHWHH[SUHVVLRQKRZHYHUDQGWKHLQVWUXFWLRQ
UXQVSURSHUO\
7RZRUNDURXQGWKLVGLVSOD\SUREOHPH[SRUWWKHSURFHVVRUPHPRU\
ILOHDQGPDNH\RXUHGLWVLQWKH3&WH[WILOH7KHQLPSRUWWKLVWH[W
ILOH6HH\RXUSURJUDPPLQJPDQXDOIRUPRUHLQIRUPDWLRQRQ
LPSRUWLQJH[SRUWLQJSURFHVVRUPHPRU\ILOHV
7KHIROORZLQJWLPLQJGLDJUDPIRU$OOPRGHVKRZVUHODWLRQVKLSV
EHWZHHQVWDWXVELWVDQGLQVWUXFWLRQH[HFXWLRQZKHQWKHLQVWUXFWLRQ
ILQGVWZRWUXHFRQGLWLRQV
Scan Markers
Only
1 Scan
Rung Condition
Instruction Execution
Comparison Found
)RU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VVRUVWRSVWKH
VHDUFKDQGWXUQVRQWKHIRXQG)'DQGLQKLELW,1ELWVVR\RXUODGGHU
SURJUDPFDQWDNHDSSURSULDWHDFWLRQ7RFRQWLQXHWKHVHDUFK
FRPSDULVRQ\RXPXVWWXUQRIIWKH,1ELW
Description: 7KH&23LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWFRSLHVWKHYDOXHVLQ
COP WKHVRXUFHILOHLQWRWKHGHVWLQDWLRQILOH7KHVRXUFHUHPDLQV
COPY FILE XQFKDQJHG7KH&23LQVWUXFWLRQGRHVQRWXVHVWDWXVELWV,I\RXQHHG
Source DQHQDEOHELWSURJUDPDSDUDOOHORXWSXWWKDWXVHVDVWRUDJHDGGUHVV
Destination
Length 7KH&23LQVWUXFWLRQGRHVQRWZULWHRYHUILOHERXQGDULHV$Q\
RYHUIORZGDWDLVORVW$OVRQRGDWDFRQYHUVLRQRFFXUVLIWKHVRXUFH
DQGGHVWLQDWLRQILOHVDUHGLIIHUHQWGDWDW\SHVXVHILOHVRIWKHVDPHGDWD
W\SHIRUHDFK
,IWKHGHVWLQDWLRQLVLQDILOHRIZRUGVVXFKDVDQLQWHJHUILOH\RX
VSHFLI\WKHOHQJWKLQZRUGV,IWKHGHVWLQDWLRQLVLQDILOHRIVWUXFWXUHV
VXFKDVDFRXQWHUILOH\RXVSHFLI\WKHOHQJWKLQVWUXFWXUHV)RU
H[DPSOHLIWKHVRXUFHLVLQDQLQWHJHUILOHWKHGHVWLQDWLRQLVLQD
FRXQWHUILOHDQG\RXVSHFLI\DOHQJWKRILQWHJHUZRUGVDUH
FRSLHGLQWRFRXQWHUVWUXFWXUHV
Entering Parameters
7RSURJUDPWKH&23LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJ
Parameter: Definition:
Source the starting address of the source file. The source remains unchanged.
Destination address of the destination file. The instruction writes over any data
already stored at the destination.
$77(17,21 ,I\RXXVHWKH&23LQVWUXFWLRQZLWK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IWKHGHVWLQDWLRQLVLQDILOHRIVWUXFWXUHV
VXFKDVDFRXQWHUILOH\RXVSHFLI\WKHOHQJWKLQVWUXFWXUHV)RU
H[DPSOHLIWKHVRXUFHZRUGLVDQLQWHJHUILOHWKHGHVWLQDWLRQLVLQD
FRXQWHUILOHDQG\RXVSHFLI\DOHQJWKRIWKHVRXUFHZRUGLVFRSLHG
WLPHVWRILOOWKHFRXQWHUVWUXFWXUHV
7KH)//LQVWUXFWLRQLVOHYHOVHQVLWLYH
Entering Parameters
7RSURJUDPWKH)//LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJ
Parameter: Definition:
Source the address of the source word or a program constant. The source
remains unchanged.
Destination the starting address of the destination file. The instruction writes over
any data already stored at the destination.
$77(17,21 ,I\RXXVHWKH)//LQVWUXFWLRQZLWKDQ
(QKDQFHG3/&SURFHVVRUVHULHV$'ILOHERXQGDULHV
PLJKWEHFRPHFURVVHGLIWKHGHVWLQDWLRQSDUDPHWHULV
LQGLUHFWO\DGGUHVVHG
,IWKHLQGLUHFWDGGUHVVLVZULWWHQWRWKHSURJUDPDUHD
WKH(QKDQFHG3/&SURFHVVRUVHULHV$'GLVSOD\V
PDMRUIDXOWFRGHEDGXVHUSURJUDPFKHFNVXP,I
WKHLQGLUHFWDGGUHVVLVZULWWHQRXWVLGHRIWKHSURJUDP
DUHDXQH[SHFWHGUHVXOWVFRXOGRFFXU
,I\RXXVHWKH)//LQVWUXFWLRQZLWKDQ(QKDQFHG
3/&SURFHVVRUVVHULHV(DQGKLJKHUWKLVFRQGLWLRQLV
FRUUHFWO\LGHQWLILHGE\HLWKHUPDMRUIDXOWFRGH
LQGLUHFWDGGUHVVRXWRIUDQJHKLJKRUPDMRUIDXOW
FRGH LQGLUHFWDGGUHVVRXWRIUDQJHORZ
Example:
I:012 FLL
[
[ FILL FILE
10
Source N7:0
Destination #N12:0
Length 5
If input word 12, bit 10 is on, copy the value
of word N7:0 into the first five words
starting at N12:0
:RUGVDUHFRSLHGIURPWKHVSHFLILHGVRXUFHILOHLQWRWKHVSHFLILHG
GHVWLQDWLRQILOHHYHU\VFDQWKDWWKHUXQJLVWUXH7KH\DUHFRSLHGLQ
DVFHQGLQJRUGHUZLWKQRWUDQVIRUPDWLRQRIGDWDXSWRWKHVSHFLILHG
QXPEHURUXQWLOWKHODVWZRUGRIWKHGHVWLQDWLRQILOHLVUHDFKHG
ZKLFKHYHURFFXUVILUVW
$FFXUDWHO\VSHFLI\WKHVWDUWLQJDGGUHVVDQGOHQJWKRIWKHGDWDEORFN
\RXDUHILOOLQJ7KHLQVWUXFWLRQZLOOQRWZULWHRYHUDILOHERXQGDU\
VXFKDVEHWZHHQILOHV1DQG1DWWKHGHVWLQDWLRQ7KHRYHUIORZ
ZRXOGEHORVW
1RWHV
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: %RWKWKH)%&DQG''7LQVWUXFWLRQVFRPSDUHELWVLQDILOHRIUHDOWLPH
FBC
PDFKLQHRUSURFHVVYDOXHVLQSXWILOHZLWKELWVLQDUHIHUHQFHILOH
FILE BIT COMPARE EN GHWHFWGHYLDWLRQVDQGUHFRUGPLVPDWFKHGELWQXPEHUV7KHVH
Source DN LQVWUXFWLRQVUHFRUGWKHSRVLWLRQRIHDFKPLVPDWFKIRXQGDQGSODFHWKLV
Reference
Result
FD LQIRUPDWLRQLQWKHUHVXOWILOH,IQRPLVPDWFKHVDUHIRXQGWKH'1ELW
Compare Control
Length
IN
LVVHWEXWWKHUHVXOWILOHUHPDLQVXQFKDQJHG
ER
Position
Result control 7KHGLIIHUHQFHEHWZHHQWKH''7DQG)%&LQVWUXFWLRQLVWKDWHDFK
Length
Position
WLPHWKH''7LQVWUXFWLRQILQGVDPLVPDWFKWKHSURFHVVRUFKDQJHVWKH
UHIHUHQFHELWWRPDWFKWKHVRXUFHELW7KH)%&LQVWUXFWLRQGRHVQRW
FKDQJHWKHUHIHUHQFHELW8VHWKH''7LQVWUXFWLRQWRXSGDWH\RXU
UHIHUHQFHILOHWRUHIOHFWFKDQJLQJPDFKLQHRUSURFHVVFRQGLWLRQV
:KHQWKHLQVWUXFWLRQUHDFKHVWKHHQGRIWKHILOHWKHGRQHELWELW
'1RIWKHFRPSDUHFRQWUROHOHPHQWLVVHW7KHQZKHQWKHUXQJJRHV
IDOVHWKHLQVWUXFWLRQUHVHWV
HQDEOHELW
IRXQGELWLIVHW
FRPSDUHGRQHELW
UHVXOWGRQHELWLIVHW
ERWKFRQWUROFRXQWHUV
7RHQDEOHWKLVPRGHRIRSHUDWLRQVHWWKHLQKLELWELW,1 HLWKHUE\
ODGGHUSURJUDPRUPDQXDOO\EHIRUHSURJUDPH[HFXWLRQ
Entering Parameters
7RSURJUDPWKHVHLQVWUXFWLRQV\RXQHHGWRSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJLQIRUPDWLRQ
Parameter: Description:
Reference the indexed address of the file that contains the data with which you
compare your input file.
Result the indexed address of the file where the instruction stores the position
(bit) number of each detected mismatch.
Cmp Control the address of the comparison control structure (R) that stores status
bits, the length of the source and reference files (both should be the
same), and the current position during operation. Use the compare
control address with mnemonic when you address these parameters:
Length (.LEN) is the decimal number of bits to be compared in the
source and reference files. Remember that bits in I/O files are
numbered in octal 00-17, but that bits in all other files are numbered in
decimal 0-15.
Position (.POS) is the current position of the bit to which the instruction
points. Enter a value only if you want the instruction to start at an
offset concurrent with a control file offset for one scan.
Result Control the address of the result control structure (R) that stores the bit
position number each time the instruction finds a mismatch between
source and reference files.
8VHWKHUHVXOWFRQWURODGGUHVVZLWKPQHPRQLFZKHQ\RXDGGUHVV
WKHVH SDUDPHWHUV
/HQJWK/(1LVWKHGHFLPDOQXPEHURIHOHPHQWVLQWKHUHVXOW
ILOH0DNHWKHOHQJWKORQJHQRXJKWRUHFRUGWKHPD[LPXP
QXPEHURIH[SHFWHGPLVPDWFKHV
3RVLWLRQ326LVWKHFXUUHQWSRVLWLRQLQWKHUHVXOWILOH(QWHUD
YDOXHRQO\LI\RXZDQWWKHLQVWUXFWLRQWRVWDUWDWDQRIIVHW
FRQFXUUHQWZLWKDFRQWUROILOHRIIVHWIRURQHVFDQ
$77(17,21 'RQRWXVHWKHVDPHDGGUHVVIRUPRUH
WKDQRQHFRQWUROVWUXFWXUH'XSOLFDWLRQRIWKHVH
DGGUHVVHVFRXOGUHVXOWLQXQSUHGLFWDEOHRSHUDWLRQ
SRVVLEO\FDXVLQJHTXLSPHQWGDPDJHDQGRULQMXU\WR
SHUVRQQHO
Bit: Function:
Comparison Enable .EN (bit 15) starts operation on a false-to-true rung transition
Control Bits If the .IN bit is set for one-at-a-time operation, the ladder program
must toggle the .EN bit after the instruction detects each mismatch.
Done .DN (bit 13) is set when the processor reaches the end of the source and reference files
Error .ER (bit 11) is set when the processor detects an error and stops operation of
the instruction
For example, an error occurs if the length (.LEN) is less than or equal to zero
or if the position (.POS) is less than zero. The ladder program must reset the
.ER bit if the instruction detects an error.
Found .FD (bit 08) is set each time the processor records a mismatch bit number in the result file
(one-at-a-time operation) or after recording all mismatches (all per scan).
Result Done .DN (bit 13) is set when the result file fills
Control Bits The instruction stops and requires another false-to-true rung transition to
reset the result .DN bit and then continue. If the instruction finds another
mismatch, it wraps the new position number around to the beginning of the
file, writing over previous position numbers.
$IWHUWKH)%&RU''7LQVWUXFWLRQVHWVWKHFRPSDUH'1ELWWKH
LQVWUXFWLRQLVUHVHWZKHQWKHUXQJ¶VLQSXWFRQGLWLRQVJRIDOVH7KH
LQVWUXFWLRQUHVHWVLWVVWDWXVELWVDQGERWKFRQWUROHOHPHQWV
Example: 7KH''7LQVWUXFWLRQDERYHFRPSDUHVWKHELWVLQWKHVRXUFHILOH
DDT ,ZLWKWKHELWVLQWKHUHIHUHQFHILOH%UHFRUGLQJWKH
DIAGNOSTIC DETECT EN PLVPDWFKHGELWSRVLWLRQVLQWKHUHVXOWILOH1
Source #I:030 DN
Reference #B3:0
Result #N10:0 FD
Compare control R6:0 IN
Length 48
Position 0 ER
Result control R6:1
Length 10
Position 0
bit 40 bit32
9
The FBC and DDT instructions detect mismatches and record their locations by bit number in a result file.
1
The DDT instruction changes the status of the corresponding bit in the reference file to match the input file
when it detects a mismatch.
2
The length of the result file is the length that you enter for RESULT CONTROL.
16657a
,PSRUWDQW 7KH)%&DQG''7LQVWUXFWLRQVPD\FDXVHDQ\
(QKDQFHG3/&SURFHVVRUWRIDXOWLIWKHLQGH[HG
DGGUHVVLQJRIIVHWFRQWDLQVDYDOXHWKDWH[FHHGVGDWD
WDEOHERXQGDULHV7RZRUNDURXQGWKLVDGGDODGGHU
UXQJWKDWFOHDUV6LQGH[HGDGGUHVVLQJRIIVHW
LPPHGLDWHO\EHIRUHDQ)%&RU''7LQVWUXFWLRQ
CLR
Clear
Destination S:24
FBC
EN
Source #I0:30
Reference #B3:0 DN
Result #N10:0 FD
Compare Control R6:0
or Length 48 IN
Position 0
ER
Result Control R6:1
Length 10
Position 0
DDT
EN
Source #I0:30
Reference #B3:0 DN
Result #N10:0 FD
Compare Control R6:0
Length 48 IN
Position 0
ER
Result Control R6:1
Length 10
Position 0
Description: 7KH'75LQVWUXFWLRQFRPSDUHVDVRXUFHZRUGWKURXJKDPDVNZLWKD
DTR UHIHUHQFHZRUG7KHLQVWUXFWLRQDOVRZULWHVWKHVRXUFHZRUGLQWRWKH
DATA TRANSITION UHIHUHQFHDGGUHVVIRUWKHQH[WFRPSDULVRQ7KHVRXUFHZRUGUHPDLQV
Source XQFKDQJHG
Mask
Reference :KHQWKHPDVNHGVRXUFHGLIIHUVIURPWKHUHIHUHQFHWKHLQVWUXFWLRQ
JRHVWUXHIRURQO\RQHVFDQ7KHSURFHVVRUZULWHVWKHPDVNHGVRXUFH
YDOXHLQWRWKHUHIHUHQFHDGGUHVV:KHQWKHPDVNHGVRXUFHDQGWKH
UHIHUHQFHDUHWKHVDPHWKHLQVWUXFWLRQUHPDLQVIDOVH
$77(17,21 2QOLQHSURJUDPPLQJZLWKWKLV
LQVWUXFWLRQFDQEHGDQJHURXV,IWKHGHVWLQDWLRQYDOXHLV
GLIIHUHQWIURPWKHVRXUFHYDOXHWKHLQVWUXFWLRQJRHVWUXH
8VHFDXWLRQLI\RXLQVHUWWKLVLQVWUXFWLRQZKHQWKH
SURFHVVRULVLQ5XQRU5HPRWH5XQPRGH
Entering Parameters
7RSURJUDPWKH'75LQVWUXFWLRQ\RXQHHGWRSURYLGHWKHSURFHVVRU
ZLWKWKHIROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Mask the hexadecimal value or address that contains the mask value
15 08 07 00 15 08 07 00
Source Word
1 8 3 I:002 1 8 7
15 08 07 00 15 08 07 00
Mask Value
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0FFF 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
15 08 07 00 15 08 07 00
Current Current
Scan 1 8 3 Reference Word 1 8 7 Scan
N63:11
Previous 1 8 3 1 8 3 Previous
Scan Scan
Rung remains false as long as Rung goes true for one scan
input value does not change when change is detected 13385
1RWHV
If You Use a Shift Register for: Data in the Shift Register Could Represent:
Tracking parts through an assembly line Part types, quality, size, and status
7DEOH$OLVWVWKHDYDLODEOHVKLIWLQVWUXFWLRQV
Table 11.A
Available Shift Instructions
Load bits into, shift bits through, and unload bits from a bit array one bit at BSL, BSR 11-2
a time, such as for tracking bottles through a bottling line where each bit
represents a bottle
Load and unload values in the same order, such as for tracking parts FFL, FFU 11-5
through an assembly line where parts are represented by values that have
a part number and assembly code
Load and unload values in reverse order, such as tracking stacked LFL, LFU * 11-8
inventory in a warehouse, where goods are represented by serial number
and inventory codes
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: %LWVKLIWLQVWUXFWLRQVVKLIWDOOELWVZLWKLQWKHVSHFLILHGDGGUHVV
BSL
RQHELWSRVLWLRQZLWKHDFKIDOVHWRWUXHUXQJWUDQVLWLRQ7KHVH
BIT SHIFT LEFT EN LQVWUXFWLRQVDUH
File
Control DN
%LW6KLIW/HIW%6/
Bit address
Length %LW6KLIW5LJKW%65
Entering Parameters
7RSURJUDPDELWVKLIWLQVWUXFWLRQ\RXQHHGWRSURYLGHWKHSURFHVVRU
ZLWKWKHIROORZLQJLQIRUPDWLRQ
Parameter: Definition:
File the address of the bit array you want to manipulate. You must start the
array at a 16-bit word boundary. For example, use bit 0 of word number
1, 2, 3, etc. You can end the array at any bit number up to 15,999.
However, you cannot use the remaining bits in that particular element
because the instruction invalidates them.
Control The address of the control structure (48 bits – three 16-bit words) in the
control area (R) of memory that stores the instruction’s status bits, the
size of the array (number of bits), and the bit pointer.
Position the current position of the bit to which the instruction points. Enter a
value only if you want the instruction to start at an offset concurrent with
a control file offset for one scan. Use the control address with mnemonic
when you address this parameter.
Bit Address the address of the source bit. The instruction inserts the status of this bit
in either the first (lowest) bit position (for the BSL instruction) or the last
(highest) bit position (for the BSR instruction) in the array.
Length the decimal number of bits to be shifted. Remember that bits in I/O files
are numbered in octal 00-17, but that bits in all other files are numbered
in decimal 0-15. Use the control address with mnemonic when you
address this parameter.
$77(17,21 'RQRWXVHWKHVDPHFRQWURODGGUHVVIRU
PRUHWKDQRQHLQVWUXFWLRQ8QH[SHFWHGRSHUDWLRQFRXOG
UHVXOWLQSRVVLEOHHTXLSPHQWGDPDJHDQGRUSHUVRQDO
LQMXU\
Bit: Definition:
Enable .EN (bit 15) is set when the rung makes a false-to-true rung transition to
indicate the instruction is enabled.
Done .DN (bit 13) is set to indicate that the bit array shifted one bit position
Error .ER (bit 11) is set to indicate that the instruction detected an error, such as if
you entered a negative file length
,PSRUWDQW :KHQHQDEOHGWKHELWSRLQWHULVVHWWRWKHYDOXHRIWKH
OHQJWKWKHELWDUUD\LVVKLIWHG$IWHUDOORIWKHELWVDUH
VKLIWHGWKHLQVWUXFWLRQUHVHWVWKH(1(5DQG'1ELWV
DQGWKHELWSRLQWHUZKHQLQSXWFRQGLWLRQVJRIDOVH
invalid 73 64
Unload Bit
L
95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
16658
Bit Address (I:022/12) The location of the source bit (bit 12 of input word 22)
:KHQDUXQJFRQWDLQLQJWKH%6/LQVWUXFWLRQJRHVIURPIDOVHWRWUXH
WKHSURFHVVRUVHWVWKH(1ELW7KHQWKHSURFHVVRUVKLIWVELWVLQELW
ILOH%VWDUWLQJZLWKELWWRWKHOHIWKLJKHUELWQXPEHURQHELW
SRVLWLRQ7KHODVWELWVKLIWVRXWDWELWSRVLWLRQLQWRWKH8/ELW7KH
VSHFLILHGVRXUFHELWELWRILQSXWZRUGVKLIWVLQWRWKHILUVWELW
SRVLWLRQELWRIELWILOH%
$IWHUWKHSURFHVVRUFRPSOHWHVWKHVKLIWRSHUDWLRQLQRQHSURJUDP
VFDQZKHQWKHUXQJJRHVIDOVHWKHLQVWUXFWLRQUHVHWVWKH(1(5LI
VHWDQG'1ELWVDQGUHVHWVWKHSRLQWHU
)RUZUDSDURXQGRSHUDWLRQPDNHWKHVRXUFHDGGUHVVWKHVDPHDVWKH
KLJKHVWRXWJRLQJELWDGGUHVV<RXFDQRPLWXVLQJWKH8/ELWLQ
ZUDSDURXQGRSHUDWLRQ
95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
16659
Bit Address (I:023/06) The source bit address (bit 06 in input word 23)
:KHQDUXQJFRQWDLQLQJWKH%65LQVWUXFWLRQJRHVIURPIDOVHWRWUXH
WKHSURFHVVRUVHWVWKH(1ELW7KHQWKHSURFHVVRUVKLIWVELWVLQELW
ILOH%WRWKHULJKWWRDORZHUELWQXPEHURQHELWSRVLWLRQVWDUWLQJ
ZLWKWKHKLJKHVWELWSRVLWLRQ7KHORZHVWELWELWVKLIWVRXWRI
WKHELWDUUD\LQWRWKH8/ELW7KHVSHFLILHGVRXUFHELWRILQSXW
ZRUGVKLIWVLQWRWKHKLJKHVWELWSRVLWLRQ
$IWHUWKHSURFHVVRUFRPSOHWHVWKHVKLIWRSHUDWLRQLQRQHSURJUDP
VFDQZKHQWKHUXQJJRHVIDOVHWKHLQVWUXFWLRQUHVHWVWKH(1(5
LI VHWDQG'1ELWVDQGUHVHWVWKHSRLQWHU
)RUZUDSDURXQGRSHUDWLRQPDNHWKHVRXUFHDGGUHVVWKHVDPHDVWKH
ORZHVWRXWJRLQJELWDGGUHVV<RXFDQRPLWXVLQJWKH8/ELWLQ
ZUDSDURXQGRSHUDWLRQ
FFU LFL and LFU * In reverse of the order stored (last in, first out)
FIFO UNLOAD EU
* Available in Enhanced PLC-5 processors only
FIFO
Destination DN
Control
Length
:KHQXVHGLQSDLUVWKHVHLQVWUXFWLRQVHVWDEOLVKDQDV\QFKURQRXVVKLIW
Position
EM UHJLVWHUVWDFN
Entering Parameters
:KHQ\RXSURJUDPD),)2RU/,)2VWDFNXVHWKHVDPHILOHDQG
FRQWURODGGUHVVHVOHQJWKDQGSRVLWLRQYDOXHVIRUERWKLQVWUXFWLRQVLQ
WKHSDLU<RXQHHGWRSURYLGHWKHSURFHVVRUZLWKWKHIROORZLQJ
LQIRUPDWLRQ
6RXUFHLVWKHDGGUHVVWKDWVWRUHVWKH³QH[WLQ´YDOXHWRWKH
VWDFN7KH),)2RU/,)2ORDGLQVWUXFWLRQ))/RU/)/UHWULHYHV
WKHYDOXHIURPWKLVDGGUHVVDQGORDGVLWLQWRWKHQH[WZRUGLQ
WKHVWDFN
'HVWLQDWLRQLVWKHDGGUHVVWKDWVWRUHVWKHYDOXHWKDWH[LWVIURP
WKHVWDFN
),)2RU/,)2LVDQLQGH[HGDGGUHVVRIWKHVWDFN8VHWKH
VDPH),)2DGGUHVVIRUWKHDVVRFLDWHG))/DQG))8
LQVWUXFWLRQVXVHWKHVDPH/,)2DGGUHVVIRUWKHDVVRFLDWHG
/)/DQG/)8LQVWUXFWLRQV
&RQWUROLVWKHDGGUHVVRIWKHFRQWUROVWUXFWXUHELWV±WKUHH
ELWZRUGVLQWKHFRQWURODUHD5RIPHPRU\7KHFRQWURO
VWUXFWXUHVWRUHVWKHLQVWUXFWLRQ¶VVWDWXVELWVVWDFNOHQJWKDQG
QH[WDYDLODEOHSRVLWLRQSRLQWHULQWKHVWDFN
8VHWKHFRQWURODGGUHVVZLWKPQHPRQLFZKHQ\RXDGGUHVVWKH
IROORZLQJSDUDPHWHUV
/HQJWK/(1LVWKHPD[LPXPQXPEHURIHOHPHQWVLQ
WKH VWDFN
3RVLWLRQ326LQGLFDWHVWKHQH[WDYDLODEOHORFDWLRQZKHUH
WKHLQVWUXFWLRQORDGVGDWDLQWRWKHVWDFN
/HQJWKVSHFLILHVWKHPD[LPXPQXPEHURIZRUGVLQWKHVWDFN
$GGUHVVWKHOHQJWKYDOXHE\PQHPRQLF/(1
3RVLWLRQLQGLFDWHVWKHQH[WDYDLODEOHORFDWLRQZKHUHWKH
LQVWUXFWLRQORDGVGDWDLQWRWKHVWDFN$GGUHVVWKHSRVLWLRQYDOXH
E\PQHPRQLF326
(QWHUDSRVLWLRQYDOXHRQO\LI\RXZDQWWKHLQVWUXFWLRQWRVWDUWDW
DQRIIVHWDWSRZHUXS2WKHUZLVHHQWHU<RXUODGGHUSURJUDP
FDQFKDQJHWKHSRVLWLRQLIQHFHVVDU\
$77(17,21 ([FHSWZKHQSDLULQJVWDFN
LQVWUXFWLRQVGRQRWXVHWKHVDPHFRQWURODGGUHVVIRUDQ\
RWKHULQVWUXFWLRQ8QH[SHFWHGRSHUDWLRQFRXOGUHVXOW
ZLWKSRVVLEOHHTXLSPHQWGDPDJHDQGRUSHUVRQDOLQMXU\
Enable Load .EN (bit 15) when the rung makes a false-to-true rung transition to
indicate the instruction is enabled (used in FFL and LFL
instructions).
Note: During prescan, this bit is set to prevent a false load
when the program scan begins.
Enable Unload .EU (bit 14) when rung conditions are true to indicate the instruction is
enabled (used in FFU and LFU instructions).
Note: During prescan, this bit is set to prevent a false
unload when the program scan begins.
Done .DN (bit 13) by the processor to indicate that the stack is full. The .DN
bit inhibits loading the stack until there is room.
Empty .EM (bit 12) by the processor to indicate that the stack is empty. Do not
enable the FIFO or LIFO unload commands if the .EM bit is
set.
16660a
:KHQWKHVWDFNEHFRPHVHPSW\WKHSURFHVVRUVHWVWKH(0ELW
7KHUHDIWHUWKHSURFHVVRUWUDQVIHUVD]HURYDOXHIRUHDFKIDOVHWRWUXH
UXQJWUDQVLWLRQXQWLOWKH))/LQVWUXFWLRQORDGVQHZYDOXHV<RXU
ODGGHUSURJUDPVKRXOGGHWHFWWKDWWKHVWDFNLVHPSW\DQGLQKLELWRWKHU
LQVWUXFWLRQVIURPXVLQJ]HURYDOXHVVWRUHGDWWKHGHVWLQDWLRQ
:LWKD))8LQVWUXFWLRQ\RXFDQXQORDGGDWDIURPDZRUGRWKHUWKDQ
WKHILUVWZRUGRIWKHVWDFNE\FKDQJLQJWKH),)2DGGUHVVWRWKH
DGGUHVVRIWKHGHVLUHGZRUGDQGFKDQJLQJWKHOHQJWKDFFRUGLQJO\
LFL
File #N70:3
LIFO LOAD
Word
EN
Source N70:1 3
LIFO #N70:3 DN 4
Control R6:61
Length
5
64
Position 0 EM 6
7
LFU 8
LIFO UNLOAD EU
9 64 words allocated for
LIFO #N70:3 10 LIFO stack at #N70:3
Destination N70:2 DN 11
Control R6:61 SOURCE N70:1 DESTINATION N70:2
Length 64
Position 0 EM
,PSRUWDQW 7KHGLIIHUHQFHEHWZHHQ),)2DQG/,)2VWDFNRSHUDWLRQ
LVWKDWWKH/)8LQVWUXFWLRQUHPRYHVGDWDLQWKHUHYHUVH
RUGHUWRWKHRUGHULWLVORDGHGODVWLQILUVWRXW
2WKHUZLVH/,)2LQVWUXFWLRQVRSHUDWHLGHQWLFDOWR
),)2 LQVWUXFWLRQV
1RWHV
6HTXHQFHULQVWUXFWLRQVFDQFRQVHUYHSURJUDPPHPRU\7KHVH
LQVWUXFWLRQVPRQLWRUDQGFRQWUROPXOWLSOHVRIGLVFUHWHRXWSXWVDWD
WLPHLQDVLQJOHUXQJ
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: 8VHWKH64,DQG642LQVWUXFWLRQVLQSDLUVWRUHVSHFWLYHO\PRQLWRU
DQGFRQWURODVHTXHQWLDORSHUDWLRQ8VHWKH64/LQVWUXFWLRQWRORDG
GDWDLQWKHVHTXHQFHUILOH
SQI SQO
SEQUENCER OUTPUT EN SQL
SEQUENCER INPUT
File SEQUENCER LOAD EN
File
Mask Mask DN File
Source Destination Source
DN
Control Control Control
Length Length Length
Position Position Position
7KHVHLQVWUXFWLRQVRSHUDWHRQPXOWLSOHVRIELWVDWDWLPH3ODFH64,
LQVWUXFWLRQVLQVHULHVDQG642LQVWUXFWLRQVLQSDUDOOHOLQWKHVDPH
UXQJIRURURWKHUELWRSHUDWLRQV
,PSRUWDQW (DFK642LQVWUXFWLRQLQFUHPHQWVWKHFRQWUROVWUXFWXUH
VRFRUUHVSRQGLQJ64,LQVWUXFWLRQVPD\PLVVSDUWVRIWKH
VRXUFHILOH
Entering Parameters
:KHQSURJUDPPLQJ64,DQG642LQVWUXFWLRQVLQSDLUVXVHWKHVDPH
FRQWURODGGUHVVOHQJWKYDOXHDQGSRVLWLRQYDOXHLQHDFKLQVWUXFWLRQ
7KHVDPHDSSOLHVZKHQXVLQJPXOWLSOHLQVWUXFWLRQVLQWKHVDPHUXQJ
WRGRXEOHWULSOHRUIXUWKHULQFUHDVHWKHQXPEHURIELWV
7RSURJUDPVHTXHQFHULQVWUXFWLRQV\RXQHHGWRSURYLGHWKHSURFHVVRU
ZLWKWKHIROORZLQJLQIRUPDWLRQ
)LOHLVWKHLQGH[HGDGG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LRQLQWKHVHTXHQFHUILOH7KHSRVLWLRQ
YDOXHLVLQFUHPHQWHGLQWHUQDOO\E\642DQG64/LQVWUXFWLRQV
,PSRUWDQW <RXUODGGHUSURJUDPFDQH[WHUQDOO\LQFUHPHQWWKH
SRVLWLRQYDOXHRIWKH64,LQVWUXFWLRQ2QHZD\WRGRWKLV
LVWRSDLULWZLWKWKH642LQVWUXFWLRQDQGDVVLJQWKH
VDPHFRQWUROVWUXFWXUHWRERWKLQVWUXFWLRQV
,QHDUOLHUVHULHVSURFHVVRUVLIWKH326YDOXHZDVRXWRIUDQJH
WKH326YDOXHZDVDXWRPDWLFDOO\VHWWRZKLFKLVWKHILUVWVWHS
LQWKHVHTXHQFH7KHUHZDVQRLQGLFDWLRQWKDWWKLVRFFXUUHG,Q
VHULHV(DQGODWHUSURFHVVRUVLIWKH326YDOXHH[FHHGVWKH
QXPEHURIZRUGVLQWKHILOHWKH(5ELWLVVHWQRGDWDLVZULWWHQ
DQGWKH326YDOXHUHPDLQVWKHVDPH
Enable .EN (bit 15) (SQO or SQL) is set on a false-to-true rung transition to indicate
that the instruction is enabled. The instruction follows the rung
condition.
Note: During prescan, this bit is set to prevent a false increment of
the table pointer when the program scan begins.
Done .DN (bit 13) (SQO or SQL) is set after the instruction finishes operating on the
last word in the sequencer file. After the rung goes false, the
processor resets the .DN bit on the next false-to-true rung
transition.
Error .ER (bit 11) when the length value is less than or equal to zero or when the
position value is less than zero
17 10 07 00
00 00 11 11 00 00 11 11
Mask
Value
0F0F
17 10 07 00
Destination O:014 00 00 01 01 00 00 10 10
0
1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
SQO instruction moves the data of the current step through a mask to an output word for controlling
multiple outputs. 16645a
7KH642LQVWUXFWLRQVWHSVWKURXJKWKHVHTXHQFHUILOHRIELWRXWSXW
ZRUGVZKRVHELWVKDYHEHHQVHWWRFRQWUROYDULRXVRXWSXWGHYLFHV
:KHQWKHUXQJJRHVIURPIDOVHWRWUXHWKHLQVWUXFWLRQLQFUHPHQWVWR
WKHQH[WVWHSZRUGLQWKHVHTXHQFHUILOH17KHGDWDLQWKH
VHTXHQFHUILOHLVWUDQVIHUUHGWKURXJKDIL[HGPDVN))WRWKH
GHVWLQDWLRQDGGUHVV2&XUUHQWGDWDLVZULWWHQWRWKHGHVWLQDWLRQ
HOHPHQWHYHU\VFDQWKDWWKHUXQJUHPDLQVWUXH
$WVWDUWXSZKHQ\RXVZLWFKWKHSURFHVVRUIURP3URJUDPPRGHWR
5XQPRGHLQVWUXFWLRQRSHUDWLRQGHSHQGVRQZKHWKHUWKHUXQJLVWUXH
RUIDOVHRQWKHILUVWVFDQ
,IWKHUXQJLVWUXHDQG326 WKHLQVWUXFWLRQWUDQVIHUVGDWDLQ
VWHS
,IUXQJLVIDOVHWKHLQVWUXFWLRQZDLWVIRUWKHILUVWIDOVHWRWUXHUXQJ
WUDQVLWLRQDQGWUDQVIHUVGDWDLQVWHS
$IWHUWUDQVIHUULQJWKHODVWZRUGRIWKHVHTXHQFHUILOHWKHSURFHVVRU
VHWVWKH'1ELW2QWKHQH[WIDOVHWRWUXHUXQJWUDQVLWLRQWKH
SURFHVVRUUHVHWVWKH'1ELWDQGVHWVWKHSRVLWLRQWRVWHS
S1 MOV
MOVE
15
Source 0
The bit S:1/15 is the "first pass" bit. This bit is set when the processor Dest R6:20.POS
first scans a program. When this rung goes true, the processor moves
the value of 0 to the position word of the SQO instruction. After the
position is set to 0, the next false to true transition will cause the
processor to run step 1.
7KH64,LQVWUXFWLRQFRPSDUHVDILOHRILQSXWLPDJHGDWD,
WKURXJKDPDVN)))WRDILOHRIUHIHUHQFHGDWD1IRU
HTXDOLW\:KHQWKHVWDWXVRIDOOQRQPDVNHGELWVRIWKHZRUGDWWKDW
SDUWLFXODUVWHSPDWFKWKRVHRIWKHFRUUHVSRQGLQJUHIHUHQFHZRUGWKH
LQVWUXFWLRQJRHVWUXH2WKHUZLVHWKHLQVWUXFWLRQLVIDOVH
,PSRUWDQW <RXFDQXVHWKH64,LQVWUXFWLRQZLWKWKHFRQWURO
VWUXFWXUHRIWKH642LQVWUXFWLRQ3URJUDPWKH64,DVWKH
FRQGLWLRQLQVWUXFWLRQLQWKHVDPHUXQJZLWKWKH642
$VVLJQWKHVDPHFRQWURODGGUHVVDQGOHQJWKWRERWK
LQVWUXFWLRQVVRWKH\WUDFNWRJHWKHU
7RH[WHUQDOO\LQFUHPHQWWKHVHTXHQFHUILOHXVHD&37LQVWUXFWLRQWR
PRYHDQHZSRVLWLRQYDOXHLQWRWKH64,LQVWUXFWLRQ¶VFRQWUROHOHPHQW
'RWKLVWRLQFUHPHQWHDFKVWHSLQWKH64,LQVWUXFWLRQ¶VILOH5XQJ
LQFUHPHQWVWKH64,LQVWUXFWLRQ5XQJUHVHWVWKHSRVLWLRQYDOXHDIWHU
VWHSSLQJWKURXJKWKHILOH
SQI ADD
Rung 0
SEQUENCER INPUT ADD
File #N7:0 Source A R6:0.POS
Mask F0FF Source B 1
Source I:005 Destination R6:0.POS
Control R6:0 0
Length 20
Position 0
0
1
2 Destination File #N7:20
3
4 15 08 07 00
Word
5 0
N70:20
6
7
21 1 Sequencer
10 Destination
11 2 File #N7:20
12 22
13 23 00 00 10 10 11 00 11 01 3
14
15 24 4
16 Current Step
17 5
25
Rack 0 I/O Group 2
SQL instruction loads data from the input word into a destination
16661a
file from where it can be moved to other sequencer files.
:KHQWKHUXQJJRHVIURPIDOVHWRWUXHWKH64/LQVWUXFWLRQ
LQFUHPHQWVWRWKHQH[WVWHSLQWKHVHTXHQFHUILOHDQGORDGVGDWDLQWRLW
RQHVWHSIRUHDFKUXQJWUDQVLWLRQ7KH64/LQVWUXFWLRQORDGVFXUUHQW
GDWDHDFKVFDQWKDWWKHUXQJUHPDLQVWUXH$PDVNLVQRWXVHG
$WVWDUWXSZKHQ\RXVZLWFKWKHSURFHVVRUIURP3URJUDPWR5XQ
PRGHWKHLQVWUXFWLRQRSHUDWLRQGHSHQGVRQZKHWKHUWKHUXQJLVWUXHRU
IDOVHRQWKHILUVWVFDQ
,IWKHUXQJLVWUXHWKHLQVWUXFWLRQORDGVGDWDLQWRVWHS
,IWKHUXQJLVIDOVHWKHLQVWUXFWLRQZDLWVIRUWKHILUVWIDOVHWRWUXH
UXQJWUDQVLWLRQDQGORDGVGDWDLQWRVWHS
$IWHUORDGLQJWKHODVWVWHSWKHSURFHVVRUVHWVWKH'1ELW2QWKHQH[W
IDOVHWRWUXHWUDQVLWLRQWKHSURFHVVRUUHVHWVLWV'1ELWUHVHWVWKH
SRVLWLRQWRVWHSDQGORDGVGDWDLQWRWKDWZRUG
1RWHV
Loop through a set of rungs for a preset FOR, NXT, BRK 13-5
number of times
Jump to a separate subroutine file, pass data JSR, SBR, RET 13-8
to the subroutine, perform an operation, and
return the results
Trigger a one-shot event based on a change in ONS, OSR,* OSF* 13-14 (ONS),
rung condition 13-15 (OSR),
13-16 (OSF)
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Description: 8VH0&5LQVWUXFWLRQVLQSDLUVWRFUHDWHSURJUDP]RQHVWKDWWXUQRII
DOOWKHQRQUHWHQWLYHRXWSXWVLQWKH]RQH5XQJVZLWKLQWKH0&5]RQH
MCR DUHVWLOOVFDQQHGEXWVFDQWLPHLVUHGXFHGGXHWRWKHIDOVHVWDWHRI
QRQUHWHQWLYHRXWSXWV1RQUHWHQWLYHRXWSXWVDUHUHVHWZKHQWKHLUUXQJ
JRHVIDOVH
True Executes the rungs in the MCR zone based on each rung’s
individual input conditions (as if the zone did not exist).
0&5]RQHVOHW\RXHQDEOHRULQKLELWVHJPHQWVRI\RXUSURJUDPVXFK
DVIRUUHFLSHDSSOLFDWLRQV
:KHQ\RXSURJUDP0&5LQVWUXFWLRQVQRWHWKDW
<RXPXVWHQGWKH]RQHZLWKDQXQFRQGLWLRQDO0&5LQVWUXFWLRQ
<RXFDQQRWQHVWRQH0&5]RQHZLWKLQDQRWKHU
'RQRWMXPSLQWRDQ0&5]RQH,IWKH]RQHLVIDOVHMXPSLQJLQWR
LWDFWLYDWHVWKH]RQH
,IDQ0&5]RQHFRQWLQXHVWRWKHHQGRIWKHODGGHUSURJUDP\RX
GRQRWKDYHWRSURJUDPDQ0&5LQVWUXFWLRQWRHQGWKH]RQH
,PSRUWDQW 7KH0&5LQVWUXFWLRQLVQRWDVXEVWLWXWHIRUDKDUGZLUHG
PDVWHUFRQWUROUHOD\WKDWSURYLGHVHPHUJHQF\VWRS
FDSDELOLW\<RXVWLOOVKRXOGLQVWDOODKDUGZLUHGPDVWHU
FRQWUROUHOD\WRSURYLGHHPHUJHQF\,2
SRZHU VKXWGRZQ
$77(17,21 'RQRWRYHUODSRUQHVW0&5]RQHV
(DFK0&5]RQHPXVWEHVHSDUDWHDQGFRPSOHWH,I
RYHUODSSHGRUQHVWHGXQSUHGLFWDEOHPDFKLQHRSHUDWLRQ
FRXOGRFFXUZLWKSRVVLEOHGDPDJHWRHTXLSPHQWDQGRU
LQMXU\WRSHUVRQQHO
$77(17,21 ,I\RXVWDUWLQVWUXFWLRQVVXFKDVWLPHUV
RUFRXQWHUVLQDQ0&5]RQHLQVWUXFWLRQRSHUDWLRQFHDVHV
ZKHQWKH]RQHLVGLVDEOHG5HSURJUDPFULWLFDO
RSHUDWLRQVRXWVLGHWKH]RQHLIQHFHVVDU\
Example: :KHQWKHUXQJFRQWDLQLQJWKHILUVW0&5LQVWUXFWLRQLVWUXHWKH
SURFHVVRUH[HFXWHVWKHUXQJVLQWKH0&5]RQHEDVHGRQWKHUXQJ
LQSXWFRQGLWLRQV2WKHUZLVHWKHSURFHVVRUUHVHWVWKHQRQUHWHQWLYH
RXWSXWLQVWUXFWLRQVZLWKLQWKH0&5]RQH
I:012
When the first MCR
instruction is false, the
03 processor resets all
non-retentive outputs
I:012 I:012 O:013 in the zone.
13 10 03
Description: 8VH-03DQG/%/LQVWUXFWLRQVLQSDLUVWRVNLSSRUWLRQVRIWKHODGGHU
SURJUDP
JMP
If the Jump Rung Is: Then the Processor:
] LBL [
True Skips from the JMP rung to the LBL rung and continues
executing the program. You can jump forward or backward.
-XPSLQJIRUZDUGWRDODEHOVDYHVSURJUDPVFDQWLPHE\RPLWWLQJD
SURJUDPVHJPHQWXQWLOQHHGHG-XPSLQJEDFNZDUGOHWVWKHSURFHVVRU
UHSHDWLWHUDWLRQVWKURXJKDSURJUDPVHJPHQWXQWLOLWVORJLF
LV FRPSOHWH
,PSRUWDQW %HFDUHIXOQRWWRMXPSEDFNZDUGVDQH[FHVVLYHQXPEHU
RIWLPHV7KHZDWFKGRJWLPHUFRXOGWLPHRXWZKLFK
ZRXOGIDXOWWKHSURFHVVRU
Using JMP
7KH-03LQVWUXFWLRQOHWVWKHSURFHVVRUVNLSUXQJV<RXFDQMXPSWR
WKHVDPHODEHOIURPRQHRUPRUH-03LQVWUXFWLRQV
$77(17,21 -XPSHGWLPHUVDQGFRXQWHUVDUHQRW
VFDQQHG5HSURJUDPFULWLFDORSHUDWLRQVRXWVLGHWKH
MXPSHG]RQH
Using LBL
7KH/%/LQVWUXFWLRQLVWKHWDUJHWRIWKH-03LQVWUXFWLRQWKDWKDVWKH
VDPHODEHOQXPEHU3ODFHWKH/%/LQVWUXFWLRQILUVWRQWKHUXQJWR
ZKHUH\RXZDQWWKHSURFHVVRUWRMXPS
,PSRUWDQW 0DNHVXUHWKDWWKH/%/LQVWUXFWLRQLVWKHILUVW
LQVWUXFWLRQRQWKHUXQJ7KHVRIWZDUHFXUUHQWO\OHWV\RX
WRFUHDWHDEUDQFKDURXQGDQ/%/LQVWUXFWLRQWKLVZLOO
FDXVHWKHSURFHVVRUWRRSHUDWHLQFRUUHFWO\
,I\RXPRGLI\DQGDFFHSWDUXQJFRQWDLQLQJDODEHOZKLOHRQOLQHZLWK
WKHSURFHVVRULQ5XQPRGHWKHVRIWZDUHFUHDWHVDQ,5SDLU,I\RX
PRGLI\WKH,UXQJEHIRUHDVVHPEOLQJWKHHGLWVWKHSURFHVVRUZLOOIDXOW
ZLWKDGXSOLFDWHODEHOHUURU
7KHUHDUHIRXUZD\VWRDYRLGWKLVSUREOHP
(GLWWKHUXQJZLWKWKHSURFHVVRULQ3URJUDPPRGH
&DQFHOWKHHGLWVDQGUHHGLWWKHUXQJ
/HWWKHIDXOWRFFXUWKHQFOHDUWKHIDXOWDIWHUDVVHPEOLQJWKHHGLWV
$VVHPEOHWKHILUVWHGLWWKHQPRGLI\WKHUXQJDJDLQWRPDNHWKH
VHFRQGFKDQJH,I\RXDUHHGLWLQJRQOLQHWKHSURFHVVRUPD\
H[HFXWHWKHUXQJZLWKWKHILUVWHGLWDQGPD\FDXVHWKHSURFHVVRUWR
IDXOWRUUXQLPSURSHUO\
10 11 01
I:012 20
JMP
13 When input I:012/13 is set, the processor jumps to
label 20 and continues program execution. It does not
execute the rungs between these two points.
T4:0 TON
TIMER ON DELAY EN
DN Timer T4:0
Time base 1.0 DN
Preset 100
Accum 0
I:012 O:013
10 13
20 I:012 O:013
LBL
17 02
Description: 8VH)25%5.DQG1;7LQVWUXFWLRQVWRFUHDWH\RXURZQ
FOR SURJUDPPLQJURXWLQHVZKHUH\RXFRQWUROWKHQXPEHURIWLPHVWKH
FOR ORRSLVH[HFXWHG
Label number
Index ,PSRUWDQW 'XULQJSUHVFDQODGGHULQVWUXFWLRQVZLWKLQWKH
Initial value
Terminal value )251;7ORRSDUHSUHVFDQQHGQRWVNLSSHG
Step size
NXT
NEXT $77(17,21 8VLQJ)25DQG1;7LQVWUXFWLRQV
Label Number
ZLWKLQDQRXWSXWEUDQFKFDQFDXVHXQSUHGLFWDEOH
PDFKLQHRSHUDWLRQ
:KHQXVLQJWKH)25DQG1;7LQVWUXFWLRQVZLWKLQD
EUDQFKLQDODGGHUSURJUDPWKHH[HFXWLRQRIWKH
)251;7ORRSPD\QRWRFFXUDVH[SHFWHG'RQRW
XVHWKH)25RU1;7LQVWUXFWLRQVZKHQ
SURJUDPPLQJZLWKLQDEUDQFKLQDODGGHUSURJUDP
Entering Parameters
7RSURJUDPWKH)25LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Label number the unique label number that marks the location of the FOR instruction. Enter a unique
number. Classic PLC-5 processors support label numbers 0-31; Enhanced PLC-5
processors support label numbers 0-255.
Index the logical address where the instruction stores the index value it computes. The index
value is the sum of the initial value plus the accumulating step values. The FOR
instruction uses the index value to determine the number of times the loop is executed.
When you enable the FOR instruction, the processor sets the index value equal to the
initial value. Then, if the index values is less than or equal to the terminal value, the
processor loops through the following instructions. If the index is greater than the
terminal value, the processor jumps to the NXT instruction.
When the processor encounters a NXT instruction, it returns to the corresponding FOR
instruction, then it compares the index with the terminal value. If the index is less than
or equal to the terminal value, the processor jumps back to the FOR instruction.
Otherwise it steps to the following instruction. If the processor encounters a BRK on a
true rung, the processor skips to the instruction following the NXT.
Initial value (index value) is an integer value or integer address that represents the starting value for
the loop.
Terminal value (reference value) is an integer value or integer address that represents the ending value
for the loop.
Step size (constant) is an integer value that specifies the amount to increment the index value.
You can change the step value from the ladder program.
Using FOR
:KHQWKHUXQJLVWUXHWKH)25LQVWUXFWLRQH[HFXWHVWKHUXQJV
EHWZHHQWKH)25DQG1;7UHSHDWHGO\LQRQHSURJUDPVFDQXQWLOLW
UHDFKHVWKHSUHVHWQXPEHURIORRSVRUD%5.LQVWUXFWLRQDERUWVWKH
RSHUDWLRQ7KH)25LQVWUXFWLRQUHSHDWVWKLVRSHUDWLRQHDFKVFDQLWV
UXQJLVWUXH7KH)25LQVWUXFWLRQGRHVQRWUHTXLUHDUXQJWUDQVLWLRQWR
EHJLQRSHUDWLRQ
:KHQWKHUXQJLVIDOVHWKHSURFHVVRUMXPSVWRWKHUXQJIROORZLQJWKH
1;7LQVWUXFWLRQ
,PSRUWDQW %HFDUHIXOQRWWRORRSWRRPDQ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HORRSZKHQHYHUWKHSURFHVVRUGHWHFWVDQHUURURU
WRDYRLGSURORQJHGORRSVWKDWFRXOGFDXVHWKHZDWFKGRJWLPHUWRWLPH
RXWZKLFKZRXOGIDXOWWKHSURFHVVRU
Using NXT
7KH1;7LQVWUXFWLRQPXVWEHSURJUDPPHGRQDQXQFRQGLWLRQDOUXQJ
WKDWLVWKHODVWUXQJWREHUHSHDWHGE\WKH)RU1H[WORRS7KH1;7
LQVWUXFWLRQUHWXUQVWKHSURFHVVRUWRWKHFRUUHVSRQGLQJ)25
LQVWUXFWLRQLGHQWLILHGE\WKHODEHOQXPEHUVSHFLILHGLQWKH
1;7 LQVWUXFWLRQ
FOR
5 If integer file 7, word 10, bit 5 is true, initialize N7:0 to
zero and execute the rungs until the NXT. When the Label number 0
processor encounters the NXT, increment N7:0 and Index N7:0
rung jump back to the FOR instruction. As long as N7:0 Initial value 0
rung is less than or equal to 10, keep executing the loop. Terminal value 10
rung When N7:0 is greater than 10, jump to the rung Step size 1
following the NXT.
N7:10
/ BRK
5 If integer file 7, word 10, bit 5 ever goes true,
rung break out of the loop and jump to the rung
rung following the NXT instruction.
rung NXT
NEXT
Label Number 0
rung
rung
rung
Description: 7KH-656%5DQG5(7LQVWUXFWLRQVGLUHFWWKHSURFHVVRUWRJRWRD
JSR VHSDUDWHVXEURXWLQHILOHZLWKLQWKHODGGHUSURJUDPVFDQWKDW
JUMP TO SUBROUTINE VXEURXWLQHILOHRQFHDQGUHWXUQWRWKHSRLQWRIGHSDUWXUH
Prog file number
Input parameter
Return parameter 7KH-65LQVWUXFWLRQGLUHFWVWKHSURFHVVRUWRWKHVSHFLILHGVXEURXWLQH
SBR
ILOHDQGLIUHTXLUHGGHILQHVWKHSDUDPHWHUVSDVVHGWRDQGUHFHLYHG
SUBROUTINE IURPWKHVXEURXWLQH7KHRSWLRQDO6%5LQVWUXFWLRQLVWKHKHDGHU
Input parameter
LQVWUXFWLRQWKDWVWRUHVLQFRPLQJSDUDPHWHUV8V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UHVHWV
DFFRUGLQJWRDSSOLFDWLRQUHTXLUHPHQWV
<RXFDQSDVVWKHIROORZLQJW\SHVRISDUDPHWHUV
Type: Example:
,I\RXSDVVIORDWLQJSRLQWGDWDWRDQLQWHJHUDGGUHVVWKHIUDFWLRQDOSDUW
RIWKHYDOXHLVWUXQFDWHGORVW
,PSRUWDQW 'RQRWPL[IORDWLQJSRLQWDQGLQWHJHUGDWDDQGDGGUHVVHV
ZKHQSDVVLQJGDWDRU\RXZLOOORVHDFFXUDF\
JSR
JUMP TO SUBROUTINE
Prog file number 90 Program constants and values
Input parameter N16:23 stored at logical addresses are
Input parameter N16:24 passed to the SBR instruction
Values are Input parameter 231 when execution jumps to the
returned Return parameter N19:11 subroutine file.
Return parameter N19:12
Execution resumes
SBR
SUBROUTINE
Values and program constants Input parameter N43:0
are stored at logical addresses
Input parameter N43:1
in the subroutine as subroutine
execution begins. Input parameter N10:3
RET
Values stored at logical RETURN ( )
addresses are returned to the
addresses that you specified in Return parameter N43:5
the JSR instruction when Return parameter N43:4
execution returns to the main
ladder program.
Entering Parameters
7RSURJUDPWKHVHLQVWUXFWLRQVSURYLGHWKHSURFHVVRUZLWKWKH
IROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Program file number the program file number of the file that contains
the subroutine
Input parameter (SBR) an address where the subroutine stores the incoming
data (optional)
Return parameter (JSR) an address that stores the data received from the
subroutine (optional)
:KHQHQWHULQJLQSXWDQGUHWXUQSDUDPHWHUV
:KHQ\RXHQWHUWKH-65LQVWUXFWLRQWKHSURJUDPPLQJVRIWZDUH
SURPSWV\RXIRULQSXWSDUDPHWHUV$IWHU\RXHQWHUDQLQSXW
SDUDPHWHUSUHVV[Enter]7KHVRIWZDUHSURPSWV\RXIRUDQRWKHU
LQSXWSDUDPHWHU:KHQ\RXGRQRWKDYHDQ\PRUHLQSXW
SDUDPHWHUVWRHQWHUSUHVV[Enter] DJDLQ7KHQWKHSURJUDPPLQJ
VRIWZDUHSURPSWV\RXIRUUHW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PDQRWKHU5(7
LQVWUXFWLRQLQDQXQFRQGLWLRQDOUXQJDWWKHHQGRIWKHVXEURXWLQHWR
JXDUDQWHHDYDOLGUHWXUQIURPWKHVXEURXWLQHZKHQWKHFRQGLWLRQVRQ
WKHILUVW5(7LQVWUXFWLRQDUHIDOVH
,PSRUWDQW 7RDYRLGDSURFHVVRUIDXOWRQO\XVHWKH5(7LQVWUXFWLRQ
LQ\RXUSURJUDPZKHQ\RXDUHUHWXUQLQJSDUDPHWHUV,I
\RXDUHQRWUHWXUQLQJSDUDPHWHUVOHWWKHHQGVWDWHPHQW
LQWKHVXEURXWLQHGRWKHUHWXUQWRWKHPDLQSURJUDP
JSR
JUMP TO SUBROUTINE
Prog file number 90
Input par N16:23
Input par N16:24
Balance of Main Program Input par 231
Return par N19:11
Subroutine Return par N19:12
SBR
SUBROUTINE
Input par N43:0
Input par N43:1
Input par N43:2
Description: :KHQWKHSURFHVVRUHQFRXQWHUVWKH71'LQVWUXFWLRQWKHSURFHVVRU
UHVHWVWKHZDWFKGRJWLPHUWR]HURSHUIRUPVDQ,2XSGDWHDQG
TND EHJLQVUXQQLQJWKHODGGHUSURJUDPDWWKHILUVWLQVWUXFWLRQLQWKH
PDLQSURJUDP
Example:
I:012 I:012
,QVHUWWKH71'LQVWUXFWLRQZKHQGHEXJJLQJRUWURXEOHVKRRWLQJ\RXU
TND
ODGGHUSURJUDP7KH71'LQVWUXFWLRQOHWV\RXUSURJUDPUXQRQO\XS
04 05
WRWKLVLQVWUXFWLRQ0RYHLWSURJUHVVLYHO\WKURXJK\RXUSURJUDPDV
\RXGHEXJHDFKQHZVHFWLRQ$OVRXVHWKH71'LQVWUXFWLRQDVD
ERXQGDU\EHWZHHQWKHPDLQSURJUDPDQGORFDOVXEURXWLQHV<RXFDQ
SURJUDPWKH71'LQVWUXFWLRQXQFRQGLWLRQDOO\RUFRQGLWLRQLWVUXQJ
DFFRUGLQJWR\RXUGHEXJJLQJQHHGV
,PSRUWDQW 'RQRWFR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WKHSURJUDPVFDQEHJLQV
Example:
I:011 N7:10 B3
ONS
04 10 5
When the input condition goes from false to true, the ONS conditions the rung so that
the output turns on for one scan. The output turns off for successive scans until the
input goes from false to true again.
Description: 7KH265LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWWULJJHUVDQHYHQWWR
OSR
RFFXURQHWLPH7KH265LQVWUXFWLRQVHWVWKHIROORZLQJELWV
ONE SHOT RISING OB
Storage BIt This Bit: Changes State as Follows:
Output Bit SB
Output Word
Output .OB Is set for one program scan when the rung goes from false to true
Note: During prescan, this bit is cleared to inhibit false triggering
when the program scan begins.
8VHWKH265LQVWUXFWLRQZKHQHYHUDQHYHQWPXVWVWDUWEDVHGRQWKH
FKDQJHRIVWDWHRIWKHUXQJIURPIDOVHWRWUXHQRWFRQWLQXRXVO\ZKHQ
WKHUXQJLVWUXH<RXPXVWHQWHUDELWDGGUHVVIRUWKHRXWSXWELWDQG
VWRUDJHELW8VHHLWKHUDELQDU\ILOHRULQWHJHUILOHDGGUHVV
Entering Parameters
7RSURJUDPWKHVHLQVWUXFWLRQV\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Storage bit the address where you want the storage bit status stored. For
example, B3/17
Output bit the bit position in the output word where you want the output
bit status stored. For example 5
Output word the word address where you want the output bit status
stored. For example, N7:0
Description: 7KH26)LQVWUXFWLRQLVDQRXWSXWLQVWUXFWLRQWKDWWULJJHUVDQHYHQWWR
OSF
RFFXURQHWLPHZKHQWKHUXQJWUDQVLWLRQVIURPWUXHWRIDOVH7KH26)
ONE SHOT FALLING OB LQVWUXFWLRQVHWVWKHIROORZLQJELWV
Storage BIt
Output Bit SB
Output Word This Bit: Changes State as Follows:
Output .OB Is set for one program scan when the rung goes from true to false
8VHWKH26)LQVWUXFWLRQZKHQHYHUDQHYHQWPXVWVWDUWEDVHGRQWKH
FKDQJHRIVWDWHRIWKHUXQJIURPWUXHWRIDOVHQRWRQWKHUHVXOWLQJUXQJ
VWDWXV<RXPXVWHQWHUDELWDGGUHVVIRUWKHRXWSXWELWDQGVWRUDJHELW
8VHHLWKHUDELQDU\ILOHRULQWHJHUILOHDGGUHVV
Entering Parameters
7RSURJUDPWKHVHLQVWUXFWLRQV\RXPXVWSURYLGHWKHSURFHVVRUZLWK
WKHIROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Storage bit the address where you want the storage bit status stored. For
example, B3/17
Output bit the bit position of the output word where you want the output
bit status stored. For example 5
Output word the word address where you want the output bit status
stored. For example, N7:0
Description: 7KH6)5LQVWUXFWLRQUHVHWVWKHORJLFLQDVHTXHQWLDOIXQFWLRQFKDUW
:KHQDQ6)5LQVWUXFWLRQJRHVWUXHWKHSURFHVVRUSHUIRUPVD
SFR
SRVWVFDQODVWVFDQRQDOODFWLYHVWHSVDQGDFWLRQVLQWKHVHOHFWHG
SFC Reset
ILOHDQGWKHQUHVHWVWKHORJLFLQWKH6)&RQWKHQH[WSURJUDPVFDQ
Prog file number
7KHFKDUWUHPDLQVLQWKLVUHVHWVWDWHXQWLOWKH6)5LQVWUXFWLRQJRHV
Restart step at
IDOVH7KH6)5LQVWUXFWLRQDOVRUHVHWVDOOUHWHQWLYHDFWLRQVWKDWDUH
FXUUHQWO\DFWLYH
Entering Parameters
Example: 7RSURJUDPWKLVLQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUZLWKWKH
IROORZLQJLQIRUPDWLRQ
SFR
SFC Reset
Prog file number 2 Parameter: Definition:
Restart step at N7:5
Program File Number a valid SFC program file number
,PSRUWDQW 7KH5HVWDUW6WHSDWSDUDPHWHULVRQO\DYDLODEOHZLWK
3/&VHULHV$DQG3/&/
/VHULHV%DQGDOO(QKDQFHG3/&VHULHV&
SURFHVVRUV,I\RXDUHXVLQJD3/&RU
VHULHV $SURFHVVRUWKH6)&UHVHWVWRWKHLQLWLDOVWHS
$VWHSQXPEHULVDVRIWZDUHDVVLJQHGUHIHUHQFHQXPEHUDVVRF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IURPELWDQDORJ
LQSXWVFDOLQJLQHQJLQHHULQJXQLWV
]HURFURVVLQJGHDGEDQG
GHULYDWLYHWHUPFDQDFWRQ39RUHUURU
GLUHFWRUUHYHUVHDFWLQJFRQWURO
RXWSXWDODUPV
RXWSXWOLPLWLQJZLWKDQWLUHVHWZLQGXS
PDQXDOPRGHZLWKEXPSOHVVWUDQVIHU
IHHGIRUZDUGRURXWSXWELDVLQJ
GLVSOD\LQJDQGPRQLWRULQJ3,'YDOXHV
'HULYDWLYHRI39
1 t d(PV)
CV = K c ( E ) + ∫ ( E ) dt + T d + Bias ( E = SP – PV )
Ti 0 dt
1 t d(PV)
CV = K c ( E ) + ∫ ( E ) dt + T d + Bias ( E = PV – SP )
Ti 0 dt
,QGHSHQGHQWJDLQVHTXDWLRQ
'HULYDWLYHRI(UURU
d(E)
CV = K P ( E ) + K i ∫ ( E ) dt + K d + Bias
t
0 dt
'HULYDWLYHRI39
d(PV)
CV = K P ( E ) + K i ∫ ( E ) dt – K d + Bias ( E = SP – PV )
t
0 dt
d(PV)
CV = K P ( E ) + K i ∫ ( E ) dt + K d + Bias ( E = PV – SP )
t
0 dt
:KHUH
1
:LWK'HSHQGHQW*DLQVVHOHFWHG S k = ( E k )∆ t + S k – 1
Ti
,IWKH,QWHJUDORU5HVHW*DLQLV]HURWKHDFFXPXODWHGVXPFRQWLQXDOO\
VHWVWR]HURLQ$XWRPRGH
$YRLGµ,QWHJUDO:LQGXS¶E\SUHYHQWLQJWKHUXQQLQJVXPIURP
DFFXPXODWLQJZKHQHYHUWKHRXWSXW&9UHDFKHVLWVPD[LPXPRU
PLQLPXPYDOXHV7KHVHYDOXHVDUHHLWKHUDQGRUWKHXVHU
VSHFLILHGOLPLWVLQRXWSXWOLPLWLQJ,QWKLVFDVH6N 6N±
7KHDFFXPXODWHGVXPUHPDLQVµIUR]HQ¶XQWLOWKHRXWSXWGURSVEHORZ
LWVPD[LPXPYDOXHRUULVHVDERYHLWVPLQLPXPYDOXHWKHQQRUPDO
DFFXPXODWLRQUHVXPHV
:KHQH[HFXWLQJWKH3,'LQVWUXFWLRQLQPDQXDOPRGHDµEXPSOHVV¶
WUDQVIHUEDFNWR$XWRPRGHFDQEHDFKLHYHGE\XVLQJWKHDFFXPXODWHG
VXPWRFRPSXWDWLRQDOO\WUDFNWKHPDQXDORXWSXW
d(E
k = CVManual – Bias – K p ( E ) – K d
dt
:KHQ\RXVZLWFKEDFNWRDXWRPRGHWKH3,'FRPSXWDWLRQ\LHOGVWKLV
0DQXDO2XWSXWYDOXHDQGQRµMXPS¶LQRXWSXWRFFXUVDVDUHVXOWRIWKH
PRGHFKDQJH
Derivative Term
7KHIROORZLQJDSSUR[LPDWLRQLVXVHGWRFDOFXODWHWKHGHULYDWLYHWHUP
( Q ) Q k – Qk – 1
d
=
dt ∆t
Where Q represents either Error or PV,
depending upon your settings.
7KHFDOFXODWLRQLVIXUWKHUHQKDQFHGE\XVLQJDµGHULYDWLYHVPRRWKLQJ
ILOWHU¶7KLVILUVWRUGHUORZSDVVGLJLWDOILOWHUHOLPLQDWHVODUJH
GHULYDWLYHWHUPµVSLNHV¶FDXVHGE\QRLVHLQWKH39
$GGLQJWKLVILOWHUWRWKHRYHUDOOGHULYDWLYHWHUP\LHOGV
Qk – Qk – 1
D k = ( 1 – α ) K d + αD k – 1
∆t
Where:
Kd = the derivative gain
Dk = the current derivative term
Dk–1 = the previous derivative term
Qk = (as previously defined)
1
α =
∆t
16 + 1
Kd
∆t = Loop Update Time
DQDQDORJYDOXHRI]HURIRUWKHORZHVWUHDGLQJRIWKHSURFHVV
YDULDEOHWKH6 YDOXHFRUUHVSRQGVWRDQDQDORJYDOXHRI
PD[
IRUWKHKLJKHVWUHDGLQJRIWKHSURFHVVYDULDEOH7KHVHYDOXHV
UHSUHVHQWSURFHVVOLPLWV6HW6 DQG6 WRLI\RXGRQRW
PLQ PD[
ZDQWVFDOLQJ
)RUH[DPSOHLI\RXPHDVXUHDVFDOHRIWHPSHUDWXUHIURP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RXUGHDGEDQGYDOXHLQZRUGRIWKHFRQWUROEORFN'%ZRUG
RID3'GDWDILOHW\SH7KHGHDGEDQGH[WHQGVDERYHDQGEHORZWKH
VHWSRLQWE\WKHYDOXH\RXVSHFLI\(QWHUWRLQKLELWWKHGHDGEDQG,I
VFDOHGWKHGHDGEDQGKDVWKHVDPHVFDOHGXQLWVDVWKHVHWSRLQW
Anti-Reset Windup
$QWLUHVHWZLQGXSLVDIHDWXUHWKDWSUHYHQWVWKHLQWHJUDOWHUPIURP
EHFRPLQJH[FHVVLYHZKHQRXWSXWVUHDFKDOLPLW:KHQWKHVXPRI
WKH3,'DQGELDVWHUPVLQWKHRXWSXWUHDFKHVDOLPLWWKHLQVWUXFWLRQ
VWRSVFDOFXODWLQJWKHLQWHJUDORXWSXWWHUPXQWLOWKHRXWSXWFRPHVEDFN
LQWRUDQJH
PID
Module located in rack 0,
I/O group 0, module slot 0 PID
Control block N7:20
Process Variable N7:109
Tieback N7:110
Control variable N7:120
15297
Set Output
<RXFDQUHSODFHDPDQXDOFRQWUROVWDWLRQZLWKDWKXPEZKHHODQG
SXVKEXWWRQVZLWFKHVDQGVLPXODWHWKH3,'IXQFWLRQZLWKODGGHUORJLF
8VHWKH6HW2XWSXWPRGHWRHQWHUDYDOXHUHSUHVHQWLQJDSHUFHQWDJHRI
WKH&RQWURO9DULDEOHRXWSXW7\SLFDOO\LWLVGHVLUHGWRHQWHUDYDOXH
IURPDQRSHUDWRULQWHUIDFH7KHWDEOHEHORZLOOXVWUDWHVWKHSURFHGXUH
WRIROORZZKHQ6HW2XWSXWPRGHLVGHVLUHG
Table 14.A
Set Output Mode Procedure
Select Set Output Mode SET OUTPUT MODE: 1 (0:no/1:yes) Software A/M Mode = Manual
(bit N7:0/4 = 1) (bit PD10:0.SWM = 1)
,IWKHVHWRXWSXWYDOXHLVJUHDWHUWKDQWKHXSSHU&9OLPLWRUORZHUWKDQ
WKHORZHU&9OLPLWDQGRXWSXWOLPLWLQJLVHQDEOHG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RQLVQRWQHHGHG7KHRQO\ZD\WKHHQDEOHELWEHFRPHVIDOVH
DJDLQLVLIWKHVHVDPHTXDOLI\LQJFRQGLWLRQVEHFRPHIDOVH7KH3'
EORFNGRHVQRWXVHDGRQHELW
Rung True
State
False
True
.EN
False Actual Execution of
the PID Instruction
,PSRUWDQW 8QOLNHWKH,QWHJHU%ORFNYHUVLRQWKH3'%ORFN3,'
H[HFXWHVDJDLQLIWKHSURJUDPVFDQHQFRXQWHUVWKLVUXQJ
DJDLQZKLOHWKHUXQJVWDWHLVVWLOOWUXH
Entering Parameters
:KHQ\RXHQWHUWKHLQVWUXFWLRQ\RXPXVWVSHFLI\IRXUDGGUHVVHVWKDW
DUHIXQGDPHQWDOWRWKHRSHUDWLRQRIWKHLQVWUXFWLRQ$IWHU\RXHQWHU
WKHVHDGGUHVVHVWKHSURJUDPPLQJVRIWZDUHGLVSOD\VDVFUHHQIURP
ZKLFK\RXHQWHUWKHRSHUDWLQJSDUDPHWHUVRIWKHLQVWUXFWLRQ
7KHXVHRILQWHJHUFRQWUROEORFNVYHUVXV3'FRQWUROEORFNVGHSHQGV
RQ\RXUSURFHVVRU,I\RXDUHXVLQJD&ODVVLF3/&SURFHVVRUWKH3'
FRQWUROEORFNLVQRWDYDLODEOH,QWKH(QKDQFHG3/&SURFHVVRUV
ERWKWKH1DQG3'FRQWUROEORFNVDUHDYDLODEOH7KH3'FRQWUROEORFN
JLYHV\RXPRUHIOH[LELOLW\LHIORDWLQJSRLQWYDULDEOHVKLJKHU
UHVROXWLRQ±ELWYHUVXVELW
7KHDGGUHVVHVWKDW\RXHQWHUDUH
Parameter: Definition:
Control Block a file that stores PID status and control bits, constants, variables,
and internally used parameters.
Based on the data type you use, a different configuration screen
appears for you to enter PID information (see the next sections for
more information).
If you have an Enhanced PLC-5 processor, you can use an integer
control block or a PD control block. Using a PD file, words 0, 1 are
the status words; words 2-80 store the PID values.
If you use an Integer control block, the PID calculations are
performed using integer values. If you use a PD control block, the
PID calculations are performed using floating point values.
If you have a Classic PLC-5 processor, you must use an integer file
(N) for your control block. Using an integer file, word 0 is the status
word; words 1-22 store the PID values.
Process Variable a word address that stores the process input value.
Control Variable a word address to which the PID instruction sends its calculated PID
output value.
Note: If a value greater than 4095 is written to the “control variable”
location of the Integer Type PID instruction, the output of the PID
instruction obtains a permanent offset which can only be removed
by writing to the “control variable” with a value between 0 and
4095. This happens whether you write to this location via rung logic
or directly to the data table location.
Note: The file PD type PID instruction does not exhibit this behavior.
Parameter: Description:
Equation Enter whether you want to use independent (0) or dependent (1) gains. Displays one of
the following:
Use dependent gains when you want to use standard loop tuning methods. Use
independent gains when you want the three gain constants (P, I, and D) to
operate independently.
Output Limiting Displays whether or not the instruction clamps the output at the high and low limiting
values. Displays one of the following:
The PID algorithm has an anti-reset windup feature that prevents the integral term from
becoming too large when the output reaches the high or low alarm limits. If the limits
are reached, the algorithm stops calculating the integral term until the output comes
back into range.
Set output mode Selects the use of set output value % for manual operation
Setpoint scaling Selects if the setpoint is to be interpreted as a value in the engineering units or an
unscaled (0 to 4095) value
Last state resume Selects if you want to resume last state or hold last state
(Continued)
Parameter: Description:
Deadband status Set if the PV is inside the selected deadband range; reset if it is not
Upper CV limit alarm Set if calculated CV is greater than the CV upper limit word %
Lower CV limit alarm Set if calculated CV is less than the CV lower limit word %
Setpoint out of range Displays whether or not the setpoint is out of the range of engineering units you
selected on the PID Configuration screen. Displays one of the following:
Note: A major processor fault occurs if the SP is out of range when the instruction is
first enabled.
PID done Displays whether the PID instruction has completed (1 = done; 0 = not done).
PID enabled Displays whether the PID instruction is enabled (1 = enabled; 0 = not enabled).
Feed forward Enter a value between –4095 and 4095 for the amount of feed forward.
The ladder program can enter a feedforward value to bump the output in anticipation of
a disturbance. This value is often used to control a process with transportation lag.
Max scaled input Enter the integer number (–32,768 - 32,767) that is the maximum value available from
the analog module. For example, use 4095 for a module whose range is 0-4095.
Min scaled input Enter the number that is the minimum value available from the analog module. For
example, use 0 for a module whose range is 0 to 4095.
Dead band For an unscaled deadband, enter a value in the engineering units you selected on
the PID Configuration screen. Valid range is 0 to 4095 unscaled, –32,768 to
+32,767 scaled.
Note: The deadband is zero crossing.
Set output value % Enter a percent (0-100%) to use as the CV Output when ‘set output mode’ is selected.
Upper CV limit % Enter a percent (0-100) above which the algorithm clamps the output.
Lower CV limit % Enter a percent (0-100) below which the algorithm clamps the output.
Scaled PV value Displays data from the analog input module that the instruction scales to the same
engineering units that you selected for the setpoint.
Setpoint Enter an integer. Valid range is 0 to 4095 (unscaled) or Smin- Smax (scaled
engineering units).
Proportional gain Enter an integer. Valid entry range is 0-32,767 (unitless) or Kp 0-32,767. The
(Kc) processor divides the entry value by 100 for calculations.
Reset time (Ti) Enter an integer. Valid entry range for Ti is 0-32,767 (minutes times 100). The
minutes/repeat processor automatically divides the entry value by 100 for calculations.
Valid entry range for Ki is 0-32,767 (inverse seconds times 1000). The processor
automatically divides the entry by 1000 for calculations.
(Continued)
Parameter: Description:
Derivative rate (Td) Enter an integer. Valid entry range is 0-32,767 or KD 0-32,767. The processor divides
the entry value by 100 for calculations.
Loop update time Enter an update time (greater than or equal to 0.01 seconds) at 1/5 to 1/10 times the
natural period of the load (load time constant). Valid entry range is 1-32,767 seconds.
The processor divides the entry value by 100 for calculations. The load time constant
should be greater than:
1ms(algorithm) + block transfer time (ms)
Periodically enable the PID instruction at a constant interval equal to the update time.
For update times of less than 100 msec, use an STI. When update times are greater
than 100 msec, use a timer or a real-time sampling.
Note: If you omit an update time or enter a negative update time, a major fault occurs
the first time the processor runs the PID instruction.
1 reserved
Note: Terms marked with an asterisk (*) are entered as Yy × 100. The term itself is Yy. The term marked with a double
asterisk (**) is entered as Yy × 1000. The term itself is Yy.
(Continued)
Note: Terms marked with an asterisk (*) are entered as Yy × 100. The term itself is Yy. The term marked with a double
asterisk (**) is entered as Yy × 1000. The term itself is Yy.
Setpoint .SP Enter a floating-point number in the same engineering units that are on the
PID Configuration screen. Valid range is –3.4 E+38 to +3.4 E+38.
Process Variable .PV Displays data from the analog input module that the instruction scales to
the same engineering units that you selected for the setpoint.
Output % .OUT Displays the PID algorithm control output value (0-100%).
PV Alarm Displays whether the PV is within or exceeds the high or low alarm limits
you selected on the PID Configuration screen. Displays one of the following:
.PVHA=1
.PVLA=1 NONE – PV within alarm limits
HIGH – PV exceeds high alarm limit (used with deadband)
LOW – PV exceeds low alarm limit (used with deadband)
Deviation Alarm Displays whether the error is within or exceeds the high or low deviation
alarms you selected on the PID Configuration screen. Displays one of the
following:
.DVPA=1
.DVNA=1
NONE – error within deviation alarm limits
POSITIVE – error exceeds high alarm (used with deadband)
NEGATIVE – error exceeds low alarm (used with deadband)
Output Limiting .OLH=1 Displays whether or not the instruction clamps the output at the high and
.OLL=1 low limiting values (.MAXO and .MINO) you selected on the PID Configuration
screen. Displays one of the following:
The PID algorithm has a anti-reset-windup feature that prevents the integral
term from becoming too large when the output reaches the high or low
alarm limits. If the limits are reached, the algorithm stops calculating the
integral term until the output comes back into range.
(Continued)
SP Out of Range .SPOR=0 Displays whether or not the setpoint is out of the range of engineering units
.SPOR=1 you selected on the PID Configuration screen. Displays one of the following:
NO – SP within range
YES – SP out of range
Note: A major processor fault occurs if the SP is out of range when the
instruction is first enabled.
Error Within DB .EWD=0 Displays whether the error is within or exceeds the deadband value
.EWD=1 you enter on this screen. The deadband is zero crossing. Displays one
of the following:
PID Initialized .INI=0 Each time you change a value in the control block, the PID instruction takes
.INI=1 over twice as long to execute (until initialized) on the first scan. Displays one
of the following:
NO – PID instruction not initialized after you changed control block values
YES – PID instruction remains initialized because you did not change any
control block values
A/M Station Mode .MO=0 Enter whether you want automatic (0) or manual (1) PID control. Displays
.MO=1 one of the following:
Software A/M Mode .SWM=0 Enter whether you want automatic PID (0) control or Set Output Mode (1), for
.SWM=1 software-simulated control. Displays one of the following:
You can simulate a manual control station with the data monitor when you
program a single loop. To do this, set .SWM to SW MANUAL and enter a
Set Output Percent value.
You can simulate a manual control station with ladder logic, pushwheels,
and pushbutton switches when you program several loops. To do this, set
.SWM to SW MANUAL and move a value into the set output element .SO.
(Continued)
Status Enable .EN=0 Enter whether to use (1) or inhibit (0) this bit which displays the rung
.EN=1 condition so you can see whether the PID instruction is operating. Displays
one of the following:
Proportional Gain .KP Enter a floating-point value. Valid range for independent or standard gains is
0 to 3.4 E+38 (unitless).
Integral Gain .KI Enter a floating-point value. Valid range for independent gains is 0 to 3.4
E+38 inverse seconds; valid range for standard gains is 0 to 3.4 E+38
minutes per repeat.
Derivative Gain .KD Enter a floating-point value. Valid range for independent gains is 0 to 3.4
E+38 seconds; valid range for standard gains is 0 to 3.4E+38 minutes.
Output Bias % .BIAS Enter a value (–100 to +100) to represent the percentage of output you want
to feed forward or use as a bias to the output. The bias value can
compensate for steady-loss of energy from the system.
The ladder program can enter a feedforward value to bump the output in
anticipation of a disturbance. This value is often used to control a process
with transportation lag.
Tieback % .TIE Displays a number (0 to 100) representing the percent of raw tieback (0 –
4095) from the manual control station. The PID algorithm uses this number
to achieve bumpless transfer when switching from manual to auto mode.
Set Output % .SO Enter a percent (0 to 100), from this screen or a ladder program, to
represent the software-manually controlled output.
When you select software-simulated control (.SWM=1), the PID instruction
overrides the algorithm with the set output value (0 - 4095) for transfer to
the output module, and copies it to .OUT for display as a percent. The
transfer to software-simulated control is bumpless because .SO (under your
control) starts with the last automatic algorithm output. Do not vary .SO until
after the transfer.
To achieve bumpless transfer when changing from software-simulated
control to automatic control, the PID algorithm changes the integral term so
that the output is equal to the set output value.
:KHQXVLQJD3'ILOHW\SHIRUWKHFRQWUROEORFNWKHGDWDPRQLWRU
VFUHHQIRUWKH3,'LQVWUXFWLRQSURYLGHVDFFHVVWRD3,'FRQILJXUDWLRQ
VFUHHQ)URPWKH3,'FRQILJXUDWLRQVFUHHQ\RXFDQGHILQHWKH
IROORZLQJFKDUDFWHULVWLFVRIWKH3,'LQVWUXFWLRQ7DEOH(
Table 14.E
PID Configuration Descriptions (PD Control Block)
PID Equation .PE=0 Enter whether you want to use independent (0) or dependent (1) gains. Displays one of
.PE=1 the following:
Use dependent gains when you want to use standard loop tuning methods. Use
independent gains when you want the three gain constants (P, I, and D) to
operate independently.
Derivative of .DO=0 Enter whether you want the derivative of the PV (0) or the error (1). Displays one of
.DO=1 the following:
Select the PV derivative for more stable control when you do not change the setpoint often.
Select the error derivative for fast responses to setpoint changes when the algorithm can
tolerate overshoots.
Control Action .CA=0 Enter whether you want reverse (0) or direct acting (1). Displays one of the following:
.CA=1
REVERSE (0) – for reverse acting (E = SP-PV)
DIRECT (1) – for direct acting (E = PV-SP)
PV Tracking .PVT=0 Enter whether you do not (0) or do (1) want PV tracking. Displays one of the following:
.PVT=1
NO (0) – for no tracking
YES (1) – for PV tracking
Select no tracking if the algorithm can tolerate a bump when switching from manual to
automatic control. Select PV tracking if you want the setpoint to track the PV in manual
control for bumpless transfer to automatic control.
Update Time .UPD Enter an update time (greater than or equal to .01 seconds) at 1/5 to 1/10 the natural
period of the load (load time constant). The load time constant should be greater than:
Periodically enable the PID instruction at a constant interval equal to the update time.
When the program scan time is close to the required update time, use an STI to ensure a
constant update interval. When the program scan is several times faster than the required
update time, use a timer.
Attention: If you omit an update time or enter a negative update time, a major fault occurs
the first time the processor runs the PID instruction.
(Continued)
Cascade Loop .CL=0 Enter whether this loop is not (0) or is (1) used in a cascade of loops. Displays one of the
.CL=1 following:
Cascade Type .CT=0 If this loop is part of a cascade of loops, enter whether this loop is the master (1) or a slave
.CT=1 (0). Displays one of the following:
Master to .ADDR If this loop is a slave loop in a cascade, enter the control block address of the master.
this Slave
Tieback is ignored in the master loop of a cascade. When you change cascaded loops to
manual control, the slave forces the master into manual control. When PV tracking is
enabled, the order of events is:
When you return to automatic control, change the slave first, then the master.
Engineering .MAXS Enter the floating-point value in engineering units that corresponds to the analog module’s
Unit Max full scale output. Valid range is –3.4 E+38 to +3.4 E+38.
Attention: Do not change this value during operation because a processor fault
might occur.
Engineering Unit .MINS Enter the floating-point value in engineering units that corresponds to the analog module’s
Min zero output. Valid range is –3.4 E+38 to +3.4 E+38 (post-scaled number).
Attention: Do not change the maximum scaled value during operation because a
processor fault might occur.
Input .MAXI Enter the floating-point number (–3.4 E+38 to +3.4 E+38) that is the unscaled maximum
Range Max value available from the analog module. For example, use 4095 for a module whose range
is 0-4095.
Input .MINI Enter the floating-point number (–3.4 E+38 to +3.4 E+38) that is the minimum unscaled
Range Min value available from the analog module. For example, use 0 for a module whose range is
0-4095.
Output Limit .MAXO Enter a percent (0-100) above which the algorithm clamps the output.
High %
Output Limit .MINO Enter a percent (0-100) below which the algorithm clamps the output.
Low %
PV Alarm High .PVH Enter a floating-point number (–3.4 E+38 to +3.4 E+38) that represents the highest
PV value that the system can tolerate.
PV Alarm Low .PVL Enter a floating-point number (–3.4 E+38 to +3.4 E+388) that represents the lowest
PV value that the system can tolerate.
PV Alarm .PVDB Enter a floating-point number (0-3.4 E+38) that is sufficient to minimize nuisance alarms.
Deadband This is a one-sided deadband. The alarm bit (.PVH or .PVL) is not set until the PV crosses
the deadband and reaches the alarm limit (DB zero point). The alarm bit remains set until
the PV passes back through and exits from the deadband.
(Continued)
Deviation Alarm .DVP Enter a floating-point number (0-3.4 E+38) that specifies the greatest error deviation above
(+) the setpoint that the system can tolerate.
Deviation Alarm .DVN Enter a floating-point number (–3.4 E+38-0) that specifies the greatest error deviation
(–) below the setpoint that the system can tolerate.
Deviation Alarm .DVDB Enter a floating-point number (0-3.4 E+38) that is sufficient to minimize nuisance alarms.
Deadband
This is a one-sided deadband. The alarm bit (.DVP or .DVN) is not set until the error crosses
the deadband and reaches the alarm limit (DB zero point). The alarm bit remains set until
the error passes back through and exits from the deadband.
No Zero Crossing .NOZC=0 Enter whether to use (1) or inhibit (0) the no zero crossing feature:
.NOZC=1
0 – no zero crossing disabled
1 – no zero crossing enabled
No Back .NOBC=0 Enter whether to use (1) or inhibit (0) the no back calculation feature:
Calculation .NOBC=1
0 – no back calculation disabled
1 – no back calculation enabled
No Derivative .NDF=0 Enter whether to use (1) or inhibit (0) the filter in the derivative calculation.
Filter .NDF=1
0 – no filter used in derivative calculation
1 – filter used in derivative calculation
0 Control/Status Bits
Bit 15 Enabled (EN)
Bit 11 No back calculation (0=disabled, 1=enabled)
Bit 10 No zero crossing (0=disabled, 1=enabled)
Bit 9 Cascade selection (master, slave)
Bit 8 Cascade loop (0=no, 1=yes)
Bit 7 Process variable tracking (0=no, 1=yes)
Bit 6 Derivative action (0=PV, 1=error)
Bit 5 No derivative filter (0=disabled, 1=enabled)
Bit 4 Set output (0=no, 1=yes)
Bit 2 Control action (0=SP-PV, 1=PV-SP)
Bit 1 Mode (0=automatic, 1=manual)
Bit 0 Equation (0=independent, 1=ISA)
(Continued)
1 Status Bits
Bit 12 PID initialized (0=no, 1=yes)
Bit 11 Set point out of range
Bit 10 Output alarm, lower limit
Bit 9 Output alarm, upper limit
Bit 8 DB, set when error is in DB
Bit 3 Error is alarmed low
Bit 2 Error is alarmed high
Bit 1 Process variable (PV) is alarmed low
Bit 0 Process variable (PV) is alarmed high
Note: During prescan, bit 12 is cleared.
32, 33 Process variable high alarm value –3.4 E+38 to +3.4 E+38
34, 35 Process variable low alarm value –3.4 E+38 to +3.4 E+38
(Continued)
VHWSRLQWRXWRIUDQJHDQGFRXOGFKDQJHWKHGHDGEDQGUDQJH
FKRLFHRIGHULYDWLYHDFWLRQEDVHGRQFKDQJHLQ39RUFKDQJHLQ
HUURUEHFDXVHLQWHUQDOYDOXHVZLOOFKDQJH
SURFHVVRUSURGXFHVDUXQWLPHHUURUZKHQLWH[HFXWHVWKHLQVWUXFWLRQ
,I\RXFKDQJH636 RU6 WRFUHDWHWKHODWWHUFRQGLWLRQWKH
PLQ PD[
3,'LQVWUXFWLRQILUVWWULHVWRXVHWKHSUHYLRXVO\YDOLGVHWSRLQW
FRQWLQXHV3,'FRQWURODQGVHWVWKHVHWSRLQWRXWRIUDQJHHUURUELW
,IWKHLQVWUXFWLRQILQGVQRSUHYLRXVO\YDOLGVHWSRLQWLWSURGXFHVDUXQ
WLPHHUURU
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LQWKH
OLPLWVFRXOGFDXVHXQSUHGLFWDEOHRSHUDWLRQGDPDJHWR
HTXLSPHQWRULQMXU\WRSHUVRQQHO
)LJXUHVKRZVWKHODGGHUORJLF\RXQHHGWRDGGWR\RXU3,'
SURJUDP7DEOH*OLVWVWKHYDULDEOHVLQWKLVH[DPSOH
Figure 14.3
Descaling PID Values Example
FAL
FILE ARITHMETIC/LOGIC
Control R6:2 EN
Length 6
Position 0
Mode ALL DN
Destination #N19:0
Expression ER
#N17:0 - #N18:0
FAL
FILE ARITHMETIC/LOGIC
Control R6:5 EN
Length 6
Position 0
Mode ALL DN
Destination #N21:0
Expression ER
#N19:0 * #N20:0
Table 14.G
Variables for the Descaling PID Values Example
Variable Description
Figure 14.4
Example PID Programming Conditioned by a Timer in the Main Program
TON
T10:0 TIMER ON DELAY
EN
Timer T10:0
Time base 0.01
DN Preset 10 DN
Accum 0
BTR
BLOCK TRANSFER READ
T10:0 EN
Rack 0
Group 1
DN Module 0 DN
Control Block BT9:0
Data file N7:104
Length 5 ER
Continuous N
BT9:0 B3
DN 0
PID
B3 PID
Control Block N7:20
Process variable N7:104
0
Tieback 0
Control variable N7:200
BTW
BLOCK TRANSFER WRITE
N7:20 EN
Rack 0
Group 0
13 Module 0 DN
Control Block BT9:1
Data file N7:200
Length 13 ER
Continuous N
,PSRUWDQW 7KHSURJUDPVFDQZDLWVIRUEORFNWUDQVIHULQVWUXFWLRQV
LQWKH67,ILOHWRFRPSOHWHWKHLUWUDQVIHUV
Figure 14.5
Example PID Programming in an STI File
BTR
BLOCK TRANSFER READ
Rack 0 EN
Group 1
0 DN
Module
Control Block BT9:0
Data file N7:104 ER
Length 5
BT9:0 Continuous N
U
EN
PID
PID
Control block N7:20
Process Variable N7:104
Tieback 0
N7:20 Control variable N7:200
U
15
BTW
BLOCK TRANSFER WRITE
Rack 0 EN
Group 0
Module 0 DN
Control Block BT9:1
Data file N7:200
Length 13 ER
BT9:1 Continuous N
U
EN
BTR
BT9:0 BLOCK TRANSFER READ EN
Rack 0
EN Group 1
DN
Module 0
Control Block BT9:0
Data file N7:104 ER
Length 5
Continuous N
PID
BT9:0 PID
Control Block N7:20
DN Process variable N7:104
Tieback 0
Control variable N7:200
BTW
N7:20 BLOCK TRANSFER WRITE EN
Rack 0
Group 0
13 DN
Module 0
Control Block BT9:1
Data file N7:200 ER
Length 13
Continuous N
Figure 14.7
Example PID Programming Conditioned by a Timer in the Main Program
TON
T11:0 TIMER ON DELAY EN
Timer T11:0
DN Time base 0.01
DN
Preset 10
Accum 0
BTR
T11:0 BLOCK TRANSFER READ EN
Rack 0
DN Group 1
DN
Module 0
Control Block BT9:0
Data file N7:104 ER
Length 5
Continuous N
BT9:0 B3
DN 0
PID
B3 B3 PID
ONS Control Block PD10:0
0 1 Process variable N7:104
Tieback 0
Control variable N7:200
BTW
,PSRUWDQW 7KHSURJUDPVFDQZDLWVIRUEORFNWUDQVIHULQVWUXFWLRQV
LQWKH67,ILOHWRFRPSOHWHWKHLUWUDQVIHUV
Figure 14.8
Example PID Programming in an STI File
BTR
BLOCK TRANSFER READ
Rack 0 EN
Group 1
DN
Module 0
Control Block BT9:0
Data file N7:104 ER
Length 5
BT9:0 Continuous N
U
EN
PID
PID
Control block PD10:0
Process Variable N7:104
Tieback 0
Control variable N7:200
BTW
BLOCK TRANSFER WRITE
Rack 0 EN
Group 0
Module 0 DN
Control Block BT9:1
Data file N7:200
Length 13 ER
BT9:1 Continuous N
U
EN
DN 0
PID
B3 B3 PID
ONS Control Block PD10:0
0 1 Process variable N7:104
Tieback 0
Control variable N7:200
BTW
B3
BLOCK TRANSFER WRITE EN
Rack 0
0 Group 0
Module 0 DN
Control Block BT9:1
Data file N7:200 ER
Length 13
Continuous N
MOV
N7:20 MOVE
Source N7:36
4 Destination N7:30
7KHODVWUXQJLQWKHDERYHH[DPSOHLVIRURXWSXWWUDFNLQJIRU
EXPSOHVVWUDQVIHUIURPDXWRPDWLFWRPDQXDOPRGH
Address: Description:
Cascading Loops
<RXFDQFDVFDGHWZRORRSVE\DVVLJQLQJWKHFRQWURORXWSXWRIWKH
RXWHUORRSWRWKHVHWSRLQWRIWKHLQQHUORRS7KHVHWSRLQWRIWKHLQQHU
ORRSLVWKHWKLUGZRUGZRUGRIWKHLQWHJHUFRQWUROEORFN,IWKH
FRQWUROEORFNRIWKHLQQHUORRSLV1DGGUHVVWKHRXWHUORRS
FRQWURORXWSXWDW15HSODFHWKH3,'UXQJVLQ)LJXUHRU
)LJXUHZLWKWKRVHLQ)LJXUH
<RXPXVWQRWVFDOHWKHVHWSRLQWRIWKHLQQHUORRS6HWWKHVFDOLQJELW
ZRUGELWWRWRLQKLELWVHWSRLQWVFDOLQJ
Figure 14.11
Cascaded Loops
PID
PID
Control Block N7:20
Process variable N7:105
Tieback N7:106
Control variable N7:52
PID
PID
Control Block N7:50
Process variable N7:107
Tieback N7:108
Control variable N7:121
Ratio Control
<RXFDQPDLQWDLQWZRYDOXHVLQDUDWLRE\XVLQJD08/LQVWUXFWLRQ
7KUHHSDUDPHWHUVDUHLQYROYHG
WKHZLOGRUXQFRQWUROOHGYDOXH
WKHFRQWUROOHGYDOXH
WKHUDWLREHWZHHQWKHVHWZRYDOXHV
(QWHUWKHDGGUHVVRIWKHFRQWUROOHGYDOXHDVWKH'HVWLQDWLRQ(QWHUWKH
DGGUHVVRIWKHZLOGRUXQFRQWUROOHGYDOXHDV6RXUFH$(QWHUHLWKHU
WKHDGGUHVVRIWKHUDWLRYDOXHRUDSURJUDPFRQVWDQWIRUWKHUDWLRDV
6RXUFH%)RUH[DPSOHDGGWKHUXQJVLQ)LJXUHWRWKH3,'
SURJUDPLQ)LJXUHRU)LJXUH
Figure 14.12
Ratio Control with a PID Instruction
PID
PID
Control block N7:20
Process Variable N7:105
Tieback N7:106
Control variable N7:120
MUL
MUL
Source A N7:105
Source B 0.350000
Destination N7:52
PID
PID
Control block N7:50
Process Variable N7:107
Tieback N7:108
Control variable N7:121
MOV
MOVE
Source N7:34
Destination N7:22
Error
Displayed
as EUs
Convert
Binary % to EU
Smax - Smin
Error x
SetPoint 4095
Scaling
Feed- Set
No Forward Output
12 Bit Error Mode
Truncation
SP-PV Output
SP Limiting
(Error) PID (Out) Off Mode
Yes + +
- Calculation
Convert Eng. Units -1 Auto No
To Binary PV-SP
Output CV
SP-Smin On
x 4095 Limiting
Smax-Smin Set Manual Yes
Output %
Tieback
SP Convert Convert
Displayed as Binary to EU Binary to % Binary
user entry
Smax - Smin 100
PV x + Smin CV x
4095 4095
12 Bit
Truncation
Yes
SetPoint
Scaling Output (CV)
No
displayed as
% Binary
PV
PV
Displayed
as EUs
Figure 14.15
PLC-5 PID (PD Block)
SP Error
Displayed Displayed
as EUs as EUs
Figure 14.16
PLC-5 PID (PD Block) as Master/Slave Loops
Master
Loop
Software A/M
Output
-or- Control
Bias %
A/M Station Mode Action
Set
Software Output %
Auto SP-PV A/M Mode A/M
Convert Eng. Station
+ (Error) Units To % PID (Out%) + Auto Mode
- Calculation
SP Man -1 Error x 100 Auto
PV-SP maxs-mins Output (Master.Out)
PVT Set Manual Limiting
No Output % Manual
Software
Yes PVT A/M Mode
Auto
Convert Binary No Convert Eng.
SP Items referenced in this box
To Eng. Units Units To % Manual are parameters, units, and
(PV-mini)(maxs-mins) x 100 Manual modes as they pertain to the
+ mins PV
maxi-mini Yes maxs-mins designated Slave loop.
Auto
A/M
Station Mode
PV
Output
Slave Control Bias %
Loop Action Set
Software
A/M Mode A/M Output %
Convert % SP-PV
(Master.Out) (SP) Convert Eng. Station
To Eng. Units
+ Units To % PID + Auto Mode
x (maxs-mins) - Calculation
+ mins -1 Error x 100 Auto
100 PV-SP Convert %
maxs-mins Output
To Binary CV
Manual Limiting
Out% x 40.95
Set Manual
Convert Binary
Output %
To Eng. Units
(PV-mini)(maxs-mins) Tieback %
+ mins
maxi-mini
PV
Figure 14.17
PD Block Master/Slave Interlocking State Transitions
Master Loop Transitions Slave Loop Transitions
Auto Auto
Auto Auto
M-
SW
to
Au
an
M
Man
M-
(on
S-M
M-
n
Ma
)
Au
M-
to
Auto
S-S
S-Man
WM
Man SWM
S-Auto
SWM
(on
S-
)
Auto Auto SW
Man M Auto
(on
M-
S-SWM (on)
to
SW
Au
Man
M-
S-SWM (on)
M-
S-Auto
S-SWM (off)
(of
SW
n
Ma
f)
M
M-
(on
)
Man
( SWM ) Man SWM
S-Auto
Auto Man
Man ( SWM ) SWM
SWM
)
(on
Man SWM
M
SW
M-
SW
S-
M-
Man
(of
SW
( SWM )
f)
M
(on
)
Man Auto
n
to
Man
Ma
( SWM )
M-Au
S-
M-Ma
S-Man
Man
S-Auto
( SWM )
Man
M-
Man
SW
( SWM )
M-
M
(of
SW
f)
M
Man
(on
S-SWM (on)
)
Man
S-SWM (off)
n
S-SWM (off)
( SWM
Ma
( Man
) )
S-
SWM
Man SWM
( SWM ) Man
( SWM )
Man
( SWM )
S-Auto
S-Man
Man
Note: ( SWM ) indicates that this loop
is in Manual with SWM also on". Man
( SWM )
Designates Master Loop Mode SWM
*
Stable State (Composite Mode)
*
Slave Loop Mode
Mode transition
M Designated Master
S Slave
Man Manual
Auto Automatic
SWM Software Manual
Use this
If You Want to: Found on Page:
Instruction:
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
Table 15.B
Block Transfer Instructions for Local or Remote Racks in Scanner Mode
Figure 15.1
Block Transfer Operation in Scanner Mode
One of Several Remote I/O Chassis
PLC-5 (supervisor) w/ 1771-ASB Adapter (processor)
1 B
7 T
BTD
File BTW 7
1 M
BTR o
- d
A u
S l
B e
7DEOH&GHVFULEHVKRZWREORFNWUDQVIHUGDWDZKHQWKHSURFHVVRU
LVFRQILJXUHGIRUDGDSWHUPRGH)LJXUHLOOXVWUDWHVKRZWKH
WUDQVIHURFFXUV
Table 15.C
Block Transfer Instructions for Adapter Mode
Figure 15.2
Block Transfer Operation in Adapter Mode
Supervisor Adapter
Processor PLC-5
Scanner
BTW BTR
BTD
BTR BTW File
Description: :KHQWKHUXQJJRHVWUXHWKH%7:LQVWUXFWLRQWHOOVWKHSURFHVVRUWR
BTR
ZULWHGDWDVWRUHGLQWKHGDWDILOHWRWKHVSHFLILHGUDFNJURXSPRGXOH
BLOCK TRNSFR READ EN
DGGUHVVWKH%75LQVWUXFWLRQWHOOVWKHSURFHVVRUWRUHDGGDWDIURPWKH
Rack UDFNJURXSPRGXOHDGGUHVVDQGVWRUHLWLQWKHGDWDILOH
Group
DN
Module
Control Block
Data file ER
Block-Transfer Request Queue
Length
Continuous :KHQDIDOVHWRWUXHUXQJWUDQVLWLRQHQDEOHVD%7:RU%75
LQVWUXFWLRQWKHWUDQVIHUUHTXHVWLVTXHXHG
7KHSURFHVVRUUXQVHDFKEORFNWUDQVIHUUHTXHVWLQWKHRUGHULWLV
UHTXHVWHG:KHQWKHSURFHVVRUFKDQJHVWR3URJUDPPRGHDQ\EORFN
WUDQVIHUVDUHFDQFHOOHG
)RU&ODVVLF3/&SURFHVVRUVHDFKUDFNQXPEHUKDVDEORFNWUDQVIHU
TXHXHZLWKDFRUUHVSRQGLQJTXHXHIXOOELW7DEOH'OLVWVWKH
TXHXHIXOOELWV2QFHWKHVHELWVDUHVHW\RXUODGGHUSURJUDPPXVW
FOHDUWKHP<RXUSURJUDPVKRXOGFRQWLQXDOO\PRQLWRUWKHVH
TXHXHIXOOELWVIRXQGLQWKHVWDWXVILOHZRUGELWV(QKDQFHG
3/&SURFHVVRUVFDQKDYHXQOLPLWHGEORFNWUDQVIHUVLQORFDOUDFNV
VRWKHUHDUHQRTXHXHIXOOELWV
Table 15.D
Queue-Full Bits for Block Transfer Requests (Word 7) –
Classic PLC-5 Processors
Bit Description
7KHQXPEHURIUDFNVLQ\RXUV\VWHPGHSHQGVRQWKHSURFHVVRU
\RXXVH
$%75RU%7:LQVWUXFWLRQZULWHVYDOXHVLQWRLWVFRQWUROEORFN
DGGUHVVDILYHZRUGLQWHJHUILOHZKHQWKHLQVWUXFWLRQLVHQWHUHG7KH
SURFHVVRUXVHVWKHVHYDOXHVWRH[HFXWHWKHWUDQVIHU
7KH(QKDQFHG3/&SURFHVVRUVDOVRKDYHDEORFNWUDQVIHUILOHW\SH
%7<RXFDQVWLOOXVHH[LVWLQJSURJUDPVZLWKLQWHJHUILOHW\SHVEXW
WKHQHZ%7ILOHW\SHPDNHVDGGUHVVLQJHDVLHU)RUH[DPSOHLI\RX
QHHGWZRFRQWUROILOHV\RXFDQXVH%7DQG%7XVLQJLQWHJHU
ILOHV\RXZRXOGKDYHWRXVHIRUH[DPSOH1DQG1
Entering Parameters
7RSURJUDPD%7:RU%75LQVWUXFWLRQ\RXPXVWSURYLGHWKH
SURFHVVRUZLWKWKHIROORZLQJLQIRUPDWLRQWKDWLWVWRUHVLQLWV
FRQWUROEORFN
5DFNLVWKH,2UDFNQXPEHURFWDORIWKH,2FKDVVLVLQ
ZKLFK\RXSODFHGWKHWDUJHW,2PRGXOH7DEOH(OLVWVWKHYDOLG
UDQJHVIRUUDFNQXPEHUV
Table 15.E
Valid Ranges for Rack Number in Block Transfer Instructions
,PSRUWDQW ,QD3/&RUSURFHVVRUWKHEORFN
WUDQVIHUGDWDW\SH%7PXVWEHXVHGIRUUDFNDGGUHVVHV
JUHDWHUWKDQ
7KHILYHZRUGLQWHJHU1FRQWUROILOHKDVWKHIROORZLQJVWUXFWXUH
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
word 0 EN ST DN ER CO EW NR TO RW rack group slot
)RULQIRUPDWLRQRQWKHVWDWXVELWVLQZRUGVHHSDJHIRU
LQIRUPDWLRQRQZRUGVWKURXJKVHHSDJH
'DWD)LOHLVWKHDGGUHVVRIWKHLQSXWRXWSXWVWDWXVLQWHJHU1
IORDWELQDU\%&'RU$6&,,GDWDILOHIURPZKLFKZULWHRULQWR
ZKLFKUHDGWKHSURFHVVRUWUDQVIHUVGDWD(QWHUWKLVILOHDGGUHVV
ZLWKRXWWKHV\PERO
,PSRUWDQW <RXFDQQRWXVHLQGLUHFWDGGUHVVHVIRUWKHGDWDILOH
DGGUHVVLQD%75RU%7:LQVWUXFWLRQ
/HQJWKLVWKHQXPEHURIGDWDILOHZRUGVWRUHDGZULWH
,PSRUWDQW $IORDWLQJSRLQWHOHPHQWFRQVLVWVRIWZRZRUGVZKHQ
\RXVSHFLI\DYDOXHLQWKH/HQJWKILHOGIRUDIORDWLQJ
SRLQWGDWDILOHRQO\KDOIRIWKRVHIORDWLQJSRLQWHOHPHQWV
DUHUHDGZULWWHQ)RUH[DPSOHLI\RXVSHFLI\IRUWKH
OHQJWKIORDWLQJSRLQWHOHPHQWVZLOODFWXDOO\EH
UHDGZULWWHQ
,PSRUWDQW )ORDWLQJSRLQWGDWDILOHOHQJWKVPXVWEHDQHYHQQXPEHU
&RQWLQXRXVGHWHUPLQHVWKHPRGHRIRSHUDWLRQ
Yes Continuous – once the rung goes true, the instruction continues
to transfer data until the continuous (.CO) bit is reset and the
rung is false or you edit the instruction and specify NO for
continuous mode.
Enable .EN (bit 15) when the rung goes true. This bit shows that the instruction
is enabled (that the block transfer is in progress).
In non-continuous mode, the .EN bit remains set until the
block transfer finishes or fails and the rung goes false.
In continuous mode, once the .EN bit is set, it remains set
regardless of the rung condition.
Start .ST (bit 14) when the processor begins transferring data. The .ST bit is
reset at the false-to-true transition after the .DN bit or .ER
bit is set.
Done .DN (bit 13) at completion of the block transfer, if the data is valid. The
.DN bit is set asynchronous to the program scan so the .DN
bit may go true any time after the block transfer is initiated.
The .DN bit is reset the next time the associated rung goes
from false to true.
Error .ER (bit 12) when the processor detects that the block transfer failed.
The .ER bit is reset the next time the associated rung goes
from false to true.
Continue .CO (bit 11) when you edit the instruction for repeated operation of the
block transfer after the first scan, independent of whether
the processor continues to scan the rung.
Reset the .CO bit if you want the rung condition to initiate
block transfers (return to non-continuous mode). If you are
using continuous block transfers in a sequential function
chart, see Appendix B, “SFC Reference,” in this manual.
Enable-waiting .EW when the block transfer request enters the queue. If the
(bit 10) queue is full, this bit remains reset until there is room in the
queue.
The .EW bit is reset when the associated rung goes from
false to true.
In continuous mode, once the .EW bit it set, it remains set.
Use the .EW bit to verify that a BTW or BTR instruction is
queued before leaving an SFC step.
No Response .NR (bit 09) if the block transfer module does not respond to the first
local block transfer request. The .NR bit is reset when the
associated rung goes from false to true (not used with
remote block transfer).
Time Out .TO (bit 08) if you reset the time out bit through ladder logic or data
monitor, the processor repeatedly tries to send a block
transfer request to an unresponsive module for four
seconds before setting the .ER bit.
If you set the .TO bit through ladder logic or data monitor,
the processor disables the four-second timer and requests
a block transfer one more time before setting the .ER bit.
$77(17,21 7KHSURFHVVRUUXQVEORFNWUDQVIHU
LQVWUXFWLRQVDV\QFKURQRXVO\WRSURJUDPVFDQ7KHVWDWXV
RIWKHVHELWVFRXOGFKDQJHDWDQ\SRLQWLQWKHSURJUDP
VFDQ,I\RXH[DPLQHWKHVHELWVLQODGGHUORJLFFRS\WKH
VWDWXVRQFHWRDVWRUDJHELWZKRVHVWDWXVLVV\QFKURQL]HG
ZLWKWKHSURJUDPVFDQ2WKHUZLVHWLPLQJSUREOHPVPD\
LQYDOLGDWH\RXUSURJUDPZLWKSRVVLEOHGDPDJHWR
HTXLSPHQWRULQMXU\WRSHUVRQQHO
<RXUODGGHUSURJUDPVKRXOGFRQGLWLRQWKHXVHRIEORFNWUDQVIHUGDWD
RQWKHVWDWHRIWKH'1ELW
Word – Integer
BT Control Block Description
Control Bock
Table 15.G
Enhanced PLC-5 Processor Block Transfer Error Codes
Error Description:
Number:
–1 not used
–2 not used
–3 The size of the block transfer plus the size of the index in the block transfer
data table was greater than the size of the block transfer data table file.
–4 There was an invalid transfer of block transfer write data between the
adapter and the block transfer module.
–6 The block transfer module requested a different length than the associated
block transfer instruction. This could happen if a 64-word block transfer
instruction was executed and the block transfer module’s default length
was not 64 words.
–7 Block transfer data was lost due to a bad communication channel. Possible
reasons are noise, bad connections, and loose wires. Check resistors.
–9 The block transfer timeout, set in the instruction, timed out before
completion.
–10 No communication channels are configured for remote I/O or rack number
does not appear in rack list.
–11 No communication channels are configured for the requested rack or slot.
Figure 15.3
Timing Diagram for Status Bits in Continuous BTR and BTW Instructions
stage 3
EN
EW
ST
stage 2
CO stage 1
DN
ER
$FRQWLQXRXVEORFNWUDQVIHUFRQWLQXHVDVORQJDVWKHSURFHVVRUVWD\V
LQ5XQRU7HVWPRGHDQGWKHWUDQVIHUGRHVQRWHUURU,I\RXVZLWFKWR
3URJUDPPRGHRUWKHSURFHVVRUIDXOWVWKHEORFNWUDQVIHUVWRSVDQG
ZLOOQRWVWDUWDJDLQXQWLOWKHSURFHVVRUVFDQVWKHUXQJWKDWFRQWDLQVWKH
EORFNWUDQVIHULQVWUXFWLRQ,IUXQQLQJFRQWLQXRXVEORFNWUDQVIHUVIURP
ZLWKLQVHTXHQWLDOIXQFWLRQFKDUWVVHHDSSHQGL[%
7RVWRSFRQWLQXRXVRSHUDWLRQHLWKHUPRGLI\WKHEORFNWUDQVIHU
LQVWUXFWLRQDQGVHOHFWQRQFRQWLQXRXVRUUHVHWWKH&2ELW
EN
EW
ST
CO
DN
ER
Write: Read:
Where: Represents:
Transfer Time
7KHWUDQVIHUWLPHLQPLOOLVHFRQGVEHWZHHQWKHDFWLYHEXIIHUDQGWKH
PRGXOHVWDUWVZKHQWKHSURFHVVRUVHWVWKHVWDUWELWDQGHQGVZKHQ
WKHSURFHVVRUVHWVWKHGRQHELW7KHWUDQVIHUWLPHLVGHILQHGE\
WKHVHIRUPXODV
Write: Read:
remote (57.6K baud) 13 + 30C + 0.3W remote (57.6K baud) 9 + 21.3C + 0.3W
Where: Represents:
Transfer Time
7KHWUDQVIHUWLPHLQPLOOLVHFRQGVEHWZHHQWKHDFWLYHEXIIHUDQGWKH
PRGXOHVWDUWVZKHQWKHSURFHVVRUVHWVWKHVWDUWELWDQGHQGVZKHQWKH
SURFHVVRUVHWVWKHGRQHELW7KHWUDQVIHUWLPHLVGHILQHGE\WKLV
IRUPXODVDPHIRUDUHDGRUZULWH
* Only use continuous mode when you want a block transfer to continue executing even when
the logic which controls it is not being scanned.
,PSRUWDQW 7KHVHH[DPSOHVVKRZDQ(QKDQFHG3/&SURFHVVRU
XVLQJWKH%7ILOHW\SH,I\RXDUHXVLQJD&ODVVLF3/&
SURFHVVRUVXEVWLWXWHDQDSSURSULDWHLQWHJHUILOH
BTW BTR
enable bit enable bit BTW
Precondition BT10:1 BT10:0 BLOCK TRANSFER WRITE EN
Rack 3
EN EN Group 2
DN
Module 0
Control Block BT10:1
Data file N11:10 ER
Length 11
Continuous NO
Block-transfer rungs must be scanned for the transfers to occur.
The preconditions allow time-driven or event-driven transfers.
BTW BTR
enable bit enable bit BTW
BT10:1 BT10:0 BLOCK TRANSFER WRITE EN
Rack 3
EN EN Group 2
DN
Module 0
Control Block BT10:1
Data file N11:10 ER
Length 11
Continuous NO
Block-transfer rungs must be
scanned for the transfers to occur.
BTW
BLOCK TRANSFER WRITE EN
Preconditions
Rack 3
Group 6
Module 1 DN
Control Block BT10:1
Scan the rung once to start continuous block transfers. The continuous Data file N7:200 ER
operation starts on a false-to-true rung transition and continues,
Length 0
whether or not the rungs are scanned again. To stop continuous
operation, use the Data Monitor to reset the continuous bit (.CO or Continuous YES
bit 11), or change the Continuous field in the instruction to NO.
BT10:0 BT10:0
U
ER EN
BT10:1 BT10:1
U
ER EN
These rungs will reset block transfers and should be placed in logic where rungs are
being scanned for error recovery. Your logic must rescan the block transfers with
preconditions true in order to restart continuous block transfers.
BTR
error bit
BTR
BT10:0 BT10:0 enable bit
U
ER EN
This rung will reset block transfers and should be placed in logic where rungs are being
scanned for error recovery. Your logic must rescan the block transfers with preconditions
true in order to restart continuous block transfers.
BTR
BT10:0 BLOCK TRANSFER READ EN
Rack 2
EN Group 2
Module 1 DN
BTR
enable bit Control Block BT10:0
Data File N7:400 ER
Length 4
Continuous NO
FAL
BT10:0 FILE ARITH/LOGICAL EN
Control R6:4
DN Length 4
DN
BTR Position 0
done bit Mode ALL
Destination #N7:500 ER
Expression #N7:400
$IWHU\RXHQWHUWKHFRQWUROEORFNDGGUHVVIRUWKH&,2LQVWUXFWLRQWKH
SURJUDPPLQJWHUPLQDOGLVSOD\VDQLQVWUXFWLRQHQWU\VFUHHQ
Table 15.I
CIO Instruction Entry Screen Configuration
Change the command type. Toggle among the following: [F1] – Command Type
• 1771 Read selects a block transfer read.
• 1771 Write selects a block transfer write.
• 1794 Fault Action selects the action the module takes
when the adapter faults and the connection is terminated.
• 1794 Idle Action selects the action the module takes when
the connection is idle.
• 1794 Config Data changes the configuration for the 1794
module.
• 1794 Safe State Data changes the value of the safe state
data for the 1794 module.
Enter a PLC-5 data table address of the ControlNet processor. [F2] – PLC-5 Address
$IWHUHQWHULQJDQGDFFHSWLQJWKHUXQJFRQWDLQLQJWKH&,2LQVWUXFWLRQ
WKHGDWDPRQLWRUVFUHHQIRUWKH&,2LQVWUXFWLRQOHWV\RXGLVSOD\WKH
SDUDPHWHUVIRUWKHFRQWUROEORFNRIWKHFXUUHQW&,2LQVWUXFWLRQ)URP
WKHGDWDPRQLWRUVFUHHQ\RXFDQGHILQHWKHIROORZLQJSDUDPHWHUV
7DEOH-
Table 15.J
CIO Instruction Control Block Parameters
Toggle the control bit that the cursor is on. You can toggle [F2] – Toggle Bit
among the TO, EW, CO, ER, DN, ST, and EN bits.
Change the size of the block of data to send or receive. [F3] – Size in Elements
Change the address for which the data is displayed. [F5] – Specify Address
Display the data table values for the next file. [F7] – Next File
Display the data table values for the previous file. [F8] – Previous File
Display the data table values for the next element. [F9] – Next Element
Display the data table values for the previous element. [F10] – Previous Element
Enable .EN (bit 15) when the rung goes true. The .EN bit is reset when the .DN bit or .ER bit is set.
This bit shows that the instruction is enabled.
Start .ST (bit 14) when the processor begins executing the CIO instruction. The .ST bit is reset when the
.DN bit or .ER bit is set.
Done .DN (bit 13) when the last word of the CIO instruction transferred. The .DN bit is reset the next time
the associated rung goes from false to true.
The .DN bit is only active in non-continuous mode.
Error .ER (bit 12) when the processor detects that the message transfer failed. The .ER bit is reset the next
time the associated rung goes from false to true.
Continue .CO (bit 11) manually for repeated operation of the CIO instruction after the first scan, independent of
whether the processor continues to scan the rung.
Enable-Waiting .EW (bit 10) when the processor detects that a message request entered the queue. The processor
resets the .EW bit when the .ST bit is set.
Time Out .TO (bit 08) through ladder logic to stop processing the message. The processor sets the .ER bit.
$77(17,21 7KHSURFHVVRUFRQWUROVVWDWXVELWV67
DQG(:DV\QFKURQRXVO\WRWKHSURJUDPVFDQ,I\RX
H[DPLQHWKHVHELWVLQODGGHUORJLFFRS\WKHVWDWXVWRD
VWRUDJHELWZKRVHVWDWXVLVV\QFKURQL]HGZLWKWKH
SURJUDPVFDQ2WKHUZLVHWLPLQJSUREOHPVPD\
LQYDOLGDWH\RXUSURJUDPZLWKSRVVLEOHGDPDJHWR
HTXLSPHQWRULQMXU\WRSHUVRQQHO
$77(17,21 )RUFRQWLQXRXVPRGHWRRSHUDWH
FRUUHFWO\\RXPXVWVHWWKH&2ELWHLWKHURQWKH
FRQILJXUDWLRQVFUHHQRUWKURXJKODGGHUORJLFEHIRUH\RX
HQDEOHWKH&,2LQVWUXFWLRQ
1RWHV
SURFHVVRUVRQORFDORUUHPRWHOLQNV
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKH06*LQVWUXFWLRQVHH$SSHQGL[&
Message (MSG)
7KHIROORZLQJWDEOHOLVWVZKLFK(QKDQFHG3/&SURFHVVRUVVHULHV
DQGUHYLVLRQ\RXFDQXVHZLWKWKH06*LQVWUXFWLRQWRWUDQVIHUGDWD
IURPWRD3/&SURFHVVRURUWRIURPDQ6/&RUSURFHVVRU
LQ6/&QDWLYHPRGH
Processor
Processors:
Series/Revision:
Classic PLC-5 an integer file (N) without the # symbol for the message
control block. Example: N7:0
Enhanced PLC-5, Ethernet an integer file (N) or the message (MG) file type to
PLC-5, or VME PLC-5 access the message control block for DH+ transfers.
Example: MG10:0
Ethernet PLC-5, ControlNet a message (MG) file type to access the VMEbus,
PLC-5, VME PLC-5 Ethernet, or ControlNet network
<RXFDQQRWXVHLQGLUHFWDGGUHVVHVIRUWKHFRQWUROEORFNDGGUHVVLQDQ
06*LQVWUXFWLRQ,I\RXKDYHDQ06*LQVWUXFWLRQFUHDWHGZLWK
YHUVLRQRUHDUOLHUWKDWXVHVDFRQWUROEORFNZLWKDQLQGLUHFW
DGGUHVV\RXPXVWGHOHWHWKHLQVWUXFWLRQDQGUHHQWHULWZLWKRXWDQ
LQGLUHFW DGGUHVV
)RUWKH90(3/&SURFHVVRUVWRGRWUDQVIHUVWRWKH90(EXVWKH
06*LQVWUXFWLRQPXVWEHSURJUDPPHGZLWKDQ0*FRQWUROEORFN
)RU&RQWURO1HW3/&SURFHVVRUVWRSHUIRUPWUDQVIHUVRQWKH
&RQWURO1HWQHWZRUNWKH06*LQVWUXFWLRQPXVWEHSURJUDPPHGZLWK
DQ0*GDWDW\SHLQWKHFRQWUROEORFN
7KHFRQWUROEORFNVL]HYDULHVDFFRUGLQJWRWKHOHQJWKRIWKHPHVVDJH
LI\RXFRPPXQLFDWHZLWKD3/&SURFHVVRUWKHFRQWUROILOHZLOOEH
DSSUR[LPDWHO\RUZRUGV,I\RXFRPPXQLFDWHZLWKD3/&
3/&RU3/&SURFHVVRUWKHFRQWUROILOHZLOOEHDSSUR[LPDWHO\
WRZRUGV7KLVVL]HLVGLVSOD\HGRQWKHVFUHHQLQWKH BLOCK
SIZEILHOG
)RU(QKDQFHG3/&SURFHVVRUV\RXFDQXVHDQLQWHJHUILOH
H[FOXGLQJ&RQWURO1HW3/&SURFHVVRUVRUPHVVDJH0*ILOHW\SH
WRDFFHVVWKHPHVVDJHFRQWUROEORFNIRU'+WUDQVIHUV)RUH[DPSOH
0*LVDYDOLG06*FRQWUROEORFNDGGUHVVIRU(QKDQFHG3/&
SURFHVVRUV8VLQJWKH0*ILOHW\SHWKHFRQWUROEORFNVL]HLVIL[HGDW
ZRUGVWKLVVL]HLVGLVSOD\HGRQWKHVFUHHQLQWKHBLOCK SIZEILHOG
)RUWKH(WKHUQHW3/&SURFHVVRUVD06*LQVWUXFWLRQJRLQJWKURXJK
SRUWWKH(WKHUQHWSRUWXVHVWZRFRQVHFXWLYHPHVVDJHHOHPHQWVLH
0*DQG0*<RXUSURJUDPPLQJVRIWZDUHPLJKWGLVSOD\D
ZDUQLQJZKHQ\RXVHOHFWSRUW
[F1] – Command Type Whether the MSG instruction performs a read or write operation and to what type of
processor the message is going to.
[F2] – PLC-5 Address The data file address of the processor containing the message instruction. If the
MSG operation is write, this address is the starting word of the source file. If the
MSG operation is read, this address is the starting word of the destination file.
[F4] – Local/Remote LOCAL: the message is sent to a device on the local DH+ link.
REMOTE: the message is sent through a bridge (DH, DH II, etc.) to another
DH+ link.
If you select REMOTE, the function keys [F5] – Remote Station, [F6] – Link ID, and
[F7] – Remote Link are active.
[F5] – Remote Station The DH or DH II address (1-376 octal) of the target station.
[F6] – Link ID The remote link where the processor you want to communicate with resides. The
default is 0.
[F7] – Remote Link Toggles through DH, DH II, and other choices for what connects the remote link to
the local DH+.
[F8] – Local Node The local station address on the DH+ (0-77 octal).
If you communicate with another processor on the local link, this address is the
address of the target station on the local link.
If you communicate with a target station on a remote link, this address is the station
number of the communication adapter module that bridges the data highway.
[F9] – Destination Address The starting address of the source or destination file in the target processor.
[F10] – Port Number The channel for message communications. Valid options are: 0, 1A (default), 1B, 2A,
2B, and 3A for the ASCII command.
Entering Parameters
7KHFRQWUROEORFNLVZKHUHDOORIWKHLQIRUPDWLRQUHODWLQJWRWKH
PHVVDJHLVVWRUHG(WKHUQHWPHVVDJHLQVWUXFWLRQVXVHWZRFRQVHFXWLYH
06*HOHPHQWVWKHILUVWRQHFRQWDLQVWKHPHVVDJHLQIRUPDWLRQWKH
VHFRQGRQHFRQWDLQVWKHGHVWLQDWLRQDGGUHVV
,PSRUWDQW 6LQFHWKH(WKHUQHWPHVVDJHVQHHGWZRFRQVHFXWLYH
FRQWUROEORFNVWKHPHVVDJHFRQWUROEORFNWKDW\RX
VSHFLI\PXVWVWDUWRQDQHYHQQXPEHU
$77(17,21 :KLOHFRQILJXULQJ06*LQVWUXFWLRQV
IRUWKH'+DQGVHULDOOLQNVNHHSLQPLQGWKHILOHVXVHG
IRU(WKHUQHW06*FRQWUROEORFNV
,I\RXFKRRVHDILOHEHLQJXVHGDVDQ(WKHUQHWFRQWURO
EORFNWKHSURJUDPPLQJVRIWZDUHSURPSWV\RXWR
FKRRVHZKHWKHU\RXZDQWWRRYHUZULWHWKHILOH,I\RX
FKRRVHWRRYHUZULWHWKHILOHXQSUHGLFWDEOHPDFKLQH
RSHUDWLRQFRXOGRFFXU
$IWHUHQWHULQJWKHFRQWUROEORFNWKHSURJUDPPLQJWHUPLQDO
DXWRPDWLFDOO\GLVSOD\VDGDWDHQWU\VFUHHQIURPZKLFK\RXHQWHU
LQVWUXFWLRQSDUDPHWHUVWKDWDUHVWRUHGDWWKHFRQWUROEORFNDGGUHVV
<RXPXVWHQWHUDSRUWQXPEHURIWRHQDEOHDVSHFLDOVFUHHQIRU
(WKHUQHWWUDQVIHUV
Command Type Whether the MSG instruction performs a read or write operation. The software
toggles between:
• PLC-5 Typed Read
• PLC-5 Typed Write
• PLC-5 Typed Write to SLC
• PLC-5 Typed Read from SLC
• SLC Typed Logical Read
• SLC Typed Logical Write
• PLC-2 Unprotected Read
• PLC-2 Unprotected Write
• PLC-3 Word Range Read
• PLC-3 Word Range Write
• ASCII
PLC-5 Address The data file address of the processor containing the message instruction. If the
MSG operation is write, this address is the starting word of the source file. If the
MSG operation is read, this address is the starting word of the destination file.
Destination Address The starting address of the source or destination file in the target processor.
Port Number The channel for message communications. Ethernet communications use channel 2.
Multihop Select yes if you want to send the MSG instruction to a ControlLogix device. Then use
the Multihop tab to specify the path of the MSG instruction. For more information, see
“Configuring an Ethernet Multihop MSG Instruction” on page 16-9.
7KH(WKHUQHW3/&SURFHVVRUVGRQRWVXSSRUWKRVWQDPHVDVDPHDQV
RIDGGUHVVLQJPHVVDJHV+RZHYHU\RXFDQXVHKRVWQDPHVZLWK
3/&SURJUDPPLQJVRIWZDUHIRUFRQQHFWLQJWR(WKHUQHW3/&
SURFHVVRUVLIDQDPHVHUYHULVRQWKHQHWZRUNRUDKRVWILOHLV
PDLQWDLQHGRQ\RXUZRUNVWDWLRQ
Entering Parameters
7KHFRQWUROEORFNLVZKHUHDOORIWKHLQIRUPDWLRQUHODWLQJWRWKH
PHVVDJHLVVWRUHG(WKHUQHWPHVVDJHLQVWUXFWLRQVXVHWZRFRQVHFXWLYH
06*HOHPHQWVWKHILUVWRQHFRQWDLQVWKHPHVVDJHLQIRUPDWLRQWKH
VHFRQGRQHFRQWDLQVWKHGHVWLQDWLRQDGGUHVV
,PSRUWDQW 6LQFHWKH(WKHUQHWPHVVDJHVQHHGWZRFRQVHFXWLYH
FRQWUROEORFNVWKHPHVVDJHFRQWUROEORFNWKDW\RX
VSHFLI\PXVWVWDUWRQDQHYHQQXPEHU
$IWHUHQWHULQJWKHFRQWUROEORFNWKH3/&SURJUDPPLQJVRIWZDUH
DXWRPDWLFDOO\GLVSOD\VDGDWDHQWU\VFUHHQIURPZKLFK\RXHQWHU
LQVWUXFWLRQSDUDPHWHUVWKDWDUHVWRUHGDWWKHFRQWUROEORFNDGGUHVV
<RXPXVWHQWHUDSRUWQXPEHURI$WRHQDEOHDVSHFLDOVFUHHQIRU
WUDQVIHUVRYHU(WKHUQHWZLWKWKH3/&(WKHUQHW,QWHUIDFH0RGXOH
Command Type Whether the MSG instruction performs a read or write operation. The software
toggles between:
• PLC-5 Typed Read
• PLC-5 Typed Write
• PLC-5 Typed Write to SLC
• PLC-5 Typed Read from SLC
• SLC Typed Logical Read
• SLC Typed Logical Write
• PLC-2 Unprotected Read
• PLC-2 Unprotected Write
• PLC-3 Word Range Read
• PLC-3 Word Range Write
• ASCII
PLC-5 Address The data file address of the processor containing the message instruction. If the MSG
operation is write, this address is the starting word of the source file. If the MSG
operation is read, this address is the starting word of the destination file.
Destination Address The starting address of the source or destination file in the target processor.
Port Number The channel for message communications. The PLC-5 Ethernet Interface Module
communications use channel 3A.
5HPRYDORIWKH3/&(WKHUQHW,QWHUIDFH0RGXOHZLOOQRWFKDQJHWKH
IRUPDWRIWKH06*LQVWUXFWLRQVGHILQHGIRUWKHPRGXOH
Ethernet
ControlLogix chassis
SLC 5/05 Processor
PLC-5 processor with
DH+ ControlNet
1785-ENET sidecar
7RFRPPXQLFDWHWKURXJKD&RQWURO/RJL[(1(7PRGXOH\RX
FRQILJXUHWKHPXOWLKRSIHDWXUHRID06*LQVWUXFWLRQIURPWKH
(WKHUQHW3/&SURFHVVRURU3/&SURFHVVRUZLWK(1(7
VLGHFDUPRGXOHWRWKHWDUJHWGHYLFH<RXQHHG56/RJL[
SURJUDPPLQJVRIWZDUH(QDEOHWKHPXOWLKRSRSWLRQZKHQ\RXVSHFLI\
WKHWDUJHWGHYLFH7KHQXVHWKH0XOWLKRSWDEWRVSHFLI\WKHSDWKRIWKH
06*LQVWUXFWLRQ
,I\RXZDQWWRJRWKURXJKWKH&RQWURO/RJL[(1(7PRGXOHDQG
RXWWKH'+5,2PRGXOHWRWKHWDUJHWGHYLFH\RX
XVH*DWHZD\FRQILJXUDWLRQVRIWZDUHWRFRQILJXUHWKH
'+5,2PRGXOHURXWLQJWDEOHLQWKH&RQWURO/RJL[V\VWHP
VSHFLI\D/LQN,'QXPEHURQFKDQQHOSURSHUWLHVIRUFKDQQHO$
RIWKH(WKHUQHW3/&SURFHVVRURU3/&SURFHVVRUZLWKD
(1(7VLGHFDUPRGXOH
)RUPRUHLQIRUPDWLRQDERXWFRQILJXULQJD3/&FKDQQHODQG
VSHFLI\LQJWKHSDWKRIWKH06*LQVWUXFWLRQVHHWKHGRFXPHQWDWLRQIRU
\RXUSURJUDPPLQJVRIWZDUH
Command Type Change the command type. Toggle between the following:
• PLC-5 Typed Write selects a write operation to a ControlNet PLC-5 processor
• PLC-5 Typed Read selects a read operation from another ControlNet PLC-5
processor
PLC-5 Address The PLC-5 data table address of the ControlNet processor. If the MSG operation is
write, this address is the starting word of the source file. If the MSG operation is read,
this address is the starting word of the destination file.
Destination Address The starting address of the source or destination file in the target processor.
Port Number The channel for message communications. The port number must be 2 for ControlNet.
Multihop Select yes if you want to send the MSG instruction to a ControlLogix device. Then use
the Multihop tab to specify the path of the MSG instruction. For more information, see
“Configuring an ControlNet Multihop MSG Instruction” on page 16-11.
ControlNet
ControlLogix chassis
SLC 5/05 Processor
ControlNet PLC-5 processor
DH+ ControlNet
7RFRPPXQLFDWHWKURXJKD&RQWURO/RJL[&1%PRGXOH\RX
FRQILJXUHWKHPXOWLKRSIHDWXUHRID06*LQVWUXFWLRQIURPWKH
&RQWURO1HW3/&SURFHVVRUWRWKHWDUJHWGHYLFH<RXQHHG56/RJL[
SURJUDPPLQJVRIWZDUH(QDEOHWKHPXOWLKRSRSWLRQZKHQ\RX
VSHFLI\WKHWDUJHWGHYLFH7KHQXVHWKH0XOWLKRSWDEWRVSHFLI\WKH
SDWKRIWKH06*LQVWUXFWLRQ
,I\RXZDQWWRJRWKURXJKWKH&RQWURO/RJL[(1(7PRGXOHDQG
RXWWKH'+5,2PRGXOHWRWKHWDUJHWGHYLFH\RX
XVH*DWHZD\FRQILJXUDWLRQVRIWZDUHWRFRQILJXUHWKH
'+5,2PRGXOHURXWLQJWDEOHLQWKH&RQWURO/RJL[V\VWHP
VSHFLI\D/LQN,'QXPEHURQFKDQQHOSURSHUWLHVIRUFKDQQHO$
RIWKH(WKHUQHW3/&SURFHVVRURU3/&SURFHVVRUZLWKD
(1(7VLGHFDUPRGXOH
)RUPRUHLQIRUPDWLRQDERXWFRQILJXULQJD3/&FKDQQHORU
VSHFLI\LQJWKHSDWKRIWKH06*LQVWUXFWLRQVHHWKHGRFXPHQWDWLRQIRU
\RXUSURJUDPPLQJVRIWZDUH
$77(17,21 'RQRWPRGLI\DQ\VWDWXVELWZKLOHWKH
,QVWUXFWLRQLVHQDEOHG
8QSUHGLFWDEOHPDFKLQHRSHUDWLRQFRXOGRFFXUZLWK
SRVVLEOHGDPDJHWRHTXLSPHQW
DQGRULQMXU\WRSHUVRQQHO
Enable .EN (bit 15) when the rung goes true. This bit shows that the instruction is enabled (that the
instruction is being executed). In non-continuous mode, .EN bit remains set until the
message is completed and the rung goes false. In continuous mode, once .EN bit is set, it
remains set regardless of the rung condition.
Start .ST (bit 14) when the processor begins executing the MSG instruction. The .ST bit is reset when the
.DN bit or .ER bit is set.
Done .DN (bit 13) when the last packet of the MSG instruction transferred. The .DN bit is reset the next
time the associated rung goes from false to true. The .DN bit is only active in
non-continuous mode.
Error .ER (bit 12) when the processor detects that the message transfer failed. The .ER bit is reset the next
time the associated rung goes from false to true.
Continue .CO (bit 11) manually for repeated operation of the MSG instruction after the first scan, independent
of whether the processor continues to scan the rung. Reset the .CO bit if you want the
rung condition to initiate messages (return to non-continuous mode).
Enable-Waiting .EW (bit 10) when the processor detects that a message request entered the queue. The processor
resets the .EW bit when the .ST bit is set.
No Response .NR (bit 09) if the target processor does not respond to the first MSG request. The .NR bit is reset
when the associated rung goes from false to true.
Time Out .TO (bit 08) if you set the .TO bit through ladder logic, the processor stops processing the message
and sets the .ER bit (timeout error 55). A DH+ message time out in 30-60 seconds. A
ControlNet message will time out in 4 seconds
No Cache .NC if you set the .NC bit, the open connection is closed when the MSG is done. If this bit
(ControlNet processors only) remains reset, the connection remains open even when the MSG is complete.
$77(17,21 7KHSURFHVVRUFRQWUROVVWDWXVELWV67
DQG(:DV\QFKURQRXVO\WRWKHSURJUDPVFDQ,I\RX
H[DPLQHWKHVHELWVLQODGGHUORJLFFRS\WKHVWDWXVWRD
VWRUDJHELWZKRVHVWDWXVLVV\QFKURQL]HGZLWKWKH
SURJUDPVFDQ2WKHUZLVHWLPLQJSUREOHPVPD\
LQYDOLGDWH\RXUSURJUDPZLWKSRVVLEOHGDPDJHWR
HTXLSPHQWRULQMXU\WRSHUVRQQHO
,PSRUWDQW ,IWKH6)&VWDUWRYHUDQG&2ELWVDUHFOHDUHGWKH(1
67'1(5(:DQG15ELWVDUHFOHDUHG
GXULQJ SUHVFDQ
Word – Integer
Message Control Block Description
Control Block
3 Internal data
Read data identified by a type code. This command reads data structures without you specifying the PLC-5 Typed Read
actual word length. For example, if you choose a typed read of the PLC-5 timer data section with a
requested data size of 5 elements, the MSG instruction reads 15 words (5 timer structures of 3
words each).
Write data identified by a type code. This command writes data structures without you specifying the PLC-5 Typed Write
actual word length.
Read 16-bit words from any area of the PLC-2 data table or PLC-2 compatibility file. PLC-2 Unprotected Read
Write 16-bit words to any area of the PLC-2 data table or PLC-2 compatibility file. PLC-2 Unprotected Write
Read data identified by a type code. This command reads data structures without specifying the actual PLC-5 Typed Read from SLC2, 3
word length. This command provides additional data verification for communications between a PLC-5
and SLC 500 processor.1
Write data identified by a type code. This command writes data structures without specifying the actual PLC-5 Typed Write to SLC2, 3
word length. This command provides additional data verification for communications between a PLC-5
and SLC 500 processor.1
Read a range of words, starting at the address specified for the external address in the MSG control file SLC Typed Logical Read3
and reading sequentially the number of words specified for the requested size field in the MSG control
file. The data that is read is stored, starting at the address specified fro the internal address in the MSG
control file. This is used for communicating between a PLC-5 and SLC 500 processor.1
Write a range of words, starting at the address specified for the internal address in the MSG control file SLC Typed Logical Write3
and writing sequentially the number of words specified for the requested size field in the MSG control file.
The data from the internal address is written, starting at the address specified for the external address in
the MSG control file. This is used for communicating between a PLC-5 and SLC 500 processor.1
Read a range of words, starting at the address specified for the external address in the MSG control file PLC-3 Word Range Read
and reading sequentially the number of words specified for the requested size field in the MSG control
file. The data that is read is stored, starting at the address specified for the internal address in the MSG
control file.
Write a range of words, starting at the address specified for the internal address in the MSG control file PLC-3 Word Range Write
and writing sequentially the number of words specified for the requested size field in the MSG control file.
The data from the internal address is written, starting at the address specified for the external address in
the MSG control file.
1The PLC-5 is limited to a maximum message of 103 words (206 bytes). The maximum message size for SLC 5/03™ and SLC 5/04™ processors is 103 words
(206 bytes). The maximum message size capability of all other SLC 500 processors is 41 words (82 bytes).
2
These commands are valid only with any SLC 5/04 and SLC 5/03 series C and later processors.
3
These commands are only valid with processors listed in the table on page 16-2.
<RXFDQXVHWKH7\SHG5HDGDQG7\SHG:ULWHFRPPDQGVWRWUDQVIHU
GDWDWDEOHVHFWLRQVZLWKRXWFRXQWLQJWKHDFWXDOZRUGVSHUGDWDWDEOH
HOHPHQW<RXRQO\KDYHWRVSHFLI\WKHQXPEHURIHOHPHQWV\RXZDQW
WRWUDQVIHU)RUH[DPSOHLQWKHGDWDWDEOHWLPHUVHFWLRQRQHHOHPHQW
FRQWDLQVZRUGVEXWLQWKHELQDU\GDWDWDEOHVHFWLRQRQHHOHPHQW
FRQWDLQVRQHZRUG
This Communication Command: To this Device: Requires that You Enter: Example Address:
PLC-3 Word Range Read PLC-5/250 the address in double quotes “1N7:0”
PLC-3 Word Range Write
PLC-5 the address in double quotes, “$N7:0”
precede with a $ character
PLC-5 Typed Read to SLC SLC 5/03 and the address N7:0
PLC-5 Typed Write from SLC 5/04 processors
,I\RXDUHXVLQJDQLQWHJHU1ILOHW\SH\RXFDQGRWKHIROORZLQJ
IURPWKHGDWDPRQLWRUVFUHHQ7DEOH%
Table 16.B
Data Monitor Screen for the MSG Instruction – N File Type
,I\RXDUHXVLQJDQPHVVDJH0*ILOHW\SH\RXFDQGRWKHIROORZLQJ
IURPWKHGDWDPRQLWRUVFUHHQ7DEOH&
Table 16.C
Data Monitor Screen for the MSG Instruction – MG File Type
Toggle the control bit that the cursor is on. [F2] – Toggle Bit
You can toggle among the TO, NR, EW, CO, ER, DN, ST, and
EN bits
Change the size of the block of data to send or receive. [F3] – Size in Elements
Change the address for which the data is displayed. [F5] – Specify Address
Display the data table values for the next file. [F7] – Next File
Display the data table values for the previous file. [F8] – Previous File
Display the data table values for the next element. [F9] – Next Element
Display the data table values for the previous element. [F10] – Previous Element
$77(17,21 )RUFRQWLQXRXVPRGHWRRSHUDWH
FRUUHFWO\\RXPXVWVHWWKH&2ELWHLWKHURQWKH
FRQILJXUDWLRQVFUHHQRUWKURXJKODGGHUORJLFEHIRUH\RX
HQDEOHWKH06*LQVWUXFWLRQ
&RQWLQXRXVPRGHZRUNVDVIROORZV)LJXUH
:KHQWKHUXQJWKDWFRQWDLQVWKH06*LQVWUXFWLRQJRHVWUXHWKH
SURFHVVRULQLWLDWLQJWKH06*LQVWUXFWLRQVHWVWKH(1ELW7KH
SURFHVVRUDOVRUHVHWVWKH(5DQG'1ELWV
7KHSURFHVVRUWKHQTXHXHVWKHPHVVDJHUHTXHVW:KHQWKH
PHVVDJHUHTXHVWHQWHUVWKHTXHXHWKHSURFHVVRUVHWVWKH(:ELW
:KHQWKHSURFHVVRUVWDUWVWRSURFHVVWKHPHVVDJHUHTXHVWWKH
SURFHVVRUVHWVWKH67ELW7KHQH[WWLPHWKHSURFHVVRUUHFHLYHV
QHWZRUNFRQWUROWKHSURFHVVRUWUDQVPLWVWKHPHVVDJH
,IDQHUURURFFXUVWKHSURFHVVRUVHWVWKH(5ELWDQGVWRUHVDQ
HUURUFRGHLQWKHORZHUE\WHRIZRUGRIWKHFRQWUROEORFNIRU
&ODVVLF3/&SURFHVVRUVDQGZRUGRIWKHFRQWUROEORFNIRU
(QKDQFHG3/&SURFHVVRUV
,PSRUWDQW )LJXUHLVDSSURSULDWHIRU(QKDQFHG3/&
SURFHVVRUVRQO\<RXFDQUHVHW&ODVVLF3/&
SURFHVVRUVE\WRJJOLQJWKHHUURURUHQDEOHELWV
Figure 16.1
Timing Diagram for Status Bits in Continuous MSG Instructions
EN
EW
A
ST
CO
DN
ER
Rung true Data sent by MSG begins MSG Rung false Rung true
instruction transmission transmission
and received on network completes
in the queue
these events are asynchronous to ladder program scan
A When the MSG transmission completes, the cycle starts over here without rung transitions
$FRQWLQXRXVPHVVDJHWUDQVIHUFRQWLQXHVDVORQJDVWKHSURFHVVRU
VWD\VLQ5XQRU7HVWP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LPHWKHUXQJJRHVIDOVHWKHSURFHVVRUUHVHWVWKH(1
ELW7KHQZKHQWKHDVVRFLDWHGUXQJJRHVWUXHDJDLQWKHPHVVDJH
WUDQVIHUF\FOHVWDUWVDJDLQ
Figure 16.2
Timing Diagram for Status Bits in Non-Continuous MSG Instructions
EN
EW
ST
CO
DN
ER
Rung true Data sent by MSG begins MSG Rung false Rung true
instruction transmission transmission
and received on network completes
in the queue
Table 16.D
Message Instruction Operation
station A enables the message instruction in the station A enables the message instruction in the
ladder program ladder program
station A obtains the token and transmits the read station A obtains the token and transmits data
command (station B acknowledges immediately) (station B acknowledges immediately)
station B obtains the token and transmits station B stores the data in memory
requested data
station A receives the data and station B obtains the token to respond that the
acknowledges immediately write is complete
station A sets the done bit station A sets the done bit when it receives
a response
ZKHUH
TP = WRNHQSDVV QXPEHURIVWDWLRQVRQ'+OLQN
TT WUDQVPLVVLRQWLPH QXPEHURIGDWDZRUGV
1XPEHURIGDWDZRUGVLQDOOWUDQVPLWWHGPHVVDJHV
IRURQHWRNHQSDVVDURXQGWKH'+OLQN
OH '+RYHUKHDG PV
P ORQJHVWSURJUDPVFDQIRUDQ\SURFHVVRURQWKH'+OLQN
DSSOLFDWLRQYDOXHLQPLOOLVHFRQGV
6HHWKH3/&90(EXV3URJUDPPDEOH&RQWUROOHUV8VHU0DQXDODQG
WKH(WKHUQHW3/&3URJUDPPDEOH&RQWUROOHUVPDQXDOIRU
SHUIRUPDQFHQXPEHUVDQGEHQFKPDUNV
Code:
00D5 213 00D5 incorrect address for the local data table
Code:
F006 236 F006 addressed file does not exist in target processor
F007 237 F007 destination file is too small for number of words requested
F011 247 F011 data type requested does not match data available
Table 16.F
Errors Detected By the VME Processor
0000 success
000D raw data transfer crash (PLC switched out of run mode)
See how many total characters are in the buffer ACB 17-5
Read characters from the buffer and put into a ARD 17-10
string
Read one line of characters from the buffer and ARL 17-12
put into a string
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
7KHUHDUHWZRW\SHVRI$6&,,LQVWUXFWLRQV
$6&,,LQVWUXFWLRQVDUHGHSHQGHQWXSRQRQHDQRWKHU)RUH[DPSOHLI
\RXKDYHDQ$5'$6&,,UHDGLQVWUXFWLRQDQGWKHQDQ$:7$6&,,
ZULWHWKHGRQHELWRQWKH$5'PXVWEHVHWEHIRUHWKH$:7FDQ
EHJLQH[HFXWLQJHYHQLIWKH$:7ZDVHQDEOHGZKLOHWKHSURFHVVRU
ZDVH[HFXWLQJWKH$5'$VHFRQG$6&,,LQVWUXFWLRQFDQQRWEHJLQ
XQWLOWKHILUVWKDVFRPSOHWHG+RZHYHUWKHSURFHVVRUGRHVQRWZDLW
IRUDQ$6&,,LQVWUXFWLRQWRFRPSOHWHEHIRUHFRQWLQXLQJWRH[HFXWH
\RXUODGGHUSURJUDPQRQ$6&,,LQVWUXFWLRQV
Unload.UL (10) This bit may be used by the user to cancel an ASCII read or
write in progress. The time out may occur immediately or up to 6
seconds later.
Synchronous Done.EM (12) The bit is set on the first scan of the instruction after it is completed.
Asynchronous Done.DN (13) The bit is set immediately upon successful completion of the
instruction, asynchronous to program scan.
Note: If this bit is set , the .EN bit is cleared and the .DN bit is set
during prescan.
Queue.EU (14) The bit is set when the instruction is successfully queued.
Enable.EN (15) The bit is set when the rung goes true and is reset after completion
of the instruction and the rung goes false.
Note: If this bit is set and the .DN and .ER bits are cleared, the
control word is cleared during prescan.
Word – Integer
ASCII Control Block Description
Control Block
Length (.LEN)
7KLVLVWKHQXPEHURIFKDUDFWHUVWKHRSHUDWLRQLVWREHSHUIRUPHGRQ
Position (.POS)
7KLVLVWKHFXUUHQWFKDUDFWHUQXPEHUZKLFKWKHRSHUDWLRQ
KDVH[HFXWHG
Using Strings
<RXFDQDGGUHVVVWULQJOHQJWKVE\DGGLQJD/(1WRDQ\VWULQJDGGUHVV
IRUH[DPSOH67/(1
6WULQJOHQJWKVPXVWEHEHWZHHQDQGE\WHV,QJHQHUDOOHQJWKV
WKDWDUHRXWVLGHRIWKLVUDQJHFDXVHWKHSURFHVVRUWRVHWDPLQRUIDXOW
6DQGWKHLQVWUXFWLRQLVQRWH[HFXWHG
,PSRUWDQW <RXFRQILJXUHDSSHQGRUHQGRIOLQHFKDUDFWHUVRQWKH
&KDQQHO&RQILJXUDWLRQVFUHHQ7KHGHIDXOWDSSHQG
FKDUDFWHUVDUHFDUULDJHUHWXUQDQGOLQHIHHGWKHGHIDXOW
HQGRIOLQHWHUPLQDWLRQFKDUDFWHULVFDUULDJHUHWXUQ
)RUPRUHLQIRUPDWLRQVHH\RXUVRIWZDUHXVHUPDQXDO
Description: 8VHWKH$%/LQVWUXFWLRQWRVHHKRZPDQ\FKDUDFWHUVDUHLQWKHEXIIHU
ABL
XSWRDQGLQFOXGLQJWKHHQGRIOLQHFKDUDFWHUVWHUPLQDWLRQ2QD
ASCII TEST FOR LINE
EN
IDOVHWRWUXHWUDQVLWLRQWKHV\VWHPUHSRUWVWKHQXPEHURIFKDUDFWHUVLQ
Channel DN WKH3RVLWLRQILHOGDQGVHWVWKHGRQHELW7KHVHULDOSRUWPXVWEHLQ
Control
Characters ER
8VHUPRGH
Entering Parameters
7RXVHWKH$%/LQVWUXFWLRQ\RXPXVWVXSSO\WKLVLQIRUPDWLRQ
Parameter: Definition:
Channel the number of the RS-232 port. (The only valid value is 0).
Control the address of a control file element used for the control
status bits.
Example:
I:012 ABL
[ EN
[ ASCII TEST FOR LINE
10 Channel 0 DN
If input word 12, bit 10 is set, the processor Control R6:32
performs an ABL operation for channel 0.
Characters ER
:KHQWKHUXQJJRHVIURPIDOVHWRWUXHWKHFRQWUROHOHPHQWHQDEOHELW
(1LVVHW7KHLQVWUXFWLRQLVSXWLQWKH$6&,,LQVWUXFWLRQTXHXHWKH
(8ELWLVVHWDQGSURJUDPVFDQFRQWLQXHV7KHLQVWUXFWLRQLVWKHQ
H[HFXWHGSDUDOOHOWRSURJUDPVFDQ
7KHSURFHVVRUGHWHUPLQHVWKHQXPEHURIFKDUDFWHUVXSWRDQG
LQFOXGLQJWKHHQGRIOLQHWHUPLQDWLRQFKDUDFWHUVDQGSXWVWKLVYDOXH
LQWKHSRVLWLRQILHOG7KHGRQHELWLVWKHQVHW,ID]HURDSSHDUVLQWKH
SRVLWLRQILHOGQRHQGRIOLQHWHUPLQDWLRQFKDUDFWHUVZHUHIRXQG7KH
)'ELWLVVHWLIWKHSRVLWLRQILHOGZDVVHWWRDQRQ]HURYDOXH
:KHQWKHSURJUDPVFDQVWKHLQVWUXFWLRQDQGILQGVWKH'1ELWVHWWKH
SURFHVVRUWKHQVHWVWKH(0ELW7KH(0ELWDFWVDVDVHFRQGDU\GRQH
ELWFRUUHVSRQGLQJWRWKHSURJUDPVFDQ
7KHHUURUELW(5LVVHWGXULQJWKHH[HFXWLRQRIWKHLQVWUXFWLRQLI
WKHLQVWUXFWLRQLVDERUWHG±VHULDOSRUWQRWLQ8VHUPRGH
WKHLQVWUXFWLRQLVDERUWHGGXHWRSURFHVVRUPRGHFKDQJH
Description: 8VHWKH$&%LQVWUXFWLRQWRVHHKRZPDQ\WRWDOFKDUDFWHUVDUHLQWKH
ACB
EXIIHU2QDIDOVHWRWUXHWUDQVLWLRQWKHV\VWHPGHWHUPLQHVWKHWRWDO
ASCII CHARS IN BUFFER
EN QXPEHURIFKDUDFWHUVDQGUHSRUWVLWLQWKH&KDUDFWHUVILHOG7KHVHULDO
Channel DN SRUWPXVWEHLQ8VHUPRGH
Control
Characters ER
Entering Parameters
7RXVHWKH$&%LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUWKH
IROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Channel the number of the RS-232 port (The only valid value in this field is 0).
Control the address of a control file element used for control status bits.
Characters the number of the characters in the buffer that the processor finds
(0-256). This field is display only.
Example:
I:012 ACB
EN
[
[
ASCII CHARS IN BUFFER
10 Channel 0
DN
If input word 12, bit 10 is set, the processor Control R6:32
performs an ACB operation for channel 0. Characters
ER
:KHQWKHUXQJJRHVIURPIDOVHWRWUXHWKHFRQWUROHOHPHQWHQDEOHELW
(1LVVHW:KHQWKHLQVWUXFWLRQLVSXWLQWKH$6&,,LQVWUXFWLRQ
TXHXHWKH(8ELWLVVHWDQGSURJUDPVFDQFRQWLQXHV7KHLQVWUXFWLRQ
LVWKHQH[HFXWHGSDUDOOHOWRSURJUDPVFDQ
7KHSURFHVVRUGHWHUPLQHVWKHQXPEHURIFKDUDFWHUVLQWKHEXIIHUDQG
SXWVWKLVYDOXHLQWKHSRVLWLRQILHOG7KHGRQHELWLVWKHQVHW,ID]HUR
DSSHDUVLQWKHSRVLWLRQILHOGQRFKDUDFWHUVZHUHIRXQG7KH)'ELWLV
VHWLIWKHSRVLWLRQILHOGZDVVHWWRDQRQ]HURYDOXH
:KHQWKHSURJUDPVFDQVWKHLQVWUXFWLRQDQGILQGVWKH'1ELWVHWWKH
SURFHVVRUWKHQVHWVWKH(0ELW7KH(0ELWDFWVDVDVHFRQGDU\GRQH
ELWFRUUHVSRQGLQJWRWKHSURJUDPVFDQ
7KHHUURUELW(5LVVHWGXULQJWKHH[HFXWLRQRIWKHLQVWUXFWLRQLI
WKHLQVWUXFWLRQLVDERUWHG±VHULDOSRUWQRWLQ8VHUPRGH
WKHLQVWUXFWLRQLVDERUWHGGXHWRSURFHVVRUPRGHFKDQJH
Description: 8VHWKH$&,LQVWUXFWLRQWRFRQYHUWDQ$6&,,VWULQJWRDQLQWHJHUYDOXH
EHWZHHQ±DQG
ACI
STRING TO INTEGER CONVERSION
Source
7KHSURFHVVRUVHDUFKHVWKHVRXUFHILOHW\SH67IRUWKHILUVWFKDUDFWHU
Destination WKDWLVEHWZHHQDQG$OOQXPHULFFKDUDFWHUVDUHH[WUDFWHGXQWLOD
QRQQXPHULFFKDUDFWHURUWKHHQGRIWKHVWULQJLVUHDFKHG&RPPDV
DQGVLJQV±DUHDOORZHGLQWKHVWULQJ
7KHH[WUDFWHGQXPHULFVWULQJLVWKHQFRQYHUWHGWRDQLQWHJHUEHWZHHQ
±DQG
,IQRQXPHULFFKDUDFWHUVDUHIRXQGQRDFWLRQLVWDNHQ$OVRLIWKH
VWULQJKDVDQLQYDOLGOHQJWKOHVVWKDQ]HURRUJUHDWHUWKDQWKH
IDXOWELWLVVHW6DQGWKHLQVWUXFWLRQLVQRWH[HFXWHG
7KLVLQVWUXFWLRQDOVRVHWVWKHDULWKPHWLFIODJVIRXQGLQZRUGELWV
LQWKHSURFHVVRUVWDWXVILOH6
S:0/0 Carry (C) the carry was generated while converting the
string to an integer
S:0/1 Overflow (V) the integer value was outside of the valid range
Example:
I:012 ACI
[
[ STRING TO INTEGER
10 Source ST38:90
Destination N7:123
If input word 12, bit 10 is set, convert the string in
ST38:90 to an integer and store the result in N7:123. 75
Description: 7KH$&1LQVWUXFWLRQDSSHQGV6RXUFH%WRWKHHQGRI6RXUFH$DQG
ACN
VWRUHVWKHUHVXOWLQWKH'HVWLQDWLRQ
STRING CONCATENATE
,IWKHUHVXOWLVORQJHUWKDQFKDUDFWHUVRQO\WKHILUVWDUHZULWWHQ
Source A
WRWKHGHVWLQDWLRQILOHDQGWKHHUURUELW6LVVHW$OVRLIWKH
Source B
OHQJWKRIHLWKHUVWULQJLVLQYDOLGOHVVWKDQ]HURRUJUHDWHUWKDQWKH
Destination
IDXOWELWLVVHWDQGWKHVWULQJDWWKHGHVWLQDWLRQDGGUHVVLVQRWFKDQJHG
Example:
I:012 ACN
[
[ STRING CONCATENATE
10 Source A ST37:42
If input word 12, bit 10 is set, concatenate the string Source B ST38:91
in ST37:42 with the string in ST38:91 and store the
result in ST52:76 Destination ST52:76
Description: 8VHWKH$(;LQVWUXFWLRQWRFUHDWHDQHZVWULQJE\WDNLQJDSRUWLRQRI
AEX
DQH[LVWLQJVWULQJ
STRING EXTRACT
Source Entering Parameters
Index
Number
Destination
7RXVHWKH$(;LQVWUXFWLRQ\RXPXVWSURYLGHWKHSURFHVVRUWKH
IROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Index the starting position (from 1 to 82) of the portion of the string you want to
extract. (An index of 1 indicates the left-most character of the string.)
Number the number of characters (from 0 to 82) you want to extract, starting at
the indexed position. If the Index plus the Number is greater than the total
characters in the source string, the destination string will be the
characters from the index to the end of the source string. If you enter 0
for the number, the destination string length is set to zero.
Destination the string element (ST) where you want the extracted string stored.
Example:
I:012 AEX
[
[ STRING EXTRACT
10 Source ST38:40
If input word 12, bit 10 is set, extract 10 characters Index 42
starting at the 42nd character of ST38:40 and store Number 10
the result in ST52:75. Destination ST52:75
7KHIROORZLQJFRQGLWLRQVFDXVHWKHSURFHVVRUWRVHWWKHIDXOW
ELW 6
LQYDOLGVWULQJOHQJWKRUVWULQJOHQJWKRI]HUR
LQGH[RUQXPEHUYDOXHVRXWVLGHRIUDQJH
LQGH[YDOXHJUHDWHUWKDQWKHOHQJWKRIWKHVRXUFHVWULQJ
7KHGHVWLQDWLRQVWULQJZLOOQRWFKDQJHLQDQ\RIWKHDERYHLQVWDQFHV
Description: 8VHWKH$+/LQVWUXFWLRQWRVHWRUUHVHWWKH56'75DQG576
AHL KDQGVKDNHFRQWUROOLQHVIRU\RXUPRGHP2QDIDOVHWRWUXHWUDQVLWLRQ
ASCII HANDSHAKE LINE
EN
WKHV\VWHPXVHVWKHWZRPDVNVWRGHWHUPLQHZKHWKHUWRVHWRUUHVHWWKH
Channel
AND Mask
DN '75DQG576OLQHVRUOHDYHWKHPXQFKDQJHG
OR Mask
Control ER ,PSRUWDQW %HIRUH\RXXVHWKLVLQVWUXFWLRQPDNHVXUHWKDW\RXGR
Channel Status
QRWFRQIOLFWZLWKWKHDXWRPDWLFFRQWUROOLQHVRQ
\RXU PRGHP
Entering Parameters
7RXVHWKH$+/LQVWUXFWLRQ\RXPXVWSURYLGHWKLVLQIRUPDWLRQ
Parameter: Definition:
Channel the number of the RS-232 port that you want to use. Currently, only
channel 0 can be set or reset.
AND Mask the mask to reset the DTR and RTS control lines. Bit 0 corresponds
to the DTR line and bit 1 corresponds to the RTS line. A 1 at the
mask bit causes the line to be reset; a 0 leaves the line unchanged.
OR Mask the mask to set the DTR and RTS control lines. Bit 0 corresponds to
the DTR line and bit 1 corresponds to the RTS line. A 1 at the mask
bit causes the line to be set; a 0 leaves the line unchanged.
Control the address of the result control structure in the control area of
memory for the result.
Channel Status displays the current status (0000 to FFFF) of the handshake lines
for the channel specified above. This field is display only; convert
the hexadecimal status to binary and refer to the table below:
Bit 1 0
I:012 AHL
[ EN
[ ASCII HANDSHAKE LINES
11 Channel 0
DN
AND Mask 0000
OR Mask 0003
Control ER
R6:22
If input word 12, bit 11 is set, bit 0 and bit 1 of the OR Channel Status
mask is set to SET (ON) the DTR and RTS lines.
Channel status will display a 001F.
Example:
I:012 AIC
[
[ INTEGER TO STRING
10 Source 867
Destination ST38:42
If input word 12, bit 10 is set, convert the value
867 to a string and store the result in ST38:42.
Description: 8VHWKH$5'LQVWUXFWLRQWRUHDGFKDUDFWHUVIURPWKHEXIIHUDQGVWRUH
WKHPLQDVWULQJ7RUHSHDWWKHRSHUDWLRQWKHUXQJPXVWJRIURPIDOVH
ARD
ASCII READ EN WRWUXH7KHVHULDOSRUWPXVWEHLQ8VHUPRGH
Channel
Destination DN
Control Entering Parameters
String Length
ER
Characters Read
7RXVHWKH$5'LQVWUXFWLRQSURYLGHWKHIROORZLQJLQIRUPDWLRQ
Parameter: Definition:
Channel the number of the RS-232 port. (The only valid value is 0).
Control the control file element used for the control status bits.
Destination the string element where you want the characters stored.
String Length the number of characters you want to read from the buffer. The
maximum is 82 characters. If you specify a length larger than 82,
only 82 characters will be read. (If you specify 0, the string length
defaults to 82.)
Characters Read the number of characters that the processor moved from the buffer
to the string (0 to 82). This field is display only.
Example:
ARD
I:012 EN
[
[ ASCII READ
10 Channel 0
Destination ST52:76 DN
If input word 12, bit 10 is set, read 50 characters Control R6:23
from the buffer and move them to ST52:76. String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WUXFWLRQVWDUWVH[HFXWLQJZLWKWKH8/ELWDOUHDG\VHWDQG
WKHUHDUHFKDUDFWHUVLQWKHEXIIHUWKHLQVWUXFWLRQSURFHHGVWR
QRUPDO FRPSOHWLRQ
7KHHUURUELW(5LVVHWGXULQJWKHH[HFXWLRQRIWKHLQVWUXFWLRQLI
WKHLQVWUXFWLRQLVDERUWHG±VHULDOSRUWQRWLQ8VHUPRGH
WKHLQVWUXFWLRQLVDERUWHGGXHWRSURFHVVRUPRGHFKDQJH
ZKHQXVLQJDPRGHPWKHPRGHPLVGLVFRQQHFWHG
Figure 17.1
Example ARD Timing Diagram
Rung Condition ON
OFF
ON
Enable Bit (.EN) OFF
Done Bit
Error Bit ON
(.DN or. ER) OFF
1 2 3 4 5 1 5 2 3 4
1 - rung goes true
2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
Description: 8VHWKH$5/LQVWUXFWLRQWRUHDGFKDUDFWHUVIURPWKHEXIIHUXSWRDQG
ARL
LQFOXGLQJWKHHQGRIOLQHWHUPLQDWLRQFKDUDFWHUVDQGVWRUHWKHPLQD
ASCII READ LINE EN VWULQJ7KHHQGRIOLQHFKDUDFWHUVDUHVSHFLILHGRQWKH&KDQQHO
Channel
Destination
&RQILJXUDWLRQVFUHHQWKHGHIDXOWLVDFDUULDJHUHWXUQ)RUPRUH
DN
Control
String Length
LQIRUPDWLRQRQFKDQQHOFRQILJXUDWLRQVHH\RXUVRIWZDUHXVHUPDQXDO
Characters Read ER 7KHVHULDOSRUWPXVWEHLQ8VHUPRGH
Entering Parameters
7RXVHWKH$5/LQVWUXFWLRQ\RXPXVWSURYLGHWKLVLQIRUPDWLRQ
Parameter: Definition:
Channel the number of the RS-232 port. (The only valid value is 0).
Control the address of the control file element used for the control status bits.
Destination the string element where you want the string stored.
String Length the number of characters (maximum 82) you want to read from the
buffer. If the processor finds the end-of-line characters before
reading the number of characters you specified, only those
characters read and the end-of-line are moved to the destination.
Characters the number of characters that the processor moved from the buffer
Read to the string (0 to 82). This field is display only.
Example:
ARL
I:012
ASCII READ LINE EN
[ [
10 Channel 0
Destination ST52:72 DN
If input word 12, bit 10 is set, read 18 characters Control R6:23
(or until end-of-line) from the buffer and move String Length 18
them to ST52:72. ER
Characters Read
:KHQWKHUXQJJRHVIURPIDOVHWRWUXHWKHFRQWUROHOHPHQWHQDEOHELW
(1LVVHW7KHLQVWUXFWLRQLVSXWLQWKH$6&,,LQVWUXFWLRQTXHXHWKH
(8ELWLVVHWDQGSURJUDPVFDQFRQWLQXHV7KHLQVWUXFWLRQLVWKHQ
H[HFXWHGSDUDOOHOWRSURJUDPVFDQ
2QFHWKHUHTXHVWHGQXPEHURIFKDUDFWHUVRUWKHHQGRIOLQH
FKDUDFWHUVDUHLQWKHEXIIHUDOOFKDUDFWHUVLQFOXGLQJWKHHQGRIOLQH
FKDUDFWHUVDUHPRYHGWRWKHGHVWLQDWLRQVWULQJ7KHQXPEHURI
FKDUDFWHUVPRYHGLVVWRUHGLQWKHSRVLWLRQZRUGRIWKHFRQWUROHOHPHQW
DQGWKHGRQHELWLVVHW
:KHQWKHSURJUDPVFDQVWKHLQVWUXFWLRQDQGILQGVWKH'1ELWVHWWKH
SURFHVVRUWKHQVHWVWKH(0ELW7KH(0ELWDFWVDVDVHFRQGDU\GRQH
ELWFRUUHVSRQGLQJWRWKHSURJUDPVFDQ
<RXFDQXVHWKH8/ELWWRWHUPLQDWHDQ$5/LQVWUXFWLRQEHIRUHLW
FRPSOHWHVIRUH[DPSOH\RXPD\ZDQWWRWHUPLQDWHWKHLQVWUXFWLRQLI
\RXNQRZWKDWWKH$6&,,GHYLFHFRQQHFWHGWRWKHSRUWLVQRWVHQGLQJ
GDWDRULIWKHFRQQHFWLRQEUHDNVDIWHUWKHLQVWUXFWLRQVWDUWVH[HFXWLQJ
6HWWKH8/ELWLQWKHFRQWUROVWUXFWXUHWKH(5ELWLVWKHQVHW
,PSRUWDQW :KHQ\RXVHWWKH8/ELWWKHLQVWUXFWLRQGRHVQRW
WHUPLQDWHLPPHGLDWHO\LWPD\WDNHVHYHUDOVHFRQGV
,IDQ$5/LQVWUXFWLRQVWDUWVH[HFXWLQJZLWKWKH8/ELWDOUHDG\VHWDQG
WKHUHDUHQRFKDUDFWHUVLQWKHEXIIHUWKHLQVWUXFWLRQWHUPLQDWHV,IDQ
$5/LQVWUXFWLRQVWDUWVH[HFXWLQJZLWKWKH8/ELWDOUHDG\VHWDQG
WKHUHDUHFKDUDFWHUVLQWKHEXIIHUWKHLQVWUXFWLRQSURFHHGVWR
QRUPDO FRPSOHWLRQ
7KHHUURUELW(5LVVHWGXULQJWKHH[HFXWLRQRIWKHLQVWUXFWLRQLIWKH
FKDQQHOLVLQV\VWHPPRGHRUVZLWFKHVWRV\VWHPPRGHWKH
SURFHVVRUVZLWFKHVWRSURJUDPWHVWPRGHRULIWKHPRGHPLVORVW
ZKHQXVLQJPRGHPFRQWURO
Figure 17.2
Example ARL Timing Diagram
Rung Condition ON
OFF
Done Bit
Error Bit ON
(.DN or. ER) OFF
ON
Empty Bit (.EM) OFF
Parameter: Definition:
Source the string you want to find when examining the search string.
Index the starting position (from 1 to 82) of the portion of the search string you
want to search. An index of 1 indicates the left-most character.
Result an integer address where the processor stores the position of the search
string where the source string begins. If no match is found, 0 is stored in
the result.
Example:
I:012 ASC
[
[
STRING SEARCH
10 Source ST38:40
Index 35
Search ST52:80
If input word 12, bit 10 is set, search the string in ST52:80 Result N10:0
starring at the 35th character, for the string found in
ST38:40. In this example, the result is stored in N10:0.
7KHIROORZLQJFRQGLWLRQVFDXVHWKHSURFHVVRUWRVHWWKHIDXOW
ELW6
LQYDOLGVWULQJOHQJWKRUVWULQJOHQJWKRI]HUR
LQGH[YDOXHVRXWVLGHRIUDQJH
LQGH[YDOXHJUHDWHUWKDQWKHOHQJWKRIWKHVRXUFHVWULQJ
7KHUHVXOWLVVHWWR]HURLQDQ\RIWKHDERYHLQVWDQFHV
Description: 8VHWKH$65LQVWUXFWLRQWRFRPSDUHWZR$6&,,VWULQJV7KHV\VWHP
ORRNVIRUDPDWFKLQOHQJWKDQGXSSHUORZHUFDVH,IWKHWZRVWULQJV
DUHLGHQWLFDOWKHUXQJLVWUXHLIWKHUHDUHDQ\GLIIHUHQFHVWKHUXQJ
LVIDOVH
Example:
ASR O:013
ASCII STRING COMPARE
Source A ST37:42 01
Source B ST38:90
If the string in ST37:42 is identical to the
string in ST38:90, set output bit O:013/01.
$QLQYDOLGVWULQJOHQJWKFDXVHVWKHSURFHVVRUWRVHWWKHIDXOWELW
6DQGWKHUXQJLVIDOVH
Description: 8VHWKH$:$LQVWUXFWLRQWRZULWHFKDUDFWHUVIURPWKHVRXUFHWRD
GLVSOD\GHYLFH7KLVDSSHQGLQVWUXFWLRQDGGVRUFKDUDFWHUVZKLFK
AWA
ASCII WRITE APPEND EN \RXFRQILJXUHLQWKH&KDQQHO&RQILJXUDWLRQ7KHGHIDXOWLVDFDUULDJH
Channel
Source
UHWXUQDQGOLQHIHHGDSSHQGHGWRWKHHQGRIWKHVWULQJ<RXFDQXVH
Control
String Length
DN
WKLVLQVWUXFWLRQZLWKWKHVHULDOSRUWLQ8VHURU6\VWHPPRGH
Characters Sent ER
Entering Parameters
7RXVHWKH$:$LQVWUXFWLRQ\RXPXVWSURYLGHWKLVLQIRUPDWLRQ
Parameter: Definition:
Channel the number of the RS-232 port. (The only valid value is 0).
Control the address of the control file element used for the control status bits.
String Length the maximum number of characters you want to write from the
source string (0 to 82). If you enter 0, the entire string will be written.
Characters Sent the number of characters that the processor sent to the display area
(0 to 82). Only after the entire string is sent is this field updated
(no running total for each character sent is stored). This field is
display only.
Example:
I:012 AWA
EN
[
[ ASCII WRITE APPEND
10 Channel 0
Source ST37:42 DN
Control R6:23
If input word 12, bit 10 is set, read 25 characters from String Length 25 ER
ST37:42 and write it to the display device. Then write Characters Sent
a carriage return and line feed (default).
:KHQWKHUXQJJRHVIURPIDOVHWRWUXHWKHFRQWUROHOHPHQWHQ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LQJPRGHPFRQWURO,IWKHPRGHPZDVDOUHDG\
ORVWWKHLQVWUXFWLRQVWLOOH[HFXWHV
Figure 17.3
Example AWA Timing Diagram
Rung Condition ON
OFF
ON
Enable Bit (.EN)
OFF
ON
Queue Bit (.EU)
OFF
Done Bit ON
Error Bit OFF
(.DN or. ER)
ON
Empty Bit (.EM)
OFF
1 2 3 4 5 1 5 2 3 4
1 - rung goes true
2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
Description: 8VHWKH$:7LQVWUXFWLRQWRZULWHFKDUDFWHUVIURPWKHVRXUFHWRD
AWT
GLVSOD\GHYLFH7RUHSHDWWKHLQVWUXFWLRQWKHUXQJPXVWJRIURP
ASCII WRITE IDOVHWRWUXH<RXFDQXVHWKLVLQVWUXFWLRQZLWKWKHSRUWLQ6\VWHPRU
EN
Channel 8VHUPRGH
Source
Control DN
String Length
Characters Sent ER Entering Parameters
7RXVHWKH$:7LQVWUXFWLRQ\RXPXVWSURYLGHWKLVLQIRUPDWLRQ
Parameters: Definition:
Channel the number of the RS-232 port. (The only valid value is 0).
Control the address of the control file element used for the control status file.
String Length the maximum number of characters you want to write from the
source string (0 to 82). If you enter 0, the entire string will be written.
Characters Sent the number of characters that the processor sent to the display area
(0 to 82). Only after the entire string is sent is this field updated
(no running total for each character sent is stored). This field is
display only.
Example:
I:012 AWT
[
[ ASCII WRITE EN
10 Channel 0
Source ST37:20 DN
Control R6:23
If input word 12, bit 10 is set, write 40 characters String Length 40
from ST37:20 and write it to the display device. Characters Sent ER
:KHQWKHUXQJJRHVIURPIDOVHWRWUXHWKHFRQWUROHOHPHQWHQDEOHELW
(1LVVHW7KHLQVWUXFWLRQLVSXWLQWKH$6&,,LQVWUXFWLRQTXHXHWKH
(8ELWLVVHWDQGSURJUDPVFDQFRQWLQXHV7KHLQVWUXFWLRQLVWKHQ
H[HFXWHGSDUDOOHOWRSURJUDPVFDQ
)RUW\FKDUDFWHUVIURPVWULQJ67DUHVHQWWKURXJKFKDQQHO7KH
GRQHELWLVVHWDQGDYDOXHRILVVHQWWRWKHSRVLWLRQZRUG
:KHQWKHSURJUDPVFDQVWKHLQVWUXFWLRQDQGILQGVWKH'1ELWVHWWKH
SURFHVVRUWKHQVHWVWKH(0ELW7KH(0ELWDFWVDVDVHFRQGDU\GRQH
ELWFRUUHVSRQGLQJWRWKHSURJUDPVFDQ
<RXFDQXVHWKH8/ELWWRWHUPLQDWHDQ$:7LQVWUXFWLRQEHIRUHLW
FRPSOHWHVIRUH[DPSOH\RXPD\ZDQWWRWHUPLQDWHWKHLQVWUXFWLRQLI
\RXNQRZWKDWWKH$6&,,GHYLFHFRQQHFWHGWRWKHSRUWFDQQRWDFFHSW
GDWDRULIWKHFRQQHFWLRQEUHDNVDIWHUWKHLQVWUXFWLRQVWDUWVH[HFXWLQJ
6HWWKH8/ELWLQWKHFRQWUROVWUXFWXUHWKH(5ELWLVWKHQVHW
,PSRUWDQW :KHQ\RXVHWWKH8/ELWWKHLQVWUXFWLRQGRHVQRW
WHUPLQDWHLPPHGLDWHO\LWPD\WDNHVHYHUDOVHFRQGV
,IDQ$:7LQVWUXFWLRQVWDUWVH[HFXWLQJZLWKWKH8/ELWDOUHDG\VHW
WKHLQVWUXFWLRQDERUWVLPPHGLDWHO\
7KHHUURUELW(5LVVHWGXULQJWKHH[HFXWLRQRIWKHLQVWUXFWLRQLIWKH
SURFHVVRUVZLWFKHVWRSURJUDPRUWHVWPRGHRULIWKHPRGHPEHFRPHV
ORVWZKHQXVLQJPRGHPFRQWURO,IWKHPRGHPZDVDOUHDG\ORVWWKH
LQVWUXFWLRQVWLOOH[HFXWHV
Figure 17.4
Example AWT Timing Diagram
ON
Rung Condition OFF
ON
Enable Bit (.EN) OFF
ON
Queue Bit (.EU) OFF
Done Bit ON
Error Bit
(.DN or. ER) OFF
ON
Empty Bit (.EM)
OFF
1 2 3 4 5 1 5 2 3 4
1 - rung goes true
2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
1RWHV
SDS or DFA CAR utilities Distributed Diagnostic and Machine Control User Manual
)RUPRUHLQIRUPDWLRQRQWKHRSHUDQGVDQGYDOLGGDWDW\SHVYDOXHVRI
HDFKRSHUDQGXVHGE\WKHLQVWUXFWLRQVGLVFXVVHGLQWKLVFKDSWHUVHH
$SSHQGL[&
This Type of
Logic Equation: Does this:
Combinatorial provides for the ANDing of inputs in addition to the OR function used
in transition equations. This allows complex combinations to be
accommodated more easily within the SDS framework with a
minimum number of steps.
)RUPRUHLQIRUPDWLRQRQWKH6'6LQVWUXFWLRQVHHWKH'LVWULEXWHG
'LDJQRVWLFDQG0DFKLQH&RQWURO8VHU0DQXDO
1RWHV
Timer and Counter TON timer on (0.01 base) 3.8 2.6 2-3
(1.0 base) 4.1 2.5
(Continued)
Use the larger number for addresses beyond 2048 words in the processor’s data table.
)or every bit address above the first 256 words of memory in the data table, add 0.16 ms and 1 word of memory.
(Continued)
1.Use the larger number for addresses beyond 2048 words in the processor’s data table.
E = number of elements acted on per scan
SRT true is only an approximation. Actual time depends on the randomness of the numbers.
Compare CMP all 2.48 + (Σ[0.8 + i]) 2.16 + Wi[0.56] 2.48 + (Σ[0.8 + i]) 2.16 + Wi[0.56] 2+Wi
Compute CPT all 2.48.+ (Σ[0.8 + i]) 2.16 + Wi[0.56] 2.48.+ (Σ[0.8 + i]) 2.16 + Wi[0.56] 2+Wi
1.Use the larger number for addresses beyond 2048 words in the processor’s data table.
i = execution time of each instruction (operation, e.g. ADD, SUB, etc.) used within the CMP or the CPT expression
Wi = number of words of memory used by the instruction (operation, e.g. ADD, SUB, etc) within the CMP or CPT expression
CMP or CPT instructions are calculated with short direct addressing
File Instructions
5HIHUWR7DEOH$%IRUWKHLQVWUXFWLRQWLPLQJIRUILOHLQVWUXFWLRQV
Table A.B
Timing and Memory Requirements for File, Program Control, and ASCII
Instructions (Enhanced PLC-5 Processors)
File FAL all 11 + (Σ[2.3 + i])E 6.16 + Wi[0.16] 11 + (Σ[2.3 + i])E 6.16 + Wi[0.16] 3-5 +Wi
Arithmetic
and Logic
File Search FSC all 11 + (Σ[2.3 + i])E 6.16 + Wi[0.16] 11 + (Σ[2.3 + i])E 6.16 + Wi[0.16] 3-5 +Wi
and
Compare
File COP copy 16.2+E[0.72] 1.4 17.8+E[1.44] 1.4 4-6
counter, timer, and 15.7+E[2.16] 1.4
control
FLL fill 15.7+E[0.64] 1.5 18.1+E[0.80] 1.5 4-6
counter, timer, and 15.1+E[1.60] 1.5
control
Shift BSL bit shift left 10.6+B[0.025] 5.2 4-7
Register
BSR bit shift right 11.1 + B[0.025] 5.2 4-7
FFL FIFO load 8.9 3.8 4-7
FFU FIFO unload 10.0+E[0.43] 3.8 4-7
LFL LIFO load 9.1 3.7 4-7
LFU LIFO unload 10.6 3.8 4-7
Diagnostic FBC 0 mismatch 15.4 + B[0.055] 2.9 6-11
1 mismatch 22.4 + B[0.055] 2.9
2 mismatches 29.9+ B[0.055] 2.9
DDT 0 mismatch 15.4 + B[0.055] 2.9 6-11
1 mismatch 24.5 + B[0.055] 2.9
2 mismatches 34.2 + B[0.055] 2.9
DTR data transitional 5.3 5.3 4-7
(Continued)
1.Use the larger number for addresses beyond 2048 words in the processor’s data table.
i = execution time of each instruction (operation, e.g. ADD, SUB, etc.) used within the FAL or the FSC expression
E = number of elements acted on per scan
B = number of bits acted on per scan
Wi = number of words of memory used by the instruction (operation, e.g. ADD, SUB, etc.) within the FAL or FSC expression
FAL or FSC instructions are calculated with short direct addressing
(Continued)
OR or 36 14 4-7
(Continued)
negate 59 33 68 34 5-7
clear 49 30 55 34 4-5
move 58 33 5-7
AND 68 34 6-9
OR 68 34 6-9
XOR 68 34 6-9
NOT 59 34 5-7
File Instructions
7KHLQVWUXFWLRQWLPLQJIRUILOHLQVWUXFWLRQVGHSHQGVRQWKHGDWDW\SH
QXPEHURIILOHVDFWHGRQSHUVFDQQXPEHURIHOHPHQWVDFWHGRQSHU
VFDQDQGZKHWKHUWKHLQVWUXFWLRQFRQYHUWVGDWDEHWZHHQLQWHJHUDQG
IORDWLQJSRLQWIRUPDWV
IRULQWHJHUWRIORDWLQJSRLQWFRQYHUVLRQDGG
µVIRUHDFKHOHPHQWDGGUHVV
µVIRUHDFKILOHDGGUHVVSUHIL[
IRUIORDWLQJSRLQWWRLQWHJHUFRQYHUVLRQDGG
µVIRUHDFKHOHPHQWDGGUHVV
µVIRUHDFKILOHDGGUHVVSUHIL[
Table A.D
Timing and Memory Requirements for File Instructions
(Classic PLC-5 Processors)
Time (µs)
Time (µs) Time (µs)
integer or
integer floating point Words of
Category Code Title floating point
Memory1
True True False
(Continued)
Time (µs)
Time (µs) Time (µs)
integer or
integer floating point Words of
Category Code Title floating point
Memory1
True True False
OR 98 + W[37.2 + N] 54 7-12
File Search and Compare FSC all comparisons 93 + W[32.7 +N] 93 + W[43.3 +N] 54 6-10
0 mismatch 75 + 6W 31
1 mismatch 130 + 6W 31
2 mismatches 151 + 6W 31
0 mismatch 71 + 6W 31
1 mismatch 150 + 6W 31
2 mismatches 161 + 6W
1
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
W = number of elements acted on per scan
N = 2 × (number of integer file addresses) + 8 × (number of floating-point file addresses) + 6 × (number of timer, counter, or control file addresses) + (
number of
conversions between integer and floating point formats)
(Continued)
Time (µs)
Time (µs) Time (µs)
integer or
integer floating point Words of
Category Code Title floating point
Memory1
True True False
local 196 16
remote 204 16
local 202 16
remote 166 16
1 parameter 91 15 3-5
0 parameters 48 13 1
1 parameter 70 13 2-3
LBL label 12 12 3
1
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
(Continued)
Time (µs)
Time (µs) Time (µs)
integer or
integer floating point Words of
Category Code Title floating point
Memory1
True True False
Modifier in µsec
Addressing Mode Data Type (add for each
operand)
Direct Integer 0
Float 0
Float-to-integer 5.6
Integer-to-float 8.4
Source Destination
(integer to floating point) (floating point to integer)
Data Type
0-2K 2-4K 4K+ 0-2K 2-4K 4K+
integer 0 1 2 0 1 2
floating point 0 3 4 0 3 4
data conversion 8 9 10 33 34 35
0XOWLSO\WKHDGGLWLRQDOWLPHE\WKHQXPEHURIHOHPHQWVLQWKHILOHIRU
DQ\W\SHRIILOHRUILOHDGGUHVV)RUH[DPSOH
([SUHVVLRQ1>1@
)
DGGIRUFRQYHUWLQJWRIORDWLQJSRLQW
DGGIRULQGLUHFWDGGUHVV
'HVWLQDWLRQ1
DGGIRUFRQYHUWLQJWRLQWHJHU
)$/PXOWLSO\:>1LQGLUHFWDGGUHVVLQJ@
1
:
([HFXWLRQWLPHLQ$//PRGH
>@
µV
Integer (N) 42 42
S:8 Current program The time for the processor to scan through all active
scan time steps one time
S:9 Maximum program The maximum time for the processor to scan
scan time through all active steps one time (word S:8)
(Continued)
S:13 Faulted File Contains the file number if an SFC fault occurred
Number
S:79 * MCP inhibit, file Information on the individual multiple main control
(except number and scan programs.
for scan time
time) – Enhanced PLC-5 processors only.
S:127
)LJXUH%VKRZVDVDPSOH6)&DQGWKHHVWLPDWHGPHPRU\
UHTXLUHPHQWVIRUWKH6)&
Figure B.1
Sample SFC and Memory Requirements
Classic PLC-5 Processors Enhanced PLC-5 Processors
one action/step
step/transition pair a=1
8 words 16 + 6a=22 words
simultaneous diverge simultaneous diverge
n=2 n=2
n +1 = 3 words 3n +1 = 7 words
Figure B.2
Dynamic Limit of Active Steps Could Be Exceeded
(Classic PLC-5 Processors)
Figure B.3
Scan Sequence for a Step, Transition, and Postscan
A scan of step A
A pA postcan of step A
F hk
A I/O X0 F hk
T hk pA B I/O X1
T hk pB
15556
//
X0 X1 X2 X7
%HFDXVHRQO\RQHSDWKLVDFWLYHWKHVFDQVHTXHQFHIRUWKH
FRQYHUJHQFHLVWKHVDPHDVIRUDVWHSDQGWUDQVLWLRQ)LJXUH%
VKRZVWKHVFDQVHTXHQFHIRUWKHGLYHUJHQFHDQGFRQYHUJHQFHRID
VHOHFWHGEUDQFK
Figure B.5
Scan Sequence for a Selected Branch - Divergence and Convergence
A scan of step A A
pA postcan of step A
F hk
F oh X1 F hk
T hk pA C I/O X3
T hk pC
A I/O X0
F hk
T hk pA B I/O X2
T hk pB
15557
//
B C D N
2QVXEVHTXHQWVFDQVWKHSURFHVVRUVFDQVLQWKHRUGHURIVWHS,2DQG
WUDQVLWLRQIRUHDFKSDWKVWDUWLQJIURPWKHOHIW
7KHYHUWLFDOSURJUHVVLRQIURPVWHSWRVWHSLVLQGHSHQGHQWRIWKHDFWLYH
VWHSVRQWKHRWKHUSDUDOOHOSDWKV)LJXUH%
Figure B.7
Simultaneous Branch - Convergence
//
7KHFRPPRQWUDQVLWLRQFDQQRWJRWUXHXQWLOWKHSURFHVVRUVFDQVDOOWKH
VWHSVLQWKHVLPXOWDQHRXVEUDQFKDWOHDVWRQFH2QFHWKHWUDQVLWLRQ
JRHVWUXHWKHSURFHVVRUGRHVQRWVFDQWKHUHPDLQLQJSDWKVLQWKH
EUDQFKWKHSURFHVVRUSRVWVFDQVHDFKVWHSLQWKHEUDQFK)LJXUH%
VKRZVWKHVFDQVHTXHQFHIRUWKHGLYHUJHQFHDQGFRQYHUJHQFHRID
VHOHFWHGEUDQFK
Figure B.8
Scan Sequence for a Simultaneous Branch – Divergence and
Convergence
A
A scan of step A
X0 pA postcan of step A
F hk
X1
F C I/O
F hk
T hk pB oc pC
X1
A I/O X0 F hk B I/O
* T hk pB oc pC
T hk pA B od C I/O X1
T hk pB oc pC
15558
* In an Enhanced PLC-5 Processors, these states do not occur if scan
configuration is set to ADVANCED mode.
start
X0 X1 X2
B C D
X3 X4 X5
E X6 G
J
X7
X9
I
X8
X10
end
Figure B.10
Scan Sequence Example for the Example SFC
F hk
F oh X2
F hk
T h k p A D I /O X5 F hk
T h k p D J I /O X9
F oh X1
T hk pJ
F hk
T hk p A C I/O X4 F hk
T hk p C K I/O X 10
A I /O X0 T hk pK
F hk F hk
T h k p A B I/O F F G I /O X7
X3
F o d G I /O h k E I /O F I /O X6 F H I /O X7 T
T hk pB E od F T F h k E I/O X7 * T
X6 * T
A = step scan (A - K)
pA = post scan (A - K) T o d G I /O h k E I /O p F H I /O G I /O X7
I/O = I/O scan
XN = transition (1 - 10)
T=true F hk
F=false X8
T hk pE oc pH oc pG I I /O
oh = overhead
oc = convergence overhead T hk pI
od = divergence overhead * In an Enhanced PLC-5 Processor, these states do not occur if
hk = housekeeping scan configuration is set to ADVANCED mode. 15303
oh (overhead) 0.02 ms
7RGHWHUPLQHWKHZRUVWFDVHUXQWLPHDVVXPHWKDWDWUDQVLWLRQJRHV
WUXHMXVWDIWHUDQ,2VFDQRUMXVWDIWHUDWUDQVLWLRQLVVFDQQHG7KLV
DVVXPSWLRQUHTXLUHVDQH[WUDVFDQVHTXHQFHEHIRUHWKHWUDQVLWLRQ
JRHVWUXH
7KHVFDQWLPHRIDVWHSDQGWUDQVLWLRQLVSURSRUWLRQDOWRWKHQXPEHURI
UXQJVIRUWKHVWHSDQGWUDQVLWLRQ)LJXUH%VKRZVWKHPLQLPXP
VFDQWLPHIRUDVWHSWKDWFRQWDLQVDVLQJOH27(DQGDQ(1'VWDWHPHQW
DQGDWUDQVLWLRQWKDWFRQWDLQVDVLQJOH;,&DQGDQ(27VWDWHPHQW
Figure B.11
Minimum Scan Time for a Step and Transition Pair
X0
X1
1.6 ms
F hk 1.6 ms
A I/O X0 F hk
T hk pA B I/O X1
T hk pB
1.9 ms 1.9 ms
14271
Table B.D
Variables for Steady-State Scan Time
Where: Is:
Tscan total time to scan logic in all active steps and associated false transitions
'LYHUJHQW6FDQ7LPHVWDUWVZKHQWKHSURFHVVRUWHVWVDWUDQVLWLRQDQG
HQGVZKHQWKHSURFHVVRUVFDQVWKHQH[WVWHS¶V,2'LYHUJHQWVFDQ
WLPHLQFOXGHVWUDQVLWLRQVFDQWLPHSRVWVFDQWLPHRIWKHSUHYLRXVVWHS
VFDQWLPHRIWKHQHZVWHSRYHUKHDGDQGVFDQWLPHRIHDFKSDUDOOHO
DFWLYHVWHSRXWVLGHRIWKHGLYHUJHQFH
)RUDVHOHFWHGSDWKGLYHUJHQFHWKHEHVWFDVHLVZKHQWKHWUDQVLWLRQ
JRHVWUXHMXVWEHIRUHWKH,2VFDQ8VHWKLVHTXDWLRQ7DEOH%(
A
//
X0 X1 X2 Xn
B C D N
Table B.E
Variables for Selected-Path Divergent Scan Time
Where: Is:
Tmilliseconds transition scan time in milliseconds from step A to the first step in
selected path N
T0 sum of scan times of logic in all other active steps and transitions
parallel to the divergence, but outside of the divergence
)RUDVLPXOWDQHRXVGLYHUJHQFHWKHEHVWFDVHLVZKHQWKHWUDQVLWLRQ
JRHVWUXHMXVWEHIRUHWKH,2VFDQ8VHWKLVHTXDWLRQ7DEOH%)
A
X0
//
B C D N
Table B.F
Variables for Simultaneous-Path Divergent Scan Time
Where: Is:
T0 sum of scan times of logic in all other active steps and transitions
parallel to the divergence, but outside of the divergence
)RUWKHZRUVWFDVHDVVXPHWKDWDWUDQVLWLRQJRHVWUXHMXVWDIWHUWKH,2
VFDQRUMXVWDIWHUDWUDQVLWLRQLVVFDQQHG7KLVDVVXPSWLRQUHTXLUHVDQ
H[WUDVFDQVHTXHQFHEHIRUHWKHWUDQVLWLRQJRHVWUXH
&RQYHUJHQW6FDQ7LPHLVZKHQDVLPXOWDQHRXVEUDQFKHQGV7KH
EHVWFDVHLVZKHQWKHWUDQVLWLRQJRHVWUXHMXVWEHIRUHWKH,2VFDQ8VH
WKLVHTXDWLRQ7DEOH%*
F G H N
//
X1
Table B.G
Variables for Simultaneous-Path Convergent Scan Time
Where: Is:
T0 sum of scan times of logic in all other active steps and transitions
parallel to the convergence, but outside of the convergence
)RUWKHZRUVWFDVHDVVXPHWKDWDWUDQVLWLRQJRHVWUXHMXVWDIWHUWKH,2
VFDQRUMXVWDIWHUDWUDQVLWLRQLVVFDQQHG7KLVDVVXPSWLRQUHTXLUHVDQ
H[WUDVFDQVHTXHQFHEHIRUHWKHWUDQVLWLRQJRHVWUXH
1RWHV
This Data
Accepts:
Type/Value:
integer any integer data type: integer, timer, counter, status, bit, input,
output, ASCII, BCD, control (e.g., N7:0, C4:0, etc.)
float any floating point data type with 7-digit precision (valid range is
±1.1754944e–38 to ±3.4028237e+38).
PID any PID data type (e.g., PD16:0) or integer data type
(e.g., N7:0)
Table C.A
Programming Instructions and Operands
Require
Instruction Description Operand Valid Value False-to-True
Transition
ABL * ASCII Test Buffer for Line channel immediate, 0-4 integer yes
control control
destination integer
source B string
destination string
destination string
destination string
control control
destination string
Require
Instruction Description Operand Valid Value False-to-True
Transition
source B integer
destination integer
destination string
control control
string length 0 - 82
destination string
control control
string length 0 - 82
search string
result integer
source B string
control control
length 1 - 1000
position 0 - 999
AWA * ASCII Write with Append channel immediate, 0-4 integer yes
source string
control control
string length 0 - 82
Require
Instruction Description Operand Valid Value False-to-True
Transition
source string
control control
length 0 - 82 yes
control control
control control
destination integer
Require
Instruction Description Operand Valid Value False-to-True
Transition
group 0-7
module 0-1
length 0, 1-64
continuous YES, NO
1
BTW Block Transfer Write rack 00-277 octal yes
group 0-7
module 0-1
length 0, 1-64
continuous YES, NO
CIO ControlNet I/O Transfer control block ControlNet transfer (1 - 64) yes
CIR Custom Input Routine program file number immediate (2 - 999) for all N/A
processors
destination array
Require
Instruction Description Operand Valid Value False-to-True
Transition
COR Custom Output Routine program file number immediate (2 - 999) for all no
processors
position 0 - 15999
length 1 - 1000
position 0 - 999
Require
Instruction Description Operand Valid Value False-to-True
Transition
reference integer
length 1 - 1000
position 0 - 999
Require
Instruction Description Operand Valid Value False-to-True
Transition
position 0 - 15999
length 1 - 1000
position 0 - 999
length 1 - 1000
position 0 - 999
length 1 - 1000
position 0 - 999
index integer
destination integer
Require
Instruction Description Operand Valid Value False-to-True
Transition
length 1 - 1000
position 0 - 999
IDI Immediate Data Input data file offset immediate (0-999), integer yes
destination integer
IDO Immediate Data Output data file offset immediate (0-999), integer yes
source integer
Require
Instruction Description Operand Valid Value False-to-True
Transition
length 1 - 1000
position 0 - 999
length 1 - 1000
position 0 - 999
destination float
destination float no
Require
Instruction Description Operand Valid Value False-to-True
Transition
destination integer
destination integer
destination integer
Require
Instruction Description Operand Valid Value False-to-True
Transition
pv value integer
cv value integer
REF SFC reference (see LAB) label number immediate (0 - 255) N/A
(ASCII import/export only)
PRE 0 - 32767
ACC 0 - 32767
Require
Instruction Description Operand Valid Value False-to-True
Transition
control control
length 1 - 1000
position 0 - 999
control control
length 1 - 1000
position 0 - 999
control control
length 1 - 1000
position 0 - 999
length 1 - 1000
position 0 - 999
Require
Instruction Description Operand Valid Value False-to-True
Transition
length 1 - 1000
position 0 - 999
destination integer
Require
Instruction Description Operand Valid Value False-to-True
Transition
TOF 2 Timer Off Delay time base immediate (0.01, 1.0) yes: requires
true-to-false
PRE 0 - 32767 transition to
execute
ACC 0 - 32767
PRE 0 - 32767
ACC 0 - 32767
TRC SFC transition file number 2 - 999 for all processors N/A
(ASCII import/export only)
destination integer
destination integer
2
This instruction requires periodic scans to be updated. See page 2-9 in this manual or page 2-10 in the Structured Text User Manual for more
information.
3
This instruction requires periodic scans to be updated. See page 1-14 in this manual or your Structured Text User Manual for more information.
1RWHV
A ASCII
ABL instruction 17-4 ABL 17-4
ACB 17-5
ACB instruction 17-5
ACI 17-6
ACI instruction 17-6 ACN 17-7
ACN instruction 17-7 AEX 17-7
ACS instruction 4-11 AHL 17-8
AIC 17-9
ADD instruction 4-12
ARD 17-10
Addition instruction ARL 17-12
ADD 4-12 ASC 17-14
AEX instruction 17-7 ASR 17-15
AFI instruction 13-13 AWA 17-15
AWT 17-17
AHL instruction 17-8
ASCII instructions, strings 17-3
AIC instruction 17-9
ASCII Integer to String instruction 17-9
Always False instruction 13-13
ASCII Read Characters instruction 17-10
AND instruction 5-2
ASCII Read Line instruction 17-12
AND Operation instruction
AND 5-2 ASCII Set Handshake Lines instruction 17-8
Arc Cosine instruction ASCII String Compare instruction 17-15
ACS 4-11 ASCII String Concatenate instruction 17-7
Arc Sine instruction ASCII String Extract instruction 17-7
ASN 4-13 ASCII String Search instruction 17-14
Arc Tangent instruction ASCII String to Integer instruction 17-6
ATN 4-14
ASCII Write Append instruction 17-15
ARD instruction 17-10
ASCII Write instruction 17-17
ARL instruction 17-12
ASN instruction 4-13
ASC instruction 17-14
ASR instruction 17-15
ATN instruction 4-14
Attention B
32- to 16-bit conversion 4-10 Bit Distribute instruction
AVE indexed address 4-16 BTD 7-2
change index value 13-6
Bit Shift Left (BSL) instruction 11-2
control structure addressing 10-4
DTR online programming 10-8 Bit Shift Right (BSR) instruction 11-2
entering input addresses 1-6 block transfer
entering output addresses 1-7 BTR instruction 15-3
FAL indexed address 9-2 BTW instruction 15-3
FOR and NXT with output branches 13-5 direct communication mode 15-2
FOR and NXT within branches 13-5 I/O scan mode 15-1
indexed addressing 8-2 instructions 15-1
jumped timers and counters 13-4 programming examples 15-15
MCR zones timing 15-13, 15-14
overlapping or nesting 13-2 Block Transfer Read instruction
timers and counters 13-2 BTR 15-3
modify status bits of BTR/BTW 15-6
Block Transfer Write instruction
MSG
BTW 15-3
status bits .ST and .EW 15-24
online programming with ONS 13-14 Break (BRK) instruction 13-5
pairing stack instructions 11-6 BRK instruction 13-5
PID BSL instruction 11-2
change engineering unit max 14-22
BSR instruction 11-2
change engineering unit min 14-22
change inputs or units 14-19 BTD instruction 7-2
changing scaling 14-6 BTR instruction 15-3
resume last state 14-10 BTW instruction 15-3
setting temperature limits 14-28
update time 14-21
placement of critical counters 2-15, 2-17 C
resetting TON and TOF 2-8, 2-20 CAR utility 18-1
SRT indexed address 4-27 CIO instruction 15-22
status of BTR/BTW bits 15-7 monitoring 15-24
STD indexed address 4-30 status bits 15-24
use of control address 12-3 using 15-23
using control addresses 8-2 Classic PLC5 processors 1
using control addresses for instructions 11-2
Clear instruction
AVE instruction 4-15 CLR 4-17
Average File instruction CLR instruction 4-17
AVE 4-15
CMP
AWA instruction 17-15 instruction 3-2
AWT instruction 17-17
files instruction
arithmetic operations 9-7 ControlNet I/O transfer 15-22
copy operations 9-5 immediate data input 1-8
functions 9-14 immediate data output 1-8
instruction instructions
COP 9-19 ASCII 17-1
FLL 9-20 block transfer 15-1
logical operations 9-12 CIO
operation modes 8-5 monitoring 15-24
FLL instruction 9-20 compare 3-2
floating point diagnostic 10-1
valid value range C-1 memory requirements A-1
message 16-1
For (FOR) instruction 13-5
operands C-1
FOR instruction 13-5 program flow 13-1
FRD instruction 6-2 relay-type 1-1, 2-1
FSC instruction 9-14 sequencer 12-1
shift register 11-1
timer 2-1
G timing A-1
gain constants 14-3 INVALID OPERAND
GEQ instruction 3-5, 3-6 error message 4-4
Greater Than or Equal To instruction 3-5, 3-6 IOT instruction 1-7
I J
I/O image files 1-2 JMP instruction 13-3
I/O scan mode JSR instruction 13-8
block transfer 15-1 Jump instruction 13-3
IDI instruction 1-8 Jump to Subroutine instruction 13-8
using 1-9
IDO instruction 1-8
L
using 1-9
Label (LBL) instruction 13-5
IIN instruction 1-6
Label instruction 13-3
Immediate Data Input
instruction 1-8 LBL instruction 13-3, 13-5
Immediate Data Output LEQ instruction 3-6
instruction 1-8 LES instruction 3-7
Immediate Input instruction 1-6 Less Than instruction 3-7
Immediate Output instruction Less Than or Equal To instruction 3-6
IOT 1-7 LFL instruction 11-5
incremental mode 8-7 LFU instruction 11-5
T U
TAN instruction 4-32 units, engineering
Tangent instruction scaling 14-5
TAN 4-32 User Interrupt Disable
Temporary End UID 13-19
instruction 13-13 User Interrupt Enable
Temporary End instruction 13-20 UIE 13-20
Test Buffer For Line instruction 17-4 using
CIO instruction 15-23
timer
IDI instruction 1-9
accuracy 2-3
IDO instruction 1-9
instruction parameters 2-2, 2-13
MSG instruction 16-10
RES 2-20
RTO 2-10
TOF 2-7 X
TON instruction 2-4 X to the Power of Y instruction
Timer Off Delay instruction 2-7 XPY 4-33
Timer On Delay instruction 2-4 XIC instruction 1-3
timers 2-1 XIO instruction 1-3
timing XOR instruction 5-5
block transfer 15-13, 15-14 XOR Operation instruction
instructions A-1 XOR 5-5
tip XPY instruction 4-33
connecting to Ethernet PLC5 processors
using hostnames 16-6
TND
instruction 13-13
TND instruction 13-19, 13-20
TOD instruction 6-2
TOF instruction 2-7
TON instruction 2-4
transition
scanning sequence B-7
1RWHV
Cat. No. 1785 series Pub. No. 1785-6.1 Pub. Date November 1998 Part No. 955133-83
Clarity
What is unclear?
Sequence
What is not in the right order?
Other Comments
Use back for more comments.
Return to: Marketing Communications, Allen-Bradley Co., 1 Allen-Bradley Drive, Mayfield Hts., OH 44124-6118Phone: (440)646-3166
FAX: (440)646-4320
Other Comments
(
9
2
0
(
5
PLEASE FOLD HERE
(
6
$
(
/
3
123267$ *(
1(&(66$5<
,)0$,/('
,17+(
81,7('67$7(6
$//(1%5$'/(<'5
0$<),(/'+(,*+762+
Customer Support
,I\RXQHHGDGGLWLRQDODVVLVWDQFHLQXVLQJ\RXUVRIWZDUH
$OOHQ%UDGOH\RIIHUVWHOHSKRQHDQGRQVLWHSURGXFWVXSSRUWDW
&XVWRPHU6XSSRUW&HQWHUVZRUOGZLGH
)RUWHFKQLFDODVVLVWDQFHRQWKHWHOHSKRQHILUVWFRQWDFW\RXUORFDOVDOHV
RIILFHGLVWULEXWRURUV\VWHPLQWHJUDWRU,IDGGLWLRQDODVVLVWDQFHLV
QHHGHGWKHQFRQWDFW\RXUORFDO&XVWRPHU6XSSRUW&HQWHURUFRQWDFW
6\VWHP6XSSRUW6HUYLFHV
)RUDVVLVWDQFHWKDWUHTXLUHVRQVLWHVXSSRUWFRQWDFW\RXUORFDORIILFH
GLVWULEXWRURUV\VWHPLQWHJUDWRU'XULQJQRQRIILFHKRXUVFRQWDFW
\RXUORFDO&XVWRPHU6XSSRUW&HQWHU