Upload
diebaamie
View
222
Download
0
Embed Size (px)
Citation preview
8/7/2019 Description of Basic Instructions
1/41
2-3. Description o/Basic Instructions
StartStart NotOut
Step '.Availability1
-I All FP-Ms and FPl s
-I
Outline ST:ST/:OT:Begins a logic operation with a Form A (normally open) contact.Begins a logic operation with a Form B (normally closed) contact.Outputs the operated result to the specified output.
Program example. ',' .:.. Boolean Noh-ladder , , ,L a d ~ e t [ J i a g r a m . Address Illstn.iction FP Programll1er IlIuW Operations: :-xo-: :-YH iO ST X 0 ~ ~ ~ ] B1 1 IOYI: '[ : lOT y 0 ~ 8 E J~ = : : : ~ " " " " ' S t a r t Out ..........==:: =; I ' : . A " ~ l Y wvI! : X1 : : Y
12 I STI X 1 G ; ] ~ G ; ] D E J) ~ ! i - - - ' --- .......... [ : I x.wx TiLd )t:.wx 1 .I '--'-:-':'-""'Slart Not Out - . - - - ~ lOT y 1 ~ G ; ] D E J3 i l-WL Y wvI
Operands.< . . '. .1< Rt!lay< !Thner/Counter1nsthjtt ion\l< ",' ... '.,. ... / ,.. Contact
( . } XYRT CST\ STI A A A A Af--------'---'---f---t--t---+---+-----jOT' NIA A A NIA NIA
A: AvailableN/A: Not Available Explanat ion of example
YO goes 0\1 when XO turns ON. Y] goes ON when X J turns OFF.
Description
Time chartxo ~ I - . ~ _ - - + - I _
ON ' r - - - - - - : - - - - . , - - - - 'YO ~ ' - - . _. _ - ' - - _ ~ _ _ I _ONX1 OFF=- c__ -+ -__-'--_ON '
Y1 OFF - ' - - ' - -_ - ' - - - ' - - - ' - -=
The ST inslruction staTlS logic operalions and regards the input contacl specified at the Slarl asForm A (normally open) ConlaCI.
The ST/ inslruction starts logic operations and regards the input contact specified atlhe start asForm B (normally closed) contaCI.
The OT inslruction outputs the operation result 10 a specified coil.Notes:\. The ST and STI instructions start from the bus line. iISome input devices such as emergency stop switch usually have the Form B (normally closed) contact.When an emergency stop switch with the Form B contact is programmed as input to the FP-M/FP1, usethe ST instruction instead of the ST/ instruction. fXO Yt= The OT instruction cannot start directly from the bus line. The OT instruction can be used consecutively. Y1
I Bus line I YHI. Refer to page 401, "4-6. Duplicated Use of Outputs", for details about duplicate output of the OT instruction.31
8/7/2019 Description of Basic Instructions
2/41
2-3. l)'scr;pt;on ofBa.f;c Instructions
Not 1 All FPMs and FPls
I . :. A : : ~ : : " . . ~ ~ ~ f : C ~ : : ~ . ~ ~ . ~ . ~ sOutline InV(J1Sthe operaLed result up to this insLrucLion.Program example
.............. ...... ..
o r X ~ t - _---=----. .- - - - - - - l ~ [ : O ~: /: ...... Noto 5T X 01 AN X 12 aT - Y 03 /4 aT Y
Islllsllr;lr,;;l~ ~ L J DrANllslll;lr,;;l~ ~ ~ DrorlfANlr;lQ~ ~ L . : J L : JfNOTlr,;;l~ L : . JrmlrANll;lr,;;l~ ~ L J D Time chart
ONXO OFF Explanation of example
YO goes ON when both XO and XI turn ON. Y l goes ON when XO or X1 turns OFF.
Description
-
X1 _ - - 7 ' i ~ ' ----.-"--....T-k" " " < ~ t . ! : .LoONYO .=:.OF:....:F ~ . . c . = = - : - --7"""""-7-_
Y1 g ~ F , < I ~ . . ; ; , ; . " . . ; ; , ; . , = ...=.'==='.=. L..C
- The I instruction inverts the operated result up to this inSifuction.
32
..
8/7/2019 Description of Basic Instructions
3/41
2-3. Description ofBasic InstructiollS
ANDAND Not
Step , ... . AVIlI18bllity . '1
All FP-Ms and FPIs1
Outline AN: Connects a Form A (normally open) contact serially.ANI: Connects a Form B (normally closed) contact serially.
Program example...'.,...... , , . . . i '........ . . ) i ...' " , . , . / \ > E J o ( ) l ~ j r i N c ) i j " J a d d e r ) F P . .,. ~ . ..I8f..,. . . . ., n,. ' "" " ,. . ~ r8tion,...................,............... s. ..,.i..".. ,.,..,.... A a d r ~ . . h ..$ttuCtiPri( ..,.,7 "T" ' " ' ...............
0 8T X 0 ~ G ; ] 8 E J-wx xwx1 AN X 1 ~ [ ] E J-WY x-wx~ :-)(,--::"x2"-: Y 2 ANI X 2 ~ ~ ~ I [ ] E Jf----7--1 [ y. w y Oli ld 'Awxo . I . : 3 aT y 0 ~ G ; ] 8 E J- - - ~ ~ ~ ~ A N D Not l-W'L y.wy
ONX2 ,;::;OF,-,-F__ ~ - - - , - , - , .........= . . L ~ __ ~ = - ' - - _ONYO OFF.= . . . : . _ - - - ' - - - - - - ' - '- - - - - ' - ' - - - - - -- ' - ' - - - - - - - '- ' - - - - -
T im e c ha rtXO ~ = > + ' ,,-,,+,-=>l-l Ii 1_
ONX1 ::..:.OF:..:.F__ ~ ~ c . ; . L _ - - + ~ ~ ! - - _. .. ,....... . ,. ,.'. 1 ...... / ...... ,.iTlmei'iCOunter
.. l r l ~ t f u ~ i i c ) r l i ,.... a ~ l ~ y ''''>Contatt .... i . .
8/7/2019 Description of Basic Instructions
4/41
2-3. Description ofBasic In.flruClions
ORIOROR Not
Step I, . Availability,.' .. - ,.. '..... '.I
All FPMs and FP Is II !!IOutline OR: Connects a Form A (normally open) contact in parallel.
OR/: Connects a Form B (normally closed) contact in parallel.Progl'am example
Boolean N O n " l a d d e r F P P r O g r a m m e r u ~ .' ., ... tionsAddr.!5$ lnBtrlJCtion ". ". . . . . .. . ...,operaXO YO
o l - ~ M ; ' -;------1[1 ,I :::: --:........ OR
J : X2 '2 ~ ~ ~ :'. - - - - ......... OR Not
Operands. I n s t r ~ ~ t i : n ' R e l ; ~ ) t i ~ : = t e r
XYR T ',., COR,ORI . A A A A A
A: AvailableN/A: Not Available
10 ! 8T X 0I; 1 iOR X!2 10R/ X 213 lOT y 0i (iIIIII
Time chartON DXO OFF f-------- ' -- ' - -- ' - -
X1 g ~ [ J - - -+ - - ' - - - X2 g ~ ....,. i jq ; ) >U ~ . , .
ON . . . . . . . . . . - - - . - -YO O=Fc..:.F_----'_L.-.-'--'-'----'-.--'-----'-" ~ _
Explanation of example" YO goes ON when eilher XO or Xl lurns ON or X2 lUms OFF.
Description" Performs a logical OR operation wilh the results of the immediately preceding operation
connected in parallel.Notes:I" Use the OR instruction when the normally open contact (Form A contact) is connected in p a r a l l e - I ~ U f - ~ ; ; j'' ORI instruction when the normally closed contact (Form B contact) is connected in parallel. The OR instruction starts from the bus line.I The OR and ORI instructions can be used consecutively.i
34
8/7/2019 Description of Basic Instructions
5/41
AND stack2-3. Description ofBasic Instructions
. ~ P ... Ayallai)i1ity1 All FP-Ms and FPls
Outline Performs an AND operation on multiple instruction blocks.
o 5T X 0o ~ X O I : : - - X 2 ~ - - _ : - - - - - - 1 [ ~ 1 OR X 1
: X1. : : X3 : 2 5T X 2': : 3 OR X 3'.u.( 'm.( Instruction blocks 4 AN5
5 OT Y
Program example... .i .. :... ..:
.....:.........................): .: :.
Explanation of example YO goes ON when XO or Xl and X2 or X3 turn ON.
Time chartONXO ~ O : . . . : . F F _ - - + ' ' " ' + ~ ~ ' ' + __
(XO OR X1) AND (X2 OR X3) YOI I 1 I
ONX3 OFFblock 1 block 2
,X1 . : : : . g N : . . . . : . F F _ - + - - - ! - _ - - - ' ~ ~ ~ ~ .X2 ON .:.,., :{ .
~ O : . . . : . F F _ - l ' " . , . . ' - " , . , . " " : . " . , " " . , . . . " ' - > __, ! - ,-+,--J"""",L--==, .l2JL-----.i---i--...;.---
ONYO OFF
Description The ANS instruction is used to connect blocks in series.
A block begins with the ST instruction. When two or more instruction blocks are programmed in series, make a program as follows.
block 5block 4
: :"XOGY-X2QD-;X4T: VOI II I I:
8/7/2019 Description of Basic Instructions
6/41
l-3. L J t ~ . R r j " t i o T l o I B a . ~ i c Instructions
OR stackSttiP. ..... ..)AV,.ilibJUWi .1 All FP-Ms and FPIs
Outline Performs an OR operation on multiple instruction blocks.Program example
(XO AND X1) OR (X2 AND X3) --} YOI I I I
Explanat ion of example YO goes ON when both XO and X I or both X2 andX::\ turn ON.
0 8T X 0 ~ ~ G E Jwx )(WX1 AN X 1 G ; ] ~ D E J-M' l(wx2 ST x 21 ~ ~ D E J(w x )( w x
AN X G ; ] ~ D E J31 vwv x-wx14 ORS ~ ~ E J
1BWR IX/IV .
Is JOT Y ~ ~ G J E J.Wl vwv -
Time c h a r ~ONXO OFFONX1 OFFON 1X2 OFFONX3 OFF ,ON EiJ=JO OFF
block 2
Instruction blocks YO
block 1
Description The ORS instruction is used to connect blocks in parallel.
..
[
bIOCk l-8T ! ablock 1 AN X 14 block ( ST x 22 AN X 3OAS CDST X 4AN X 5OAS ........(g)OUT Y 0
block5
YOblock 1-{b10Ck2-{b10Ck3-{
A block begins with the ST instruction. When two or more instruction blocks are programmed in parallel. make a rrogram as follows.
block 4..::-.":.......-.-".::-.:::"+'-".:'XO X1 :f - - I :,
X2 X3 ill :I-------l :". -------------.--- - X4 X5 f - - I-- --__--f ..
block 5
36
8/7/2019 Description of Basic Instructions
7/41
2-3. Description ofBasic Instructions
PSHS Push stack 1Read stack All FP-Ms and FPIs
POPS Pop stack 1Outtine PSHS:RDS:
POPS:Program example
Stores the operated result up to this instruction.Reads the operated result stored by the PSHS instruction.Reads and clears the operated result stored by the PSHS instruction.
ST XPSHSAN XOT YRDSAN XOT YPOPSANI XOT Y
012YO[ 3
Y1 4[ 5Y2 6789
i B O ( ) ~ 8 " N o n 4 i d ~ ~ " F P . ' . ' . Prci . ' . ' . . ~ . . mer....... n. .,.. . ., ' ............., .Addr.$$.I!'tslruCiiQn . ~ , ~ ~ -
I XO, , X1o I ~ ~ 1 - - 1 -P-U-sh-S-t-ac-k-----i
: : f- I--------1'- --'--X3 Read StackI :-L...+-:-lIf-------II ,-- - Pop Stack
Explanation of example When XU lurns ON:1i Stores the operaled result up 10 the PSHS instruction
and YO goes ON when XI tums ON.2) Reads the stored result by the ROS instruction and YI
goes ON when X2 turns ON.3) Reads lhe stored result by the POPS insnuction and Y2
goes ON when X3 turns OFF. Also clears the stort".d resultby the PSHS instruction.
Time chartXO 2 L l - ' - ' - - , ~ , , . ; ; ; . . =..,--,=':'.1-1 _
ON ... 'X1 ~ ~ , ~ - - - , [ ? J = . "'..;....c. _------'-,=,.:.,_,....=,. '=.. c==Y O , - ~ , ~ . - - - - - - - -X 2 ~ ~ / Y1 . . : . g ~ _ F _ - - - - J q _ ~ _X3 . . : . g ~ = F ~ = = = = ~ p ; + J,Y2 . . : . ~ = F E2J'--- _
37
8/7/2019 Description of Basic Instructions
8/41
2-3. Description ofBasic InstTuc:tions
DescriptionPSHS: Stores the operated result up tothis instruction and executes operation fromthe next step. RDS: Reads the operated result stored bythe PSHS instruction and. using its contents.continues operation from the next step.POPS: Reads the operated result storedby the PSHS instruction and. using itscontents. continues operation from the nextstep. Also clears the operated result storedby the PSHS instruction.
38
You can continue to use the same operationresult several times by successively usingthe RDS instruction. When you arefinished. be sure to issue the POPSinstruction.
XO..... YO1----1 I - . ~ + - - - - - - - lPush / ~ : X1 Y1Stack ' , . : I [R e a d ~ ' - -. X2 X3 Y2Stack ' . . : f--VI------{_ . X4 X5 Y3H I [Pop .- _.X6 X7S t a c k ~ m : 1>-----1
8/7/2019 Description of Basic Instructions
9/41
2-3. Description ofBa.'iic Instructions
Leading edge differentialTrailing edge differential
$ J e p ) : : ~ : A . Y . I " b . ' n t . Y : : ? /I
r--- All FP-Msand FPlsI
Outline DF::;Tums ON the contact for only one scan when the leading edge of thetrigger is detected.DFj: Turns ON the contact for only one scan when the trailing edge of thelrigger is detected.
rorl rANl r ; l ElRT~ ~ L . : . JIsTlfSTlr ; tD~ ~ L . . . : J ~rsHiftlr;;llSHifilfNoTlr;.;;l~ ~ l . . ! . . . I ~ C JrorlrANl[Jr;.;;l~ CJ
o1
yX
:.& d' d re " ....: . ': .....":.. : :..:.I.... . : : . : : .. : . : ,. vw M.: i ' ~ ' ::;{:;:;::.;::j ::?:;:.
8/7/2019 Description of Basic Instructions
10/41
2-3. Description ofBasic I n s t r u c t i o n . ~
Notes: Trigger to the OF instructions between the MCand MCE instruction set are ignored while theMC execution condition is OFF.
x ( M C ~ ~I---< OF }-----{MCEO
XO _ !....""'::)....::::=:::....::::=::::....: : : 4 1 - - - ~Xl - - - - - - l ' I ~ : : : : """:::.:::",,,::::.::::i:::::"":::LIYO 0",,::::.'---+-__ -+ -__.:
Changes in X1 are ignoredduring this interval. If, in the example above, output is required at
p o i n t ~ , place the OF instruction outside the MCand MCE instruction set.XO
f-I- - - - - - I t MC 0Xl RoI [
If the same trigger is set for the MC and for theOF instruction, there will be no output. Place theOF instruction outside the MC and MCEinstruction set when output is required.
YO neverturns ON.
XOI (MC 0XO ROI [
f - - - - - - - { MCE 0RO YOt---{ OF }---{ }- j
....
f - - - - - - - ( MCE 0RO YOI---< OF }-----{
A program without a OF instruction
Application examples Self-hold circuits when the output is controlled bya long input signal.
Xi (DFrRhROxo RO R3 R1~ D F / H ~R xo R1 R3 R2~ D F H ~At---!XO R2 A3HDF / HHAO A2 YOr - - - -vr - - - - -{
Xo -4Ct=JT&=::" =:i:::",,:::: ---f?77Il.L..:":=:'::':=::':+:- RO : . " : ; > : : : : : : " " : : : . " , - -R1 - - - ; . : _ - - - L : . I : : : ; ; ; ; . : : : : : . ~ : : : : ; ; . ; ; ; : : : : : : ~ : : : : : : = : : : " ' = : : : : ' : : 4 1 - - R2 ---7---Fp::::::q=:::::=:::\'7-"--R3 ~ :L....-----l.I]",-:::--YO -11"::::",,,,/::.;:;;":::="="""IL.- _
Alternating circuit using a single signal to hold andrelease a circuit.
Xl -+---4r:z:::m=:::)'---:=::"-4-'+ -i -P ::
XO p.:,:::.::: :.. :::::jXl - + - - - + : - ~ = , : : : : : = \ \ ~ : : : : H i - -. , .RO ~ _ + P l ....: _ ....-+:__r , IYO t:z;s;l ; :
A program with a OF instruction
bXO RO Y
J? IXl ROI (bXO RO YJ~ O F ~Y Xl ROHOF ) [
40
8/7/2019 Description of Basic Instructions
11/41
SetReset
2-3. Description of B a . ~ i c Instructions$ tep> AvtiilibUtw< .3
r--- All FP-Ms and FPIs3
Outtine SET: Holds the contact (in bit) ON.RST: Holds the contact (in bit) OFF.
Program example
. .
Y O : ~;twOutput numberof relayo ST X 01 SET Y 04 ST X 15 RST Y 0
Operands Time chartONXO .::.O:....:FF_--i''-'-'--l---''-'- --i''-'-'--L.....-
Xl g - = - ~ : . . . . : F _ - - - - - ! - __1EL__JJ'--+____,YO = g ~ ~ F _ - - - L l r.""'_>:""".""".:'""""_'_':'""" ; : ; : "" "~ = . . . , . . , I _ _ J ~
A: AvailableN/A: Not Available
Explanat ion of example When XU turns ON, YO goes ON and holds the contact (in bit) ON. When XI turns ON, YO goes OFF and holds the contact (in bit) OFF.
Description The SET instruction executes when the trigger is turned ON. Output turns ON and holds thecontact (in bit) ON regardless of the trigger's state changes.
The RST instruction executes when trigger is turned ON. Output turns OFF and holds ::leconlact (in bit) OFF regardless of the trigger's state changes. You can use the same number for relays (Y and R) with the SET and RST instructions asmany times as you like.
XO YOI (SX1 YOf (RX2 YOI (SX3 YOj (R
41
http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%80http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%80http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%80http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%80http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%80http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%80http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%80http:///reader/full/g~--'--F_---%22'I%22%22%22%E7%BE%AE..%22.%E7%AC%A7%E7%95%808/7/2019 Description of Basic Instructions
12/41
:!-3. Description ofBasic Instructions When the SET and RST instructions are used, the contents of the output changes with eachstep during the processing of the operalion.
Example: When XO, X I, and X2 are turned ONXO YOf - I - - - ~ ( S
This portion of the program is processedas if YO were ON.
X1 YOI (R( ) This portion is processed as if YO wereX2 YO OFF.I (S( J This portion is processed as if YO wereON.
The external output at the I/O update depends on the final results of the operation. Place a DF instruction before the SET and RST instructions to make program developmentand refinement easier.
42
-
8/7/2019 Description of Basic Instructions
13/41
Keep2-3. Description a/Basic Imtruetjom
$.lEij.X.A.viU..tiIUtY:/ ..........1 All FP-Ms and FPls
Outline Turns ON the output and maintains its condition.Program example
ST XST XKP Y
o12
:ij9() . ~ a r . ~ ~ ~ f i i d . . ~ ~ . t \ . ...................... ....FP . .NWW.... .. : .:.n:... . 1. . :.m. .8..... .. 8..:..:....:.liMlo... ..... . ...--: .: : :.:8lIOI: -1$...........::. 4 a d ' ~ i $ I " $ t i i i C t k i j ) ~ . . . . ~ , ~ ,
KP Y :0: 11~ L e s s J I
x o / s e t triggero ,X1/Resettngger
Operands Time chart
, , ,I. ) \ > ~ ~ < : : .",...,.,.....ONX1 OFF.= . . : . . . . : . - - - -+-- - - -F=-- - - ! - - - - ! ! - ' - "" '+- - - -
XO O = O ~ - , - F - - l ~ - - - - I I , , " , " : :.:"",\,=....,i=.=>=.==,. ,ONYO OFF
A: AvailableN/A: Nol Available
! / l t ~ ~ _ ~ ~ ' 0 . t t ~ r::iC
8/7/2019 Description of Basic Instructions
14/41
2-3. Descri/J/ion of Basic Ills/ruc/ions
No operationS t e p > A V 8 1 _ ~ m . Y + .......1 All FP-Ms and FPls
Outline No operationProgram example
I X1 NOP vq Io[ - -n - - . ---------1[ J---1
Explanation of example YO o u t p u t ~ when X I lurns ON.
Description
ST XNapaT Y
...
Th e NOr instruction can he , i ~ e d I t' make the program easier to reau when checking orcorrecting.
When the NOP instruetjlln j, inseflcd. the si7.c o f the pr()gr:ml will increase slightly. howewr.lhere will be no erfl'ci on Ihe r C ~ l I l t ~ o f the arithmetic opl'latioo,.
Example: To move lhe starting poinl o f ;1 progr:lln t>1r.ck rrom ; l l . l d r l ~ s s 39 to address 40, insert a :'oiOP
inqruction to address 3() .This moves the starting [Joint to address 40.
Address Address36'1 5T XO 36 I 5T XOI IOR X1 I OR X1I OT Y1 I OT Y139 5T X2 .....Iill.. ' - - t n se r t a NOP inSlrllc:ion.40 AN X3 40 I 5T X2OT R20 41 ' AN X3
5T R2 OT R20OF 5T R244 5T X3 OF45 5T X3
Note:I To delete the NOP instruction after editing in the PROG. mode, use the programming tools ( N P S T - G R ~ lI DELETE ALL NaPS, FP Programmer n: O Ii Operation procedure of FP Programmer II E j [ill0 EI
44
..
8/7/2019 Description of Basic Instructions
15/41
2-3. Description ofBasic InstructionsS t ~ p ' . iAv.l labUity .....
O.Ols units timerO.ls units timer
Is units timer
3I--
3I--4
All FP-Ms and FPIs
Outline TMR: Sets the ON-delay timer for 0.01 s units (0 to 327.67 s)TMX: Sets the ON-delay timer for 0.1 s units (0 to 3276.7 s)TMY: Sets the ON-delay timer for J s units (0 to 32767 s)
Program example
_ S e t v a l u e ~ _ , .i xo r TM x -;39 I :o r - - - - - - ~ - - - ; : . 5 - : -L jl -1
8/7/2019 Description of Basic Instructions
16/41
2-3. Description ofBasic Instructions
Description The TM instruction is a down type preset timer." If there are not enough TM instruction numbers, you can increase the number by changing thesetting of system register 5. Refer to page 4 J8. "5-4. System Registers", for details on how tochange the number of timer instructions.
Timer set t imeThe fonnula of the timer set time is [the time unit] x [set value)Example: TMX5 K30 (0. J s x 30 = 3 s)
Timer operation" When the decimal constant "K" is specified as a se t value:
Procedure:CD When the mode of the programmable controller is set to
RUN. K30 (decimal) is transferred to set value area SV5. When the leading edge of trigger XO is detected (OFFON), set value K30 is transferred from the SV5 to theelapsed value area EV5.
@ The passed time is subtracted from the EV5 every scanwhile trigger XO is in the ON state.
@ When the data in the elapsed value area EV5 becomes 0,timer contact T5 turns ON and then the YO goes ON. When the "SVn" is specified as a set value:
Procedure:CD When the leading edge of trigger XO is detected (OFF
ON). the value in set value area SV5 is transferred to theelapsed value area EV5. The passed time is subtracted from the EV5 every scanwhile trigger XO is in the ON state.
@ When the data in elapsed value area EV5 becomes O. timercontact T5 turns ON and then YO goes ON.
Notes:
XOIT5I I - - - - - - - - - - - l
R9010K FO MV. DT9040, svs]
If you turn OFF timer operation tr igger XO in the middle of an operation, the operation will be interruptedand the elapsed time will be reset to O." Timer set value area SV is a memory area for the timer's time setting."The t imer contact goes ON when the value in timer elapsed value area EV becomes O. However, thevalue in t imer elapsed value area EVwill also become 0 in a reset condit ion." For each TM instruction, one SV and EV sel and one contact T are supported as follows:
~ _ ; I : , ' : ; I . ~ I ~ f I : . i . ~ . ' I ~ : : . : . I : : . ' : " :TMO SVO EVO TO
TM99 SV99 EV99 T99" The timer is reset whenever the power is turned OFF, or the mode is changed from RUN to PROG. Setsystem register 6 to retain the run status.Refer to page 418, "5-4. System Registers", for details about system registers." Since:the timing operation is executed during the scan of the timer instruction, program timer instructionsso that the TM instruction is executed once per scan.Be sure that the "rM instruction is executed once per scan when the INT, JP, LOOP instructions andothersJare programmed.
46
8/7/2019 Description of Basic Instructions
17/41
2-3. Description ofBasic Instructions
Changing the value in the set Value Area (SV)All FP-Ms and FPI s can change the value in the set value area (SV), even during RUN mode, using the high-levelinstruction FO (MV) or the programming tool (FP Programmer nor NPST-GR).The range of values that can be specified in the set value area (SV) are:
FPI CI4 and CI6 series: SVO to SVI27All FP-Ms and FPI C24, C40. C56. and cn series: SVO to SV143
High-level Instruction FO (MV):Use the high-level instruction FO (MV) as describedon Lhe righL in order to change the timer settingaccording LO the input conditions.Example: Change the setting from 5. seconds to 2
seconds when input XO goes ON.Refer to page 114, uFO (MV) 16-bit data move" fordetails on the high-level instruction FO (MV).
FP Programmer D:Example: Change the value of SVO from K50 to K20.Sleps:
I) Monitor the status of the word daLa.2) Search for SVO.3) Clear the c ~ n t e n l S of SVO.4) Write the new value.
Refer to the FP Programmer DOperation Manual fordetails.
XOHFO MV, K20, SVoJ
X1 [TMX 50j 3T3 YOI [
Key operations(f]8El[ ; J G ~~ 0 8 E l
NPST-GR Sortware:SelecL"MONITOR LIST RELAYS" in Lhe on-line menu, read the relevant SV, and rewrile.Refer to the NPST-GR Software Ver. 3 Manual for details.
Notes: Even if the SV value is changed, the setting in the program will not be rewritten. The setting from theprogram is sent to the SV and changed only when the mode is changed back to RUN mode, or thenext time the power is turned ON. When the SV value is rewritten, the currently operating timer will continue operating as-is. The EVvalue will not be changed until the next input ON condition. The value in elapsed value area EV can be changed in the same way.
Example:When fine-tuning the timing during trial operation. youcan change the values of the special data registers01'9040 to 0T9043. in the 0 to 255 range, using thepolentiometers on the front of the main unit.
R901O: Always ON relay01'9040: Manual dial-set regisler for YO.
Note:
R9010f---fF0 MV, OT9040, SVO]XO [TMX SVOI 0
TO YOj [
Note that the timers are non-retentive. They will all be reset (set to 0) if the power is turned OFF, or themode is changed from RUN to PROG. Set system register 6 to retain the run status.
47
8/7/2019 Description of Basic Instructions
18/41
2-3. Description ofBasic Instructions
Application exampleWhen using two timer instructionsProgram example 1
30L lTMX, 1
ONY1 OFF
ONYO OFF
XO ~ ? > \ i . . . } : : : { r L.TO g ~ ~ { . / t . >....L
: ' - -3 s ' " - .T1 g ~ : ~ ' l - -:'-2s-+
ST X 0TM X 0
K 30TM X 1
K 20ST T 0OT Y 0ST T 1OT Y 1
X ~ 6 M XTO
1-1- - - - - - - - - -1T1I
Program example 2ST X 0PSHSXO ~ T M X TM X 0I K 30~ M POPS1 TM X 1K 20ST T 0OT Y 0ST T 1OT Y 1
XO ~ . Y : " : . . : . :}{L. .TO g ~ ~ y .. :......).L
:'--3s- .T1 g ~ ~ } U . . > . i < ~
~ 2 s - + : ,YO g ~ : 1 u:, : ' .LY1 = g ~ - ' - - F__I:?>.::.::: .. L
...
48
8/7/2019 Description of Basic Instructions
19/41
FP-C/FP-M/FP0/FP1/FP2/FP2SH/FP3/FP10SHHigh-level Instructions
3 - 188
3.3 Explanation of High-level Instructions
Outline The two specified 16-bit data are compared and the result is output tothe special internal relay.For the FP-M/FP0/FP1, the P type high-level instructions are notavailable.
Program example
BooleanLadder Diagram
Address Instruction
40 F60 CMP , DT 0 , K 100
46
49(50)
52(50)
R900A
R900B
R900C
Trigger
S1 S2
Y10
Y11
Y12
X0
X0
X0
X0
Numbers in parentheses in the boolean indicate theaddress used for the FP2, FP2SH and FP10SH.
40
41
46
47
48 (49)
49 (50)
50 (51)
51 (53)
52 (54)
53 (55)
54 (57)
ST X 0
F 60 (CMP)
DT 0
K 100
ST X 0
AN R 900A
OT Y 10
ST X 0
AN R 900B
OT Y 11
ST X 0
AN R 900C
OT Y 12
S1 16-bit equivalent constant or 16-bit area to be compared
S2 16-bit equivalent constant or 16-bit area to be compared
Operands
Relay Timer/Counter RegisterIndex
registerConstant
IndexOperand
WX WY WRWL(*1)
SV EV DTLD
(*1)FL
(*1)IX (*2) IY (*3) K H
modifier
S1 A A A A A A A A A A A A A A
S2 A A A A A A A A A A A A A A
(*1) This cannot be used with the FP-M, FP0, and FP1.
(*2) With the FP2, FP2SH, and FP10SH, this is I0 to IC.
(*3) With the FP2, FP2SH, and FP10SH, this is ID.
5
F60P60
Step Availability
5FP-C/FP-M/FP0/FP1/
FP2/FP2SH/FP3/FP10SH(PCMP)
(CMP)16-bit data compare
A: Available
8/7/2019 Description of Basic Instructions
20/41
High-level InstructionsFP-C/FP-M/FP0/FP1/FP2/FP2SH/FP3/FP10SH
3 - 189
3.3 Explanation of High-level Instructions
Explanation of exampleCompares decimal constant K100 with the contents of data register DT0 when trigger X0 turns on.
When DT0 > K100, R900A turns on and external output relay Y10 turns on.
When DT0 = K100, R900B turns on and external output relay Y11 turns on.
When DT0 < K100, R900C turns on and external output relay Y12 turns on.
DescriptionCompares the 16-bit data specified by S1 with that specified by S2. The comparison result is output to the
special internal relays R9009, R900A, R900B and R900C.
The following table lists the states of the carry flag (R9009), > flag (R900A), = flag (R900B), and < flag
(R900C), depending on the relative sizes of S1 and S2.
FlagComparison between
S1 and S2 R900A(> flag)
R900B(= flag)
R900C(< flag)
R9009(carry flag)
S1 < S2 off off on
S1 = S2 off on off off
S1 > S2 on off off
: turns on or off according to the conditions
Execution condition (Trigger)In this program example, the comparison will be performed only when X0 turns on.
If ongoing comparison is necessary, relay R9010, which is always on, should be used in the execution
conditions (trigger).
R9010 can be eliminated in this case.
R0
R1
R2
R9010
R9010
R9010
R9010
F60 CMP, DT 0, K 100R900A
R900B
R900C
Always on relay.
You can also program the above using the PSHS, RDS, and POPS instructions.
RDS
Y10
POPS
Y11
Y12
X0
F60 CMP, DT 0, K 100R900A
R900B
R900C
PSHS
This is a program in which operation is the same as the program example on page 3 - 188.
8/7/2019 Description of Basic Instructions
21/41
FP-C/FP-M/FP0/FP1/FP2/FP2SH/FP3/FP10SHHigh-level Instructions
3 - 190
3.3 Explanation of High-level Instructions
Precautions when using two or more comparison instructionsThe comparison instruction flags R900A to R900C are updated with each execution of the comparison
instruction.
If you use two or more comparison instructions in your program, be sure to use the flags immediately after
each comparison instruction, by employing output relays or internal relays.
Example: Compares DT0 with K100, and DT1 with K200.
4
Y10
Y11
Y12
X0
X0
X0
X0
F60 CMP, DT 0, K 100
R900A
R900B
R900C
Y13
Y14
Y15
X1
X1
X1
X1
F60 CMP, DT 1, K 200
R900A
R900B
R900C
1
2
3
The comparison result for 1 is output to the output relays(Y10, Y11, and Y12) of program 2 .The comparison result for 3 is output to the output relays
(Y13, Y14, and Y15) of program 4 .
8/7/2019 Description of Basic Instructions
22/41
F137 (STMR) Auxiliary timer2-3. Description ofBasic Instructions
$\tlP UA.vIIltabiUW'/All FP-Ms and
5 FPI CS6 and cn series(CPU version 2.7 or later)Outline Sets the ON-delay timer for 0.01 s units (0.01 to 327.67 s)Program example
fSTlfSTlr;;llw;l~ ~ L . : . J L : J~ D [ J D E ]8T X 0F 137(8TMR)
K 300DT 5
8T R 900DaT R 5
1011
1617
~ Q 9 i ' i r . N 9 " f J t c m ~ r ,.FP.:.'. ,. .'.:.'..,....,Pr,.,'.:. , ..., .....: , .am..: . . . ' . m . . . , . . . .If . '' . k.::.Au., .. . .O.: . .IR.. ... . httidn,...,: . ., .. : , .:.8...A
8/7/2019 Description of Basic Instructions
23/41
2-3. Description ofBasic Instructions
Timer set time
XOf-{F137 STMR, K500, DTS]
R900D R5f- I-------- l [t __ _____=____
The fonnula of the timer set time is 0.01 x set value (Ul! to 327.67 s can be set as time).Example: STMR. K500 (0.01 s x 500 =5 s)
Timer operationProcedure:G) When the leading edge of trigger XO is detected
(OFF ON), set value K500 is transferred to thearea for timer elapsed value DT5.
(g) The passed time is subtracted from DT5 every scanwhile trigger XO is in the ON state.
':f' When the data in DT5 becomes O. special internalrelay R900D turns ON and then R5 goes ON.
Notes: 18 If you turn OFF trigger XO in the middle of an operation, the operation will be interrupted and the elapsedt ime will be reset to O. Do not overlap the designations for areas that hold settings and areas for elapsed values with othermemory areas for operation of TM/CT instructions and application instructions. The OT instruction can be described continuously even without using R900D. Since the timing operation is executed during the scan of the instruction, program F137 (STMR)instructions so that the F137 (STMR) instruction is executed once per scan.Be sure that the F137 (STMR) instruction is executed once per scan when the INT, JP. LOOPinstructions and others are programmed.
50
8/7/2019 Description of Basic Instructions
24/41
Counter
2-3. Description ofBasic InstructionsStep . < ~ V 8 1 I 8 b l l i t Y : < .:.
3 All FP-Ms and FPls
Outline Subtracts the preset counter.Program example
S e t v a l u e ~ , 0 STCount trigger CT .. 9.' 1 ST0Reset trigger _, 2 CT.......J _ q ~ KC . - ~ C o u n t e r instruction number YO.10. 5 ST5 'I [ 6 OT
x 0X 1
10 010
C 10 0Y 0
f S l l f S l l f 0 ~~ ~ L . : . J C JfSll rstl EJRT~ ~ L : . . J~ C J 8 G E l~ [ ] G E JfSllfCTlr;tr;;lr;;lr.;;lL...:-I L..:J L:...J CJf O T l f A N l f 0 ~~ ~ L . : J C J
FP1 C14 and C16 series: up to 128All FP-Ms and FP1 C24. C40, C56. and cn series: up to 144The number of the CT instructions is shared with that of the TM instructions.You can change the sharing of TM an d CT instructions through the systemregisters.Th e default value of the TM and CT instructions is,for FP1 C14 and C16 series:TM instruction: 0 to 99, CT instruction: 100 to 127for all FP-Ms and FP1 C24, C40, C56, and C72 series:TM instruction: 0 to 99, CT instruction: 100 to 143
r r ~ : 7 ~ ' ~ J ~ ~ ~ t , ) Y c ~ N ~ ~ < > i \ )1 All series: KO to K32767Decimal constant or counter set value area (SVn)" whose number is the sameas its timer instruction number (n)"SVn" can be specified only when th e version of th e CPU is 2.7 or later.
Operands
A: AvailableN/A: Not Available
Explanation of example In order 10 reset the counter. turns reset trigger XlON and then OFF.o When the leading edge of the XO is detected tentimes. counter contact CIOO turns ON and then YOgoes ON.
o The elapsed value EVIOO is reset when Xl turns ON_
Time chartON
XO OFF= - : - _ ~ = = : : : : ; : : = = = = ~ - - -X1 g ~ , - - - - - __l_e_n_ti_m_es_---!-__PITL
c 1 O o 8 ~ F _YO =8N-'FF __
51
8/7/2019 Description of Basic Instructions
25/41
2-3. Description ofBasic Instructions
Description The CT instruction is a down type preset counter. If there are not enough CT instruction numbers, you can increase lhe number by changing lheselling of system register 5. Refer to page 418, "5-4. System Registers", for details on how tochange the number of contact numbers.
When programming the CT instruction, be sure to program the count and reset triggers.Count trigger: subtract one count from elapsed value area EV each time its leading edge is
detected.(trigger XO in the example)Reset trigger: reset the counter when this is ON.
(lrigger Xl in the example)
I
Elapsedvalue
R9010I-{FO MV, OT9040, SV100]
Counter operat ion When the decimal constant uK" is specified as a set value:Procedure:
CD When the mode of the programmable controller is set toRUN, KlO (decimal) is transferred to the set value areaSVIOO.When reset trigger Xl turns ON. elapsed value areaEVIOO is reset. The value in the SVlOO is transferred tothe EVIOO when the trailing edge of Xl is detected(ON ---7 Off).
@ Each time the leading edge of count trigger XO isdetected. one count is subtracted from the value in theelapsed value area EV1OO.
@ When the elapsed value area EVlOO becomes 0,counter contact C100 turns ON and then YO goes ON.
When the "SVn" is specified as a preset value:Procedure:G) When reset trigger Xl turns ON. elapsed value area
EVlOO is reset. The value in SV100 is transferred to theEV100 when the trailing edge of Xl is detected (ON ---7Off). Each time the leading edge of count trigger XO isdetected, one count is subtracted from the value in theelapsed value area EVlOO.
@ When the elapsed value area EVIOO becomes 0, countercontact ClOO turns ON and rhen YO goes ON.
Notes: Even if the mode of the programmable control ler is changed from PROG. to RUN, the set value is not setto the elapsed value area. If you need to preset the counter elapsed value area, be sure to turn the iesettrigger ON and then OFF once before use. Counter set value area SV is a memory area for the counter seUing. The counter contact goes ON when the value in the counter elapsed value area (EV) becomes O.However, the value in the elapsed value area for the counter will also become 0 in a reset condition.
Continued
52
8/7/2019 Description of Basic Instructions
26/41
2-3. Description ofBasic Instructions/
Notes:o For each CT instrction, one SV and EV set and one contact C are supported as follows:
j ~ _ . ; ' . : . } I ~ ~ : : : : I ~ _ ' : : . 6 1 ' : : :CT100 SV100 EV100 Cl00
o The counter is not reset even if the power is turned OFF, or the mode is changed from RUN to PROG.Set system register 6 if you need to set the counter non-hold type. Refer to page 418, "5-4. SystemRegisters", for details about system registers.o When the count trigger and the reset trigger are detected simultaneously, the reset trigger has priority. Changing the value in the Set Value Area (SV)
AlIlhe conlrol units can change rhe value in the set value area (SV), even during RUN mode. using lhe high-levelinstruction FO (MV) or the programming tool (FP Programmer nor NPST-GR).The range of values that can be specified in lhe set value area (SV) are:
FPI CI4 and CI6 series: SVO to SVI27All FP-Ms and FPl C24. C40. C56. and cn series: SVO to SV143
o High-level 1nstr-uction FO (MV):Use the high-level instruction FO (MV) as describedbelow in order to change the counter selling according10 the inpul conditions.Example: Change the selling from 50 (K50) to 20 (K20)
when input XO goes ON.Refer to page 114. "FO (MV) 16-bit data move" fordetails on the high-level instruction FO (MV).
o FP Programmer n:Example: Change the value of SVIOO from K50 to K20.Steps: I) Monilor the stalUS of the word data.
2) Search for SVIOO.3) Clear the coments of SVIOO.4) Write the new value.
Refer to lhe FP Programmer J1 Operation Manual fordetails.
XOH FO MV, K20, SVl 00 JXl' I [ 50 JC3 YOI [
Key operations~ 8 E J[ { ; ] 0 0 0 ~
o NPST-GR Software:Select"MONITOR LIST RELAYS" in the on-line menu. read the relevant SV. and rewrite.Refer to the NPST-GR Software Ver. 3 Manual for details.
Notes: Even if the SV value is changed, the setting in the program will not be rewritten. The setting from theprogram is sent to the SV and changed only when the mode is changed back to RUN. or the next time thepower is turned ON. When the SV value is rewritten. the currently operating counter will continue operating as-is. The EVvalue will not be changed until the next time the reset trigger goes from ON to OFF.o If the power is turned OFF, or the mode is switched from RUN to PROG., the counter status will beretained.o The value in the elapsed value area (EV) can be changed in the same way.
53
8/7/2019 Description of Basic Instructions
27/41
2-3. Description ofBa.sic Instruction.s
F118 (UDC) UP/DOWN counter $ . l " P i : : ; i . ! ; ' ! : ; / i ~ Y i l l i ~ J n t y ; ; i : ; ; r ; ; ) . : .5 All FP-Ms and FPlsOutline Sets the UP/DOWN counter.Program example
50 8T X 051 8T X 152 8T X 253 F 118 (UDC)
WR 0DT 0
58 8T R 901059 F60 (CMP)
K 50DT 0
64 8T R900B65 OT R 0
::-:::'0' ' : : : : : : : - : : : > : i i i l . : : ; : ; : - : - ; ' : i t : ~ ~ : : : - a : d : ; ' : l i ' ; ; " . : . : - : . ; . : . ; . ;:::;:;:;:/';:;:;:;';:::;:::::X:;::::; ; :; :; :: :: ;: : :: :; :; : :; :; :; :; :: :; .; :. :; .; :- ;- :. ". ;....... :. :.;;.:-;.;. :-:.;.:."
:'" . p Q . ~ . O ~ . J ~ ~ ~ e ( . : ~ . ::':,'...:pj i . '. , ... , ..::." 8 "" m "" " 8 . u L:.......... ' : . ..:8.'..:.li. . :L s'.."a d. .r e s . . n s . . . . ._ "".'.::.:: : .. ..:.:....: i.:.:,,.:, r::r': ."'!"'i".l" .U,,,",,,&1VI.1 . : : } ~ : > : { < : : t : : : ~ : : : ~ : } ~ : : ~ : } } ~ : ~ : : ::;::..; : : r / / : } : : > ~ : : : : ~ < }::}ft{/ ....;.,.: :.-..".
Count trigger SReset trigger D
UP/DOWN trigger F1 18 UDC: ~ ~ 8 ~ ~ ~ ~ ~ Q :' : 9 1 ~ ~ ~ ~ ~ c i :
R9010f---{ F60 CMP, K 50. DT 0]R900B ROI [
51
64
50
58
52
16-bit equivalent constant or 16-bit area for counter preset value16-bit area for counter elapsed value
Operands< ...........
8/7/2019 Description of Basic Instructions
28/41
2-3. De.w:ription ofBasic Instructions .
Time chartX2 . : : : : ~ , - , - F _ - + : = } ? = { t = } ? = ? : : = r : 4 , m l . - - - _:':l;: S:IKSOI
I I50 :49 :48 :47 :48 :49 :50 :51 :52 I I I i . __ : I i i lit'Subtraction: Addition. ,. ,, .
oONX1 =O:...:FF_---.;. ~ : - I = - ~ - + " ' - - - + ' ' - + ' . ; L . . . . f = - ~ + " ' - -OTO
,,( O ~ ~ ~ ~ ) = ~ , - , - F - - " ~ > - El _,,
AO -----JItill'-- ---J[U] _Description
DOWN counting when the trigger is in the OFF stale.UP counting when the trigger is in the ON state.Adds or subtracts one count at Ihe leading edge of this trigger.The area for counter elapsed value D becomes 0 when the leading edgeof rhe trigger is delected (OFF ---+ ON).The value in S is transferred to D when the trailing edge of Ihe triggeris delecled (ON ---+ OFF).K-32,768 to K32,767
Count trigger:Reset trigger:
When programming the FIl8 ( lIDe) instruction, be sure to program Ihe UP/OOWN, countand reset triggers.
UP/DOWN trigger:
Set value range: Flag condition=flag (R900B): Carry flag (R9009): Turns ON for an instant when the calculated result is recognized as "0".Turns ON for an instanl when the calculated result exceeds the range of16-bit data (overflows or underflows).
*Range of 16-bit data: K-32,768 to K32,767 (H8000 to H7FfF)Note: When using special internal relays R900B and R9009 as the flags for thisinstruction, be sure to program the flags at the address immediately after theinstruction.
Notes: The value in S is transferred to D only when the trail ing edge of the reset trigger is detected. If yo:..: needto reset the counter when turning ON the power, make a program using special internal relay R9013.(The R9013 turns ON only for one scan durat ion when the mode of the programmable controller is set toRUN or when power is supplied to the programmable controller in RUN mode.)
When the trailing edge of the reset trigger and the leading edge of the count trigger are detectedsimultaneously, the reset trigger has priority. Refer to page 202, "F60 (CMP) 16-bit data compare", for details about the F60 (CMP) instruction.
55
8/7/2019 Description of Basic Instructions
29/41
2-3. Description ofBasiclnstructions
Shift register$J.@P ? ' : : A v " l ~ m f t t ' : m : t ' ; : : : ; ) ' : : :1 All FP-Ms and FPls
Outline Shifts one bit of 16-bit [word internal relay (WR)] data to the left.Program example
oData a r e a ~ ._.
Data input SR '.WEL=3:Shift trigger
o 8T X 01 8T X 12 8T X 23 8R WR 3
l S T I l S T I l , 0 ~~ ~ L . J L : Jl S T I l s T l ~ r w ; ; l~ ~ L . J Of S T l r ; T l r ; l ~~ ~ L . : . J O~ [ J E ; j ~ [ J E l
Reset trigger
16-bit data area (WR) whose one bit is shif ted to the left
Operands
A N/A N/A N/A N/A N/A N/A N/A N/A A: AvailableN/A: No ' Available
I:;:;::"':;,,'}">'" ':.' .......NXO OFFONXl OFF
X2 g ~ ; 1tDJ'-----R30 g ~ F " " , , 1 ; i ; L ~
, I ,
R31 g ~ F i : ) ; ) ) : i : i L . _ ~ _R32 g ~ !)):!:::/!?:::lR33 ~ _.:-- _R34 g ~ _'-- _
Time chartExplanation of example If shiftlTigger X1 turns ON when X2 is in the OFFstate, the contents of the internal relay WR3(intemal relays R30 to R3F), are shifted one bit tothe left. " 1 " is shifted in R30 if XO is ON. and "0 " is shiftedin R30 if XO is OFF.
If resel rrigger X2 turns ON (leading edge), thecontents of WR3 are cleared (all bits in the WR3become "0").
56
8/7/2019 Description of Basic Instructions
30/41
2-3. Description ofBasic Instructions
When shift trigger (X1) is turned ON:, , : W ~ : : . ; : , : : . : m , : : : , : , ; 3F . . . . .
Data input (XO)ON: 1 is shifted into the LSB (Least Significant Bit).When reset trigger (X2) is turned ON:
[ : . g # ~ , ' : : : j : : : : : : ; : : : : ; ' : : : ' : ; 1 0 0 0 1 1 0 0 0 1 1-0-0-0-1 1 1 0 0 1 I.-
I p ~ ~ : :::::::::.):;;:1 0 0 0 0 I 0 0 0 0 1-0-0-0-0I 0 0 0 0 INote: Refer to page 6, "1-2. Explanation of Memory Areas", for details about word internal relay (WR).Description
Shifls one bit of the specified data area (WR) to the left ( to the higher bit pos it ion) . When programming the SR ins truc tion, be sure to program the data input , shift and resettriggers.
Data input: specifies the state of new shift-in datanew shift-in data 1: when the input is ON
0: when the input is OFFShi ft tr igger: shi ft s one bit to the left when the leading edge of the trigger is detectedReset t rigger : turns al l the bi ts of the data area to 0 when the trigger turns ON
The area available for this instruction is only the word internal relay (WR).Word internal relay (WR) number range:FP l C14 and C16 series: WRO to WR15All FP-Ms and FP l C24. C40, C56, and cn ser ies : WRO to WR62
Notes: The SR instruction needs data input, shift trigger. and reset trigger. When the reset trigger and the shift trigger are detected simultaneously, the reset trigger has priority. If the area is specified as the hold type, the data in the area is not reset (become "0") when the mode isset to the RUN mode. If you need to reset the data, turn ON the reset trigger before use or change thesettings of the system register 7. Refer to page 418. "5-4. System Registers", for details about system registers. F119 (LRSR), F100 (SHR), F101 (SHL), F120 (ROR), F121 (ROL), F122 (RCR) and F123 (RCL)can also be used as shift register instructions.
57
8/7/2019 Description of Basic Instructions
31/41
2-3. Description ofBasic Ir.structions
F119 (LRSR) Left/right shift register $tttp.,. AvalratHlitv(.?t5 All FP-Ms and FPIsOutline Shins one bit of the 16-bit data range to the left or to the right.Program example
Leftlrighttrigger F119 LRSR 50 ST X 0 ~ ~ G E J[ Wl xwx50 ST X 1 ~ ~ O E J1 )l-WX )(wxData input 52 ST X 2 ~ ~ G J E J: ) ~ ) I ~ ~ ~ j i ' : )lW. xwx51 53 ST X 3 ~ G ; I [ ] E Jhift trigger )lWl )[ Wl01 r;:JOO882 : : 6 ~ t : : : i : 54 F 119(LRSR)Reset trigger 02 DT 0 ~ 8 E J53 DT ~ 8 E JOTildStarting 16-bit area whose one bit is shifted to the left or to the rightEnding 16-bit area whose one bit is shifted to the left or to the right
Operands:. . .. .. I"i .me.:. J C.:..O'. .:._.1n.: 6 r .. e ...:1 ~ " ' e w i .:.... .. . . . . .: .. .: . . . . . . . . . . . . . . . . .......:. '...... R ~ I I I Y / Ir " . .r:. .. ~ . ...~ . : 1UI..::..1..8........ .....:: Constant lndeX::-;:::;:::";::/?/ N/A A A A A A N/A N/A N/A N/A N/A
.. ' .':.:
........ :: ..: 'fC.:.' . :.... N/A A A A A A N/A N/A N/A N/A N/A A: AvailableN/A: Not Available Explanation of example
One bit of the dala range from DTO to DT9 is shi fted to the left when the leading edge of shift trigger X2 io; detecled(OFF ON) while left/right trigger XO is in the ON state.
One bit of the data range from DTO to DT9 is shi fted to the r ight when lhe leading edge of shif11rigger X2 isdetected (OFF ON) while left/right trigger XO is in the OFF state. "I" is shifted in the LSD or MSB of the data range if XI is the ON state, and "0" is shifted if XI is in the OFF state. The shifted-out bit is transferred to special internal relay R9009 (carry flag). When the leading edge of reset trigger X3 is detected (OFF ON), "0 " is transferred 10 all the bits of the datarange from DTO to DT9.
58
8/7/2019 Description of Basic Instructions
32/41
2-3. Description ofBasic Instructions
Left shift operation
When data input XI turns ON, "I" is shifted intoLSB.-----When data input Xl turns OFF. "0" is shifted inloLSB.------J
DTOT9 Right shift operation
MSB.-*
Shifted-out bitis transferredto R9009......- ~ , - . . , . . . - - - : : I I : - - r - - - - r - ~ - - - - , - _ - - 1 . , . . . - ~ ' r - - . - - - . . . . , - - - . . 1 . . . , . . . . - - - . . , . . . . . : : ' - - . . . . . , ( c a r r y flag).
DT9f---- When data input X I \Urns ON, "I" is shifted into MSB.' ---- When data input Xl turns OFF. "0" is shifted into MSB.
DTO
Description When programming the F1I9 (LRSR). be sure to program the left/right trigger. dara input.shift and reset triggers.
Left/ rightt rigg[ 'pccifies the direction of the shift-oul.ON: shifting out to the leftOFF: shifting out 10 the right
Data input: Specifies the new shift-in data.new shift-in data "I": when the data input turns ON
"0": when the data input turns OFFShift trigger: Shifts one bit 10 thc left or right when thc leading edge of this trigger is
detected (OFF ---+ ON).. Reset trigger: Turns all the bits of the data range specitied by 01 and 02 to "0" whcn
this trigger turns ON.
59
8/7/2019 Description of Basic Instructions
33/41
2-3. Description ofBasic Instructions
Flag condition Error !Jag (R9007):
Error flag (R9008):
Carry flag (R9009):Notes:
Turns ON and keeps the ON Slale when Ihe area specified by Ihe slarling16-bil area (OJ) is larger Ihan Ihe area specified by Ihe ending 16-bil area(D2) (when 01 > D2). The error address is Iransferred 10 DT9017 andheld. (See nOles below.)Turns ON for an inslanl when Ihe area specified by Ihe slarling 16-bilarea (0 I) is larger Ihan the area specified by Ihe ending 16-bil area (D2)(when DI > D2). The error address is Iransferred 10 DT9018. (See nOlesbelow.)Turns ON for an instant when Ihe bil shifted-oul is recognized ao; "I" .
Special data registers OT9017 and OT9018 are available for:- FP1s with CPU version 2.7 or later. (All FP1 s with a suffix "8" on the part numberhave this function.)- All FP-Ms. When using special internal relays R9008 and R9009 as the flags for this instruction,be sure to program the flags at the address immediately after the instruction. Refer to page 429, "5-5. Special Internal Relays", for details about the carry flag.Notes: Specify 01 and 02 as they are in the same type data area and be sure to set the data area addresses sothat 01 02 . If the specified area is set as the hold type, the data in the data area are not reset (become "0") when themode is set to the RUN mode. If you need to reset all the data, turn ON the trigger of the reset triggerusing special internal relay R9013. R9013 turns ON only for one scan duration when the programmablecontroller is set to RUN mode.
60
,.
8/7/2019 Description of Basic Instructions
34/41
Master control relayMaster control relay end
2-3. Description of Basic Instructions$ t ~ p I : A V ~ l j . J ) O J . t V ) O .2
- All FP-Ms and FPIs2
Outline Executes the instructions from MC to MCE when the predeterminedtrigger (I/O) turns ON,
Program example
/ Predetermined trigger 0 ST X 0 G;]G;]GJE]-wx x.wx wMC instructi n number 1 Me 0 ~ [ ] ~ G J 8Oa I ( MC 'J2: 3 ST X 1 G;]G;]OE]X13 4 OT y 0 ~ G ; ] G J E ]W\.. \( .w
X2 5 ST/ X 2 G ; ] ~ G ; ] O E ]-wx Oll ld xwx56 OT y 1 ~ G ; ] O E ].W\.. '(.WI( W7 7 MCE 0 ~ O ~ G J E J
Explanation of example Executes the programs from the MC instruction tothe MCE instruction when predetermined triggerXO (urns ON.
The example program executes in the same way asthe program below.
Time chartONXO OFFONX1 OFFON
YO OFF
..... . ... ..... ....01 _. ,
~ ' - L - _ONX2 OFFONY1 OFF__ '"""'==-------L= _
Description
All OFF .T
Executes programs from MC to MCE wheri the predetermined trigger turns ON . When the predeterm; . trigger is in the OFF state, the instructions between the MC and MCEinstruction set operah follows.. ~ ' Q ' J r q ~ t l g i j } .KP Holds the state at the t ime just before the trigger turns OFF.SETRSTTM and F137 (STMR) ResetCT and F118 (L1DC)SR and F119 (LRSR)
Holds the elapsed value at the time just before the triggerturns OFF.
Other instructions Not executed61
8/7/2019 Description of Basic Instructions
35/41
! -3. Description ofBasic Instructions
Another maSler conlrol instruction (MC. MCE)set can be programmed belween one maslercontrol instruclion set as shown on the right. Thisconslruclion is called "nesling".
XOI I - - - - - - ~ ( MC 0 t- M ............Xl YOI [X2I t - --------( MC 1X3 YlI [
r---------{ MCE 1I----------{ MCE 0 r . . ..---
Notes:
J
XOI (MCOxo RO1-1- - - - - j [
f-----{ MCE 0RO YOf---{ OF } - - {
If. in the example above. output is required atpoint. place the OF or OF! instruction outsidethe MC and MCE instruction set.
xo1-1----{I MC 0
Xl ROI [
1. When programming OF and OF! instructions in the master control instruction set:The OF and OF! instructions remember their trigger state (ON or OFF) just before the trigger of the MCinstruction turns OFF while the master control instruction set is in the OFF state.Be sure to pay atlention to the following when the OF and OF! instructions are programmed. Trigger to the OF or OF! instruction between the If the same trigger is set for the MC and for theMC and MCE instruction set is ignored while OF or OF! instruction, there will be no output.the MC trigger is OFF. Place the OF or OF! instruction outside the MC(MC O and !"ICE instruction set when output is
Xl YO reqUired.f--< OF >-----{
xo E?3TI n: 0 1- 1.,::.:. : . : W . o ~ ; ~ ~ ~ ~ ~ ~ .Xl ----S..: k ; X f l ~ .YO h h :.----.: H
Changes in Xl are ignoredduring Ihis interval.
r-----{ MCE 0RO YOf - - - - { D F ~
(MC1) and (MCE1)are reversed order.
Ouplicaled use ofsame Me inslruclionnumber.
f-------{ MC 1 .f - - - - -- {MC E 1
2. The MC instruction cannot be started directly from the bus line. Be sure to include a contact input beforethe MC instruction in your program.3. The program cannot be executed in the followingconditions:- The trigger of the MC instruction is missing. There are two or more master control instructionsets with the same number.- The order of the MC and MCE instructions arereversed.
62
8/7/2019 Description of Basic Instructions
36/41
JumpLabel
2-3. Description of Basic I n s t r u c t i o n ~ ~$'(1) < A v ~ I I . ~ n l t y , , . . 2
All FP-Ms and FPIs1
Outline Skips to lhe LBL instruction that has lhe same number as lhe JPinstruction when the predetermined trigger turns ON.Program example
..... ................. a ~ ~ t . ~ ...................... ..................................... ......... ~ : ~ ~ ~ ; ; ~ ~ ~ i ; : 6 ~ r ; J j : e . ~ I ~ . t I ~ . ~ ~ s ...10 ST X 111 JP1 ~ X 1 / Predetermined trigger - J1 , / (JP ~ _ ) .
' : JP in"",ction n"mbe,( ._ J 2020 ( LBL : 1 : )
LBL 1
G;]G;][]8~ G J ~ [ ] 8~ D ~ D E J
J P l n s t r J c t i ~ h I l U ~ b ; ; , FP1 C14 and C16 series: 0 to 31 (32 points)..
8/7/2019 Description of Basic Instructions
37/41
~ X . (J P 1,1 'program including TM, CT, ',1and SR instructions 1 r
f---------{ LBL 1
2-3. Description o f B a . ~ i c Instructions
TM, CT, an d SR instruction operation during JP execution When the LBL instruction is located after the JP instruction:- TM instruction: The limer instruction is not executed. If it is not
ext'cuted once per scan the correct time cannot beguaranleed.
- CT instruclion: Even i f the count input is ON, counting is nolperformed. The elapsed value is preserved.- SR instruclion: Even il' the shift inpul is ON, no shift is performed.The contents of the specified register are preserved.
When the LBL instruction is located before the JP instruction:- TM instruction: Because lhe timer will run several times per scan, lheconecl rime cannot be guaranteed.
- CT instruction: If lhe slale of lhe count inpul does not change duringlhe scan, it will operate in lhe llsual way.
- SR instruction: If the stale of the shi rl input does not change duringlhe scan, it will operale in tht' usual way.
f---------{ LBL 1Program including TM, CT,a n SR instructionsXlI ( ,IP
iI
Using the OF or OF/ instruction between the JP and LBL instructions Trigger to the DF or DF/ I XO XO g ~ ~
instruclion between Ihe JP and I ( JP a L-__ --+ +-I_LUL inslruclion SCi is ignored X1 YO X1 g ~ ~ f---i OF I r---[while lhe JP t r i g g t ~ r is OFF. I : '( LBL a YO g ~ Di IChanges in X1 are ignoredduring this interval.
1(lh,' ';;lI11C trigger IS ' ; l ~ 1 I'llI' 11ll ' . IP allll I 'm the DF or OF/ inslruclion, lhere will be no OUlput.Plan: tht' DF or OF/ il1sll'lIt"till l111Ulsidc Ihe.lP and LUL instruction set when oUlPUl j , required.
II
I Xl YO ,
HH OF/ }------{ J-j1 f (,IP 1 1 (LBL 1.,:rNotes:! If the a d d r e s ~ of the LB L instruction precedes the address of the ..IP instruction, the scan will notI terminate an d an operation bottleneck error may occur.1
Th e program cannot be executed in the following situations:- When the trigger of the ..IP instruction is missing.
i -When there are two or more LB L instructions with same number.- W he n o ne instruction of the JP and LB L instruction set is missing.- When the jump is from the main program area to an address outside the ED.instruction.- When the jump is from outside the step ladder program area to the s te p ladder program area: .- When the jump is f rom the subroutine or interrupt program area to outside the subroutine or interrupt
program area.
64
8/7/2019 Description of Basic Instructions
38/41
LOOPLBL
LoopLabel
2-3. Deseriplion ofBasic InslrueliOits .$ t . P ; % : : ' : ~ v . n . f > O l t Y : : % ; : \ ) : 4
- All FP Ms a n d FPls
Outline Skips to the LBL instruction that has the same number as the LOOPinstruction and executes what follows it repealedly until the' data o f aspecified operand becomes "Q".
Program example
20 LBL : : ~ : . i 20 LBL 1 ~ O ~ D E lPredetermined trigger . /L{ LBUn,"uc!;on numb.'T30 8T X 1 ~ G ; J D E l- / .30 f - - { L O O P : . l : , ~ J 31 LOOP 1 ~ 8 ~ D E JS DT 0 ~ G J E l16-bit area for set repetition timesFP1 C14 and C16 series: 0 to 31 (32 points)All FP-Ms and FP1 C24, C40, C56, an d C 72 series: 0 to 63 (64 points)
Operands
A A A A A N/A N/A N/A Explanation of example
The LOOP instruction skips all programs between the LOOP) and LBLI instruclions.Each time this instruction is executed .. . I" is decreased from the set value in data register DTO.The same operations are repeated until the value in DTO becomes "0".
A: AvailableN/A: Not Available
L Program, [ - - - - - ~ ( LBLProgram
'POr-I- - . . , [LOOP1, OTODescription
If the. value of DTO is K5. then. after performingthe jump 5 times. even if XO is set to ON. theLOOP instruction is not executed.
. The LBL instructions are specified as destinations of the LOOP instruction. Tw o or more LBL instructions with same number cannot be specified in a program. If the set value in the data area is "0 " from the beginning. the LOOP instruction is not executed(ignored).
65
8/7/2019 Description of Basic Instructions
39/41
2-3. Description ofBasic Jnstructions
Flag condition Error flag (R9007):
Error flag (R9008):
Notes:
Turns ON and keeps Ihe ON slale when the specified value in Ihe dalaarea becomes less than "0" (when the MSB of the specified data areabecomes "1"). The error address is transferred to DT9017 and held.(See notes below.)Turns ON for an instanl when the specified value in the dala areabecomes less than "0" (when Ihe MSB of Ihe specified data areabecomes "I"). The error address is transferred to DT9018. (See nolesbelow.)
f-f1 [LOOP 1, DTO J1.--l Program including TM, CT.and SR instructions 1 'I
1- - - - - - - - - - ( LBL
Special data registers DT9017 and DT9018 are available for:- FP1 s with CPU version 2.7 or later. (All FP1 s with a suffix "S" on the part numberhave this function.)- All FP-Ms. When using special internal relay R9008 as the flag for this instruction, be sure toprogram the flag at the address immediately after the instruction. Refer to page 429, "5-5. Special Internal Relays". for details about the error flag.
TM, CT, and SR instruction operation during LOOP execution When the LBL inslruclion is located affer the LOOP inslruction:- TM inslruction: The timer instruClion is nor cxeculed. If it is norexecuted once per scan, Ihe correCI lime cannol beguaranteed.- CT instruction: Even if the counl inpul is ON, counting is notperformed. The elapsed value is preserved.
- SR instruction: Even if the shiff input is ON, no shift is performed.The contents of the specified regislcr are preserved.
When Ihe LBL inslruclion is located before the LOOP instruction:-TM inslruclion: Because the timer will run several limes per scan, thecorrect time cannoI be guaranteed.-CT instruction: If the state of Ihe counl input does nOI change duringthe scan, it will operate in the usual way.
- SR instruclion: If the stale of Ihe shift inpul does nOI change duringthe scan, it will operate in Ihe usual way.
LBL 1Program including TM. CT. ,1'I ; ~ SR instructions 'Ir I [LOOP 1, DTO J I
..
Using the OF or OFI instruction between the LOOP and LBL instructions The lrigger 10 Ihe DF or DFI Xo XO g ~ ==.J ..Linstruction between the LOOP HLOOP 1, DTOJ 1....-----1'- ' , ~ = ~ ,and LBL instruclion sel are X1 YO Xl g ~ _r--< DF/ > - - - { . ,ignored while the LOOP trigger ON : :\s Off. YO OFF 0:f --------{ LBL 1 Changes in Xl are ignored. --during this intervaL
66
8/7/2019 Description of Basic Instructions
40/41
2-3. Description ofBasjl" Instruct;OIis
I f the same trigger is set for the LOOP and for the DF or DFI instruction, lhere will be no output.Place the DF or DFI instruction outside the LOOP and LBL instruction set when output is required.
]
X1 'q IH DFf) [ .!1X1 ,r-----{LOOP 1, D T o J , ~ : _1 (LBL 11
Notes:!. If the address of the LBL instruction precedes the address of the LOOP instruction, the scan will notI terminate and an operation bottleneck error may occur.i The program cannot be executed in the following situations:- When the trigger of the LOOP instruction is missing.- When there are two or more LBL instructions with same number.- When one instruction of the LOOP and LBL instruction set is missing.- When the jump is from the main program area to an address outside the ED instruction.- When the jump is from outside the step ladder program area to the step ladder program area.- When the jump is from the subroutine or interrupt program area to outside the subroutine or interruptprogram area.
67
8/7/2019 Description of Basic Instructions
41/41
23. D f . ~ c r i p t i o n ofBasic I n . ~ t r u c t i o n . ~
End
Outline Indicates the end of a main program.Program example
~ t e p - i < A ' \ I i i l ~ t W u t ~ .}i1 All FP-Ms and FPls
0 5T X 0 G;JG;JGElY1 ll:-Wll: ll:wx[ 1 OT y 0 ~ ~ G E l-Wl y.W'fJ 50 ED ~ [ ] G ~ E l(ED Explanation of example Step 50 is the end of the main program area.Description
Notes:
Indicates the end of a main program. Addresso ~ ~ ~ ~Subroutine programInlerrupl program
Place any subroutine programs and interrupt programs after the ED instruclion. Use the CNDE instruction if end processing is necessary within the main program.