Download  Print this page

Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual

Instructions, standard functions/function blocks.
Hide thumbs
   
1
2
3
Table of Contents
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990

Advertisement

MELSEC iQ-F
FX5 Programming Manual
(Instructions, Standard Functions/Function Blocks)

Advertisement

Table of Contents

   Summary of Contents for Mitsubishi Electric MELSEC iQ-F FX5

  • Page 1 MELSEC iQ-F FX5 Programming Manual (Instructions, Standard Functions/Function Blocks)
  • Page 3: Safety Precautions

    • Since the examples indicated by this manual, technical bulletin, catalog, etc. are used as a reference, please use it after confirming the function and safety of the equipment and system. Mitsubishi Electric will accept no responsibility for actual use of the product based on these illustrative examples.
  • Page 4: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 INTRODUCTION .
  • Page 5: Table Of Contents

    Standard arithmetic functions ............. . . 97 Standard bit shift functions .
  • Page 6: Table Of Contents

    Shifting n-bit data to the left by n bit(s) ............151 Shifting n-word data to the right by n word(s) .
  • Page 7: Table Of Contents

    Performing an OR operation on 16-bit data........... . 255 Performing an OR operation on 32-bit data.
  • Page 8: Table Of Contents

    Seven Segment With Latch ..............331 Separating 4 bits from 16-bit data .
  • Page 9: Table Of Contents

    Reading the oldest data from the data table ........... 406 Reading the newest data from the data table .
  • Page 10: Table Of Contents

    Calculating the sine of single-precision real number ..........515 Calculating the cosine of single-precision real number .
  • Page 11: Table Of Contents

    8.19 Initial State ................627 Initial State .
  • Page 12: Table Of Contents

    Reading 1-word/2-word data from another module ..........726 Writing 1-word/2-word data to another module (32-bit specification) .
  • Page 13: Table Of Contents

    14.2 High-speed Current Value Transfer Instruction ..........816 High-speed current value transfer of 16-bit data .
  • Page 14: Table Of Contents

    18.4 Converting BOOL to DINT ............. . . 903 18.5 Converting BOOL to TIME .
  • Page 15: Table Of Contents

    18.55 Writing the Specified Bit of Word Label ........... . 971 18.56 Copying the Specified Bit of Word Label .
  • Page 16: Table Of Contents

    25.4 Link Character Strings ..............1029 25.5 Inserting Character String .
  • Page 18: Relevant Manuals

    Functions and programming for the synchronous control of the Simple Motion Synchronous Control) module. <IB0300255> MELSEC iQ-F FX5 User's Manual (Analog Control - CPU module built- Describes the analog function of the CPU module built-in and the analog adapter. in, Expansion adapter) <JY997D60501>...
  • Page 19: Terms

    TERMS Unless otherwise specified, this manual uses the following terms. For details of the FX3 devices that can be connected with the FX5, refer to the User's Manual (Hardware) of the CPU module to be used. Terms Description ■Devices Generic term for FX5U and FX5UC PLCs Generic term for FX3S, FX3G, FX3GC, FX3U, and FX3UC PLCs FX5 CPU module Generic term for FX5U CPU module and FX5UC CPU module...
  • Page 20 Different name for FX3U-32BL Peripheral device Generic term for engineering tools and GOTs Generic term for Mitsubishi Electric Graphic Operation Terminal GOT1000 and GOT2000 series ■Software packages Engineering tool The product name of the software package for the MELSEC programmable controllers...
  • Page 21: How To Read This Manual

    HOW TO READ THIS MANUAL The following describes the page layout and symbols used in this manual. How to read PART 3 and PART 4 The contents described in this section are provided only for explaining how to read this manual. Thus, the actual description may differ.
  • Page 22 Indicates the description, setting range, data type, and data type (label) of each operand. • For the data type, refer to the following. MELSEC iQ-F FX5 Programming Manual (Program Design) Indicates the applicable devices for each operand. The following table describes the usage classification.
  • Page 23 How to read PART 5 and PART 6 The contents described in this section are provided only for explaining how to read this manual. Thus, the actual description may differ. 18.28 Converting DINT to INT  DINT_TO_INT(_E) These functions convert DINT type data to INT type data. ...
  • Page 24 MEMO...
  • Page 25: Part 1 Overview

    PART 1 OVERVIEW Part 1 consists of the following chapter. 1 OVERVIEW 2 PRECAUTIONS ON PROGRAMMING...
  • Page 26: Chapter 1 Overview

    OVERVIEW Instruction Configuration Many instructions available for CPU module are each divided into the instruction part and device part. The instruction part and device part are used as follows. • Instruction part: Indicates the function of the relevant instruction. • Device part: Indicates the data used for the instruction. The device part is further classified to source data, destination data, and numerical data.
  • Page 27: Data Specification Method

    Be careful when a large numerical value is used such as for the number of transfers. It delays the scan time. Data Specification Method The following table lists the types of data that can be used for instructions in CPU modules. Data Classification Bit data...
  • Page 28 Label data ■Primitive data type Data type (label) Specifiable label • Bit type label (BOOL) • Bit-specified word [unsigned]/bit string [16 bits] type label • Bit-specified word [signed] type label • Timer/retentive timer/long timer/long retentive timer type label contact/coil • Counter/ long counter type label contact/coil Word [unsigned]/bit string [16 bits] •...
  • Page 29 ■Generic data type Data type (label) Specifiable label Bit, word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits], single-precision real number, hour, character string, structure ANY_BITADDR ANY_BOOL ANY_ELEMENTARY Bit, word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits], single-precision real number, hour, character string ANY_WORDADDR Word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits],...
  • Page 30: Bit Data

    Bit data Data size and data range Bit data is handled in increments of bits such as contacts and coils. Data name Data size Value range Bit data 1 bit 0, 1 Handling bit data with bit devices and labels Bit data of one point per point can be handled.
  • Page 31: Bit Data (word Data)

    16-bit data (word data) Data size and data range 16-bit data includes signed and unsigned 16-bit data. In signed 16-bit data, a negative number is represented in two's complement. Data name Data size Value range Decimal notation Hexadecimal notation Signed 16-bit data 16 bits (1 word) -32768 to 32767 0000H to FFFFH...
  • Page 32 Nibble specification range The following table lists the range of 16-bit data for each nibble specification. Nibble Decimal notation Hexadecimal notation specification 0 to 15 0H to FH 0 to 255 00H to FFH 0 to 4095 000H to FFFH Signed 16-bit data: -32768 to 32767 0000H to FFFFH Unsigned 16-bit data: 0 to 65535...
  • Page 33: Bit Data (double Word Data)

    Handling 16-bit data with word devices/labels ■Word device One point of word device can handle 16-bit data. ■Word type label One point of word type label can handle 16-bit data. 32-bit data (double word data) Data size and data range 32-bit data includes signed and unsigned 32-bit data.
  • Page 34 Nibble specification range The following table lists the range of 32-bit data for each nibble specification. Nibble Decimal notation Hexadecimal notation specification 0 to 15 0H to FH 0 to 255 00H to FFH 0 to 4095 000H to FFFH 0 to 65535 0000H to FFFFH 0 to 1048575...
  • Page 35 ■Specifying a bit device with nibble specification in the source (s) When a bit device with nibble specification is specified in the source of an instruction, 0 is stored in the bits, which follow the bit for which nibble specification is made in the source, in the word device of the destination. Ladder example Processing •...
  • Page 36: Real Number Data (floating-point Data)

    Real number data (floating-point data) Data size and data range Real number data includes single-precision 32-bit real number data. Real number data can be stored only in devices other than bit devices or in single-precision real data type labels. Data name Data size Value range -126...
  • Page 37 The monitor function of the engineering tool can monitor real number data of CPU modules. To represent "0" in real number data, set all numbers in each of the following range to 0. • Single-precision real number data: b0 to b31 The setting range of real number data is as follows.
  • Page 38: Character String Data

    Character string data Format of character string data The following table lists the types of character string data, each of which ends with a NULL code to be handled as a character string. Type Character code Last character Character string ASCII code NULL(00H) Character string data is stored in devices or an array in ascending order of device numbers or array element numbers.
  • Page 39: Execution Condition

    Execution Condition Types of execution conditions The following are the five types of execution conditions of the instructions and functions of CPU module. ■On An instruction is executed during on. It is executed only while the precondition of the instruction is on. When the precondition is off, the instruction is not executed.
  • Page 40: Chapter 2 Precautions On Programming

    PRECAUTIONS ON PROGRAMMING Errors Common to Instructions The following table lists the conditions under which an error occurs when the instruction is executed. Error content Error code (SD0/SD8067) An I/O number which corresponds to no module is specified. 2801H • An I/O number which is out of range (0 to 1777(Octal number)) is specified. 2820H •...
  • Page 41: Operations Arising When The Out, Set/rst, And Pls/plf Instructions Of The Same Device Are Used

    Operations Arising when the OUT, SET/RST, and PLS/PLF Instructions of the Same Device are Used If two or more OUT, SET/RST, and PLS/PLF instructions are executed using the same device during one scan, they operate as described in this section. For OUT instructions of the same device More than one OUT instruction of the same device must not be issued during one scan.
  • Page 42 If SET/RST instructions of the same device are used ■For SET instructions The SET instruction turns on the specified device if the execution command is on, and causes no operation if it is off. Thus, if two or more SET instructions of the same device are executed during one scan, the specified device turns on even if one execution command is on.
  • Page 43 If PLS instructions of the same device are used The PLS instruction turns on the specified device when the execution command specifies an off-to-on change. The specified device is turned off unless the execution command specifies an off-to-on change (i.e. off to off, on to on, on to off). Thus, if two or more PLS instructions of the same device are issued during one scan, the specified device is turned on when the execution command of each PLS instruction specifies an off-to-on change.
  • Page 44 • If the off-to-on changes of X0 and X1 are at the same timing PLS M0 PLS M0 PLS M0 (1) Since X0 turns on, M0 turns on. (2) Since X1 turns on, M0 remains on. (3) Since X0 is other than turning on, M0 turns off. (4) Since X1 is other than turning on, M0 remains off.
  • Page 45 If PLF instructions of the same device are used The PLF instruction turns on the specified device when the execution command specifies an off-to-on change. The specified device is turned off unless the execution command specifies an on-to-off change (i.e. off to off, off to on, on to on). Thus, if two or more PLF instructions of the same device are issued during one scan, the specified device is turned on when the execution command of each PLF instruction specifies an on-to-off change.
  • Page 46: Standard Function/function Block Return Values

    • If the on-to-off changes of X0 and X1 are at the same timing PLF M0 PLF M0 PLF M0 (1) Since X0 turns off, M0 turns on. (2) Since X1 turns off, M0 remains on. (3) Since X0 is other than turning off, M0 turns off. (4) Since X1 is other than turning off, M0 remains off.
  • Page 47 PART 2 INSTRUCTION/ FUNCTION LIST This part consists of the following chapters. 3 CPU MODULE INSTRUCTION 4 MODULE SPECIFIC INSTRUCTION 5 STANDARD FUNCTIONS/FUNCTION BLOCKS...
  • Page 48: Chapter 3 Cpu Module Instruction

    CPU MODULE INSTRUCTION Sequence Instruction Contact instruction ■Operation start, series connection, parallel connection Instruction symbol Description Reference Starts logical operation (Starts NO contact logical operation) Page 104 Starts logical NOT operation (Starts NC contact logical operation) Logical AND (NO contact series connection) Logical NAND (NC contact series connection) Logical OR (NO contact parallel connection) Logical NOR (NC contact parallel connection)
  • Page 49 ■Converting the operation result into a pulse Instruction symbol Description Reference Conversion of operation result to rising edge pulse Page 113 Conversion of operation result to falling edge pulse Output instruction ■Out (excluding the timer, counter and annunciator) Instruction symbol Description Reference Device output...
  • Page 50 Shift instruction ■Shifting bit devices Instruction symbol Description Reference 1 bit shift of the device Page 139 SFTP ■Shifting 16-bit data to the right/left by n bit (s) Instruction symbol Description Reference Page 141 bn-1 (SM700, SM8022) SFRP 0∙∙∙0 Page 143 bn+1 bn (SM700, SM8022) SFLP...
  • Page 51 ■Shifting n-bit data to the right/left by n bit (s) Instruction symbol Description Reference SFTR Page 149 (n1) (n2) (n2) SFTRP SFTL Page 151 (n1) (n2) (n2) SFTLP ■Shifting n-word data to the right/left by n word (s) Instruction symbol Description Reference WSFR...
  • Page 52: Basic Instruction

    Basic Instruction Comparison operation instruction ■Comparing 16-bit binary data Instruction symbol Description Reference LD=, AND=, OR= (s1)=(s2): Conductive Page 165 (s1)(s2): Non-Conductive LD=_U, AND=_U, OR=_U LD<>, AND<>, OR<> (s1)(s2): Conductive (s1)=(s2): Non-Conductive LD<>_U, AND<>_U, OR<>_U LD>, AND>, OR> (s1)>(s2): Conductive (s1)(s2): Non-Conductive LD>_U, AND>_U, OR>_U LD<=, AND<=, OR<=...
  • Page 53 ■Comparing 16-bit binary data band Instruction symbol Description Reference (s1)>(s3): (d) is on Page 173 (s1)(s3)(s2): (d) + 1 is on ZCPP (s3)>(s2): (d) + 2 is on ZCP_U ZCPP_U ■Comparing 32-bit binary data band Instruction symbol Description Reference DZCP [(s1)+1, (s1)] >...
  • Page 54 Arithmetic operation instruction ■Adding/subtracting 16-bit binary data Instruction symbol Description Reference (d)+(s)  (d) Page 182 +P_U (s1)+(s2)  (d) Page 184 +P_U (s1)+(s2)  (d) Page 186 ADDP ADD_U ADDP_U (d)-(s)  (d) Page 188 -P_U (s1)-(s2)  (d) Page 190 -P_U (s1)-(s2) ...
  • Page 55 ■Adding/subtracting 32-bit binary data Instruction symbol Description Reference [(d)+1, (d)] + [(s)+1, (s)]  [(d)+1, (d)] Page 194 D+_U D+P_U [(s1)+1, (s1)] + [(s2)+1, (s2)]  [(d)+1, (d)] Page 195 D+_U D+P_U [(s1)+1, (s1)] + [(s2)+1, (s2)]  [(d)+1, (d)] DADD Page 197 DADDP...
  • Page 56 ■Multiplying/dividing 32-bit binary data Instruction symbol Description Reference [(s1)+1, (s1)]  [(s2)+1, (s2)]  [(d)+3, (d)+2, (d)+1, (d)] Page 213 D*_U D*P_U [(s1)+1, (s1)]  [(s2)+1, (s2)]  [(d)+3, (d)+2, (d)+1, (d)] DMUL Page 215 DMULP DMUL_U DMULP_U [(s1)+1, (s1)]  [(s2)+1, (s2)]  quotient [(d)+1, (d)], remainder [(d)+3, (d)+2] Page 217 D/_U D/P_U...
  • Page 57 ■Adding/subtracting 16-bit binary block data Instruction symbol Description Reference Adds the 16-bit binary bit data in the device area ((n) points) from (s1) and the data or constants in Page 236 the device area ((n) points) from (s2) at once, and stores the result in the device area ((n) points) BK+P from (d).
  • Page 58 Logical operation instruction ■Performing an AND operation on 16-bit/32-bit data Instruction symbol Description Reference (d)(s)  (d) WAND Page 249 WANDP (s1) (s2)  (d) WAND Page 250 WANDP [(d)+1, (d)] [(s)+1, (s)]  [(d)+1, (d)] DAND Page 251 DANDP [(s1)+1, (s1)]...
  • Page 59 ■Performing an XNOR operation on 16-bit/32-bit data Instruction symbol Description Reference WXNR Page 267 WXNRP WXNR Page 268 (s1) (s2) WXNRP DXNR Page 269 [(d)+1, (d)] [(s)+1, (s)] [(d)+1, (d)] DXNRP DXNR Page 270 [(s1)+1, (s1)] [(s2)+1, (s2)] [(d)+1, (d)] DXNRP ■Performing an XNOR operation on 16-bit block data Instruction symbol...
  • Page 60 ■Batch-resetting devices Instruction symbol Description Reference ZRST Page 280 (d2) (d1)+2 (d1)+1 (d1) ZRSTP (d2) (d1)+2 (d1)+1 (d1) (1): (d1), (d2) are bit devices: Writes off (reset) from (d1) to (d2) (d1), (d2) are word devices: Writes K0 from (d1) to (d2) Data conversion instruction ■Converting binary data to BCD 4-digit/8-digit data Instruction symbol...
  • Page 61 ■Converting 16-bit signed binary data to 16-bit/32-bit unsigned binary data Instruction symbol Description Reference INT2UINT Converts 16-bit signed data in the device specified by (s) to 16-bit unsigned data, and stores the Page 294 converted data in the device specified by (d). INT2UINTP INT2UDINT Converts 16-bit signed data in the device specified by (s) to 32-bit unsigned data, and stores the...
  • Page 62 ■Converting 16-bit/32-bit binary data to Gray code Instruction symbol Description Reference Converts the specified 16-bit binary data (-32768 to 32767) to 16-bit binary Gray code data. Page 306 GRYP Gc: Gray code GRY_U Converts the specified 16-bit binary data (0 to 65535) to 16-bit binary Gray code data. GRYP_U Gc: Gray code DGRY...
  • Page 63 ■Converting character string to 16-bit/32-bit binary data Instruction symbol Description Reference Converts a character string including decimal point in the device specified by (s) to a 1 word binary Page 318 value and number of decimal fraction digits, and stores the converted data in the devices specified VALP by (d1) and (d2).
  • Page 64 ■Separating/connecting the specified number of bits Instruction symbol Description Reference NDIS Separates the data in the devices starting from the one specified by (s1) into bits specified by the Page 337 devices from (s2), and stores them to the devices starting from the one specified by (d). NDISP NUNI Connects the data in the devices starting from the one specified by (s1) with bits specified by the...
  • Page 65 ■Transferring identical 16-bit block data (65535 points maximum) Instruction symbol Description Reference FMOV Page 356 FMOVP (n) = 1 to 65535 ■Transferring identical 32-bit block data (65535 points maximum) Instruction symbol Description Reference DFMOV Page 358 (d+1, d) (s+1, s) DFMOVP (n) = 1 to 65535 ■Exchanging 16-bit/32-bit data...
  • Page 66: Application Instruction

    Application Instruction Rotation instruction ■Rotating 16-bit data to the right Instruction symbol Description Reference Rotates the 16-bit binary data to the right by (n) bit(s) (not including the carry flag). Page 371 (SM700, SM8022) RORP (1): (n) bit right rotation Rotates the 16-bit binary data to the right by (n) bit(s) (including the carry flag).
  • Page 67 ■Rotating 32-bit data to the left Instruction symbol Description Reference DROL Rotates the 32-bit binary data to the left by (n) bit(s) (not including the carry flag). Page 379 (d+1) (SM700, SM8022) ∙∙∙ b16 b15 ∙∙∙ DROLP (1): (n) bit left rotation DRCL Rotates the 32-bit binary data to the left by (n) bit(s) (including the carry flag).
  • Page 68 Structuring instruction ■Performing the FOR to NEXT instruction loop Instruction symbol Description Reference Execute the instructions between FOR instruction and NEXT instruction (n) times Page 395 NEXT ■Forcibly terminating the FOR to NEXT instruction loop Instruction symbol Description Reference BREAK Forcibly end execution between FOR instruction and NEXT instruction, and jump to pointer (P) Page 397 BREAKP...
  • Page 69 ■Writing data to the data table Instruction symbol Description Reference SFWR Page 410 SFWRP P: Pointer ■Deleting/inserting data from/to the data table Instruction symbol Description Reference FINS Page 412 FINSP N: Number of stored data FDEL Page 414 FDELP N: Number of stored data Reading/writing data instructions ■Reading data from the data memory Instruction symbol...
  • Page 70 Character string operation instruction ■Comparing character strings Instruction symbol Description Reference LD$=, AND$=, OR$= Compares the character string (s1) with the character string (s2) one character at a time. Page 431 [Character string (s1)] = [Character string (s2)]: Conductive state [Character string (s1)] ...
  • Page 71 ■Converting 16-bit/32-bit binary data to character string Instruction symbol Description Reference Converts the 1 word binary value specified by (s2) to the decimal character string with total number Page 447 of digits and the number of digits in the decimal fraction part as specified in (s1), and stores this in STRP the device specified by (d).
  • Page 72 Real number instruction ■Comparing single-precision real numbers Instruction symbol Description Reference LDE=, ANDE=, ORE= [(s1)+1, (s1)] = [(s2)+1, (s2)]: Conductive Page 476 [(s1)+1, (s1)]  [(s2)+1, (s2)]: Non-Conductive [(s1)+1, (s1)]  [(s2)+1, (s2)]: Conductive LDE<>, ANDE<>, ORE<> [(s1)+1, (s1)] = [(s2)+1, (s2)]: Non-Conductive LDE>, ANDE>, ORE>...
  • Page 73 ■Converting 16-bit/32-bit unsigned binary data to single-precision real number Instruction symbol Description Reference UINT2FLT Converts the 16-bit unsigned binary data in the device specified by (s) to single-precision real Page 503 number, and stores the converted data in (d). UINT2FLTP UDINT2FLT Converts the 32-bit unsigned binary data in the device specified by (s) to single-precision real Page 505...
  • Page 74 ■Calculating the tangent of single-precision real number Instruction symbol Description Reference Tan [(s)+1, (s)]  [(d)+1, (d)] Page 519 TANP DTAN DTANP ■Calculating the arc sine of single-precision real number Instruction symbol Description Reference [(s)+1, (s)]  [(d)+1, (d)] ASIN Page 521 ASINP DASIN...
  • Page 75 ■Calculating the exponent of single-precision real number Instruction symbol Description Reference [(s)+1, (s)]  [(d)+1, (d)] Page 533 EXPP DEXP DEXPP ■Calculating the natural logarithm of single-precision real number Instruction symbol Description Reference Loge[(s)+1, (s)]  [(d)+1, (d)] Page 535 LOGP DLOGE DLOGEP...
  • Page 76 Index register operation instruction ■Saving/returning all data of the index register Instruction symbol Description Reference ZPUSH Saves the contents of index registers to the devices specified by (d) onwards. Page 546 ZPUSHP ZPOP Reads the data in devices specified by (d) onwards to the index registers. Page 548 ZPOPP ■Saving/returning the selected data of the index register and long index register...
  • Page 77 Instruction symbol Description Reference When [(s3)+1, (s3)] = 0: 0  [(d)+1, (d)] DZONE Page 562 When [(s3)+1, (s3)] > 0: [(s3)+1, (s3)] + [(s2)+1, (s2)]  [(d)+1, (d)] DZONEP When [(s3)+1, (s3)] < 0: [(s3)+1, (s3)] + [(s1)+1, (s1)]  [(d)+1, (d)] DZONE_U DZONEP_U ■Scaling 16-bit/32-bit binary data (point coordinates)
  • Page 78 Special counter instruction ■Signed 32-bit bi-directional counters Instruction symbol Description Reference UDCNTF This instruction increments the current value of the counter specified by (d) by 1 when the Page 580 operation result up to UDCNTF instruction changes from OFF to ON, and when the counter reaches the end of its count, NO contact becomes turns ON and NC contact becomes turns OFF.
  • Page 79 Drum sequence ■16-bit binary data absolute method Instruction symbol Description Reference ABSD Creates many output patterns corresponding to the current value of a counter. Page 637 ■32-bit binary data absolute method Instruction symbol Description Reference DABSD Creates many output patterns corresponding to the current value of a counter. Page 639 ■Relative method Instruction symbol...
  • Page 80 ■Bit judgment of 16-bit data/32-bit data Instruction symbol Description Reference Page 652 ······ BONP (1): b(n) ON  (d)=On b(n) OFF  (d)=Off DBON Page 654 ······ DBONP (1): b(n) ON  (d)=On b(n) OFF  (d)=Off ■Searching the maximum value of 16-bit/32-bit data Instruction symbol Description Reference...
  • Page 81 ■Adding 16-bit data Instruction symbol Description Reference WSUM These instructions add the (n) points of 16-bit binary data in the device starting from the one Page 673 specified by (s), and store the result in the device specified by (d). WSUM_U WSUMP WSUMP_U...
  • Page 82 Clock instruction ■Reading clock data Instruction symbol Description Reference (d)+0: Year Page 686 (d)+0 (d)+1: Month (d)+1 (d)+2: Day (d)+2 (d)+3 (d)+3: Hour TRDP (d)+4 (d)+4: Minute (d)+5 (d)+5: Seconds (d)+6 (d)+6: Day of week (1): Clock element ■Writing clock data Instruction symbol Description Reference...
  • Page 83 ■Comparing date data Instruction symbol Description Reference LDDT=, ANDDT=, ORDT= Page 702 (s1) (s2) year year (s1)+1 (s2)+1 month month (s1)+2 (s2)+2 (1): Result LDDT<>, ANDDT<>, (s1) (s2) year year ORDT<> (s1)+1 (s2)+1 month < > month (s1)+2 (s2)+2 (1): Result LDDT>, ANDDT>, ORDT>...
  • Page 84 ■Comparing clock data Instruction symbol Description Reference TCMP Page 708 (s1) (s4) hour hour TCMPP (s2) (s4)+1 minute > minute (d) = ON seconds seconds (s3) (s4)+2 (s1) (s4) hour hour (s2) (s4)+1 minute minute (d)+1 = ON seconds seconds (s3) (s4)+2 (s1)
  • Page 85: Step Ladder Instructions

    ■Reading 1-word/2-word data from another module (16-bit specification) Instruction symbol Description Reference FROM These instructions read the (n) word data from the buffer memory of the intelligent function module. Page 720 FROMP DFROM These instructions read the (n)2 word data from the buffer memory of the intelligent function module.
  • Page 86: Built-in Ethernet Function Instructions

    Built-in Ethernet Function Instructions Open/Close Processing Instructions ■Opening a connection Instruction symbol Description Reference SP.SOCOPEN This instruction opens the connection specified by (s1). Page 738 ■Closing a connection Instruction symbol Description Reference SP.SOCCLOSE This instruction closes the connection specified by (s1). (Closing a connection) Page 741 Socket communication function instruction ■Reading receive data during the END processing...
  • Page 87: Chapter 4 Module Specific Instruction

    MODULE SPECIFIC INSTRUCTION Network Common Instruction Link dedicated instruction ■Reading data from another station programmable controller Instruction symbol Description Reference GP.READ Reads data from another station PLC device in units of words. Page 768 ■Reading data from another station programmable controller (with notification) Instruction symbol Description Reference...
  • Page 88: High-speed Counter Instruction

    High-speed Counter Instruction High-speed processing instruction ■Setting 32-bit data comparison Instruction symbol Description Reference DHSCS Turns ON the bit device of (d) when the current value of the high-speed counter of CH specified by Page 804 (s2) is changed to the value specified by (s1). ■Reset 32-bit data comparison Instruction symbol Description...
  • Page 89: External Device Communication Instruction

    External Device Communication Instruction Serial communication 2 Instruction symbol Description Reference Sends/receives data by non-protocol communication. Page 820 Inverter Communication Instruction ■Inverter operation monitoring (Status check) Instruction symbol Description Reference IVCK Reads the contents of the corresponding instruction code from the specified inverter station Page 822 number.
  • Page 90: Positioning Instruction

    Positioning Instruction Positioning instruction ■Zero return(OPR) with 16-bit/32- bit data DOG search Instruction symbol Description Reference DSZR • When FX3 compatible operand is specified Page 841 Specifies the proximity dog signal, zero signal and device (Y). Outputs a pulse with the specified DDSZR Page 845 device (Y) to perform the zero return operation.
  • Page 91: Bfm Device Read/ Write Instruction

    ■16-bit/32-bit data absolute positioning Instruction symbol Description Reference DRVA • When FX3 compatible operand is specified Page 873 Specifies the travel distance from the reference position, speed and performs pulse output with the DDRVA Page 876 specified device (Y). • When FX5 operand is specified Specifies the travel distance from the reference position, speed and performs pulse output with the specified axis number.
  • Page 92: Chapter 5 Standard Functions/function Blocks

    STANDARD FUNCTIONS/FUNCTION BLOCKS Standard Functions Type conversion functions Converting BOOL to WORD/DWORD Function symbol Description Reference BOOL_TO_WORD Converts BOOL type data to WORD type data. Page 900 BOOL_TO_WORD_E BOOL_TO_DWORD Converts BOOL type data to DWORD type data. Page 901 BOOL_TO_DWORD_E Converting BOOL to INT/DINT Function symbol Description...
  • Page 93 Converting WORD to INT/DINT Function symbol Description Reference WORD_TO_INT Converts WORD type data to INT type data. Page 908 WORD_TO_INT_E WORD_TO_DINT Converts WORD type data to DINT type data. Page 909 WORD_TO_DINT_E Converting WORD to TIME Function symbol Description Reference WORD_TO_TIME Converts WORD type data to TIME type data.
  • Page 94 Converting INT to DINT Function symbol Description Reference INT_TO_DINT Converts INT type data to DINT type data. Page 921 INT_TO_DINT_E Converting INT to BCD Function symbol Description Reference INT_TO_BCD Converts INT type data to BCD type data. Page 922 INT_TO_BCD_E Converting INT to REAL Function symbol Description...
  • Page 95 Converting DINT to BCD Function symbol Description Reference DINT_TO_BCD Converts DINT type data to BCD type data. Page 933 DINT_TO_BCD_E Converting DINT to REAL Function symbol Description Reference DINT_TO_REAL Converts DINT type data to REAL type data. Page 935 DINT_TO_REAL_E Converting DINT to TIME Function symbol Description...
  • Page 96 Converting TIME to WORD/DWORD Function symbol Description Reference TIME_TO_WORD Converts TIME type data to WORD type data. Page 951 TIME_TO_WORD_E TIME_TO_DWORD Converts TIME type data to DWORD type data. Page 952 TIME_TO_DWORD_E Converting TIME to INT/DINT Function symbol Description Reference TIME_TO_INT Converts TIME type data to INT type data.
  • Page 97 Converting INT/DINT to bit array Function symbol Description Reference INT_TO_BITARR Outputs low-order (n) bits of INT type data to a bit array. Page 967 INT_TO_BITARR_E DINT_TO_BITARR Outputs low-order (n) bits of DINT type data to a bit array. Page 968 DINT_TO_BITARR_E Bit array copy Function symbol...
  • Page 98: Standard Functions Of One Numeric Variable

    Standard functions of one numeric variable Absolute value Function symbol Description Reference Outputs the absolute value of an input value. Page 974 ABS_E Square root Function symbol Description Reference SQRT Outputs the square root of an input value. Page 976 SQRT_E Natural logarithm operation Function symbol...
  • Page 99: Standard Arithmetic Functions

    Arc cosine operation Function symbol Description Reference ACOS Outputs the arc cosine value of an input value. Page 985 ACOS_E Arc tangent operation Function symbol Description Reference ATAN Outputs the arc tangent value of an input value. Page 986 ATAN_E Standard arithmetic functions Addition Function symbol...
  • Page 100: Standard Bit Shift Functions

    Standard bit shift functions Shifting n-bit data to left/right Function symbol Description Reference Shifts an input value leftward by (n) bits and outputs the result. Page 1001 SHL_E Shifts an input value rightward by (n) bits and outputs the result. Page 1003 SHR_E Rotating n-bit data to left/right...
  • Page 101: Standard Comparison Functions

    Multiplexer Function symbol Description Reference Outputs one of multiple input values. Page 1018 MUX_E Standard comparison functions Compare Function symbol Description Reference Outputs the data comparison result of input values. Page 1020 GT_E GE_E EQ_E LE_E LT_E Page 1022 NE_E Standard character string functions Character string length detection Function symbol...
  • Page 102: Time Data Functions

    Inserting character string Function symbol Description Reference INSERT Inserts a character string into another character string and output the result. Page 1031 INSERT_E Deleting character string Function symbol Description Reference DELETE Deletes an arbitrary range of a character string and outputs the result. Page 1033 DELETE_E Replacing character string...
  • Page 103: Standard Function Blocks

    Standard Function Blocks Bistable function blocks Bistable function blocks (set priority) Function block symbol Description Reference Judges two input values and outputs 1 (TRUE) or 0 (FALSE). (Set priority) Page 1050 SR_E Bistable function blocks (reset priority) Function block symbol Description Reference Judges two input values and outputs 1 (TRUE) or 0 (FALSE).
  • Page 104: Timer Function Blocks

    Timer function blocks Pulse timer Function block symbol Description Reference Keeps ON a signal for specified duration. Page 1067 TP_E TP_10 TP_10_E On-delay timer Function block symbol Description Reference Turns ON a signal after a specified time. Page 1069 TON_E TON_10 TON_10_E Off-delay timer...
  • Page 105 PART 3 CPU MODULE INSTRUCTIONS This part consists of the following chapters. 6 SEQUENCE INSTRUCTIONS 7 BASIC INSTRUCTIONS 8 APPLICATION INSTRUCTION 9 STEP LADDER INSTRUCTIONS 10 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS 11 PID CONTROL INSTRUCTION...
  • Page 106: Chapter 6 Sequence Instructions

    SEQUENCE INSTRUCTIONS Contact Instructions Operation start, series connection, parallel connection LD, LDI, AND, ANI, OR, ORI • LD: NO contact operation start instruction/LDI: NC contact operation start instruction These instructions capture the ON/OFF information of the device specified by (s), and use that as the operation result. •...
  • Page 107 Processing details ■LD, LDI • The LD instruction is the NO contact operation start instruction, and the LDI instruction is the NC contact operation start instruction. These instructions capture the ON/OFF information of the specified device, and use the result as the operation result.
  • Page 108: Pulse Operation Start, Pulse Series Connection, Pulse Parallel Connection

    Pulse operation start, pulse series connection, pulse parallel connection LDP, LDF, ANDP, ANDF, ORP, ORF • LDP: Rising edge pulse operation start instruction This becomes conductive (ON) only at the rising edge (OFF to ON) of the bit device specified by (s). •...
  • Page 109 Processing details ■LDP, LDF • The LDP instruction is the rising edge pulse operation start instruction, and becomes conductive (ON) only at the rising edge (OFF to ON) of the specified bit device. When word devices are specified by bits, this instruction becomes conductive (ON) only when the status of the specified bit changes to 01.
  • Page 110: Pulse Not Operation Start, Pulse Not Series Connection, Pulse Not Parallel Connection

    Pulse NOT operation start, pulse NOT series connection, pulse NOT parallel connection LDPI, LDFI, ANDPI, ANDFI, ORPI, ORFI • LDPI: Rising edge pulse NOT operation start instruction This instruction becomes conductive (ON) at OFF, ON and the falling edge (ON to OFF) of the bit device specified by (s). •...
  • Page 111 Processing details ■LDPI, LDFI • The LDPI instruction is the rising edge pulse NOT operation start instruction, and becomes conductive (ON) at OFF, ON and the falling edge (ON to OFF) of the specified bit device. When word devices are specified by bits, this instruction becomes conductive when the status of the specified bit is 0, 1, and when it changes 10.
  • Page 112: Association Instruction

    Association Instruction Ladder block series/parallel connection ANB, ORB These instructions AND or OR the A and B blocks, and use the result as the operation result. Ladder diagram Structured text Not supported. A: A block B: B block FBD/LD Not supported. Processing details ■ANB •...
  • Page 113: Storing/reading/clearing The Operation Result

    Storing/reading/clearing the operation result MPS, MRD, MPP • MPS: This instruction stores the preceding operation result (ON/OFF) to memory. • MRD, MPP: These instructions read the operation result stored by the MPS instruction, and executes operations from the next step using that operation result. Ladder diagram Structured text ENO:=MPS(EN);...
  • Page 114: Inverting The Operation Result

    Inverting the operation result This instruction inverts the operation result up to this instruction. Ladder diagram Structured text ENO:=INV(EN); FBD/LD Processing details • This instruction inverts the operation result up to this instruction. Operation result up to the INV Operation result after execution of instruction INV instruction Operation error...
  • Page 115: Converting The Operation Result Into A Pulse

    Converting the operation result into a pulse MEP, MEF • MEP: This instruction turns ON at the rising edge of the operation result up to the MEP instruction and turns OFF in other instances. • MEF: This instruction turns ON at the falling edge of the operation result up to the MEF instruction and turns OFF in other instances.
  • Page 116: Output Instructions

    Output Instructions Out (excluding the timer, counter and annunciator) This instruction outputs the operation result up to this instruction to the specified device. Ladder diagram Structured text ENO:=OUT(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) Number of the device that turns ON/OFF ...
  • Page 117: Timer

    Timer OUT T, OUTH T, OUTHS T, OUT ST, OUTH ST, OUTHS ST The timer counts up to the set value when the operation result up to the OUT instruction is ON and the coil of the timer/ retentive timer specified by (d) turns ON. When the timer times up, NO contact becomes conductive and NC contact becomes non conductive.
  • Page 118 • OUTHS instruction: 0.001 to 32.767 seconds For the counting method, refer to the following. MELSEC iQ-F FX5 User's Manual (Application) Precautions When creating a program for measuring another timer at a timer contact, program in order starting with the timer to be measured later on.
  • Page 119: Counter

    Counter OUT C This instruction increments the current value of the counter specified by (d) by 1 when the operation result up to OUT instruction changes from OFF to ON, and when the counter reaches the end of its count, NO contact becomes conductive and NC contact becomes non-conductive.
  • Page 120: Long Counter

    Long counter OUT LC This instruction increments the current value of the long counter specified by (d) by 1 when the operation result up to the OUT instruction changes from OFF to ON, and when the counter reaches the end of its count, NO contact becomes conductive and NC contact becomes non-conductive.
  • Page 121 Operation error Error code Remarks (SD0/SD8067) 2821H When the high speed counter is assigned to the specification long counter. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
  • Page 122: Annunciator

    Annunciator OUT F This instruction outputs the operation result up to the OUT F instruction to the specified annunciator. Ladder diagram Structured text ENO:=OUT(EN,d); FBD/LD ("OUT" enters .) Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) ...
  • Page 123: Setting Devices (excluding Annunciator)

    Setting devices (excluding annunciator) The status of the device specified by (d) changes as follows when the execution command turns ON. • Bit device: Turns the coils and contacts ON. • Bit specification of word device: Set the specified bit to 1. Ladder diagram Structured text ENO:=SET(EN,d);...
  • Page 124 Precautions When the SET and RST instructions are executed on the same output relay (Y), the result of the instruction nearer the END instruction (end of program) is output. Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
  • Page 125: Resetting Devices (excluding Annunciator)

    Resetting devices (excluding annunciator) The status of the device specified by (d) changes as follows when the RST input turns ON. • Bit devices: Turns the coils and contacts OFF. • Timers, counters: Sets the current value to 0, and turns coils and contacts OFF. •...
  • Page 126 Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
  • Page 127: Setting Annunciator

    Setting annunciator SET F This instruction turns ON the specified annunciator. Ladder diagram Structured text ENO:=SET(EN,d); FBD/LD ("SET" enters .) Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)  Annunciator number (F number) that is set ANY_BOOL ...
  • Page 128 ■Related devices Device Name Remarks SD62 Annunciator (F) Detection No. This register stores the earliest detected annunciator (F) No.. SD63 Annunciator (F) Detection Number This register stores the number of annunciator (F) detections. SD64 to SD79 Annunciator (F) Detection No. table This register stores the annunciator (F) detection No.
  • Page 129: Resetting Annunciator

    Resetting annunciator RST F This instruction turns OFF the specified annunciator. Ladder diagram Structured text ENO:=RST(EN,d); FBD/LD ("RST" enters .) Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)  Annunciator number (F number) that is reset ANY_ELEMENTARY ...
  • Page 130 Processing details • This instruction turns OFF the annunciator specified by (d) when the execution command turns ON. • An annunciator number (F number) that turns OFF is deleted from special registers (SD64 to SD79) and the content of SD63 is decremented by 1. •...
  • Page 131: Setting Annunciator (with Check Time)

    Setting annunciator (with check time) This instruction sets the annunciator (F device). Ladder diagram Structured text ENO:=ANS(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)  Timer number for evaluation time 16-bit signed binary ANY16 Evaluation time data 1 to 32767...
  • Page 132 Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
  • Page 133: Resetting Annunciator (smallest Number Reset)

    Resetting annunciator (smallest number reset) ANR(P) This instruction resets the lowest number annunciator (F device) in the ON status. Ladder diagram Structured text ENO:=ANR(EN); ENO:=ANRP(EN); FBD/LD Processing details • Annunciator (F device) that is operating (in ON status) is reset when the command input turns ON. This instruction resets the annunciator with the smallest number when multiple annunciators are ON.
  • Page 134: Rising Edge Output

    Rising edge output This instruction turns ON the device specified by (d) for one scan when the PLS command turns from OFF to ON, and turns OFF in other cases. Ladder diagram Structured text ENO:=PLS(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 135 • If the RUN/STOP/RESET switch is changed from RUN to STOP after execution of the PLS instruction, the PLS instruction will not be executed even if the switch is set to RUN again. LD X0 LD X0 LD X0 PLS M0 PLS M0 PLS M0 X0 OFF...
  • Page 136: Falling Edge Output

    Falling edge output This instruction turns ON the device specified by (d) for one scan when the PLF command turns from ON to OFF, and turns OFF in other cases. Ladder diagram Structured text ENO:=PLF(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 137 Precautions • When write during RUN is completed for a circuit including a falling edge instruction (LDF/ANDF/ORF instruction), the instruction is not executed regardless of the ON/OFF status of the target device of the falling edge instruction. Also, in the case of a falling edge instruction (PLF instruction), the instruction is not executed regardless of the ON/OFF status of the device that is set as the operation condition.
  • Page 138: Inverting The Bit Device Output

    Inverting the bit device output This instruction reverses the output status of the device specified by (d) when the execution command changes from OFF to Ladder diagram Structured text ENO:=FF(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)
  • Page 139 Inverting the bit device output ALT(P) These instructions reverse (ON  OFF) bit devices when input turns ON. Ladder diagram Structured text ENO:=ALT(EN,d); ENO:=ALTP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) ...
  • Page 140 Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
  • Page 141: Shift Instructions

    Shift Instructions Shifting bit devices SFT(P) • In case of bit device: These instructions shift the ON/OFF status of the device before the device specified by (d) to the device specified by (d). • When bit of word device is specified: These instructions shift the 1/0 status of the bit before the bit specified by (d) to the bit specified by (d).
  • Page 142 • When the SFT(P) instruction is used consecutively, create the program to start from the device with the largest number. M15 M14 SFTP SFTP SFTP SFTP (1): X2 ON (2): After the 1st shift input (3): After the 2nd shift input (4): X2 ON (5): After the 3rd shift input (6): After the 4th shift input...
  • Page 143: Shifting 16-bit Data To The Right By N Bit(s)

    Shifting 16-bit data to the right by n bit(s) SFR(P) These instructions shift the 16-bit data in the device specified by (d) to the right by (n) bit(s). Ladder diagram Structured text ENO:=SFR(EN,n,d); ENO:=SFRP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 144 • Specify any value between 0 and 15 for (n). If a value 16 or larger is specified for (n), bits are shifted to the right by the remainder value of (n)16. For example, when (n) is 18, data is shifted by 2 bits to the right because 18 divided by 16 equals 1 with a remainder of 2.
  • Page 145: Shifting 16-bit Data To The Left By N Bit(s)

    Shifting 16-bit data to the left by n bit(s) SFL(P) These instructions shift the 16-bit data in the device specified by (d) to the left by (n) bit(s). Ladder diagram Structured text ENO:=SFL(EN,n,d); ENO:=SFLP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 146 • Specify any value between 0 and 15 for (n). If a value 16 or larger is specified for (n), bit(s) are shifted to the left by the remainder value of (n)16. For example, when (n) is 18, data is shifted by 2 bits to the left because 18 divided by 16 equals 1 with a remainder of 2.
  • Page 147: Shifting N-bit Data To The Right By 1 Bit

    Shifting n-bit data to the right by 1 bit BSFR(P) These instructions shift (n) point(s) of data to the right by 1 bit from the device specified by (d). Ladder diagram Structured text ENO:=BSFR(EN,n,d); ENO:=BSFRP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 148: Shifting N-bit Data To The Left By 1 Bit

    Shifting n-bit data to the left by 1 bit BSFL(P) These instructions shift (n) point(s) of data to the left by 1 bit from the device specified by (d). Ladder diagram Structured text ENO:=BSFL(EN,n,d); ENO:=BSFLP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 149: Shifting N-word Data To The Right By 1 Word

    Shifting n-word data to the right by 1 word DSFR(P) These instructions shift (n) point(s) of data to the right by 1 word from the device specified by (d). Ladder diagram Structured text ENO:=DSFR(EN,n,d); ENO:=DSFRP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 150: Shifting N-word Data To The Left By 1 Word

    Shifting n-word data to the left by 1 word DSFL(P) These instructions shift (n) point(s) of data to the left by 1 word from the device specified by (d). Ladder diagram Structured text ENO:=DSFL(EN,n,d); ENO:=DSFLP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 151: Shifting N-bit(s) Data To The Right By (n) Bit(s)

    Shifting n-bit(s) data to the right by (n) bit(s) SFTR(P) These instructions shift (n1) bits of data to the right by (n2) bit(s) from the device specified by (d). Ladder diagram Structured text ENO:=SFTR(EN,s,n1,n2,d); ENO:=SFTRP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
  • Page 152 Processing details • These instructions shift (n1) bits of data to the right by (n2) bit(s) from the device specified by (d). After the shift, (n2) points from (s) are set into (n2) points from (d)+(n1-n2). • When K0 is specified for (s), set 0s for (n2) points of bits from (d)+(n1-n2) after the shift. •...
  • Page 153: Shifting N-bit Data To The Left By N Bit(s)

    Shifting n-bit data to the left by n bit(s) SFTL(P) These instructions shift (n1) bits of data to the left by (n2) bit(s) from the device specified by (d). Ladder diagram Structured text ENO:=SFTL(EN,s,n1,n2,d); ENO:=SFTLP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
  • Page 154 Processing details • These instructions shift (n1) bits of data to the left by (n2) bit(s) from the device specified by (d). After the shift, (n2) points from (s) are set into (n2) points from (d). • When K0 is specified for (s), set 0s for (n2) points of bits from (d) after the shift. •...
  • Page 155: Shifting N-word Data To The Right By N Word(s)

    Shifting n-word data to the right by n word(s) WSFR(P) This instruction shifts (n1) words of data to the right by (n2) word(s) from the device specified by (d). Ladder diagram Structured text ENO:=WSFR(EN,s,n1,n2,d); ENO:=WSFRP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
  • Page 156 Operation error Error code Remarks (SD0/SD8067) 2820H The (n2) points of data starting from the device specified by (s) exceed in the corresponding device. The (n1) points of data starting from the device specified by (d) exceed in the corresponding device. 2821H The transfer source data (s) overlaps with shift device (d).
  • Page 157: Shifting N-word Data To The Left By N Word(s)

    Shifting n-word data to the left by n word(s) WSFL(P) This instruction shifts (n1) words of data to the left by (n2) word(s) from the device specified by (d). Ladder diagram Structured text ENO:=WSFL(EN,s,n1,n2,d); ENO:=WSFLP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
  • Page 158 Operation error Error code Remarks (SD0/SD8067) 2820H The (n2) points of data starting from the device specified by (s) exceed in the corresponding device. The (n1) points of data starting from the device specified by (d) exceed in the corresponding device. 2821H The transfer source data (s) overlaps with shift device (d).
  • Page 159: Master Control Instruction

    Master Control Instruction Setting/resetting the master control MC, MCR • MC: This instruction starts master control. • MCR: This instruction ends master control. Ladder diagram Structured text ENO:=MC(EN,n,d); ENO:=MCR(EN,n); (1): Master control ladder FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
  • Page 160 Processing details These instructions create program with efficient ladder switching by opening/closing common buses in ladders. Ladder using master control is illustrated below. (Left: Display on the engineering tool, Right: Actual operation) (1) Executed only when X0 is on ■MC •...
  • Page 161 Master control instructions can be used in a nested fashion. Each master control section is distinguished by nesting (N). Nesting is available within the range N0 to N14. A nested structure allows you to create a ladder for successively restricting program execution conditions. A nested structure ladder is illustrated as follows: (Left: Display on the engineering tool, Right: Actual operation) N0 M15...
  • Page 162 Precautions • If an instruction (e.g. LD, LDI) to be connected to the bus is not programmed following the MC instruction, a program structure error (error code: 33E0) occurs. • These instructions cannot be used in FOR to NEXT, STL to RETSTL, P to RET (SRET), and I to IRET. Also, do not block by I, IRET, FEND, END, RET (SRET), RETSTL, etc.
  • Page 163: Termination Instructions

    Termination Instructions Ending the main routine program FEND This instruction is used to branch operation of the sequence program by the CJ instruction or to divide the main routine program into a subroutine program or an interrupt program. Ladder diagram Structured text Not supported.
  • Page 164: Ending The Sequence Program

    Ending the sequence program This instruction indicates the end of a program. Ladder diagram Structured text Not supported. FBD/LD Not supported. Processing details • This instruction indicates the end of all programs including the main routine program, subroutine program, and interrupt program.
  • Page 165 Operation error Error code Remarks (SD0/SD8067) 3340H The END instruction is executed before the NEXT instruction after the FOR instruction is executed. 3381H The END instruction is executed before the RET instruction after the CALL(P) instruction is executed. 33E3H The END instruction is programmed between FOR-NEXT. 33E4H The END instruction is programmed between MC-MCR.
  • Page 166: Stop Instruction

    Stop Instruction Stopping the sequence program STOP This instruction resets outputs (Y) and stops operation of the CPU module when the execution command turns ON. (This operation is the same as setting the switch to STOP.) Ladder diagram Structured text ENO:=STOP(EN);...
  • Page 167: Chapter 7 Basic Instructions

    BASIC INSTRUCTIONS Comparison Operation Instructions Comparing 16-bit binary data LD(_U), AND(_U), OR(_U) These instructions perform a comparison operation between the 16-bit binary data in the device specified by (s1) and the 16- bit binary data in the device specified by (s2). (Devices are used as NO contacts.) Ladder diagram Structured text ENO:=LD_(EN,s1,s2);...
  • Page 168 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, SM, T, ST, C, D, W, U\G K, H F, B, SB, S SD, SW, R (s1)          ...
  • Page 169: Comparing 32-bit Binary Data

    Comparing 32-bit binary data LDD(_U), ANDD(_U), ORD(_U) These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the 32- bit binary data in the device specified by (s2). (Devices are used as NO contacts.) Ladder diagram Structured text ENO:=LDD_(EN,s1,s2);...
  • Page 170 Processing details • These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2). (Devices are used as NO contacts) • The following table lists the comparison operation results of each instruction. Instruction symbol Condition Result...
  • Page 171: Comparison Output 16-bit Binary Data

    Comparison output 16-bit binary data CMP(P)(_U) These instructions perform a comparison operation between the 16-bit binary data in the devices specified by (s1) and (s2). Ladder diagram Structured text ENO:=CMP(EN,s1,s2,d); ENO:=CMP_U(EN,s1,s2,d); ENO:=CMPP(EN,s1,s2,d); ENO:=CMPP_U(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 172 Processing details • These instructions perform a comparison operation between the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2) and according to the result (small, equal, large), (d), (d) + 1, or (d) + 2 is turned ON.
  • Page 173: Comparison Output 32-bit Binary Data

    Comparison output 32-bit binary data DCMP(P)(_U) These instructions perform a comparison operation between the 32-bit binary data in the devices specified by (s1) and (s2). Ladder diagram Structured text ENO:=DCMP(EN,s1,s2,d); ENO:=DCMP_U(EN,s1,s2,d); ENO:=DCMPP(EN,s1,s2,d); ENO:=DCMPP_U(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 174 Processing details • These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2) and according to the result (small, equal, large), (d), (d) + 1, or (d) + 2 is turned ON.
  • Page 175: Comparing 16-bit Binary Data Band

    Comparing 16-bit binary data band ZCP(P)(_U) These instructions perform a comparison operation on the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2) with the 16-bit binary data in the device specified by comparison source (s3), and output the comparison result (below, within zone, above) to the device specified by (d) onwards.
  • Page 176 Processing details • These instructions perform a comparison operation on the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2) with the 16-bit binary data in the device specified by comparison source (s3), and according to the comparison result (below, within zone, above), (d), (d) + 1, or (d) + 2 is turned ON.
  • Page 177: Comparing 32-bit Binary Data Band

    Comparing 32-bit binary data band DZCP(P)(_U) These instructions perform a comparison operation on the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2) with the 32-bit binary data in the device specified by comparison source (s3), and output the comparison result (below, within zone, above) to the device specified by (d) onwards.
  • Page 178 Processing details • These instructions perform a comparison operation on the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2) with the 32-bit binary data in the device specified by comparison source (s3), and according to the comparison result (below, within zone, above), (d), (d) + 1, or (d) + 2 is turned ON.
  • Page 179: Comparing 16-bit Binary Block Data

    Comparing 16-bit binary block data BKCMP(P)(_U) These instructions perform a comparison operation between (n) point(s) of 16-bit binary data in the device starting from the one specified by (s1) and (n) point(s) of 16-bit binary data in the device starting from the one specified by (s2), and store the operation result in the device specified by (d).
  • Page 180 Processing details • These instructions perform a comparison operation between (n) point(s) of 16-bit binary data in the device starting from the one specified by (s1) and (n) point(s) of 16-bit binary data in the device starting from the one specified by (s2), and store the comparison result in (n) point(s) of data starting from the device specified by (d).
  • Page 181: Comparing 32-bit Binary Block Data

    Comparing 32-bit binary block data DBKCMP(P)(_U) These instructions perform a comparison operation between the (n) point(s) of 32-bit binary data starting from the device specified by (s1) and the (n) point(s) of 32-bit binary data starting from the device specified by (s2), and store the operation result in the device specified by (d).
  • Page 182 Processing details • These instructions perform a comparison operation between (n) point(s) of 32-bit binary data starting from the device specified by (s1) and (n) point(s) of 32-bit binary data starting from the device specified by (s2), and store the comparison result in (n) point(s) of data starting from the device specified by (d).
  • Page 183 Operation error Error code Description (SD0/SD8067) The (n)  2 points of data starting from the device specified by (s1) and (s2) or the (n) point(s) of data starting from the device specified by 2820H (d) exceeds said device. When (d) specifies "D.b", the (n) point(s) of data starting from the device specified by (d) and the device range of the (n)  2 points of 2821H data starting from the device specified by (s1) overlap.
  • Page 184: Arithmetic Operation Instructions

    Arithmetic Operation Instructions Adding 16-bit binary data +(P)(_U) instruction and ADD(P)(_U) instruction can be used for addition of 16-bit binary data. +(P)(_U) [using two operands] These instructions add the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the result in the device specified by (d).
  • Page 185 Processing details • These instructions add the 16-bit binary data in the device specified by (s) to the 16-bit binary data in the device specified by (d), and store the addition result in the device specified by (d). ··· ··· ···...
  • Page 186 +(P)(_U) [using three operands] These instructions add the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=PLUS(EN,s1,s2,d);...
  • Page 187 Processing details • These instructions add the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the addition result in the device specified by (d). (s1) (s2) ···...
  • Page 188 ADD(P)(_U) These instructions add the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=ADDP(EN,s1,s2,d); ENO:=ADD_U(EN,s1,s2,d);...
  • Page 189 ■Relationship between the flag operation and the sign (positive or negative) of a numeric value Device Name Description SM700, SM8022 Carry When the operation result exceeds the upper limit of the data setting range, the carry flag is turned ON. SM8020 Zero When the operation result is 0, the zero flag is turned ON.
  • Page 190: Subtracting 16-bit Binary Data

    Subtracting 16-bit binary data -(P)(_U) instruction and SUB(P)(_U) instruction can be used for subtraction of 16-bit binary data. -(P)(_U) [using two operands] These instructions subtract the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the result in the device specified by (d).
  • Page 191 Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
  • Page 192 -(P)(_U) [using three operands] These instructions subtract the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=MINUS(EN,s1,s2,d);...
  • Page 193 Processing details • These instructions subtract the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the subtraction result in the device specified by (d). (s1) (s2) ···...
  • Page 194 SUB(P)(_U) These instructions subtract the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=SUBP(EN,s1,s2,d); ENO:=SUB_U(EN,s1,s2,d);...
  • Page 195 ■Relationship between the flag operation and the sign (positive or negative) of a numeric value Device Name Description SM700, SM8022 Carry When the operation result exceeds the upper limit of the data setting range, the carry flag is turned ON. SM8020 Zero When the operation result is 0, the zero flag is turned ON.
  • Page 196: Adding 32-bit Binary Data

    Adding 32-bit binary data D+(P)(_U) instruction and DADD(P)(_U) instruction can be used for addition of 32-bit binary data. D+(P)(_U) [using two operands] These instructions add the 32-bit binary data in the device specified by (d) and the 32-bit binary data in the device specified by (s), and store the result in the device specified by (d).
  • Page 197 D+(P)(_U) [using three operands] These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DPLUS(EN,s1,s2,d);...
  • Page 198 Processing details • These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the addition result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 199 DADD(P)(_U) These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DADD(EN,s1,s2,d); ENO:=DADD_U(EN,s1,s2,d);...
  • Page 200 Processing details • These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the addition result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 201: Subtracting 32-bit Binary Data

    Subtracting 32-bit binary data D-(P)(_U) instruction and DSUB(P)(_U) instruction can be used for subtraction of 32-bit binary data. D-(P)(_U) [using two operands] These instructions subtract the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the result in the device specified by (d).
  • Page 202 Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
  • Page 203 D-(P)(_U) [using three operands] These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DMINUS(EN,s1,s2,d);...
  • Page 204 Processing details • These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the subtraction result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 205 DSUB(P)(_U) These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DSUB(EN,s1,s2,d); ENO:=DSUB_U(EN,s1,s2,d);...
  • Page 206 Processing details • These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the subtraction result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 207: Multiplying 16-bit Binary Data

    Multiplying 16-bit binary data *(P)(_U) instruction and MUL(P)(_U) instruction can be used for multiplication of 16-bit binary data. *(P)(_U) These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
  • Page 208 Operation error Error code Description (SD0/SD8067) 2820H The range of the device specified by (d) exceeds said device range. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
  • Page 209 MUL(P)(_U) These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=MULP(EN,s1,s2,d); ENO:=MUL_U(EN,s1,s2,d);...
  • Page 210 Processing details • These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1) (s2) (d)+1 b16 b15 ···...
  • Page 211: Dividing 16-bit Binary Data

    Dividing 16-bit binary data /(P)(_U) instruction and DIV(P)(_U) instruction can be used for division of 16-bit binary data. /(P)(_U) These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
  • Page 212 Processing details • These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the division result in the device specified by (d). (s1) (s2) (d)+1 b0 b15 ···...
  • Page 213 DIV(P)(_U) These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DIVP(EN,s1,s2,d); ENO:=DIV_U(EN,s1,s2,d);...
  • Page 214 ■Related flag Device Name Description SM700 Carry When the operation result of the signed operation exceeds 32767, the carry flag is turned ON. SM8304 Zero When the operation result is 0, the zero flag is turned ON. SM8306 Carry When the operation result of the signed operation exceeds 32767, the carry flag is turned ON. Precautions ■Operation result •...
  • Page 215: Multiplying 32-bit Binary Data

    Multiplying 32-bit binary data D*(P)(_U) instruction and DMUL(P)(_U) instruction can be used for multiplication of 32-bit binary data. D*(P)(_U) These instructions multiply the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
  • Page 216 Processing details • These instructions multiply the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1) (s2) (d)+2 (s1)+1 (s2)+1...
  • Page 217 DMUL(P)(_U) These instructions multiply the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DMUL(EN,s1,s2,d); ENO:=DMUL_U(EN,s1,s2,d);...
  • Page 218 Processing details • These instructions multiply the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1) (s2) (d)+2 (s1)+1 (s2)+1...
  • Page 219: Dividing 32-bit Binary Data

    Dividing 32-bit binary data D/(P)(_U) instruction and DDIV(P)(_U) instruction can be used for division of 32-bit binary data. D/(P)(_U) These instructions divide the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
  • Page 220 Operation error Error code Description (SD0/SD8067) 2820H The range of the device specified by (d) exceeds the range of said device. 3400H 0 is specified for (s2) value. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
  • Page 221 DDIV(P)(_U) These instructions divide the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DDIV(EN,s1,s2,d); ENO:=DDIV_U(EN,s1,s2,d);...
  • Page 222 Precautions ■Operation result • The most significant bit of the quotient and remainder indicates the sign (positive: 0, negative: 1), respectively. • The quotient is negative when either (s1) or (s2) is negative. The remainder is negative when the (s1) is negative. ■Device specified by (d) •...
  • Page 223: Adding Bcd 4-digit Data

    Adding BCD 4-digit data B+(P) [using two operands] These instructions add the BCD 4-digit data in the device specified by (d) and the BCD 4-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 224 B+(P) [using three operands] These instructions add the BCD 4-digit data in the device specified by (s1) and the BCD 4-digit data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=BPLUS(EN,s1,s2,d);...
  • Page 225: Subtracting Bcd 4-digit Data

    Subtracting BCD 4-digit data B-(P) [using two operands] These instructions subtract the BCD 4-digit data in the device specified by (d) and the BCD 4-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 226 B-(P) [using three operands] These instructions subtract the BCD 4-digit data in the device specified by (s1) and the BCD 4-digit data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=BMINUS(EN,s1,s2,d);...
  • Page 227: Adding Bcd 8-digit Data

    Adding BCD 8-digit data DB+(P) [using two operands] These instructions add the BCD 8-digit data in the device specified by (d) and the BCD 8-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 228 DB+(P) [using three operands] These instructions add the BCD 8-digit data in the device specified by (s1) and the BCD 8-digit data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DBPLUS(EN,s1,s2,d);...
  • Page 229: Subtracting Bcd 8-digit Data

    Subtracting BCD 8-digit data DB-(P) [using two operands] These instructions subtract the BCD 8-digit data in the device specified by (d) and the BCD 8-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 230 DB-(P) [using three operands] These instructions subtract the BCD 8-digit data specified by (s1) and the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=DBMINUS(EN,s1,s2,d); ENO:=DBMINUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ("DBMINUS", "DBMINUSP"...
  • Page 231: Multiplying Bcd 4-digit Data

    Multiplying BCD 4-digit data B*(P) These instructions multiply the BCD 4-digit data specified by (s1) and the BCD 4-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("BMULTI", "BMULTIP"...
  • Page 232: Dividing Bcd 4-digit Data

    Dividing BCD 4-digit data B/(P) These instructions divide the BCD 4-digit data specified by (s1) by the BCD 4-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("BDIVISION", "BDIVISIONP"...
  • Page 233 Operation error Error code Description (SD0/SD8067) 2820H Device specified by (d) exceeds the allowable device range 3400H 0 is specified for (s2) value. 3405H BCD data in the device specified by (s1) is outside of the valid range (0 to 9999). BCD data in the device specified by (s2) is outside of the valid range (0 to 9999).
  • Page 234: Multiplying Bcd 8-digit Data

    Multiplying BCD 8-digit data DB*(P) These instructions multiply the BCD 8-digit data specified by (s1) and the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("DBMULTI", "DBMULTIP"...
  • Page 235 Processing details • These instructions multiply the BCD 8-digit data specified by (s1) and the BCD 8-digit data specified by (s2), and store the multiplication results in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) × (d)+3 (d)+2 (d)+1 •...
  • Page 236: Dividing Bcd 8-digit Data

    Dividing BCD 8-digit data DB/(P) These instructions divide the BCD 8-digit data specified by (s1) by the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("DBDIVISION", "DBDIVISIONP"...
  • Page 237 Processing details • These instructions divide the BCD 8-digit data specified by (s1) by the BCD 8-digit data specified by (s2), and store the results of division in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) ÷ 0 is entered. Quotient (d)+1 Remainder...
  • Page 238: Adding 16-bit Binary Block Data

    Adding 16-bit binary block data BK+(P)(_U) These instructions add (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=BKPLUS(EN,s1,s2,n,d);...
  • Page 239 Processing details • These instructions add (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the results of addition in the device specified by (d). •...
  • Page 240: Subtracting 16-bit Binary Block Data

    Subtracting 16-bit binary block data BK-(P)(_U) These instructions subtract (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=BKMINUS(EN,s1,s2,n,d);...
  • Page 241 Processing details • These instructions subtract (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the subtraction results in the device specified by (d). •...
  • Page 242: Adding 32-bit Binary Block Data

    Adding 32-bit binary block data DBK+(P)(_U) These instructions add (n) point(s) of 32-bit binary data from the device specified by (s1) and the (n) point(s) of 32-bit binary data from the device specified by (s2), and store the results of addition in the device specified by (d). Ladder diagram Structured text ENO:=DBKPLUS(EN,s1,s2,n,d);...
  • Page 243 Processing details • These instructions add (n) point(s) of 32-bit binary data from the device specified by (s1) and the (n) point(s) of 32-bit binary data from the device specified by (s2), and store the results of addition in the device specified by (d). •...
  • Page 244 Operation error Error code Description (SD0/SD8067) 2820H The range of (n) point(s) of data starting from the device specified by (s1), (s2), or (d) exceed the corresponding device range. 2821H The device range for (n) point(s) beginning from (s1) overlaps with that of (n) point(s) starting from (d). (Does not apply when same device has been specified for (s1) and (d).) The device range for (n) point(s) beginning from (s2) overlaps with that of (n) point(s) starting from (d).
  • Page 245: Subtracting 32-bit Binary Block Data

    Subtracting 32-bit binary block data DBK-(P)(_U) These instructions subtract (n) point(s) of 32-bit binary data from the device specified by (s1) and the (n) point(s) of 32-bit binary data from the device specified by (s2), and store the results of subtraction in the device specified by (d). Ladder diagram Structured text ENO:=DBKMINUS(EN,s1,s2,n,d);...
  • Page 246 If device is specified for (s2) (signed) ∙∙∙ ∙∙∙ ∙∙∙ (s2)+1, (s2) (s1)+1, (s1) 44445 (BIN) (BIN) -55555 (BIN) (d)+1, -1000000 (s2)+3, (s2)+2 (s1)+3, (s1)+2 3333 (BIN) (BIN) 33333 (BIN) (d)+3, (d)+2 30000 (s2)+5, (s2)+4 (s1)+5, (s1)+4 -10000 (BIN) (d)+4 (BIN) 44444 (BIN)
  • Page 247: Incrementing 16-bit Binary Data

    Incrementing 16-bit binary data INC(P)(_U) These instructions add +1 to the device (16-bit binary data) specified by (d). Ladder diagram Structured text ENO:=INC(EN,d); ENO:=INC_U(EN,d); ENO:=INCP(EN,d); ENO:=INCP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) INC(P) Device to be incremented by +1 -32768 to +32767...
  • Page 248: Decrementing 16-bit Binary Data

    Decrementing 16-bit binary data DEC(P)(_U) These instructions subtract 1 from the device (16-bit binary data) specified by (d). Ladder diagram Structured text ENO:=DEC(EN,d); ENO:=DEC_U(EN,d); ENO:=DECP(EN,d); ENO:=DECP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DEC(P) Device to be decremented by -1 -32768 to +32767...
  • Page 249: Incrementing 32-bit Binary Data

    Incrementing 32-bit binary data DINC(P)(_U) These instructions add +1 to the device (32-bit binary data) specified by (d). Ladder diagram Structured text ENO:=DINC(EN,d); ENO:=DINC_U(EN,d); ENO:=DINCP(EN,d); ENO:=DINCP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DINC(P) Head device to be incremented by +1 -2147483648 to +2147483647...
  • Page 250: Decrementing 32-bit Binary Data

    Decrementing 32-bit binary data DDEC(P)(_U) These instructions subtract 1 from the device (32-bit binary data) specified by (d). Ladder diagram Structured text ENO:=DDEC(EN,d); ENO:=DDEC_U(EN,d); ENO:=DDECP(EN,d); ENO:=DDECP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DDEC(P) Head device to be decremented by 1 -2147483648 to +2147483647...
  • Page 251: Logical Operation Instructions

    Logical Operation Instructions Performing an AND operation on 16-bit data WAND(P) [using two operands] These instructions AND each bit of 16-bit binary data from the device specified by (d) and each bit of 16-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 252 WAND(P) [using three operands] These instructions AND each bit of 16-bit binary data from the device specified by (s1) and each bit of 16-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=WAND(EN,s1,s2,d);...
  • Page 253: Performing An And Operation On 32-bit Data

    Performing an AND operation on 32-bit data DAND(P) [using two operands] These instructions AND each bit of 32-bit binary data from the device specified by (d) and each bit of 32-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 254 DAND(P) [using three operands] These instructions AND each bit of 32-bit binary data from the device specified by (s1) and each bit of 32-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=DAND(EN,s1,s2,d);...
  • Page 255: Performing An And Operation On 16-bit Block Data

    Performing an AND operation on 16-bit block data BKAND(P) These instructions AND contents of (n) point(s) from the device specified by (s1) and (n) point(s) from the device specified by (s2), and store the results in the devices specified by (d) onwards. Ladder diagram Structured text ENO:=BKAND(EN,s1,s2,n,d);...
  • Page 256 Operation error Error code Description (SD0/SD8067) 2820H The range of (n) point(s) of data starting from the device specified by (s1), (s2), or (d) exceed the corresponding device range. 2821H Device range of (n) point(s) from (s1) partially overlaps with device range of (n) point(s) from (d). (Does not apply when same device has been specified for (s1) and (d).) Device range of (n) point(s) from (s2) partially overlaps with device range of (n) point(s) from (d).