FX5 ProgrammingManual Instructions-StandardFunctions-FunctionBlocks JY997D55801-H
FX5 ProgrammingManual Instructions-StandardFunctions-FunctionBlocks JY997D55801-H
INTRODUCTION
This manual describes the instructions and functions/function blocks required for programming MELSEC iQ-F series systems.
This manual and the related manuals should be read and the functions and performance of the MELSEC iQ-F series PLC
should be understood before attempting to use the unit.
However, before using a program example introduced in this manual to the actual system, always confirm that it poses no
problem for control of the target system.
Note
• If in doubt at any stage during the installation of the product, always consult a professional electrical engineer who is
qualified and trained in the local and national standards. If in doubt about the operation or use, please consult the nearest
Mitsubishi Electric representative.
• 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.
• This manual content, specification etc. may be changed without a notice for improvement.
• The information in this manual has been carefully checked and is believed to be accurate; however, if you have noticed a
doubtful point, an error, etc., please contact the nearest Mitsubishi Electric representative. When doing so, please provide
the manual number given at the end of this manual.
1
CONTENTS
SAFETY PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
RELEVANT MANUALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16
TERMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17
HOW TO READ THIS MANUAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
PART 1 OVERVIEW
CHAPTER 1 OVERVIEW 24
1.1 Instruction Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.2 Data Specification Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
16-bit data (word data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
32-bit data (double word data). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Real number data (floating-point data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Character string data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
1.3 Execution Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2
Standard functions of one numeric variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Standard arithmetic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Standard bit shift functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Standard bitwise boolean functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Standard selection functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Standard comparison functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Standard character string functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Time data functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.2 Standard Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
CONTENTS
Bistable function blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Edge detection function blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Counter function blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Timer function blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3
Shifting n-bit(s) data to the right by (n) bit(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Shifting n-bit data to the left by n bit(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Shifting n-word data to the right by n word(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Shifting n-word data to the left by n word(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
6.5 Master Control Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Setting/resetting the master control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
6.6 Termination Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Ending the main routine program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Ending the sequence program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.7 Stop Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Stopping the sequence program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
4
Performing an AND operation on 16-bit block data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Performing an OR operation on 16-bit data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Performing an OR operation on 32-bit data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Performing an OR operation on 16-bit block data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Performing an XOR operation on 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Performing an XOR operation on 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Performing an XOR operation on 16-bit block data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Performing an XNOR operation on 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Performing an XNOR operation on 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
CONTENTS
Performing an XNOR operation on 16-bit block data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
7.4 Bit Processing Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Setting a bit in the word device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Resetting a bit in the word device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Performing a 16-bit test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Performing a 32-bit test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Batch-resetting bit devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Batch-resetting devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
7.5 Data Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Converting binary data to BCD 4-digit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Converting binary data to BCD 8-digit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Converting BCD 4-digit data to binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Converting BCD 8-digit data to binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Converting single-precision real number to 16-bit signed binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Converting single-precision real number to 16-bit unsigned binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Converting single-precision real number to 32-bit signed binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Converting single-precision real number to 32-bit unsigned binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Converting 16-bit signed binary data to 16-bit unsigned binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Converting 16-bit signed binary data to 32-bit signed binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Converting 16-bit signed binary data to 32-bit unsigned binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Converting 16-bit unsigned binary data to 16-bit signed binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Converting 16-bit unsigned binary data to 32-bit signed binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Converting 16-bit unsigned binary data to 32-bit unsigned binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Converting 32-bit signed binary data to 16-bit signed binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Converting 32-bit signed binary data to 16-bit unsigned binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Converting 32-bit signed binary data to 32-bit unsigned binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Converting 32-bit unsigned binary data to 16-bit signed binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Converting 32-bit unsigned binary data to 16-bit unsigned binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Converting 32-bit unsigned binary data to 32-bit signed binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Converting 16-bit binary data to Gray code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Converting 32-bit binary data to Gray code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Converting Gray code to 16-bit binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Converting Gray code to 32-bit binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Converting decimal ASCII to 16-bit binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Converting decimal ASCII to 32-bit binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Converting ASCII to HEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Converting character string to 16-bit binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Converting character string to 32-bit binary data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Two's complement of 16-bit binary data (sign inversion). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Two's complement of 32-bit binary data (sign inversion). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Decoding from 8 to 256 bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Encoding from 256 to 8 bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
5
Seven-segment decoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Seven Segment With Latch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Separating 4 bits from 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Connecting 4 bits to 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Separating the specified number of bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Connecting the specified number of bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Separating data in byte units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Connecting data in byte units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
7.6 Digital Switch (Thumbwheel Input) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
7.7 Data Transfer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Transferring 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Transferring 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Inverting and transferring 16-bit data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Inverting and transferring 32-bit data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Digit move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Inverting and transferring 1-bit data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Transferring 16-bit block data (65535 points maximum) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Transferring identical 16-bit block data (65535 points maximum) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Transferring identical 32-bit block data (65535 points maximum) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Exchanging 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Exchanging 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Exchanging the upper and lower bytes of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Exchanging the upper and lower bytes of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Transferring 1-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Transferring octal bits (16-bit data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Transferring octal bits (32-bit data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Transferring n-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
6
8.5 Data Table Operation Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Reading the oldest data from the data table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Reading the newest data from the data table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Writing data to the data table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Inserting data to the data table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Deleting data from the data table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
8.6 Character String Operation Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Comparing character strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Concatenating character strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
CONTENTS
Transferring character strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Converting 16-bit binary data to decimal ASCII. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Converting 32-bit binary data to decimal ASCII. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Converting HEX code data to ASCII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Converting 16-bit binary data to character string. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Converting 32-bit binary data to character string. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Converting single-precision real number to character string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Detecting a character string length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Extracting character string data from the right. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Extracting character string data from the left. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Storing the specified number of character strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
Replacing the specified number of character strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Searching character string. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Inserting character string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Deleting character string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
8.7 Real Number Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Comparing single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Single-precision real number comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Single-precision real number data band comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Adding single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Subtracting single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Adding single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Subtracting single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Multiplying single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Dividing single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Multiplying single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Dividing single-precision real numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Converting 16-bit signed binary data to single-precision real number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Converting 16-bit unsigned binary data to single-precision real number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
Converting 32-bit signed binary data to single-precision real number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Converting 32-bit unsigned binary data to single-precision real number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
Converting character string to single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Converting binary floating point to decimal floating point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
Converting decimal floating point to binary floating point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Inverting the sign of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Transferring single-precision real number data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Calculating the sine of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
Calculating the cosine of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
Calculating the tangent of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Calculating the arc sine of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
Calculating the arc cosine of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Calculating the arc tangent of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
7
Converting single-precision real number angle to radian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
Converting single-precision real number radian to angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Calculating the square root of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
Calculating the exponent of single-precision real number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Calculating the natural logarithm of single-precision real number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
Calculating the exponentiation of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
Calculating the common logarithm of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
Searching the maximum value of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
Searching the minimum value of single-precision real number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
8.8 Random Number Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
Generating random number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
8.9 Index Register Operation Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Saving all data of the index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Returning all data of the index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
Saving the selected data of the index register and long index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
Returning the selected data of the index register and long index register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
8.10 Data Control Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
Upper and lower limit control of 16-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
Upper and lower limit control of 32-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Dead band control of 16-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Dead band control of 32-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
Zone control of 16-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
Zone control of 32-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Scaling 16-bit binary data (point coordinates) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Scaling 32-bit binary data (point coordinates) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Scaling 16-bit binary data (XY coordinates) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
Scaling 32-bit binary data (XY coordinates) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
8.11 Special Timer Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Teaching timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Special function timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
8.12 Special Counter Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Signed 32-bit bi-directional counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
8.13 Shortcut Control Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
Rotary table shortest direction control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
8.14 Ramp Signal Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
Ramp signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
8.15 Pulse Related Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Measuring the density of 16 bit binary pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Measuring the density of 32 bit binary pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
16 bit binary pulse output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
32 bit binary pulse output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
16 bit binary pulse width modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
32 bit binary pulse width modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
8.16 Input Matrix Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
Input matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
8.17 Initial State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
Initial State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
8.18 Drum Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
16-bit binary data absolute method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
32-bit binary data absolute method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
Relative method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
8
8.19 Check Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
Check code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
8.20 Data Operation Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
Searching 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
Searching 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
Bit check of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Bit check of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Bit judgment of 16-bit data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Bit judgment of 32-bit data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
CONTENTS
Searching the maximum value of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Searching the maximum value of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
Searching the minimum value of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Searching the minimum value of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Sorting 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Sorting 16-bit data 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652
Sorting 32-bit data 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
Adding 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Adding 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
Calculating the mean value of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
Calculating the mean value of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Calculating the square root of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Calculating the square root of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
CRC calculation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
8.21 Indirect Address Read Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
Reading the indirect address. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
8.22 Clock Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
Reading clock data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
Writing clock data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
Adding clock data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
Subtracting clock data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Converting time data from hour/minute/second to seconds in 16 bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
Converting time data from hour/minute/second to seconds in 32 bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Converting time data from seconds to hour/minute/second in 16 bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
Converting time data from seconds to hour/minute/second in 32 bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
Comparing date data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
Comparing time data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
Comparing clock data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
Comparing clock data zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
8.23 Timing Check Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
Generating timing pulses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
Hour meter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
8.24 Module Access Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
I/O refresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
Reading 1-word/2-word data from another module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
Writing 1-word/2-word data to another module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708
Reading 1-word/2-word data from another module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Writing 1-word/2-word data to another module (32-bit specification) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
8.25 Logging Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717
Setting trigger logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717
Resetting trigger logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
9
CHAPTER 9 STEP LADDER INSTRUCTIONS 719
9.1 Starts/Ends Step Ladder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
10
Inverter operation monitoring (Status check). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
Inverter operations control (Drive) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
Inverter parameter read. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
Inverter parameter write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812
Inverter parameter block write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814
Inverter multi command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816
15.3 MODBUS Communication Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
15.4 Predefined Protocol Support Function Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
CONTENTS
16.1 Dedicated Instruction (Positioning Function). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824
Zero return(OPR) with 16-bit data DOG search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
Zero return(OPR) with 32-bit data DOG search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829
16-bit data interrupt positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831
32-bit data interrupt positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
Positioning by one table operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837
Positioning by multiple table operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839
Multiple axes concurrent drive positioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841
32-bit data ABS current value read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
16-bit data variable speed pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
32-bit data variable speed pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847
16-bit data relative positioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849
32-bit data relative positioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853
16-bit data absolute positioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857
32-bit data absolute positioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860
16.2 Positioning Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864
Restoring the absolute position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864
Starting the positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867
Teaching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870
Backing up Module Data (Writing Data to the Flash ROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873
Initializing the Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 876
11
18.12 Converting DWORD to BOOL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895
18.13 Converting DWORD to WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896
18.14 Converting DWORD to INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898
18.15 Converting DWORD to DINT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900
18.16 Converting DWORD to TIME. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901
18.17 Converting INT to BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902
18.18 Converting INT to WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 903
18.19 Converting INT to DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 904
18.20 Converting INT to DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 905
18.21 Converting INT to BCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906
18.22 Converting INT to REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908
18.23 Converting INT to TIME. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 909
18.24 Converting INT to STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 910
18.25 Converting DINT to BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912
18.26 Converting DINT to WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913
18.27 Converting DINT to DWORD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915
18.28 Converting DINT to INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916
18.29 Converting DINT to BCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917
18.30 Converting DINT to REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 919
18.31 Converting DINT to TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920
18.32 Converting DINT to STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
18.33 Converting BCD to INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923
18.34 Converting BCD to DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 925
18.35 Converting REAL to INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927
18.36 Converting REAL to DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929
18.37 Converting REAL to STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931
18.38 Converting TIME to BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 934
18.39 Converting TIME to WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 935
18.40 Converting TIME to DWORD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 936
18.41 Converting TIME to INT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937
18.42 Converting TIME to DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938
18.43 Converting TIME to STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939
18.44 Converting STRING to BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940
18.45 Converting STRING to INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941
18.46 Converting STRING to DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943
18.47 Converting STRING to REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945
18.48 Converting STRING to TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948
18.49 Converting Bit Array to INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 949
18.50 Converting Bit Array to DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 950
18.51 Converting INT to Bit Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951
18.52 Converting DINT to Bit Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952
18.53 Bit Array Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953
18.54 Reading the Specified Bit of Word Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954
18.55 Writing the Specified Bit of Word Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 955
18.56 Copying the Specified Bit of Word Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 956
18.57 Unnecessary of Type Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957
12
19.3 Natural Logarithm Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961
19.4 Calculating the Common Logarithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962
19.5 Exponential Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
19.6 Sine Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965
19.7 Cosine Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966
19.8 Tangent Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967
19.9 Arc Sine Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968
19.10 Arc Cosine Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969
19.11 Arc Tangent Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 970
CONTENTS
CHAPTER 20 ARITHMETIC OPERATION FUNCTIONS 971
20.1 Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 971
20.2 Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973
20.3 Subtraction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 975
20.4 Division. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 977
20.5 Remainder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 979
20.6 Exponentiation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 981
20.7 Move Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983
13
CHAPTER 26 TIME DATA FUNCTIONS 1024
26.1 Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024
26.2 Subtraction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1026
26.3 Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1028
26.4 Division. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1030
APPENDIX 1060
Appendix 1 Reference data: Main Instruction Execution Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1060
Appendix 2 Number of Instruction Steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1061
Appendix 3 Added and Changed Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1081
REVISIONS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1090
WARRANTY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1091
TRADEMARKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1092
14
15
CONTENTS
RELEVANT MANUALS
Manual name <manual number> Description
MELSEC iQ-F FX5 User's Manual (Startup) Performance specifications, procedures before operation, and troubleshooting of the
<JY997D58201> CPU module.
MELSEC iQ-F FX5U User's Manual (Hardware) Describes the details of hardware of the FX5U CPU module, including input/output
<JY997D55301> specifications, wiring, installation, and maintenance.
MELSEC iQ-F FX5UC User's Manual (Hardware) Describes the details of hardware of the FX5UC CPU module, including input/output
<JY997D61401> specifications, wiring, installation, and maintenance.
MELSEC iQ-F FX5 User's Manual (Application) Describes basic knowledge required for program design, functions of the CPU
<JY997D55401> module, devices/labels, and parameters.
MELSEC iQ-F FX5 Programming Manual (Program Design) Describes specifications of ladders, ST, FBD/LD, and other programs and labels.
<JY997D55701>
MELSEC iQ-F FX5 Programming Manual (Instructions, Standard Describes specifications of instructions and functions that can be used in programs.
Functions/Function Blocks)
<JY997D55801> (This manual)
MELSEC iQ-F FX5 User's Manual (Serial Communication) Describes N:N network, Parallel link, MELSEC Communication protocol, inverter
<JY997D55901> communication, non-protocol communication, and predefined protocol support.
MELSEC iQ-F FX5 User's Manual (MELSEC Communication Protocol) Explains methods for the device that is communicating with the CPU module by MC
<JY997D60801> protocol to read and write the data of the CPU module.
MELSEC iQ-F FX5 User's Manual (MODBUS Communication) Describes MODBUS serial communication.
<JY997D56101>
MELSEC iQ-F FX5 User's Manual (Ethernet Communication) Describes the functions of the built-in Ethernet port communication function.
<JY997D56201>
MELSEC iQ-F FX5 User's Manual (SLMP) Explains methods for the device that is communicating with the CPU module by
<JY997D56001> SLMP to read and write the data of the CPU module.
MELSEC iQ-F FX5 User's Manual (CC-Link IE) Describes CC-Link IE field network module.
<JY997D64201>
MELSEC iQ-F FX5 User's Manual (CC-Link) Describes CC-Link system master/intelligent device module
<SH-081793ENG>
MELSEC iQ-F FX5 User's Manual (ASLINK) Describes AnyWireASLINK system master module
<SH-081796ENG>
MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module Describes the positioning function of the CPU module built-in and the high-speed
built-in, High-speed pulse input/output module) pulse input/output module.
<JY997D56301>
MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent Describes the positioning module.
function module)
<SH-081805ENG>
MELSEC iQ-F FX5 Simple Motion Module User's Manual (Startup) Specifications, procedures before operation, system configuration, wiring, and
<IB0300251> operation examples of the Simple Motion module.
MELSEC iQ-F FX5 Simple Motion Module User's Manual (Application) Functions, input/output signals, buffer memories, parameter settings, programming,
<IB0300253> and troubleshooting of the Simple Motion module.
MELSEC iQ-F FX5 Simple Motion Module User's Manual (Advanced 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>
MELSEC iQ-F FX5 User's Manual (Analog Control - Intelligent function Describes the multiple input module (voltage, current, thermocouple, and resistance
module) temperature detector).
<SH-081802ENG>
MELSEC iQ-F FX5 User's Manual (Temperature Control) Describes the temperature control module.
<SH-081799ENG>
GX Works3 Operating Manual System configuration, parameter settings, and online operations of GX Works3.
<SH-081215ENG>
Transition from MELSEC FX3U, FX3UC Series to MELSEC iQ-F Describes the transition from MELSEC FX3U/FX3UC series to MELSEC iQ-F series.
Series Handbook
<JY997D66201>
16
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
FX5 Generic term for FX5U and FX5UC PLCs
FX3 Generic term for FX3S, FX3G, FX3GC, FX3U, and FX3UC PLCs
FX5 CPU module Generic term for FX5U CPU module and FX5UC CPU module
FX5U CPU module Generic term for FX5U-32MR/ES, FX5U-32MT/ES, FX5U-32MT/ESS, FX5U-64MR/ES, FX5U-64MT/ES,
FX5U-64MT/ESS, FX5U-80MR/ES, FX5U-80MT/ES, FX5U-80MT/ESS, FX5U-32MR/DS, FX5U-32MT/DS,
FX5U-32MT/DSS, FX5U-64MR/DS, FX5U-64MT/DS, FX5U-64MT/DSS, FX5U-80MR/DS, FX5U-80MT/DS, and
FX5U-80MT/DSS
FX5UC CPU module Generic term for FX5UC-32MT/D, FX5UC-32MT/DSS, FX5UC-64MT/D, FX5UC-64MT/DSS, FX5UC-96MT/D,
and FX5UC-96MT/DSS
Extension module Generic term for FX5 extension modules and FX3 function modules
• FX5 extension module Generic term for I/O modules, FX5 extension power supply modules, and FX5 intelligent function modules
• FX3 extension module Generic term for FX3 extension power supply module and FX3 intelligent function module
• Extension module (extension cable type) Generic term for Input modules (extension cable type), Output modules (extension cable type), Input/output
modules (extension cable type), Powered input/output module, High-speed pulse input/output module,
Extension power supply module (extension cable type), Connector conversion module (extension cable type),
Intelligent function modules, and Bus conversion module (extension cable type)
• Extension module (extension connector Generic term for Input modules (extension connector type), Output modules (extension connector type), Input/
type) output modules (extension connector type), Extension power supply module (extension connector type),
Connector conversion module (extension connector type), and Bus conversion module (extension connector
type)
I/O module Generic term for Input modules, Output modules, Input/output modules, Powered input/output modules, and
High-speed pulse input/output modules
Input module Generic term for Input modules (extension cable type) and Input modules (extension connector type)
• Input module (extension cable type) Generic term for FX5-8EX/ES and FX5-16EX/ES
• Input module (extension connector type) Generic term for FX5-C16EX/D, FX5-C16EX/DS, FX5-C32EX/D, and FX5-C32EX/DS
Output module Generic term for Output modules (extension cable type) and Output modules (extension connector type)
• Output module (extension cable type) Generic term for FX5-8EYR/ES, FX5-8EYT/ES, FX5-8EYT/ESS, FX5-16EYR/ES, FX5-16EYT/ES, and FX5-
16EYT/ESS
• Output module (extension connector type) Generic term for FX5-C16EYT/D, FX5-C16EYT/DSS, FX5-C32EYT/D, and FX5-C32EYT/DSS
Input/output module Generic term for Input/output modules (extension cable type) and Input/output modules (extension connector
type)
• Input/output module (extension cable Generic term for FX5-16ER/ES, FX5-16ET/ES, and FX5-16ET/ESS
type)
• Input/output module (extension connector Generic term for FX5-C32ET/D and FX5-C32ET/DSS
type)
Powered input/output module Generic term for FX5-32ER/ES, FX5-32ET/ES, FX5-32ET/ESS, FX5-32ER/DS, FX5-32ET/DS, and FX5-32ET/
DSS
High-speed pulse input/output module Generic term for FX5-16ET/ES-H and FX5-16ET/ESS-H
Extension power supply module Generic term for FX5 extension power supply module and FX3 extension power supply module
• FX5 extension power supply module Generic term for FX5 extension power supply module (extension cable type) and FX5 extension power supply
module (extension connector type)
• FX5 extension power supply module Different name for FX5-1PSU-5V
(extension cable type)
• FX5 extension power supply module Different name for FX5-C1PS-5V
(extension connector type)
• FX3 extension power supply module Different name for FX3U-1PSU-5V
Intelligent module The abbreviation for intelligent function modules
Intelligent function module Generic term for FX5 intelligent function modules and FX3 intelligent function modules
• FX5 intelligent function module Generic term for FX5-8AD, FX5-4LC, FX5-20PG-P, FX5-40SSC-S, FX5-80SSC-S, FX5-CCLIEF, FX5-CCL-MS,
and FX5-ASL-M
17
Terms Description
• FX3 intelligent function module Generic term for FX3U-4AD, FX3U-4DA, FX3U-4LC, FX3U-1PG, FX3U-2HC, FX3U-16CCL-M, FX3U-64CCL,
and FX3U-128ASL-M
Expansion board Generic term for board for FX5U CPU module
• Communication board Generic term for FX5-232-BD, FX5-485-BD, and FX5-422-BD-GOT
Expansion adapter Generic term for adapter for FX5 CPU module
• Communication adapter Generic term for FX5-232ADP and FX5-485ADP
• Analog adapter Generic term for FX5-4AD-ADP, FX5-4DA-ADP, FX5-4AD-PT-ADP, and FX5-4AD-TC-ADP
Bus conversion module Generic term for Bus conversion module (extension cable type) and Bus conversion module (extension
connector type)
• Bus conversion module (extension cable Different name for FX5-CNV-BUS
type)
• Bus conversion module (extension Different name for FX5-CNV-BUSC
connector type)
Connector conversion module Generic term for Connector conversion module (extension cable type) and Connector conversion module
(extension connector type)
• Connector conversion module (extension Different name for FX5-CNV-IF
cable type)
• Connector conversion module (extension Different name for FX5-CNV-IFC
connector type)
Extended extension cable Generic term for FX5-30EC and FX5-65EC
Connector conversion adapter Different name for FX5-CNV-BC
Battery Different name for FX3U-32BL
Peripheral device Generic term for engineering tools and GOTs
GOT 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
GX Works3 The product name of the software package, SWnDND-GXW3, for the MELSEC programmable controllers (The
'n' represents a version.)
18
HOW TO READ THIS MANUAL
The following describes the page layout and symbols used in this manual.
STMR
This instruction uses the four devices from the device specified by (d) to perform four types of timer output.
Ladder diagram Structured text
ENO:=STMR(EN,s1,s2,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Used timer number (operates as a 100 ms timer) Device name ANY16
(s2) Timer set value 1 to 32767 16-bit signed binary ANY16
(d) Start bit number to be output Bit ANYBIT_ARRAY
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2)
(d)
■Control data
Operand: (d)
Device Description Setting range Set by
+0 Off delay timer output: System
Turns on at the rising edge of the command of the STMR instruction and turns off when the time specified by
(s2) elapses after the falling edge.
+1 One-shot timer output after turning off: System
Turns on at the falling edge of the command of the STMR instruction and turns off when the time specified by
(s2) elapses.
+2 One shot timer output after turning on System
Processing details
• This instruction uses the four devices from the device specified by (d) to perform four types of timer output.
(1)
(d)+1
(d)+2
(d)+3
Precautions
• The timer number specified in this instruction cannot be used in other general circuits (such as OUT instruction). If the timer
number is used in other general circuits, the timer malfunctions.
• The timer specified by (s1) starts counting as a 100 ms timer on the rising edge of the command contact.
• Four devices are occupied from a device specified in (d). Make sure that such devices are not used in other controls for the
machine.
• If the command contact is turned off, (d), (d)+1, and (d)+3 turn off when the set time elapses. (d)+2 and the timer (s1) are
immediately reset.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (s2) is outside the following range.
1 to 32767
8 APPLICATION INSTRUCTION
564 8.11 Special Timer Instruction
19
Indicates the instruction symbol.
• The instruction symbol with brackets means multiple instructions. For example, "GRY(P)(_U)" means the GRY, GRYP,
GRY_U, and GRYP_U instructions.
Instruction symbol Description of symbol
Instruction symbol with "(P)" The instruction is executed on the rising edge.
Instruction symbol with "(_U)" The instruction handles 16-bit or 32-bit unsigned binary data.
• The instruction symbol with "" means multiple instructions. For example, "LDDT" means the LDDT=, LDDT<>, LDDT>,
LDDT<=, LDDT<, and LDDT>= instructions.
Indicates the description format of the ladder diagram, FBD/LD language and ST (structured text) language
Instruction symbols are input in each corresponding place surrounded in a square in the ladder diagram.
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.
Operand Bit Word Double word Indirect Constant Others
*5
X*2, Y*2, M*2, T*3, ST*3, C*3, U¥G*4 Z LC*3 LZ specification K, H E $
L*2, SM*2, F*2, D*4,W*4, SD*4,
B*2, SB*2, S*2 SW*4, R*4
Applicable X, Y, M, L, SM, F, T, ST, C, D, W, SD, U¥G Z LC LZ @ K, H E $ P, I, U,
devices*1 B, SB, S SW, R @. DX, DY,
N
20
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.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to INT type data and output from (d).
(s) (d)
1234 1234
DINT INT
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3401H The 32-bit signed binary data in the device specified by (s) is out of the valid range (-32768 to 32767).
Indicates the description format of the ladder diagram, FBD/LD language and ST (structured text) language.
In the square , either of the following symbol should be described.
• Standard function: Function symbol
• Standard function block: Instance name and function block symbol
The sign of return value of the standard function of FBD/LD is not displayed.
Indicates the description, type and data type of each argument.
Indicates the functions of each standard function or function block.
Indicates an error code which occurs at the execution and the error description when the standard function or the function
block has a specific operation error.
A device in which an error code is stored is described in the error code column. When an error code is stored in SD0, the error
flag SM0 turns on.
21
MEMO
22
PART 1
PART 1 OVERVIEW
1 OVERVIEW
2 PRECAUTIONS ON PROGRAMMING
23
1 OVERVIEW
Source (s)
Source is the data used in the operation.
Depending on the label or device specified in each instruction, the source becomes as follows.
Type Description
Constant The constant specifies a numerical value used in the operation.
It is set during program creation and cannot be changed during program execution.
Bit device The user specifies the device where the data to be used in the operation is stored.
Word device Necessary data must be thus stored in the specified device before operation execution.
By changing the data to be stored in the specified device during program execution, the data to be used by the
instruction can be changed.
Destination (d)
Data after operation is stored in the destination area.
However, some instructions require the data to be used in the operation to be stored before the operation.
Ex.
Binary 16-bit data addition instruction
+ s d + s1 s2 d
(1) (2)
(1): The data required for operation is stored before the operation.
(2): Only the operation result is stored.
Ex.
Block transfer instruction
BMOV s d n
(1)
A numerical value from 0 to 65535 or 0 to 4294967295 can be set for the size such as the number of devices, transfers, or
characters.*1
Note, however, that when the size specification such as the number of devices, transfers, or characters is 0, the relevant
instruction results in non-processing.
*1 The setting range varies depending on the instruction. For details, refer to the description of each instruction.
1 OVERVIEW
24 1.1 Instruction Configuration
Be careful when a large numerical value is used such as for the number of transfers. It delays the scan time.
1
1.2 Data Specification Method
The following table lists the types of data that can be used for instructions in CPU modules.
Data Classification
Bit data Bit data
16-bit data (word data) 16-bit signed binary data
16-bit unsigned binary data
32-bit data (double-word data) 32-bit signed binary data
32-bit unsigned binary data
Real number data (floating-point data) Single-precision real number data
BCD data BCD 4-digit data
BCD 8-digit data
String data String
Device data
Data type Description Specifiable device/constant*1
Bit Bit data can be handled. • Bit device
Page 28 Bit data • Bit specification of word device
Word Word data can be handled. • Word device
Page 29 16-bit data (word data) • Nibble specification of bit devices (K1 to
16-bit signed binary 16-bit data can be handled. K4)*2
• Decimal constant
The value range varies depending on whether the value is signed or unsigned.
16-bit unsigned binary • Hexadecimal constant
Page 29 16-bit data (word data)
Double word Double-word data can be handled. • Word device
Page 31 32-bit data (double word data) • Double-word device
32-bit signed binary Two consecutive sets of 32-bit data or 16-bit data can be handled. • Nibble specification of bit devices (K1 to
K8)*2
The value range varies depending on whether the value is signed or unsigned.
32-bit unsigned binary • Decimal constant
Page 31 32-bit data (double word data)
• Hexadecimal constant
BCD 4-digit BCD 4-digit data can be handled. • Word device
16-bit data is divided by 4 digits and each digit is specified in 0 to 9. • Nibble specification of bit devices (K1 to
K4)*2
• Decimal constant
• Hexadecimal constant
BCD 8-digit BCD 8-digit data can be handled. • Word device
32-bit data is divided by 8 digits and each digit is specified in 0 to 9. • Double-word device
• Nibble specification of bit devices (K1 to
K8)*2
• Decimal constant
• Hexadecimal constant
Single-precision real Single-precision real number data (single-precision floating-point data) can be • Word device
number handled. • Double-word device
Page 34 Configuration of single-precision real number data • Real constant
Character string ASCII code and Shift JIS code character string data can be handled. • Word device
Page 36 Character string data • Character string constant
*1 A constant can be used in the data specified for the source (s) or numerical data (n) by an instruction.
*2 For the specification method, refer to the detail page of each data type.
1 OVERVIEW
1.2 Data Specification Method 25
Label data
■Primitive data type
Data type (label) Specifiable label
Bit • 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] • Word [unsigned]/bit string [16 bits] type label
(WORD) • Nibble specified bit type label (K1 to K4)
• Current value of timer/retentive timer type label
• Current value of counter type label
Double word [unsigned]/bit string [32 bits] • Double word [unsigned]/bit string [32 bits] type label
(DWORD) • Nibble specified bit type label (K1 to K8)
• Current value of long timer/long retentive timer type label
• Current value of long counter type label
Word [signed] • Word [signed] type label
(INT) • Nibble specified bit type label (K1 to K4)
• Current value of timer/retentive timer type label
• Current value of counter type label
Double word [signed] • Double word [signed] type label
(DINT) • Nibble specified bit type label (K1 to K8)
• Current value of long timer/long retentive timer type label
• Current value of long counter type label
Single-precision real number • Single-precision real data type label
(REAL)
Time • Time type label
(TIME)
Character string • Character string type label
(STRING)
Timer • Timer type label
(TIMER)
Retentive timer • Retentive timer type label
(RETENTIVETIMER)
Counter • Counter type label
(COUNTER)
Long counter • Long counter type label
(LCOUNTER)
Pointer • Pointer type label
(POINTER)
1 OVERVIEW
26 1.2 Data Specification Method
■Generic data type
Data type (label) Specifiable label
ANY*1 Bit, word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits], 1
single-precision real number, hour, character string, structure
ANY_BITADDR*1 Bit
ANY_BOOL Bit
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],
single-precision real number, hour, character string
Any 16-bit data (ANY16) Word [signed], word [unsigned]/bit string [16 bits]
ANY16_S Word [signed]
ANY16_U Word [unsigned]/bit string [16 bits]
Any 32-bit data (ANY32) Double word [signed], double word [unsigned]/bit string [32 bits], hour
ANY32_S Double word [signed], hour
ANY32_U Double word [unsigned]/bit string [32 bits]
ANY_REAL Single-precision real number
ANYREAL_32 Single-precision real number
ANY_STRING Character string
ANYSTRING_SINGLE Character string
ANY_STRUCT*1 Structures
ANY_DT Word [signed], word [unsigned]/bit string [16 bits]
ANY_TM Word [signed], word [unsigned]/bit string [16 bits]
STRUCT Structures
ANY16_OR_STRING_SINGLE Word [signed], word [unsigned]/bit string [16 bits], character string
1 OVERVIEW
1.2 Data Specification Method 27
Bit data
1 OVERVIEW
28 1.2 Data Specification Method
16-bit data (word data)
1
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
Unsigned 16-bit data 0 to 65535
1 OVERVIEW
1.2 Data Specification Method 29
Nibble specification range
The following table lists the range of 16-bit data for each nibble specification.
Nibble Decimal notation Hexadecimal notation
specification
K1 0 to 15 0H to FH
K2 0 to 255 00H to FFH
K3 0 to 4095 000H to FFFH
K4 Signed 16-bit data: -32768 to 32767 0000H to FFFFH
Unsigned 16-bit data: 0 to 65535
Ex.
When nibble specification is made for X0, the applicable number of points is as follows.
• K1X0→4 points from X0 to X3
• K2X0→8 points from X0 to X7
• K3X0→12 points from X0 to X13
• K4X0→16 points from X0 to X17
X17 X14 X13 X10 X7 X4 X3 X0
K1X0
K2X0
K3X0
K4X0
(s)
b15 ∙∙∙ b4 b3 b2 b1 b0
D0 0 0 0 0 0 0 0 0 0 0 0 0 X3 X2 X1 X0
(d)
M115 ∙∙∙ M108 M107 ∙∙∙ M100
K2M100 1 0 0 1 1 1 0 1
(1)
(1): The data remain the same.
1 OVERVIEW
30 1.2 Data Specification Method
Handling 16-bit data with word devices/labels
■Word device 1
One point of word device can handle 16-bit data.
1 OVERVIEW
1.2 Data Specification Method 31
Nibble specification range
The following table lists the range of 32-bit data for each nibble specification.
Nibble Decimal notation Hexadecimal notation
specification
K1 0 to 15 0H to FH
K2 0 to 255 00H to FFH
K3 0 to 4095 000H to FFFH
K4 0 to 65535 0000H to FFFFH
K5 0 to 1048575 00000H to FFFFFH
K6 0 to 16777215 000000H to FFFFFFH
K7 0 to 268435455 0000000H to FFFFFFFH
K8 Signed 32-bit data: -2147483648 to 2147483647 00000000H to FFFFFFFFH
Unsigned 32-bit data: 0 to 4294967295
Ex.
When nibble specification is made for X0, the applicable number of points is as follows.
• K1X0→4 points from X0 to X3
• K2X0→8 points from X0 to X7
• K3X0→12 points from X0 to X13
• K4X0→16 points from X0 to X17
• K5X0→20 points from X0 to X23
• K6X0→24 points from X0 to X27
• K7X0→28 points from X0 to X33
• K8X0→32 points from X0 to X37
X37 X34 X33 X30X27 X24 X23 X20 X17 X14 X13 X10 X7 X4 X3 X0
K1X0
K2X0
K3X0
K4X0
K5X0
K6X0
K7X0
K8X0
1 OVERVIEW
32 1.2 Data Specification Method
■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. 1
Ladder example Processing
• 32-bit data instruction
K1X0 X3 X2 X1 X0
X10
DMOV K1X0 D0
0
(s)
b15 ∙∙∙ b4 b3 b2 b1 b0
D0 0 0 0 0 0 0 0 0 0 0 0 0 X3 X2 X1 X0
D1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
b31 ∙∙∙ b16
(1)
1 OVERVIEW
1.2 Data Specification Method 33
Real number data (floating-point data)
Exponent
Sign 1. Mantissa ×2
The following figure shows the bit configuration of the internal expression of single-precision real number data and the
meaning of each part.
■Sign (1 bit)
This bit represents the positive or negative sign of a numerical value. "0" indicates a positive number or 0. "1" Indicates a
negative number.
■Exponent (8 bits)
An exponent means N of 1.XXXXX⋅⋅⋅×2N representing a single-precision real number in binary. The following table shows the
relationships between the exponent value and N of a single-precision real number.
Exponent (b24 to b30) FFH FEH FDH ⋅⋅⋅ 81H 80H 7FH 7EH ⋅⋅⋅ 02H 01H 00H
N Not used 127 126 ⋅⋅⋅ 2 1 0 -1 ⋅⋅⋅ -125 -126 Not used
Precautions
■When setting an input value of single-precision real number from the engineering tool
The number of significant digits is about 7 because the engineering tool processes single precision real number data in 32-bit
single precision.
When the input value of single-precision real number data exceeds 7 digits, the 8th digit is rounded off.
Therefore, if the rounded-off value goes out of the range from -2147483648 to 2147483647, it will not be an intended value.
Ex.
When "2147483647" is set as an input value, it is handled as "2147484000" because 8th digit "6" is rounded off.
Ex.
When "E1.1754943562" is set as an input value, it is handled as "E1.175494" because 8th digit "3" is rounded off.
1 OVERVIEW
34 1.2 Data Specification Method
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. 1
• Single-precision real number data: b0 to b31
The setting range of real number data is as follows.
• Single precision real number data: -2128<single precision real number data]≤-2-126, 0, 2-126≤[single
precision real number data]<2128
Do not specify "-0" (only the most significant bit is 1) in real number data. Performing a real number operation
using -0 results in an operation error.
1 OVERVIEW
1.2 Data Specification Method 35
Character string data
Character string data is stored in devices or an array in ascending order of device numbers or array element numbers.
Lower Upper
(1)
Data range
The following table summarizes the ranges of character string data.
Type Maximum number of character strings*1 Maximum number of character strings that can
be handled in the program
Character string 255 single-byte characters (excluding the last NULL 16383 characters (excluding the last NULL character)
character)
*1 When specifying a character string in the program, enclose it in single quotes (').
■Character strings
In each character string storage image, "NULL" indicates a NULL code (00H).
Character string Image of storing character string data from D0 Image of storing character string data from word type
to be stored label array arrayA[0]
' ' (null character
string) D0 NULL NULL arrayA[0] NULL NULL
'ABC'
D0 B A arrayA[0] B A
D1 NULL C arrayA[1] NULL C
'ABCD'
D0 B A arrayA[0] B A
D1 D C arrayA[1] D C
D2 NULL NULL arrayA[2] NULL NULL
1 OVERVIEW
36 1.2 Data Specification Method
1.3 Execution Condition
1
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.
■Rising edge
An instruction is executed one time when turned on. It is executed only once on the rising edge (off to on) of the precondition
of the instruction and is no longer executed later even when the condition turns on.
■Off
An instruction is executed during off. It is executed only while the precondition of the instruction is off. When the precondition
is on, the instruction is not executed.
■Falling edge
An instruction is executed one time when turned off. It is executed only once on the falling edge (on to off) of the precondition
of the instruction and is no longer executed later even when the condition turns off.
■Always
An instruction is always executed regardless of whether the precondition of the instruction is on or off. When the precondition
is off, the instruction performs off processing.
1 OVERVIEW
1.3 Execution Condition 37
2 PRECAUTIONS ON PROGRAMMING
*1 For a contact instruction, an error is not detected but the operation result becomes no continuity.
Ex.
When a global device is specified
Device assignment image in
BMOV D0 D1023 K10 the device/label memory
(1) D0
D1022
W0007
W03FF
(1) The transfer destination is in the range corresponding to D1023 to D1032. Because D1024 to D1032 do not exist, the data are written only to D1023.
2 PRECAUTIONS ON PROGRAMMING
38 2.1 Errors Common to Instructions
2.3 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. 2
For OUT instructions of the same device
More than one OUT instruction of the same device must not be issued during one scan.
Otherwise, the specified device turns on or off, depending on the operation result up to each OUT instruction while it is in
execution.
In this case, the device may turn on/off during one scan because the on/off state of the specified device is determined during
execution of each OUT instruction.
The following figure shows the behavior arising when a circuit turning on/off the same internal relay (M0) is created with input
X0 and X1.
X0 M0
X1 M0
X0 M0 X0 M0
X1 M0 X1 M0
ON ON
X0 OFF OFF
ON ON
X1 OFF OFF
ON ON
M0 OFF OFF
(4)
(2)
(1) (3)
If output (Y) is specified using an OUT instruction, the on/off state of the last OUT instruction executed during the one scan will
be output.
2 PRECAUTIONS ON PROGRAMMING
2.3 Operations Arising when the OUT, SET/RST, and PLS/PLF Instructions of the Same Device are Used 39
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.
■If the SET and RST instructions of the same device exist in one scan
If the SET and RST instructions of the same device exist in one scan, the SET instruction turns on the specified device if the
execution command is on, and turns off the specified device if it is on.
If both the SET and RST instructions are off, the on/off state of the specified device will be unchanged.
X0
SET M0
X1
RST M0
X0
X0
SET M0 SET M0
X1 X1
RST M0 RST M0
END END END
ON
X0 OFF OFF
ON
X1 OFF
ON
M0 OFF OFF
(2) (4)
(3)
(1)
(1) Since X0 is on, M0 turns on.
(2) Since X1 is off, M0 remains on. (The RST instruction results in non-processing.)
(3) Since X0 is off, M0 remains on. (The SET instruction results in non-processing.)
(4) Since X1 is on, M0 turns off.
If output (Y) is specified using a SET/RST instruction, the on/off state of the last SET/RST instruction executed during the one
scan will be output.
2 PRECAUTIONS ON PROGRAMMING
40 2.3 Operations Arising when the OUT, SET/RST, and PLS/PLF Instructions of the Same Device are Used
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. The specified device is turned off unless the
2
execution command specifies an off-to-on change.
Thus, if two or more PLS instructions are issued during one scan, the device turned on by a PLS instruction may not turn on
for one scan.
X0
PLS M0
X1
PLS M0
• If X0 and X1 differs in the on/off timing (i.e. the specified device does not turn on for one scan)
X0
X0
PLS M0 PLS M0
X1 X1
PLS M0 PLS M0
END END END
ON
X0 OFF OFF
ON
X1 OFF
ON ON
M0 OFF OFF
(2) (4)
(1) (3)
2 PRECAUTIONS ON PROGRAMMING
2.3 Operations Arising when the OUT, SET/RST, and PLS/PLF Instructions of the Same Device are Used 41
• If the off-to-on changes of X0 and X1 are at the same timing
X0
X0
PLS M0 PLS M0
X1 X1
PLS M0 PLS M0
END END END
ON
X0 OFF OFF
ON
X1 OFF
ON
M0 OFF OFF
(2) (4)
(1) (3)
If output (Y) is specified using a PLS instruction, the on/off state of the last PLS instruction executed during the one scan will
be output.
2 PRECAUTIONS ON PROGRAMMING
42 2.3 Operations Arising when the OUT, SET/RST, and PLS/PLF Instructions of the Same Device are Used
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. The specified device is turned off unless the
2
execution command specifies an on-to-off change.
Thus, if two or more PLF instructions are issued during one scan, the device turned on by a PLF instruction may not turn on
for one scan.
X0
PLF M0
X1
PLF M0
• If X0 and X1 differs in the on/off timing (i.e. the specified device does not turn on for one scan)
X0
X0
PLF M0 PLF M0
X1 X1
PLF M0 PLF M0
END END END
ON
X0 OFF
ON
X1 OFF
ON
M0 OFF OFF
(2) (4)
(1)
(3)
2 PRECAUTIONS ON PROGRAMMING
2.3 Operations Arising when the OUT, SET/RST, and PLS/PLF Instructions of the Same Device are Used 43
• If the on-to-off changes of X0 and X1 are at the same timing
X0
X0
PLF M0 PLF M0
X1 X1
PLF M0 PLF M0
END END END
ON
X0 OFF
ON ON
X1 OFF
ON
M0 OFF OFF
(2) (4)
(1) (3)
If output (Y) is specified using a PLF instruction, the on/off state of the last PLF instruction executed during the one scan will
be output.
2 PRECAUTIONS ON PROGRAMMING
44 2.4 Standard Function/Function Block Return Values
PART 2
PART 2 INSTRUCTION/
FUNCTION LIST
45
3 CPU MODULE INSTRUCTION
Contact instruction
■Operation start, series connection, parallel connection
Instruction symbol Description Reference
LD Starts logical operation (Starts NO contact logical operation) Page 104
LDI Starts logical NOT operation (Starts NC contact logical operation)
AND Logical AND (NO contact series connection)
ANI Logical NAND (NC contact series connection)
OR Logical OR (NO contact parallel connection)
ORI Logical NOR (NC contact parallel connection)
■Pulse NOT operation start, pulse NOT series connection, pulse NOT parallel connection
Instruction symbol Description Reference
LDPI Starts rising edge pulse NOT operation Page 108
LDFI Starts falling edge pulse NOT operation
ANDPI Rising edge pulse NOT series connection
ANDFI Falling edge pulse NOT series connection
ORPI Rising edge pulse NOT parallel connection
ORFI Falling edge pulse NOT parallel connection
Association instruction
■Ladder block series/parallel connection
Instruction symbol Description Reference
ANB AND between logical blocks (series connection between logical blocks) Page 110
ORB OR between logical blocks (parallel connection between logical blocks)
Output instruction
■Out (excluding the timer, counter and annunciator)
Instruction symbol Description Reference 3
OUT Device output Page 114
■Annunciator
Instruction symbol Description Reference
OUT F Annunciator Page 120
■Setting/resetting annunciator
Instruction symbol Description Reference
SET F Sets annunciator Page 125
RST F Resets annunciator Page 127
ANS Sets annunciator (with evaluation time) Page 129
ANR Resets annunciator (smallest number reset) Page 131
ANRP
(SM700, SM8022)
SFRP b15 b0
0∙∙∙0
(SM700, SM8022)
SFLP b15 b0
0∙∙∙0
(d)
BSFRP (SM700)
0
(d)
BSFLP (SM700)
(d)
DSFRP
0
(d)
DSFLP
0
(d)
(n2)
SFTRP
(s)
(d)
(n2)
WSFRP
(s)
Termination instruction
■Ending the main routine program
Instruction symbol Description Reference
FEND Ends the main routine program Page 161
Stop instruction
■Stopping the sequence program
Instruction symbol Description Reference
STOP Stops the sequence operation after input conditions are met. Page 164
Executes the sequence program, upon setting the RUN/STOP/RESET switch to RUN again.
DBK+_U
DBK+P_U
DBK- Subtracts the 32-bit binary bit data in the device area ((n) points) from (s1) and the 32-bit data or Page 243
constants in the device area ((n) points) from (s2) and later, and stores the result in the device area
DBK-P specified by (d) and later.
DBK-_U
DBK-P_U
BKANDP (n)
BKORP (n)
BKXORP (n)
BKXNRP (n)
BSETP 1
BRSTP 0
TESTP
(s2)
DTESTP
(s2)
ZRSTP (1)
(1): (d1), (d2) are bit devices: Writes off (reset) from (d1) to (d2)
(d1), (d2) are word devices: Writes K0 from (d1) to (d2)
DBCD Converts the specified 32-bit binary data (0 to 99999999) to BCD 8-digit data. Page 284
(s+1, s) (d+1, d)
DBCDP
BIN BCD
DBIN Converts the specified BCD 8-digit data (0 to 99999999) to 32-bit binary data. Page 288
(s+1, s) (d+1, d)
DBINP
BCD BIN
■Seven-segment decoding
Instruction symbol Description Reference
SEGD Decoded to data for the seven-segment display unit in the device specified by (s),and stores in the Page 329
device specified by (d).
SEGDP
Digital Switch
Instruction symbol Description Reference
DSW The value of the (n) sets of digital switches connected to (s), and stored for (d2). Page 345
■Shift move
Instruction symbol Description Reference
SMOV Shifts the specified no. of digits from the word device specified by (s), and store in (d). Page 351
SMOVP
(n)
BMOVP
(n) = 1 to 65535
(n) = 1 to 65535
(n) = 1 to 65535
SWAPP
b15 ··· b8 b7 ··· b0
(d) 8 bits 8 bits
DSWAPP
b15 ··· b8 b7 ··· b0 b15 ··· b8 b7 ··· b0
(d)+1 8 bits 8 bits (d) 8 bits 8 bits
Rotation instruction
■Rotating 16-bit data to the right
Instruction symbol Description Reference
ROR Rotates the 16-bit binary data to the right by (n) bit(s) (not including the carry flag). Page 371
(1)
(1): (n) bit right rotation
RCR Rotates the 16-bit binary data to the right by (n) bit(s) (including the carry flag).
b15 (d) b0 (SM700, SM8022)
RCRP
(1)
(1): (n) bit right rotation
(1)
(1): (n) bit left rotation
RCL Rotates the 16-bit binary data to the left by (n) bit(s) (including the carry flag).
(SM700, SM8022) b15 (d) b0
RCLP
(1)
(1): (n) bit left rotation
(1)
(1)
(1): (n) bit right rotation
(1)
(1): (n) bit left rotation
DRCL Rotates the 32-bit binary data to the left by (n) bit(s) (including the carry flag).
(d+1) (d) 3
(SM700, SM8022) b31 ∙∙∙ b16 b15 ∙∙∙ b0
DRCLP
(1)
■Jumping to END
Instruction symbol Description Reference
GOEND When the input condition is met, jump to END instruction Page 384
P: Pointer
POPP
P: Pointer
P: Pointer
3
■Deleting/inserting data from/to the data table
Instruction symbol Description Reference
FINS (s)
Page 412
FINSP
(n)
FDELP
(n)
DBINDA_U
DBINDAP_U
DEMOVP
DRAD
DRADP
DDEG
DDEGP
■Saving/returning the selected data of the index register and long index register
Instruction symbol Description Reference
ZPUSH Saves the contents of the index registers and long index registers in the range specified by (s) to Page 534
devices specified by (d) onwards.
ZPUSHP
ZPOP Reads data in the devices specified by (d) onwards to the index registers and long index registers. Page 536
ZPOPP
LIMIT_U
LIMITP_U
DLIMIT [(s3)+1, (s3)] < [(s1)+1, (s1)]: The [(s1)+1, (s1)] value is stored in [(d)+1, (d)] Page 539
[(s1)+1, (s1)] ≤ [(s3)+1, (s3)] ≤ [(s2)+1, (s2)]: The [(s3)+1, (s3)] value is stored in [(d)+1, (d)]
DLIMITP [(s2)+1, (s2)] < [(s3)+1, (s3)]: The [(s2)+1, (s2)] value is stored in [(d)+1, (d)]
DLIMIT_U
DLIMITP_U
BAND_U
BANDP_U
DBAND When [(s1)+1, (s1)] ≤ [(s3)+1, (s3)] ≤ [(s2)+1, (s2)]: 0 → (d+1, d) Page 543
When [(s3)+1, (s3)] < [(s1)+1, (s1)]: [(s3)+1, (s3)] - [(s1)+1, (s1)] → [(d)+1, (d)]
DBANDP When [(s2)+1, (s2)] < [(s3)+1, (s3)]: [(s3)+1, (s3)] - [(s2)+1, (s2)] → [(d)+1, (d)]
DBAND_U
DBANDP_U
ZONE_U
ZONEP_U
DZONE_U
DZONEP_U
SCLP_U
DSCL Executes scaling using the scaling conversion data (32-bit data units) specified by (s2) for the input Page 552
value specified by (s1), and then stores the result in the device specified by (d).
DSCLP The scaling conversion is executed based on the scaling conversion data stored in the device
specified by (s2) onwards.
DSCL_U
DSCLP_U
SCL2P_U
DSCL2 Executes scaling using the scaling conversion data (32-bit data units) specified by (s2) for the input Page 558
value specified by (s1), and then stores the result in the device specified by (d).
DSCL2P The scaling conversion is executed based on the scaling conversion data stored in the device
specified by (s2) onwards.
DSCL2_U
DSCL2P_U
Initial State
■Initial State
Instruction symbol Description Reference
IST Automatically controls the initial state and special relays in a step ladder program. Page 612
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 622
■Relative method
Instruction symbol Description Reference
INCD This instruction compares the current value of a counter with the data table having (n) lines starting Page 626
from (s1) (which occupies (n) lines × 1 device). If the counter value is equivalent to the table data,
the current output is reset, and the ON/OFF status of the specified sequential outputs is controlled.
Check code
■Check code
Instruction symbol Description Reference
CCD This instruction calculates the sum data and horizontal parity value of data stored in (s) to (s)+(n)-1. Page 628
The sum data is stored in (d), and the horizontal parity value is stored in (d)+1.
CCDP
32 bits
(s1)
(s2)
DSERMMP (n)
SUMP
(d)
DSUMP (d)
3
(d): Total number of 1s
BONP
(1)
(1): b(n) ON → (d)=On
b(n) OFF → (d)=Off
DBON (s) Page 639
b31 ······ b0
DBONP
(1)
(1): b(n) ON → (d)=On
b(n) OFF → (d)=Off
■CRC calculation
Instruction symbol Description Reference
CRC This instruction generates a CRC value for (n) 8-bit data (unit: byte) starting from the device Page 667
specified by (s), and stores the CRC value to (d).
CRCP
(1)
ADRSETP
(2)
(1): Indirect address of the specified device
(2): Device name
3
Clock instruction
■Reading clock data
Instruction symbol Description Reference
TRD (d)+0: Year Page 671
(1) (d)+0
(d)+1 (d)+1: Month
(d)+2 (d)+2: Day
(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
(1): Result
LDDT>, ANDDT>, ORDT>
(s1) year (s2) year
(s1)+1 month > (s2)+1 month (1)
(s1)+2 day (s2)+2 day
(1): Result
LDDT<=, ANDDT<=,
(s1) year (s2) year
ORDT<= (s1)+1 month <= (s2)+1 month (1)
(s1)+2 day (s2)+2 day
(1): Result
LDDT<, ANDDT<, ORDT<
(s1) year (s2) year
(s1)+1 month < (s2)+1 month (1)
(s1)+2 day (s2)+2 day
(1): Result
LDDT>=, ANDDT>=,
(s1) year (s2) year
ORDT>= (s1)+1 month >= (s2)+1 month (1)
(s1)+2 day (s2)+2 day
(1): Result
■Hour meter
Instruction symbol Description Reference
HOURM This instruction adds the time during which the input contact is ON in units of 1 hour, turns ON the Page 699
device specified by (d2) when the total ON time exceeds the time specified by (s) (16-bit binary
data), and stores the current value in units of 1 hour (16-bit binary data) to (d1), and the current
value that is less than one hour (16-bit binary data) to (d1)+1 in units of seconds.
DHOURM This instruction adds the time during which the input contact is ON in units of 1 hour, turns ON the Page 701
device specified by (d2) when the total ON time exceeds the time specified by (s) (32-bit binary
data), and stores the current value in units of 1 hour (32-bit binary data) to (d1), and the current
value that is less than one hour (16-bit binary data) to (d1)+2 in units of seconds.
Logging instructions
■Setting/resetting trigger logging 3
Instruction symbol Description Reference
LOGTRG Generates a trigger for trigger logging. Data sampled for the number of records (specified in the Page 717
trigger logging setting parameter using the engineering tool) are stored in the data logging file.
■Closing a connection
Instruction symbol Description Reference
SP.SOCCLOSE This instruction closes the connection specified by (s1). (Closing a connection) Page 725
■Sending data
Instruction symbol Description Reference
SP.SOCSND This instruction sends the data set in (s3) to the target device of the connection specified by (s1). Page 730
Setting parameters
Instruction symbol Description Reference
G.CCPASET Sets parameters in the FX5-CCLIEF (own station). Page 782
Use the G(P).CCPASET instruction to set parameters in the following cases.
GP.CCPASET
• If you want to change parameters without resetting the CPU module
• If you want to mount more intelligent device station modules than the number of modules set by
the engineering tool
HIOENP
DHIOENP
Serial communication 2
Instruction symbol Description Reference
RS2 Sends/receives data by non-protocol communication. Page 804
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 825
Specifies the proximity dog signal, zero signal and device (Y). Outputs a pulse with the specified
DDSZR Page 829
device (Y) to perform the zero return operation.
• When FX5 operand is specified
Specifies the original position return speed, creep speed and axis number. Outputs a pulse with the
specified axis to perform the zero return operation.
Positioning module
4
■Restoring the absolute position
Instruction symbol Description Reference
G.ABRST1 Restores the absolute position of specified axis. Page 864
G.ABRST2
■Teaching
Instruction symbol Description Reference
GP.TEACH1 Performs teaching for the specified axis. Page 870
GP.TEACH2
Absolute value
Function symbol Description Reference
ABS Outputs the absolute value of an input value. Page 958
ABS_E
Square root
Function symbol Description Reference
SQRT Outputs the square root of an input value. Page 960
SQRT_E
Exponential operation
Function symbol Description Reference
EXP Outputs the exponential operation result of an input value. Page 964
EXP_E
Sine operation
Function symbol Description Reference
SIN Outputs the sine of the angle of an input value. Page 965
SIN_E
Cosine operation
Function symbol Description Reference
COS Outputs the cosine of the angle of an input value. Page 966
COS_E
Tangent operation
Function symbol Description Reference
TAN Outputs the tangent of the angle value of an input value. Page 967
TAN_E
Addition
Function symbol Description Reference
5
ADD Outputs the sum of input values ((s1) + (s2) + ... + (s28)). Page 971
ADD_E
Multiplication
Function symbol Description Reference
MUL Outputs the product of input values ((s1) × (s2) × ... × (s28)). Page 973
MUL_E
Subtraction
Function symbol Description Reference
SUB Outputs the difference of input values ((s1) - (s2)). Page 975
SUB_E
Division
Function symbol Description Reference
DIV Outputs the quotient of input values ((s1) ÷ (s2)). Page 977
DIV_E
Remainder
Function symbol Description Reference
MOD Outputs the remainder of input values ((s1) ÷ (s2)). Page 979
MOD_E
Exponentiation
Function symbol Description Reference
EXPT Outputs the exponentiation of an input value. Page 981
EXPT_E
Move operation
Function symbol Description Reference
MOVE Assigns an input value to (d). Page 983
MOVE_E
Selection
Function symbol Description Reference
SEL Outputs a selected input value. Page 996
SEL_E
Limit Control
Function symbol Description Reference
LIMIT Outputs an input value controlled with the upper and lower limits. Page 1000
LIMIT_E
Compare
Function symbol Description Reference
GT Outputs the data comparison result of input values. Page 1004
GT_E
GE
GE_E
EQ 5
EQ_E
LE
LE_E
LT
LT_E
NE Page 1006
NE_E
String concatenation
Function symbol Description Reference
CONCAT Concatenates character strings and output the result. Page 1013
CONCAT_E
Addition
Function symbol Description Reference
ADD_TIME Outputs the sum of input values (time data) ((s1) + (s2)). Page 1024
ADD_TIME_E
Subtraction
Function symbol Description Reference
SUB_TIME Outputs the difference of input values (time data) ((s1) - (s2)). Page 1026
SUB_TIME_E
Multiplication
Function symbol Description Reference
MUL_TIME Outputs the product of input values (time data) ((s1) × (s2)). Page 1028
MUL_TIME_E
Division
Function symbol Description Reference
DIV_TIME Outputs the quotient of input values (time data) ((s1) ÷ (s2)). Page 1030
DIV_TIME_E
Up counter
Function block symbol Description Reference
CTU Counts up the number of times of rising of a signal. Page 1042
CTU_E
Down counter
Function block symbol Description Reference
CTD Counts down the number of times of rising of a signal. Page 1044
CTD_E
Up/Down counter
Function block symbol Description Reference
CTUD Counts up/down the number of times of rising of a signal. Page 1046
CTUD_E
Pulse timer
Function block symbol Description Reference
TP Keeps ON a signal for specified duration. Page 1051
TP_E
TP_10
TP_10_E
On-delay timer
Function block symbol Description Reference
TON Turns ON a signal after a specified time. Page 1053
TON_E
TON_10
TON_10_E
Off-delay timer
Function block symbol Description Reference
TOF Turns OFF a signal after a specified time. Page 1055
TOF_E
TOF_10
TOF_10_E
6 SEQUENCE INSTRUCTIONS
7 BASIC INSTRUCTIONS
8 APPLICATION INSTRUCTION
103
6 SEQUENCE INSTRUCTIONS
(s)
ANI
OR (s)
ORI (s)
FBD/LD
In the FBD/LD language, contact is used as well as the Ladder diagram.
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Device used as contact Bit ANY_BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DX)
F, B, SB, S SD, SW, R
(s)
6 SEQUENCE INSTRUCTIONS
104 6.1 Contact Instructions
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*1 of the specified device, and use the result as the
operation result.
*1 When bits of word devices are specified, devices turn ON/OFF by the 1/0 status of the specified bit.
■AND, ANI
• The AND instruction is NO contact series connection instruction and the ANI instruction is NC contact series connection
instruction. These instructions capture the ON/OFF information*1 of the specified bit device, AND with the operation result
so far, and use the result as the operation result.
*1 When bits of word devices are specified, devices turn ON/OFF by the 1/0 status of the specified bit.
• There is no limitation to the number of series contacts. Any number of contacts can use this instructions consecutively.
• Output to other coils through contacts after the OUT instruction is called cascade output, and these outputs can be
repeated any number of times as long as their order is correct.
■OR, ORI
• The OR instruction is NO contact parallel connection and the ORI instruction is NC contact parallel connection. These
instructions capture the ON/OFF information*1 of the specified device, OR with the operation result so far, and use the 6
result as the operation result.
*1 When bits of word devices are specified, devices turn ON/OFF by the 1/0 status of the specified bit.
• These instructions are connected in parallel from the step with this instruction to the previous step with the LD and LDI
instruction.
• There is no limitation in the number of parallel connections.
• When bits of word devices are specified, bits are specified in hexadecimal. (For example, b11 of D0 is
specified by "D0.B".)
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
6.1 Contact Instructions 105
Pulse operation start, pulse series connection, pulse parallel
connection
(s)
ANDP
(s)
ANDF
ORP (s)
ORF (s)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Device used as contact Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DX)
F, B, SB, S SD, SW, R
(s)
6 SEQUENCE INSTRUCTIONS
106 6.1 Contact Instructions
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. When only the LDP instruction is programmed, operation is
the same as the conversion of the instruction under execution to pulse instruction (P).
The following figure shows an example when a ladder using the LDP instruction is replaced with a ladder not using the LDP
instruction.
X0 X0
MOV K0 D0 MOVP K0 D0
X0 X0
M0 PLS M0
• The LDF instruction is the falling edge pulse operation start instruction, and becomes conductive (ON) at the falling edge
(ON to OFF) of the specified bit device. When word devices are specified by bits, this instruction becomes conductive only
when the status of the specified bit changes to 1→0.
■ANDP, ANDF 6
• The ANDP instruction is the rising edge pulse series connection instruction, and the ANDF instruction is the falling edge
pulse series connection. These instructions AND with the operation result so far, and uses the result as the operation result.
The table below shows the ON/OFF information used by these instructions.
Device specified by ANDP, ANDF ANDP status ANDF status
Bit device Bit specification of word
device
OFF to ON 0→1 ON OFF
OFF 0 OFF OFF
ON 1 OFF OFF
ON to OFF 1→0 OFF ON
■ORP, ORF
• The ORP instruction is the rising edge pulse parallel connection instruction, and the ORF instruction is the falling edge
pulse parallel connection instruction. These instructions OR with the operation result so far, and use the result as the
operation result. The table below shows the ON/OFF information used by these instructions.
Device specified by ORP, ORF ORP status ORF status
Bit device Bit specification of word
device
OFF to ON 0→1 ON OFF
OFF 0 OFF OFF
ON 1 OFF OFF
ON to OFF 1→0 OFF ON
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
6.1 Contact Instructions 107
Pulse NOT operation start, pulse NOT series connection, pulse
NOT parallel connection
(s)
ANDPI
(s)
ANDFI
ORPI (s)
ORFI (s)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Device used as contact Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DX)
F, B, SB, S SD, SW, R
(s)
6 SEQUENCE INSTRUCTIONS
108 6.1 Contact Instructions
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.
• The LDFI instruction is the falling edge pulse NOT operation start instruction, and becomes conductive (ON) at the rising
edge (OFF to ON), OFF and ON of the specified bit device. When word devices are specified by bits, this instruction
becomes conductive (ON) when the status of the specified bit is 0, 1, and when it changes 0→1. The table below shows the
ON/OFF information used by these instructions.
Device specified by LDPI, LDFI LDPI status LDFI status
Bit device Bit specification of word
device
OFF to ON 0→1 OFF ON
OFF 0 ON ON
ON 1 ON ON
ON to OFF 1→0 ON OFF
■ANDPI, ANDFI 6
• The ANDPI instruction is the rising edge pulse NOT series connection instruction, and the ANDFI instruction is the falling
edge pulse NOT series connection instruction. These instructions AND with the operation result so far, and use the result
as the operation result. The table below shows the ON/OFF information used by these instructions.
Device specified by ANDPI, ANDFI ANDPI status ANDFI status
Bit device Bit specification of word
device
OFF to ON 0→1 OFF ON
OFF 0 ON ON
ON 1 ON ON
ON to OFF 1→0 ON OFF
■ORPI, ORFI
• The ORPI instruction is the rising edge pulse NOT parallel connection instruction, and the ORFI instruction is the falling
edge pulse NOT parallel connection instruction. These instructions OR with the operation result so far, and use the result
as the operation result. The table below shows the ON/OFF information used by these instructions.
Device specified by ORPI, ORFI ORPI status ORFI status
Bit device Bit specification of word
device
OFF to ON 0→1 OFF ON
OFF 0 ON ON
ON 1 ON ON
ON to OFF 1→0 ON OFF
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
6.1 Contact Instructions 109
6.2 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 B
ANB
ORB
B
A: A block
B: B block
FBD/LD
Not supported.
Processing details
■ANB
• This instruction ANDs the A and B blocks, and uses the result as the operation result.
• The symbol of this instruction is not NO contact symbol but a connection symbol.
■ORB
• This instruction ORs the A and B blocks, and uses the result as the operation result.
• This instruction connects the ladder blocks of two contacts or more in parallel. For parallel connection of only one contact,
use the OR and ORI instructions; there is no need to use this instruction.
• The symbol of this instruction is not NO contact symbol but a connection symbol.
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
110 6.2 Association Instruction
Storing/reading/clearing the operation result
MRD
MPP
FBD/LD
EN ENO
6
Processing details
■MPS
• This instruction stores the preceding operation result (ON/OFF) to memory.
• This instruction can be used up to 16 times consecutively. When MPP instruction is used in between, the number of uses of
MPS instruction is decremented by 1.
■MRD
• This instruction reads the operation result stored by the MPS instruction to memory, and executes operations from the next
step using that operation result.
■MPP
• This instruction reads the operation result stored by the MPS instruction to memory, and executes operations from the next
step using that operation result.
• This instruction clears the operation result stored by the MPS instruction from memory.
• The number of uses of MPS instruction is decremented by 1.
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
6.2 Association Instruction 111
Inverting the operation result
INV
This instruction inverts the operation result up to this instruction.
Ladder diagram Structured text
ENO:=INV(EN);
FBD/LD
EN ENO
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
OFF ON
ON OFF
Operation error
There is no operation error.
• This instruction operates using the operation result so far. Hence, use it at the same position as the AND
instruction. This instruction cannot be used at positions where the LD and OR instructions are programmed.
• If a ladder block is used, the operation result is inverted within the range of the ladder block. When
operating a ladder with this instruction and the ANB instruction, pay attention to the inversion range.
M0 M1 M2
Y10
M10 M20
ANB
END
6 SEQUENCE INSTRUCTIONS
112 6.2 Association Instruction
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.
Ladder diagram Structured text
ENO:=MEP(EN);
MEP ENO:=MEF(EN);
MEF
FBD/LD
EN ENO 6
Processing details
■MEP
• This instruction turns ON (conductive state) at the rising edge (OFF to ON) of the operation result up to this instruction. This
instruction turns OFF (non-conductive state) in instances other than the rising edge of the operation result up to this
instruction.
• Use of this instruction makes conversion to pulse easier when multiple contacts are connected in series.
■MEF
• This instruction turns ON (conductive state) at the falling edge (ON to OFF) of the operation result up to this instruction.
This instruction turns OFF (non-conductive state) in instances other than the falling edge of the operation result up to this
instruction.
• Use of this instruction makes conversion to pulse easier when multiple contacts are connected in series.
Operation error
There is no operation error.
• If an indexed contact is converted to pulse by the subroutine program and the FOR to NEXT instructions,
etc., these instructions may not function properly.
• These instructions operate using the operation result so far. Hence, use them at the same position as the
AND instruction. These instructions cannot be used at positions where the LD and OR instructions are
programmed.
6 SEQUENCE INSTRUCTIONS
6.2 Association Instruction 113
6.3 Output Instructions
Out (excluding the timer, counter and annunciator)
OUT
This instruction outputs the operation result up to this instruction to the specified device.
Ladder diagram Structured text
ENO:=OUT(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Number of the device that turns ON/OFF Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(d) *1 *2 *3 *4
Processing details
• This instruction outputs the operation result up to this instruction to the specified device.
Condition Operation result Coil/specified bit
When bit device is used OFF OFF
ON ON
When bit of word device is specified OFF 0
ON 1
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
114 6.3 Output Instructions
Timer
FBD/LD
EN ENO
Coil
Value
*1 In the case of the ST language and the FBD/LD language, d displays as Coil.
*2 In the case of the ST language and the FBD/LD language, Set value displays as Value.
*3 Only timer type/retentive timer type label can be used.
*4 In the case of the OUT_T instruction of the ST language and the FBD/LD language , data type is ANY_INT.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
(Set value) *2 *3
Processing details
• These instructions count 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 reaches the end of its count (current value ≥ set value), NO
contact becomes conductive and NC contact becomes non-conductive.
• Operation is as follows when the operation result up to the OUT instruction changes from ON to OFF.
Timer type Timer coil Current timer Before time-out After time-out
value NO contact NC contact NO contact NC contact
Timer off 0 Non-Conductive Conductive state Non-Conductive Conductive state
state state
Retentive timer off Holds current value Non-Conductive Conductive state Conductive state Non-Conductive
state state
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 115
• After the timer times up, clear the current value of the retentive timer and turn the contact off by the RST instruction.
• When the set value is 0, the timer times up when the OUT instruction is executed.
• The following processing is executed when the OUT instruction is executed:
• The coil in the OUT T, OUTH T, OUTHS T, OUT ST, OUTH ST and OUTHS ST instructions turns ON/OFF
• The contact in the OUT T, OUTH T, OUTHS T, OUT ST, OUTH ST and OUTHS ST instructions turns ON/OFF
• The current value in the OUT T, OUTH T, OUTHS T, OUT ST, OUTH ST and OUTHS ST instructions changes
• When the OUT T instruction is skipped using the CJ instruction, etc. while the OUT T and OUT ST instructions are ON,
these instructions do not update the current value or turn ON/OFF the contacts.
• When the same OUT T and OUT ST instructions are executed in the same scan twice or more, these instructions update
the current value for the same number of times of execution.
Values used for timers can be set in the range 1 to 32767. Actual timer constants are as follows since the
OUT, OUTH, and OUTHS instructions operate as 100 ms, 10 ms, and 1 ms timers, respectively.
• OUT instruction: 0.1 to 3276.7 seconds
• OUTH instruction: 0.01 to 327.67 seconds
• 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. In the following instance, all timers turn on in the same scan when the program is created in the
measurement order.
• When the set value is shorter than the scan time
• When the set value is 1
Ex.
When the T0 to T2 timers are programmed in order from the timer that is measured later
T1
(1) The T2 timer starts measurement from the scan following the scan where the T1
OUT T2 K1 (1)
contact turns ON.
(2) The T1 timer starts measurement from the scan following the scan where the T0
T0 contact turns ON.
OUT T1 K1 (2) (3) The T0 timer starts measurement when X0 turns ON.
X0
OUT T0 K1 (3)
Ex.
When the T0 to T2 timers are programmed in measurement order
X0
(1) The T0 timer starts measurement when X0 turns ON.
OUT T0 K1 (1)
(2) The contacts of the T1 and T2 timers also turn on when the contact of T0 turns ON.
T0
OUT T1 K1
(2)
T1
OUT T2 K1
Operation error
Error code Remarks
(SD0/SD8067)
3405H A negative value is specified for the timer value.
6 SEQUENCE INSTRUCTIONS
116 6.3 Output Instructions
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.
Ladder diagram Structured text
ENO:=OUT_C(EN,Coil,Value);
(d) Value
FBD/LD
EN ENO
Coil
Value
*1 In the case of the ST language and the FBD/LD language, d displays as Coil.
*2 In the case of the ST language and the FBD/LD language, Set value displays as Value.
*3 Only timer type/retentive timer type label can be used.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
(Set value) *2 *3
Processing details
• 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 (current value ≥ set value), NO
contact becomes conductive and NC contact becomes non-conductive.
• The counter does not count while the operation result remains on. (Count input does not need to be converted to pulses.)
• After a count up, the count value and contact status do not change until the RST instruction is executed.
• When the set value is 0, the same processing as for set value 1 is performed.
Operation error
Error code Remarks
(SD0/SD8067)
3405H A negative value is specified for the set value.
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 117
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.
Ladder diagram Structured text
ENO:=OUT_C(EN,Coil,Value);
(d) Value
FBD/LD
EN ENO
Coil
Value
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
*1
(d) Long counter number Long counter ANY*3
(Set value)*2 Long counter set value 0 to 4294967295 32-bit unsigned binary ANY_INT
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, d displays as Coil.
*2 In the case of the ST language and the FBD/LD language, Set value displays as Value.
*3 Only timer type/retentive timer type label can be used.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
*1 *2
(Set value)
Processing details
• 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 (current value ≥ set value),
NO contact becomes conductive and NC contact becomes non-conductive.
• The counter does not count while the operation result remains on. (Count input does not need to be converted to pulses.)
• After a count up, the count value and contact status do not change until the RST or ZRST instruction is executed.
• When the set value is 0, the same processing as for set value 1 is performed.
• When signed (-2147483648 to + 2147483647) or high speed counter is assigned to the LC, the UDCNTF instruction is
used. For the UDCNTF instruction, refer to Page 565 UDCNTF.
6 SEQUENCE INSTRUCTIONS
118 6.3 Output Instructions
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 119
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Annunciator number that turns ON Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
Processing details
• This instruction outputs the operation result up to the OUT F instruction to the specified annunciator.
• Operation is as follows when annunciator (F) is turned ON by the OUT F instruction.
• The annunciator number (F number) that turns ON is stored in special registers (SD64 to SD79).
• The content of SD63 is incremented by 1.
• When the content of SD63 is 16 (16 annunciators are already on), the annunciator number that turns ON is not stored in
SD64 to SD79 even if a new annunciator turns ON.
• Operation is as follows when annunciator (F) is turned OFF by the OUT F instruction:
• The coil turns OFF, but the contents of SD64 to SD79 do not change.
• To delete an annunciator that has turned OFF by the OUT F instruction from SD64 to SD79, use the RST F instruction.
■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.
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
120 6.3 Output Instructions
Setting devices (excluding annunciator)
SET
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);
(d)
FBD/LD
EN ENO
Setting data 6
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Bit device number/ Bit specification of word device to be Bit ANY_BOOL
set (turns ON)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(d) *1 *2 *3
Processing details
• The status of the specified device changes as follows when the execution command turns ON.
Device Device status
Bit devices Turns coils and contacts ON.
Bit specification of word device Sets the specified bit to 1.
• A device that is turned ON is held on even if the execution command turns OFF. Devices that are turned ON by the SET
instruction can be turned OFF by the RST instruction.
ON
X5
SET Y10 X5 OFF
ON
X7
RST Y10 X7 OFF
ON
Y10 OFF
• When the execution command is OFF, the device status does not change.
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 121
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
122 6.3 Output Instructions
Resetting devices (excluding annunciator)
RST
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.
• Bit specification of word device: Sets the specified bit to 0.
• Word devices, module access devices, index registers: Sets content to 0.
Ladder diagram Structured text
ENO:=RST(EN,d);
(d)
FBD/LD
EN ENO
d
6
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Bit device number/ bit specification of word device to be Bit/word/double word ANY_ELEMENTARY
reset, or word device number to be reset
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(d) *1 *2
Processing details
• The status of the specified device changes as follows when the execution command turns ON.
Device Device status
Bit devices Turns coils and contacts OFF.
Timers, counters Sets the current value to 0, and turns coils and contacts OFF.
Bit specification of word device Set the specified bit to 0.
Word devices, module access device, index registers Sets content to 0.
• When the execution command is OFF, the device status does not change.
• Function when a word device is specified by the RST instruction is the same as the following circuit.
X10 X10
RST D50 MOV K0 D50
Precautions
When the RST instruction for a timer or counter is executed by a program containing a jump or by a subroutine program or
interrupt program, the timer or counter is held in a reset state, and the timer or counter may not work normally.
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 123
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
124 6.3 Output Instructions
Setting annunciator
SET F
This instruction turns ON the specified annunciator.
Ladder diagram Structured text
ENO:=SET(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types 6
Operand Remarks Range Data type Data type (label)
(d) Annunciator number (F number) that is set Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
Processing details
• This instruction turns ON the annunciator specified by (d) when the execution command turns ON.
• Operation is as follows when annunciator (F) is turned ON.
• The annunciator number (F number) that turns ON is stored in special registers (SD64 to SD79).
• The content of SD63 is incremented by 1.
• When the content of SD63 is 16 (16 annunciators are already ON), the annunciator number that turns ON is not stored in
SD64 to SD79 even if a new annunciator turns ON.
SD63 16 SD63 16
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 125
■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.
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
126 6.3 Output Instructions
Resetting annunciator
RST F
This instruction turns OFF the specified annunciator.
Ladder diagram Structured text
ENO:=RST(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types 6
Operand Remarks Range Data type Data type (label)
(d) Annunciator number (F number) that is reset Bit ANY_ELEMENTARY
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 127
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.
• When the content of SD63 is 16, annunciator numbers are deleted from SD64 to SD79 by the RST instruction. Also, if an
annunciator not registered in SD64 to SD79 turns ON, its number is registered. When there are two or more unregistered
numbers, this instruction adds the numbers starting from the smallest annunciator number. SD63 is not decremented by 1
when the numbers not registered in SD64 to SD79 are turned OFF.
SD67 28
SD77 145
■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..
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
128 6.3 Output Instructions
Setting annunciator (with check time)
ANS
This instruction sets the annunciator (F device).
Ladder diagram Structured text
ENO:=ANS(EN,s,n,d);
FBD/LD
EN ENO
s d
Setting data
6
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Timer number for evaluation time 16-bit signed binary ANY16
(n) Evaluation time data 1 to 32767 16-bit unsigned binary ANY16_U
(d) Annunciator device to be set Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(n)
(d) *2
Processing details
• This instruction sets (d) when the command input remains ON continuously for the evaluation time [(n)×100 ms, (s)] or
more. This instruction resets the current value of (s) evaluation timer and does not set (d) when the command time is less
than the evaluation time [(n)×100 ms]. Also, this instruction resets the evaluation timer when the command input turns OFF.
X1
X1
ANS (s) (n) (d)
(d)
(1) (2)
(1): Less than the evaluation time ((n) × less than 100 ms)
(2): Equivalent to or longer than the evaluation time ((n) × 100 ms or more)
■Related devices
Device Name Remarks
SM8049 ON status annunciator smallest number When SM8049 is turned ON, SM8048 and SD8049 are enabled.
enabled
SM8048 Annunciator operation When one of the F devices is operating, SM8048 turns ON.
SD8049 ON status annunciator smallest number The smallest number of the F devices that are operating is stored.
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 129
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
130 6.3 Output Instructions
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
EN ENO
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. If the command input is
turned ON again, this instruction resets the annunciator with the next smallest number among annunciators (F devices) that
6
are operating.
X1
ANR
■Related devices
Device Name Remarks
SM8049 On status annunciator smallest number When SM8049 is turned ON, SM8048 and SD8049 are enabled.
enabled
SM8048 Annunciator operation When one of the F devices is operating, SM8048 turns ON.
SD8049 On status annunciator smallest number The smallest number of the F devices that are operating is stored.
Precautions
• When ANR instruction is used, annunciators in the ON status are reset in turn in each operation cycle.
• This is executed for only 1 operation cycle (only once) when the ANRP instruction is used.
Operation error
There is no error.
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 131
Rising edge output
PLS
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Device to be converted to pulse Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(d) *1 *2
Processing details
• This instruction turns ON the specified device for one scan when the PLS command turns from OFF to ON, and turns OFF
in other cases. When there is one PLS instruction programmed for the device specified by (d) during a scan, the specified
device turns ON for one scan.
ON
X5 OFF
X5
PLS M0 ON
M0 OFF
Sc Sc
Sc: 1 scan
6 SEQUENCE INSTRUCTIONS
132 6.3 Output Instructions
• 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.
X0
PLS M0
(4) (4)
LD X0 (3) LD X0 (3) LD X0
PLS M0 PLS M0 PLS M0
END 0 END END 0
ON (2) (2)
X0 OFF ON
M0 OFF
(1)
Precautions
• When write during RUN is completed for a circuit including a rising edge instruction (LDP/ANDP/ORP instruction), the
6
instruction is not executed regardless of the ON/OFF status of the target device of the rising edge instruction. Also, in the
case of a rising edge instruction (PLS instruction), the instruction is not executed regardless of the ON/OFF status of the
device that is set as the operation condition. The instruction is executed when the target device and the device in the
operation conditions is set from OFF to ON again.
• Note that the device specified by (d) sometimes turns ON for one scan or more when the PLS instruction is made to jump
by the CJ instruction or the executed subroutine program was not called by the CALL(P) instruction.
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 133
Falling edge output
PLF
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Device to be converted to pulse Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(d) *1 *2
Processing details
• This instruction turns ON the specified device for one scan when the PLF command turns OFF from ON, and turns OFF in
other cases. When there is one PLF instruction programmed for the device specified by (d) during a scan, the specified
device turns ON for one scan.
ON
X5 OFF
X5
PLF M0 ON
M0 OFF
Sc Sc
Sc: 1 scan
• If the RUN/STOP/RESET switch is changed from RUN to STOP after execution of the PLF instruction, the PLF instruction
will not be executed even if the switch is set to RUN again.
6 SEQUENCE INSTRUCTIONS
134 6.3 Output Instructions
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. The instruction is executed when the target device and the device in the
operation conditions is set from ON to OFF again.
• Note that the device specified by (d) sometimes turns ON for one scan or more when the PLF instruction is made to jump
by the CJ instruction or the executed subroutine program was not called by the CALL(P) instruction.
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 135
Inverting the bit device output
FF
This instruction reverses the output status of the device specified by (d) when the execution command changes from OFF to
ON.
Ladder diagram Structured text
ENO:=FF(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Device number to be reversed Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(d) *1 *2
Processing details
• This instruction reverses the state of the device specified by (d) when the execution command changes from OFF to ON.
Device Device status
Before execution of FF After execution of FF
instruction instruction
Bit devices OFF ON
ON OFF
Bit specification of word device 0 1
1 0
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
136 6.3 Output Instructions
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
6
Operand Remarks Range Data type Data type (label)
(d) Bit device number whose output is alternated Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1 *2
Processing details
■Alternating output (1-step)
The bit device specified by (d) is reversed ON ↔ OFF each time the command input changes from OFF to ON.
X1 X1 ON ON ON
ALTP (d)
(d) ON ON
X1 ON ON ON ON
(d)
X1
ALTP M0 M0 (d) ON ON
(1) (d)
M0
ALTP M1 M1 (d) ON
Precautions
When the CPU module is programmed with the ALT instruction, reversal operation is performed at every operation cycle. To
perform reversal operation by command ON/OFF, either use the ALTP instruction (pulse execution type) or set a command
contact as LDP etc. (pulse execution type).
6 SEQUENCE INSTRUCTIONS
6.3 Output Instructions 137
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
138 6.3 Output Instructions
6.4 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).
Ladder diagram Structured text
ENO:=SFT(EN,d);
ENO:=SFTP(EN,d);
(d)
FBD/LD
EN ENO
6
d
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Device number to receive shift Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(d) *1
Processing details
■In case of bit device
• This instruction shifts the ON/OFF status of the device before the device specified by (d) to the device specified by (d). The
device before the device specified by (d) turns OFF.
Ex.
When M11 is specified by the SFTP instruction and the SFTP instruction is executed, the ON/OFF status of M10 is shifted to
M11 and M10 is turned OFF.
• Turn ON the first device to be shifted by the SET instruction.
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 139
• When the SFT(P) instruction is used consecutively, create the program to start from the device with the largest number.
(9)
(8)
(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
(7): After the 5th shift input
(8): First device of shift
(9): Shift range
Ex.
When D0.5 (bit 5 (b5) of D0) is specified by the SFT(P) instruction and the SFT(P) instruction is executed, the 1/0 status of b4
of the D0 is shifted to b5 and b4 is set to 0.
b15 … b5 b4 … b0
(1) 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1
D0 0
(2) 0 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1
(1): Before shift execution
(2): After shift execution
Operation error
Error code Remarks
(SD0/SD8067)
2820H The device specified by (d) exceeds the corresponding device range.
6 SEQUENCE INSTRUCTIONS
140 6.4 Shift Instructions
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);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
6
Operand Remarks Range Data type Data type (label)
(d) Head device number where the shift-target data is stored 16-bit signed binary ANY16
(n) Number of shifts 0 to 15 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
• This instruction shifts the 16-bit data in the device specified by (d) to the right by (n) bit(s) from the most significant bit. The
(n) bit(s) from the most significant bit is/are filled with 0(s).
When (n)=6
0
• When (d) is a bit device, bits are shifted to the right within the device range specified by nibble specification.
When (n)=4
Y23 ··· Y20 Y17 ··· Y14 Y13 ··· Y10 (SM700, SM8022)
0 0 0 0 1 0 1 0 1 0 1 0 1
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 141
• 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.
■Related devices
Device Name Remarks
SM700 Carry ON/OFF according to the status (1/0) of the (n-1)th bit.
SM8022
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
142 6.4 Shift Instructions
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);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
6
Operand Remarks Range Data type Data type (label)
(d) Head device number where the shift-target data is stored 16-bit signed binary ANY16
(n) Number of shifts 0 to 15 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
• These instructions shift the 16-bit data in the device specified by (d) to the left by (n) bit(s) from the least significant bit. (n)
bits from the least significant bit are filled with "0".
When (n)=8
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 (d)
(SM700, SM8022)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 (d)
• When (d) is a bit device, bit(s) are shifted to the left within the device range specified by nibble specification.
When (n)=3
X17 ··· X14 X13 ··· X10
0 0 1 1 0 0 1 1
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 143
• 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.
■Related devices
Device Name Remarks
SM700 Carry ON/OFF according to the status (1/0) of the (n-1)th bit.
SM8022
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
144 6.4 Shift Instructions
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);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
6
Operand Remarks Range Data type Data type (label)
(d) Head device number to be shifted Bit ANY_BOOL
(n) Number of devices to be shifted 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
(n)
Processing details
• These instructions shift (n) point(s) of data to the right by 1 bit from the device specified by (d).
(n)
(d)+(n-1) (d)+(n-2) (d)+(n-3) ··· (d)+2 (d)+1 (d)
1 1 0 1 1 0
0
• The value of the device specified by (d) + (n-1) becomes 0.
■Related devices
Device Name Remarks
SM700 Carry ON/OFF according to the status (1/0) of the (d) bit.
Operation error
Error code Remarks
(SD0/SD8067)
2820H The (n) points of data starting from the device specified by (d) exceed in the corresponding device.
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 145
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);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Head device number to be shifted Bit ANY_BOOL
(n) Number of devices to be shifted 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
(n)
Processing details
• These instructions shift (n) point(s) of data to the left by 1 bit from the device specified by (d).
(n)
(d)+(n-1) (d)+(n-2) (d)+(n-3) ··· (d)+2 (d)+1 (d)
1 1 0 0 1 1
■Related devices
Device Name Remarks
SM700 Carry ON/OFF according to the status (1/0) of the (d) bit.
Operation error
Error code Remarks
(SD0/SD8067)
2820H The (n) points of data starting from the device specified by (d) exceed in the corresponding device.
6 SEQUENCE INSTRUCTIONS
146 6.4 Shift Instructions
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);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
6
Operand Remarks Range Data type Data type (label)
(d) Head device number to be shifted Word ANY16
(n) Number of devices to be shifted 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
• These instructions shift (n) point(s) of data to the right by 1 word from the device specified by (d).
(n)
(d)+(n-1) (d)+(n-2) (d)+(n-3) ··· (d)+2 (d)+1 (d)
555 212 325 100 50 40
Operation error
Error code Remarks
(SD0/SD8067)
2820H The (n) points of data starting from the device specified by (d) exceed in the corresponding device.
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 147
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);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(d) Head device number to be shifted Word ANY16
(n) Number of devices to be shifted 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
• These instructions shift (n) point(s) of data to the left by 1 word from the device specified by (d).
(n)
(d)+(n-1) (d)+(n-2) (d)+(n-3) ··· (d)+2 (d)+1 (d)
555 120 325 100 50 40
Operation error
Error code Remarks
(SD0/SD8067)
2820H The (n) points of data starting from the device specified by (d) exceed in the corresponding device.
6 SEQUENCE INSTRUCTIONS
148 6.4 Shift Instructions
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);
(s) (d) (n1) (n2)
FBD/LD
EN ENO
s d
n1
n2
Setting data 6
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Head device number stored to the shift data after the shift Bit ANY_BOOL
(d) Head device number to be shifted Bit ANY_BOOL
(n1)*1 Data length of shift data 0 to 65535 16-bit unsigned binary ANY16_U
*1
(n2) Number of shifts 0 to 65535 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1 *2
*1
(d)
(n1)
(n2)
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 149
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.
• When K1 is specified for (s), set 1s for (n2) points of bits from (d)+(n1-n2) after the shift.
(n1)
(n2)
(d)+9 (d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 (d)
1 1 1 0 1 1 1 1 0 0
(s)+3 (s)+2 (s)+1 (s) (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 (d)
0 0 0 0 1 1 1 0 1 1
(1)
(1): When (s)=K0, it is 0.
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).
3405H A constant other than K0 or K1 is specified when the constant (s) is specified.
The values specified in (n1) and (n2) are such that (n1)<(n2).
6 SEQUENCE INSTRUCTIONS
150 6.4 Shift Instructions
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);
(s) (d) (n1) (n2)
FBD/LD
EN ENO
s d
n1
n2
Setting data 6
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Head device number stored to the shift data after the shift Bit ANY_BOOL
(d) Head device number to be shifted Bit ANY_BOOL
(n1)*1 Data length of shift data 0 to 65535 16-bit unsigned binary ANY16_U
*1
(n2) Number of shifts 0 to 65535 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1 *2
*1
(d)
(n1)
(n2)
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 151
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.
• When K1 is specified for (s), set 1s for (n2) points of bits from (d) after the shift.
(n1)
(n2)
(d)+9 (d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 (d)
0 1 1 0 1 1 1 1 0 1
(d)+9 (d)+8 (d)+7 (d)+6 (d)+5 (s)+4 (s)+3 (s)+2 (s)+1 (s)
1 1 1 0 1 0 0 0 0 0
(1)
(1): When (s)=K0, it is 0.
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).
3405H A constant other than K0 or K1 is specified when the constant (s) is specified.
The values specified in (n1) and (n2) are such that (n1)<(n2).
6 SEQUENCE INSTRUCTIONS
152 6.4 Shift Instructions
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);
(s) (d) (n1) (n2)
FBD/LD
EN ENO
s d
n1
n2
Setting data 6
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Head device number stored to the shift data after the shift Word ANY16
(d) Head device number to be shifted Word ANY16
*1
(n1) Data length of shift data 0 to 65535 16-bit unsigned binary ANY16_U
(n2)*1 Number of shifts 0 to 65535 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n1)
(n2)
Processing details
• This instruction shifts (n1) words of data to the right by (n2) word(s) from the device specified by (d). After the shift, (n2)
points from (s) are set into (n2) points from (d)+(n1-n2).
• This instruction sets the specified value for (n2) points of devices from (d) + (n1-n2) after the shift when K is specified for
(s).
(n1)
(n2)
(d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 (d)
30FH 1EH 100H 0H 1FFH 10H 1FH 7FFH 2AH
• When the value specified for (n1) or (n2) is 0, the processing is not performed.
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 153
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).
3405H A constant other than K0 or K1 is specified when the constant (s) is specified.
The values specified in (n1) and (n2) are such that (n1)<(n2).
6 SEQUENCE INSTRUCTIONS
154 6.4 Shift Instructions
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);
(s) (d) (n1) (n2)
FBD/LD
EN ENO
s d
n1
n2
Setting data 6
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(s) Head device number stored to the shift data after the shift Word ANY16
(d) Head device number to be shifted Word ANY16
*1
(n1) Data length of shift data 0 to 65535 16-bit unsigned binary ANY16_U
(n2)*1 Number of shifts 0 to 65535 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n1)
(n2)
Processing details
• This instruction shifts (n1) words of data to the left by (n2) word(s) from the device specified by (d). After the shift, (n2)
points from (s) are set into (n2) points from (d).
• This instruction sets the specified value for (n2) points of devices from (d) + (n1-n2) after the shift when K is specified for
(s).
(n1)
(n2)
(d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 (d)
1FFH 10H 0H 7FFH 3AH 1FH 30H 0H FFH
• When the value specified for (n1) or (n2) is 0, the processing is not performed.
6 SEQUENCE INSTRUCTIONS
6.4 Shift Instructions 155
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).
3405H A constant other than K0 or K1 is specified when the constant (s) is specified.
The values specified in (n1) and (n2) are such that (n1)<(n2).
6 SEQUENCE INSTRUCTIONS
156 6.4 Shift Instructions
6.5 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);
MC (N) (d)
(N) (d)
(1)
MCR (N)
MC MCR
EN ENO EN ENO
n d n
Setting data
■Descriptions, ranges, and data types
Operand Remarks Range Data type Data type (label)
(N)*1 Nesting 0 to 14 Device name ANY16_S
(d) Number of device to be turned ON Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (N)
F, B, SB, S SD, SW, R
(N)
*1
(d)
6 SEQUENCE INSTRUCTIONS
6.5 Master Control Instruction 157
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)
X0 X0
MC N1 M0 MC N1 M0
N1 M0 N1 M0
X1 X3 M7 X1 X3 M7
Y20 Y20
(1)
M5 M5
Y30 Y30
X6 X4 X6 X4
MCR N1 MCR N1
X10 X10
Y40 Y40
■MC
• When the execution command of the MC instruction turns ON at the start of master control, the operation result between
the MC and MCR instructions is as per the instructions (according to ladder). When the execution command of MC
instruction turns OFF, the operation result between the MC and MCR instructions becomes as follows.
Device Device status
Timer The count value becomes 0, and both coils and contacts turn OFF.
Counters, retentive timers Coils turn OFF but the current status of both count values and contacts is
maintained.
Devices in OUT instruction Forcibly turned OFF.
Devices in SET and RST instructions Current status is maintained.
Devices in SFT(P) instruction
Devices in basic instructions and
applied instructions
When an instruction (e.g. FOR to NEXT instructions etc.) not requiring NO contact instruction is programmed
in a ladder using master control, the CPU module executes that instruction regardless of the execution
command of this instruction.
• With this instruction, the same nesting (N) number can be used as many times as necessary by changing the device
specified by (d).
• When this instruction is ON, the coil of the device specified by (d) turns ON. Also, the coil becomes a double coil when the
same device is used by the OUT instruction, for example. So, do not use the device specified by (d) in other instructions.
■MCR
• This instruction indicates the end of the master control range by the master control release instruction.
• Do not prefix this instruction with NO contact instruction.
• Use these (MC and MCR) instructions with same nesting number as a pair. Note, however, that when this instruction is
nested at a single location, all master controls can be ended by just one (N) number, the smallest number. (Refer to
Caution.)
6 SEQUENCE INSTRUCTIONS
158 6.5 Master Control Instruction
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)
A A
MC N0 M15 MC N0 M15
N0 M15 N0 M15
(1)
B B
MC N1 M16 MC N1 M16
N1 M16 N1 M16
(2)
C C
MC N2 M17 MC N2 M17
N2 M17 N2 M17
(3)
MCR N2 MCR N2
6
(2)
MCR N1 MCR N1
(1)
MCR N0 MCR N0
(4)
6 SEQUENCE INSTRUCTIONS
6.5 Master Control Instruction 159
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. Addition by write during RUN mode results in an error.
• Nesting up to 15 levels (N0 to N14) is possible. When nesting instructions, the MC instruction is used starting from the
smallest (N) number and the MCR instruction is started starting from the biggest number. Programming in reverse order
does not produce a nested structure and hence the CPU module cannot execute operations properly.
• When the MCR instruction is nested at a single location, all master controls can be ended by just one nesting (N) number,
the smallest number.
X1 X1
MC N0 M15 MC N0 M15
N0 M15 N0 M15
X2 X2
MC N1 M16 MC N1 M16
N1 M16 N1 M16
X3 X3
MC N2 M17 MC N2 M17
N2 M17 N2 M17
MCR N2 MCR N0
MCR N1
MCR N0
Operation error
There is no operation error.
6 SEQUENCE INSTRUCTIONS
160 6.5 Master Control Instruction
6.6 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.
FBD/LD
Not supported.
Processing details
• This instruction branches operation of the sequence program by the CJ instruction or dividing the main routine program into 6
subroutine programs and interrupt programs.
• When this instruction is executed, program execution returns to the program at step 0 after output processing, input
processing and refreshing of the watchdog timer.
• The sequence program from this instruction onwards can also be displayed as ladder by the engineering tool.
(Left: When the CJ instruction is used, Right: When there are subroutine programs and interrupt programs)
0 CALL P**
A
(2)
A
CJ P**
(1) (3) FEND
A P**
B
FEND
I**
P** C
A
END
FEND
END
A: Main routine program
B: Subroutine program
C: Interrupt Program
(1): Operation when the CJ instruction is not executed
(2): Jump by the CJ instruction
(3): Operation when the CJ instruction has been executed
Operation error
Error code Remarks
(SD0/SD8067)
3340H The FEND instruction is executed before the NEXT instruction after the FOR instruction is executed.
3381H The FEND instruction is executed before the RET instruction after the CALL(P) instruction is executed.
33E3H The FEND instruction is programmed between FOR-NEXT.
33E4H The FEND instruction is programmed between MC-MCR.
33E5H The FEND instruction is programmed between STL-RETSTL.
33E7H The FEND instruction is programmed between I-IRET.
3100H The FEND instruction is programmed in standby type program.
The FEND instruction is programmed in FB file.
6 SEQUENCE INSTRUCTIONS
6.6 Termination Instructions 161
Ending the sequence program
END
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. When this instruction is executed, the CPU module ends execution of the currently executing program.
(1)
END
• The first time the RUN is started, execution begins from this instruction.
• This instruction cannot be programmed midway during the main sequence program. When this processing is required
midway during the program, use the FEND instruction.
• When programming is performed using the engineering tool in ladder edit mode, the END instruction is automatically input
and cannot be edited.
• The following illustrates how the END and FEND instructions are used properly when a program contains a main routine
program, subroutine program, and interrupt program.
FEND (1)
B
D
END (2)
The END instruction executed while a program is divided into multiple program blocks indicates the end of a
program block.
The END instruction executed for END processing is executed at the end of the last executed program
registered in the program settings.
6 SEQUENCE INSTRUCTIONS
162 6.6 Termination Instructions
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.
33E5H The END instruction is programmed between STL-RETSTL.
33E7H The END instruction is programmed between I-IRET.
6 SEQUENCE INSTRUCTIONS
6.6 Termination Instructions 163
6.7 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);
FBD/LD
EN ENO
Processing details
• 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.)
• To restart operation of the CPU module after this instruction is executed, return the switch from RUN→STOP and set it to
RUN again.
Operation error
Error code Remarks
(SD0/SD8067)
3340H The STOP instruction is executed before the NEXT instruction is executed after the FOR instruction is executed.
3381H The STOP instruction is executed before the RET instruction is executed after the CALL(P) or XCALL(P) instruction is executed.
3582H The STOP instruction is executed before the IRET instruction is executed in the interruption program.
6 SEQUENCE INSTRUCTIONS
164 6.7 Stop Instruction
7 BASIC INSTRUCTIONS
OR
(s1) (s2)
7
("=(_U)", "<>(_U)", ">(_U)", "<=(_U)", "<(_U)", ">=(_U)" enters .)
FBD/LD
LD AND OR
s1 s1 s1
s2 s2 s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) LD, AND, Comparison data or device where the -32768 to +32767 16-bit signed binary ANY16_S
OR comparison data is stored
LD_U, 0 to 65535 16-bit unsigned binary ANY16_U
AND_U,
OR_U
(s2) LD, AND, Comparison data or device where the -32768 to +32767 16-bit signed binary ANY16_S
OR comparison data is stored
LD_U, 0 to 65535 16-bit unsigned binary ANY16_U
AND_U,
OR_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 165
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
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). (Devices are used as NO contacts.)
• The following table lists the comparison operation result of each instruction.
Instruction symbol Condition Result
=(_U) (s1) = (s2) Conductive state
<>(_U) (s1) (s2)
>(_U) (s1) > (s2)
<=(_U) (s1) ≤ (s2)
<(_U) (s1) < (s2)
>=(_U) (s1) ≥ (s2)
=(_U) (s1) (s2) Non-conductive state
<>(_U) (s1) = (s2)
>(_U) (s1) ≤ (s2)
<=(_U) (s1) > (s2)
<(_U) (s1) ≥ (s2)
>=(_U) (s1) < (s2)
Precautions
• When the most significant bit is "1" in the data stored in (s1) or (s2), it is regarded as a negative binary value for
comparison. (Excluding unsigned operation)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
166 7.1 Comparison Operation Instructions
Comparing 32-bit binary data
OR
(s1) (s2)
FBD/LD
LD AND OR
s2 s2 s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) LDD, Comparison data or head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
ANDD, ORD comparison data is stored
LDD_U, 0 to 4294967295 32-bit unsigned binary ANY32_U
ANDD_U,
ORD_U
(s2) LDD, Comparison data or head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
ANDD, ORD comparison data is stored
LDD_U, 0 to 4294967295 32-bit unsigned binary ANY32_U
ANDD_U,
ORD_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 167
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
D=(_U) (s1) = (s2) Conductive state
D<>(_U) (s1) (s2)
D>(_U) (s1) > (s2)
D<=(_U) (s1) ≤ (s2)
D<(_U) (s1) < (s2)
D>=(_U) (s1) ≥ (s2)
D=(_U) (s1) (s2) Non-conductive state
D<>(_U) (s1) = (s2)
D>(_U) (s1) ≤ (s2)
D<=(_U) (s1) > (s2)
D<(_U) (s1) ≥ (s2)
D>=(_U) (s1) < (s2)
Precautions
• When the most significant bit is "1" in the data stored in (s1) or (s2), it is regarded as a negative binary value for
comparison. (Excluding unsigned operation)
• For comparison of 32-bit counter (LC), specify an instruction (LDD=, etc.) that handles 32-bit data. If an instruction (LD=,
etc.) that handles 16-bit data is specified, a program error or operation error occurs. (Same applies for index device (LZ) as
well.)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
168 7.1 Comparison Operation Instructions
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) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) CMP(P) Comparison value data or the device where the
comparison value data is stored
-32768 to +32767 16-bit signed binary ANY16_S 7
CMP(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) CMP(P) Comparison source data or the device where -32768 to +32767 16-bit signed binary ANY16_S
the comparison source data is stored
CMP(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) The starting bit device to which the comparison Bit ANYBIT_ARRAY
result is output (Number of elements:
3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 169
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.
• (s1) and (s2) are handled as binary values within the range of above data setting.
• Large and small comparison is executed algebraically.
• With sign… -10 (FFF6H) < 2 (0002H)
• Without sign… 32767 (7FFFH) < 65280 (FF00H)
X0 X0
CMP (s1) (s2) (d) 51
50
(d) 49
Turns ON in the case of (s1)>(s2). (s2) 48 (s1)
(d)+1 (d)
Turns ON in the case of (s1)=(s2).
Latched
(d)+2 (d)+1
Turns ON in the case of (s1)<(s2).
Latched
(d)+2
Latched
(1)
(1): Even if the command input turns OFF and the CMP instruction is not executed, (d) to (d)+2 latches the status just before the command input turns from ON
to OFF.
Precautions
Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of 3 points of data starting from the device specified by (d) exceeds said device.
7 BASIC INSTRUCTIONS
170 7.1 Comparison Operation Instructions
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) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DCMP(P) Comparison value data or the head device
where the comparison value data is stored
-2147483647 to +2147483647 32-bit signed binary ANY32_S 7
DCMP(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DCMP(P) Comparison source data or the head device -2147483647 to +2147483647 32-bit signed binary ANY32_S
where the comparison source data is stored
DCMP(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) The starting bit device to which the comparison Bit ANYBIT_ARRAY
result is output (Number of elements:
3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 171
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.
• (s1) and (s2) are handled as binary values within the range of above data setting.
• Large and small comparison is executed algebraically.
• With sign… -125400 (FFFE1628H) < 224566 (00036D36H)
• Without sign… 16776690 (00FFFDF2H) < 4294967176 (FFFFFF88H)
X0 X0
DCMP (s1) (s2) (d) 51
50
(d) 49
Turns ON in the case of (s1)>(s2). (s2) 48 (s1)
(d)+1 (d)
Turns ON in the case of (s1)=(s2).
Latched
(d)+2 (d)+1
Turns ON in the case of (s1)<(s2).
Latched
(d)+2
Latched
(1)
(1): Even if the command input turns OFF and the DCMP instruction is not executed, (d) to (d)+2 latches the status just before the command input turns from
ON to OFF.
Precautions
Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of 3 points of data starting from the device specified by (d) exceeds said device.
7 BASIC INSTRUCTIONS
172 7.1 Comparison Operation Instructions
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.
Ladder diagram Structured text
ENO:=ZCP(EN,s1,s2,s3,d); ENO:=ZCP_U(EN,s1,s2,s3,d);
ENO:=ZCPP(EN,s1,s2,s3,d); ENO:=ZCPP_U(EN,s1,s2,s3,d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
7
Operand Description Range Data type Data type (label)
(s1) ZCP(P) Lower limit comparison data or the device -32768 to +32767 16-bit signed binary ANY16_S
where the comparison data is stored
ZCP(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) ZCP(P) Upper limit comparison data or the device -32768 to +32767 16-bit signed binary ANY16_S
where the comparison data is stored
ZCP(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s3) ZCP(P) Comparison source data or the device where -32768 to +32767 16-bit signed binary ANY16_S
the comparison source data is stored
ZCP(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) The starting bit device to which the comparison Bit ANYBIT_ARRAY
result is output (Number of elements:
3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
*1
(d)
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 173
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. (s1), (s2), and (s3) are
handled as binary values within the range of above data setting. Large and small comparison is executed algebraically.
• Large and small comparison is executed algebraically.
• With sign… -10 (FFF6H) < 2 (0002H) < 10 (000AH)
• Without sign… 0 (0000H) < 32767 (7FFFH) < 40000 (9C40H)
X0
ZCP (s1) (s2) (s3) (d)
(d)
Turns ON in the case of (s1)>(s3).
(d)+1
Turns ON in the case of (s1)≤(s3)≤(s2).
(d)+2
Turns ON in the case of (s3)>(s2).
(1)
(1): Even if the command input turns OFF and the ZCP instruction is not executed, (d) to (d)+2 latches the status just before the command input turns from ON
to OFF.
Precautions
• Set (s1) to a value less than (s2).
• Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of the 3 points of data starting from the device specified by (d) exceeds said device.
7 BASIC INSTRUCTIONS
174 7.1 Comparison Operation Instructions
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.
Ladder diagram Structured text
ENO:=DZCP(EN,s1,s2,s3,d); ENO:=DZCP_U(EN,s1,s2,s3,d);
ENO:=DZCPP(EN,s1,s2,s3,d); ENO:=DZCPP_U(EN,s1,s2,s3,d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DZCP(P) Lower limit comparison data or the head device -2147483647 to +2147483647 32-bit signed binary ANY32_S
where the comparison data is stored
DZCP(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DZCP(P) Upper limit comparison data or the head device -2147483647 to +2147483647 32-bit signed binary ANY32_S
where the comparison data is stored
DZCP(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s3) DZCP(P) Comparison source data or the head device -2147483647 to +2147483647 32-bit signed binary ANY32_S
where the comparison source data is stored
DZCP(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) The starting bit device to which the comparison Bit ANYBIT_ARRAY
result is output (Number of elements:
3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d) *1
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 175
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. (s1), (s2), and (s3) are
handled as binary values within the range of above data setting.
• Large and small comparison is executed algebraically.
• With sign… -125400 (FFFE1628H) < 22466 (000057C2H) < 1015444 (000F7E94H)
• Without sign… 0 (00000000H) < 2147483647 (7FFFFFFFH) < 4026531840 (F0000000H)
X0
DZCP (s1) (s2) (s3) (d)
(d)
Turns ON in the case of (s1)>(s3).
(d)+1
Turns ON in the case of (s1)≤(s3)≤(s2).
(d)+2
Turns ON in the case of (s3)>(s2).
(1)
(1): Even if the command input turns OFF and the DZCP instruction is not executed, (d) to (d)+2 latches the status just before the command input turns from ON
to OFF.
Precautions
• Set (s1) to a value less than (s2).
• Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of the 3 points of data starting from the device specified by (d) exceeds said device.
7 BASIC INSTRUCTIONS
176 7.1 Comparison Operation Instructions
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).
Ladder diagram Structured text*1
ENO:=BKCMP_(EN,s1,s2,n,d); ENO:=BKCMP__U(EN,s1,s2,n,d);
ENO:=BKCMP_P(EN,s1,s2,n,d); ENO:=BKCMP_P_U(EN,s1,s2,n,d)
(s1) (s2) (d) (n)
;
("EQ", "NE", "GT", "LE", "LT", "GE" enters .)*2
("BKCMP=(P)(_U)", "BKCMP<>(P)(_U)", "BKCMP>(P)(_U)",
"BKCMP<=(P)(_U)", "BKCMP<(P)(_U)", "BKCMP>=(P)(_U)" enters .)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) BKCMP(P) Comparison data or the device where the -32768 to +32767 16-bit signed binary ANY16_S
comparison data is stored
BKCMP(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) BKCMP(P) Device where the comparison source data is 16-bit signed binary ANY16_S
stored
BKCMP(P)_U 16-bit unsigned binary ANY16_U
(d) Head device storing comparison result Bit ANY_BOOL
(n) Number of data to be compared 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
(n)
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 177
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).
• The relevant devices of (n) point(s) of data starting from the device specified by (d) are turned ON when the comparison
conditions are met and turned OFF when the comparison conditions are not met.
∙∙∙
∙∙∙
(s1)+(n-2) 7777 (BIN) (s2)+(n-2) 6543 (BIN) (d)+(n-2) ON (1)
(s1)+(n-1) 4321 (BIN) (s2)+(n-1) 1200 (BIN) (d)+(n-1) ON (1)
b15 ∙∙∙ b0
(s2) 32000 (BIN) (d) ON (1)
(s2)+1 4321 (BIN) (d)+1 OFF (0)
(s2)+2 32000 (BIN) (d)+2 ON (1)
(s1) 32000 (BIN) = (n) (n)
∙∙∙
∙∙∙
• The following table lists the comparison operation result of each instruction.
Instruction symbol Condition Result
BKCMP=(P)(_U) (s1) = (s2) On(1)
BKCMP<>(P)(_U) (s1) (s2)
BKCMP>(P)(_U) (s1) > (s2)
BKCMP<=(P)(_U) (s1) ≤ (s2)
BKCMP<(P)(_U) (s1) < (s2)
BKCMP>=(P)(_U) (s1) ≥ (s2)
BKCMP=(P)(_U) (s1) (s2) Off(0)
BKCMP<>(P)(_U) (s1) = (s2)
BKCMP>(P)(_U) (s1) ≤ (s2)
BKCMP<=(P)(_U) (s1) > (s2)
BKCMP<(P)(_U) (s1) ≥ (s2)
BKCMP>=(P)(_U) (s1) < (s2)
• When the comparison operation result is all ON (1) in all (n) point(s) starting from (d), SM704 and SM8090 (block
comparison signal) turns ON.
Operation error
Error code Description
(SD0/SD8067)
2820H The (n) point(s) starting from the device specified by (s1), (s2), and (d) exceeds said device.
2821H When (d) specifies "D.b", the data register of (d) and the (n) point(s) of data starting from the device specified by (s1) overlap.
When (d) specifies "D.b", the data register of (d) and the (n) point(s) of data starting from the device specified by (s2) overlap.
7 BASIC INSTRUCTIONS
178 7.1 Comparison Operation Instructions
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).
Ladder diagram Structured text*1
ENO:=DBKCMP_(EN,s1,s2,n,d); ENO:=DBKCMP__U(EN,s1,s2,n,d)
ENO:=DBKCMP_P(EN,s1,s2,n,d); ;
(s1) (s2) (d) (n)
ENO:=DBKCMP_P_U(EN,s1,s2,n,
d);
("DBKCMP=(P)(_U)", "DBKCMP<>(P)(_U)", "DBKCMP>(P)(_U)",
("EQ", "NE", "GT", "LE", "LT", "GE" enters .)*2
"DBKCMP<=(P)(_U)", "DBKCMP<(P)(_U)", "DBKCMP>=(P)(_U)" enters .)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DBKCMP(P) Comparison data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
comparison data is stored
DBKCMP(P)_ 0 to 4294967295 32-bit unsigned binary ANY32_U
U
(s2) DBKCMP(P) Head device where the comparison source 32-bit signed binary ANY32_S
DBKCMP(P)_ data is stored 32-bit unsigned binary ANY32_U
U
(d) Head device storing comparison result Bit ANY_BOOL
(n) Number of data to be compared 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
(n)
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 179
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).
• The relevant (n) point(s) of data starting from the device specified by (d) are turned ON when the comparison conditions are
met and turned OFF when the comparison conditions are not met.
∙∙∙
∙∙∙
∙∙∙
∙∙∙
(s1)+(2n-1), (s1)+(2n-2) 1106 (BIN) (s2)+(2n-1), (s2)+(2n-2) 1106 (BIN) (d)+(n-1) ON (1)
b31 ∙∙∙ b0
(s2)+1, (s2) 32700 (BIN) (d) ON (1)
(s2)+3, (s2)+2 40000 (BIN) (d)+1 OFF (0)
b31 ∙∙∙ b0
(s1)+1, (s1) 32800 (BIN) >= (s2)+5, (s2)+4 32800 (BIN) (n) (d)+2 ON (1) (n)
∙∙∙
∙∙∙
∙∙∙
(s2)+(2n-1), (s2)+(2n-2) 2147400 (BIN) (d)+(n-1) OFF (0)
• (d) is specified outside the device range of (n) point(s) of data starting from the one specified by (s1) and outside the device
range of (n) point(s) of data starting from the one specified by (s2).
• The following table lists the comparison operation result of each instruction.
Instruction symbol Condition Result
DBKCMP=(P)(_U) (s1) = (s2) On(1)
DBKCMP<>(P)(_U) (s1) (s2)
DBKCMP>(P)(_U) (s1) > (s2)
DBKCMP<=(P)(_U) (s1) ≤ (s2)
DBKCMP<(P)(_U) (s1) < (s2)
DBKCMP>=(P)(_U) (s1) ≥ (s2)
DBKCMP=(P)(_U) (s1) (s2) Off(0)
DBKCMP<>(P)(_U) (s1) = (s2)
DBKCMP>(P)(_U) (s1) ≤ (s2)
DBKCMP<=(P)(_U) (s1) > (s2)
DBKCMP<(P)(_U) (s1) ≥ (s2)
DBKCMP>=(P)(_U) (s1) < (s2)
• When the comparison operation result is all ON (1) in all (n) point(s) starting from (d), SM704 and SM8090 (block
comparison signal) turns ON.
Precautions
If a 32-bit counter (high-speed counter included) is used, make sure to compare using the 32-bit operation (DBKCMP=,
DBKCMP>, DBKCMP<, etc.).
7 BASIC INSTRUCTIONS
180 7.1 Comparison Operation Instructions
Operation error
Error code Description
(SD0/SD8067)
2820H 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
(d) exceeds said device.
2821H 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
data starting from the device specified by (s1) overlap.
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
data starting from the device specified by (s2) overlap.
When bit is specified for word device, devices other than the bit-specified word devices where operation result
is stored will not change.
D10.F D10.0
0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0
D10.F D10.0
0 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0
7 BASIC INSTRUCTIONS
7.1 Comparison Operation Instructions 181
7.2 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.
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) +(P) Addend data or the device where the data that -32768 to +32767 16-bit signed binary ANY16_S
is added to another is stored
+(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) +(P) Device where the data to which another is -32768 to +32767 16-bit signed binary ANY16_S
added is stored
+(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
7 BASIC INSTRUCTIONS
182 7.2 Arithmetic Operation Instructions
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).
(d) (s) (d)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of +(P)
Operation error
7
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 183
+(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); ENO:=PLUS_U(EN,s1,s2,d);
ENO:=PLUSP(EN,s1,s2,d); ENO:=PLUSP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) +(P) Augend data or the device where the data to -32768 to +32767 16-bit signed binary ANY16_S
which another is added is stored
+(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) +(P) Addend data or the device where the data that -32768 to +32767 16-bit signed binary ANY16_S
is added to another is stored
+(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) +(P) Device for storing the operation result 16-bit signed binary ANY16_S
+(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
184 7.2 Arithmetic Operation Instructions
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) (d)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of +(P)
Operation error
7
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 185
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*1
ENO:=ADDP(EN,s1,s2,d); ENO:=ADD_U(EN,s1,s2,d);
ENO:=ADDP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD*1
EN ENO
s1 d
s2
*1 The ADD instruction is not supported by the ST language and the FBD/LD language. Use ADD of the standard function.
Page 971 ADD(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) ADD(P) Addend data or the device where the data that -32768 to +32767 16-bit signed binary ANY16_S
is added to another is stored
ADD(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) ADD(P) Addend data or the device where the data that -32768 to +32767 16-bit signed binary ANY16_S
is added to another is stored
ADD(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) ADD(P) Device for storing the operation result 16-bit signed binary ANY16_S
ADD(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
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) (d)
7 BASIC INSTRUCTIONS
186 7.2 Arithmetic Operation Instructions
■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.
SM8021 Borrow When the operation result is less than the lower limit of the data setting range, the borrow flag is turned ON.
Precautions
■When specifying the same device in the source and destination
The same device number can be specified for both the source and the destination. In this case, note that the addition result
changes in every operation cycle if a continuous operation type ADD instruction is used.
X1
ADD D0 K25 D0 (D0)+25 → (D0)
■Difference between ADD(P) instruction, +(P) instruction, and INC(P) instruction in a program
for adding "+1" 7
When ADD(P) instruction is used to add 1 to the contents of D0 every time X1 turns from OFF to ON, ADD(P) instruction is
similar to +(P) instruction and INC(P) instruction described later except for the contents shown in the table below
ADD(P) instruction +(P) instruction, INC(P) instruction
Flag (zero, borrow or carry) Operates Does not operate
Operation result (s)+1=(d) +32767 → 0 → +1 → +2 →… +32767 → -32768 → -32767 →…
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 187
Subtracting 16-bit binary data
-(P)(_U) instruction and SUB(P)(_U) instruction can be used for subtraction of 16-bit binary data.
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) -(P) Subtrahend data or the device where the data -32768 to +32767 16-bit signed binary ANY16_S
to be subtracted from another is stored
-(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) -(P) Device where the data from which another is to -32768 to +32767 16-bit signed binary ANY16_S
be subtracted is stored
-(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• 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 subtraction result in the device specified by (d).
(d) (s) (d)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of -(P)
7 BASIC INSTRUCTIONS
188 7.2 Arithmetic Operation Instructions
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 189
-(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); ENO:=MINUS_U(EN,s1,s2,d);
ENO:=MINUSP(EN,s1,s2,d); ENO:=MINUSP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) -(P) Minuend data or the device where the data -32768 to +32767 16-bit signed binary ANY16_S
from which another is to be subtracted is
-(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
stored
(s2) -(P) Subtrahend data or the device where the data -32768 to +32767 16-bit signed binary ANY16_S
to be subtracted from another is stored
-(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) -(P) Device for storing the operation result 16-bit signed binary ANY16_S
-(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
190 7.2 Arithmetic Operation Instructions
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) (d)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of -(P)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 191
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*1
ENO:=SUBP(EN,s1,s2,d); ENO:=SUB_U(EN,s1,s2,d);
ENO:=SUBP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD*1
EN ENO
s1 d
s2
*1 The SUB instruction is not supported by the ST language and the FBD/LD language. Use SUB of the standard function.
Page 975 SUB(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) SUB(P) Subtrahend data or the device where the data -32768 to +32767 16-bit signed binary ANY16_S
to be subtracted from another is stored
SUB(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) SUB(P) Subtrahend data or the device where the data -32768 to +32767 16-bit signed binary ANY16_S
to be subtracted from another is stored
SUB(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) SUB(P) Device for storing the operation result 16-bit signed binary ANY16_S
SUB(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
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) (d)
7 BASIC INSTRUCTIONS
192 7.2 Arithmetic Operation Instructions
■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.
SM8021 Borrow When the operation result is less than the lower limit of the data setting range, the borrow flag is turned ON.
Precautions
■When specifying the same device in the source and destination
The same device number can be specified for both the source and the destination. In this case, note that the subtraction result
changes in every operation cycle if a continuous operation type SUB instruction is used.
X1
SUB D0 K25 D0 (D0)-25 → (D0)
■Difference between SUB(P) instruction, -(P) instruction, and DEC(P) instruction in a program
for subtracting "-1" 7
When SUB(P) instruction is used to subtract 1 from the contents of D0 every time X1 turns from OFF to ON, SUB(P)
instruction is similar to -(P) instruction and DEC(P) instruction described later except for the contents shown in the table below
SUB(P) instruction -(P) instruction, DEC(P) instruction
Flag (zero, borrow or carry) Operates Does not operate
Operation result (s)-1=(d) -32768 → 0 → -1 → -2 →… -32768 → +32767 → +32766 →…
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 193
Adding 32-bit binary data
D+(P)(_U) instruction and DADD(P)(_U) instruction can be used for addition of 32-bit binary data.
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) D+(P) Addend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data that is added to another is stored
D+(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) D+(P) Head device where the data to which another -2147483648 to +2147483647 32-bit signed binary ANY32_S
is added is stored
D+(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• 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 addition result in the device specified by (d).
(d)+1 (d) (s)+1 (s) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) + 123456 (BIN) 691346 (BIN)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of D+(P)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
194 7.2 Arithmetic Operation Instructions
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); ENO:=DPLUS_U(EN,s1,s2,d);
ENO:=DPLUSP(EN,s1,s2,d); ENO:=DPLUSP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) D+(P) Augend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
D+(P)_U
data to which another is added is stored
0 to 4294967295 32-bit unsigned binary ANY32_U 7
(s2) D+(P) Addend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data that is added to another is stored
D+(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) D+(P) Head device for storing the operation result 32-bit signed binary ANY32_S
D+(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 195
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)+1 (s1) (s2)+1 (s2) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) + 123456 (BIN) 691346 (BIN)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of D+(P)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
196 7.2 Arithmetic Operation Instructions
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);
ENO:=DADDP(EN,s1,s2,d); ENO:=DADDP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DADD(P) Addend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data that is added to another is stored
DADD(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DADD(P) Addend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S 7
data that is added to another is stored
DADD(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DADD(P) Head device for storing the operation result 32-bit signed binary ANY32_S
DADD(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 197
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)+1 (s1) (s2)+1 (s2) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) + 123456 (BIN) 691346 (BIN)
■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.
SM8021 Borrow When the operation result is less than the lower limit of the data setting range, the borrow flag is turned ON.
Precautions
■When DADD instruction is used
When specifying word devices, a device for the lower-order 16-bits is specified first, and then a word device with the next
device number is set for the higher-order 16 bits. To prevent number overlap, it is recommended to always specify an even
number.
X1
DADD D0 K25 D0 (D0)+25 → (D0)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
198 7.2 Arithmetic Operation Instructions
Subtracting 32-bit binary data
D-(P)(_U) instruction and DSUB(P)(_U) instruction can be used for subtraction of 32-bit binary data.
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) D-(P) Subtrahend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be subtracted from another is stored
D-(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) D-(P) Head device where the data from which
another is to be subtracted is stored
-2147483648 to +2147483647 32-bit signed binary ANY32_S
7
D-(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions subtract 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 subtraction result in the device specified by (d).
(d)+1 (d) (s)+1 (s) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) - 123456 (BIN) 444434 (BIN)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of D-(P)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 199
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
200 7.2 Arithmetic Operation Instructions
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); ENO:=DMINUS_U(EN,s1,s2,d);
ENO:=DMINUSP(EN,s1,s2,d); ENO:=DMINUSP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) D-(P) Minuend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
D-(P)_U
data from which another is to be subtracted is
stored
0 to 4294967295 32-bit unsigned binary ANY32_U 7
(s2) D-(P) Subtrahend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be subtracted from another is stored
D-(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) D-(P) Head device for storing the operation result 32-bit signed binary ANY32_S
D-(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 201
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)+1 (s1) (s2)+1 (s2) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) - 123456 (BIN) 444434 (BIN)
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of D-(P)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
202 7.2 Arithmetic Operation Instructions
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);
ENO:=DSUBP(EN,s1,s2,d); ENO:=DSUBP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DSUB(P) Subtrahend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be subtracted from another is stored
DSUB(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DSUB(P) Subtrahend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S 7
data to be subtracted from another is stored
DSUB(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DSUB(P) Head device for storing the operation result 32-bit signed binary ANY32_S
DSUB(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 203
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)+1 (s1) (s2)+1 (s2) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) - 123456 (BIN) 444434 (BIN)
■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.
SM8021 Borrow When the operation result is less than the lower limit of the data setting range, the borrow flag is turned ON.
Precautions
■When the DSUB instruction is used
When specifying word devices, a device is specified for the lower-order 16-bits first, and then a word device with the next
device number is set for the higher-order 16 bits. To prevent number overlap, it is recommended to always specify an even
number.
X1
DSUB D0 K25 D0 (D0)-25 → (D0)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
204 7.2 Arithmetic Operation Instructions
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).
Ladder diagram Structured text*1
ENO:=MULTI(EN,s1,s2,d); ENO:=MULTI_U(EN,s1,s2,d);
ENO:=MULTIP(EN,s1,s2,d); ENO:=MULTIP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data 7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) *(P) Multiplicand data or the device where the data -32768 to +32767 16-bit signed binary ANY16_S
to be multiplied by another is stored
*(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) *(P) Multiplier data or the device where the data by -32768 to +32767 16-bit signed binary ANY16_S
which another is to be multiplied is stored
*(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) *(P) Head device for storing the operation result 32-bit signed binary ANY32_S
*(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
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 (d)
Ex.
Multiplication result when (d) is a bit device
• K1 ... Lower 4 bits (b0 to b3)
• K4 ... Lower 16 bits (b0 to b15)
• K8 ... Lower 32 bits (b0 to b31)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 205
Operation error
Error code Description
(SD0/SD8067)
2820H The range of the device specified by (d) exceeds said device range.
7 BASIC INSTRUCTIONS
206 7.2 Arithmetic Operation Instructions
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*1
ENO:=MULP(EN,s1,s2,d); ENO:=MUL_U(EN,s1,s2,d);
ENO:=MULP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD*1
EN ENO
s1 d
s2
*1 The MUL instruction is not supported by the ST language and the FBD/LD language. Use MUL of the standard function.
Page 973 MUL(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 7
(s1) MUL(P) Multiplicand data or the device where the data -32768 to +32767 16-bit signed binary ANY16_S
to be multiplied by another is stored
MUL(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) MUL(P) Multiplier data or the device where the data by -32768 to +32767 16-bit signed binary ANY16_S
which another is to be multiplied is stored
MUL(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) MUL(P) Head device for storing the operation result 32-bit signed binary ANY32_S
MUL(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 207
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 (d)
Ex.
For example, when K2 is specified, only the lower-order 8 bits can be obtained out of the product (32 bits).
(s1) K53(0035H)
(s2) K15(000FH)
K795(031BH)
Sign bit (0: Positive, 1: Negative)
Y27 Y26 Y25 … Y13 Y12 Y11 Y10 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
(d) 0 0 0 … 0 0 1 1 0 0 0 1 1 0 1 1
(1) (2)
(1): Not output
(2): K2Y0 operation result is output.
■Related flag
Device Name Description
SM8304 Zero When the operation result is 0, the zero flag is turned ON.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of the device specified by (d) exceeds said device range.
7 BASIC INSTRUCTIONS
208 7.2 Arithmetic Operation Instructions
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).
Ladder diagram Structured text*1
ENO:=DIVISION(EN,s1,s2,d); ENO:=DIVISION_U(EN,s1,s2,d);
ENO:=DIVISIONP(EN,s1,s2,d); ENO:=DIVISIONP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data 7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) /(P) Dividend data or the device where the data to -32768 to +32767 16-bit signed binary ANY16_S
be divided by another is stored
/(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) /(P) Divisor data or the device where the data by -32768 to +32767 16-bit signed binary ANY16_S
which another is to be divided is stored
/(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) /(P) Head device for storing the operation result 32-bit signed binary ANY16_S_ARRAY
(Number of elements:
2)
/(P)_U 32-bit unsigned binary ANY16_U_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 209
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) (d)+1
• For the division result, 32-bit is used for word device to store the quotient and remainder and 16-bit is used for bit device to
store quotient only.
• Quotient…… Stored in the lower 16 bits.
• Remainder…… Stored in the upper 16 bits. (This data can be stored for word device only.)
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
210 7.2 Arithmetic Operation Instructions
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*1
ENO:=DIVP(EN,s1,s2,d); ENO:=DIV_U(EN,s1,s2,d);
ENO:=DIVP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD*1
EN ENO
s1 d
s2
*1 The DIV instruction is not supported by the ST language and the FBD/LD language. Use DIV of the standard function.
Page 977 DIV(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 7
(s1) DIV(P) Dividend data or the device where the data to -32768 to +32767 16-bit signed binary ANY16_S
be divided by another is stored
DIV(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) DIV(P) Divisor data or the device where the data by -32768 to +32767 16-bit signed binary ANY16_S
which another is to be divided is stored
DIV(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) DIV(P) Head device for storing the operation result 32-bit signed binary ANY16_S_ARRAY
(quotient, remainder) (Number of elements:
2)
DIV(P)_U 32-bit unsigned binary ANY16_U_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
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) (d)+1
• Two devices in total starting from the one specified by (d) are used to store the division result. Make sure that these two
devices are not used for another control.
• Quotient…… Stored in the lower 16 bits.
• Remainder…… Stored in the upper 16 bits.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 211
■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
• 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.
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.
3403H The data type of the data setting is signed data and the operation result exceeds 32767.
7 BASIC INSTRUCTIONS
212 7.2 Arithmetic Operation Instructions
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).
Ladder diagram Structured text*1
ENO:=DMULTI(EN,s1,s2,n,d); ENO:=DMULTI_U(EN,s1,s2,n,d);
ENO:=DMULTIP(EN,s1,s2,n,d); ENO:=DMULTIP_U(EN,s1,s2,n,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data 7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) D*(P) Multiplicand data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be multiplied by another is stored
D*(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) D*(P) Multiplier data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data by which another is to be multiplied is
D*(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
stored
(d) D*(P) Head device for storing the operation result 64-bit signed binary ANY32_S_ARRAY
(Number of elements:
2)
D*(P)_U 64-bit unsigned binary ANY32_U_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 213
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)+1 (s1) (s2)+1 (s2) (d)+3 (d)+2 (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b63 ··· b48 b47 ··· b32 b31 ··· b16 b15 ··· b0
567890 (BIN) × 123456 (BIN) 70109427840 (BIN)
• When (d) is a bit device, only the lower 32 bits of the multiplication result are stored and the upper 32 bits cannot be
specified. If the upper 32 bits data of the multiplication operation result are required, temporarily store the result in a word
device, and transfer the data stored in word device ((d)+2) and ((d)+3) to the specified bit devices.
Ex.
Multiplication result when (d) is a bit device
• K1 ... Lower 4 bits (b0 to b3)
• K4 ... Lower 16 bits (b0 to b15)
• K8 ... Lower 32 bits (b0 to b31)
Operation error
Error code Description
(SD0/SD8067)
2820H The range of the device specified by (d) exceeds the range of said device.
7 BASIC INSTRUCTIONS
214 7.2 Arithmetic Operation Instructions
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);
ENO:=DMULP(EN,s1,s2,d); ENO:=DMULP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DMUL(P) Multiplicand data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be multiplied by another is stored
DMUL(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DMUL(P) Multiplier data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S 7
data by which another is to be multiplied is
DMUL(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
stored
(d) DMUL(P) Head device for storing the operation result 64-bit signed binary ANY32_S_ARRAY
(Number of elements:
2)
DMUL(P)_U 64-bit unsigned binary ANY32_U_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 215
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)+1 (s1) (s2)+1 (s2) (d)+3 (d)+2 (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b63 ··· b48 b47 ··· b32 b31 ··· b16 b15 ··· b0
567890 (BIN) × 123456 (BIN) 70109427840 (BIN)
• When nibble is specified ranging from K1 to K8 for (d), the result is obtained only for the lower-order 32 bits, and is not
obtained for the higher-order 32 bits. Transfer the data to word devices once, then execute the operation.
D100 → Y17 to Y0
DMOV D100 K8Y0
D101 → Output to Y37 to Y20
■Related flag
Device Name Description
SM8304 Zero When the operation result is 0, the zero flag is turned ON.
Precautions
• Even if word devices are used, the operation result (64 bits binary data) cannot be monitored at one time. In such a case, a
floating point operation is recommended.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of the device specified by (d) exceeds the range of said device.
7 BASIC INSTRUCTIONS
216 7.2 Arithmetic Operation Instructions
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).
Ladder diagram Structured text*1
ENO:=DDIVISION(EN,s1,s2,d); ENO:=DDIVISION_U(EN,s1,s2,d);
ENO:=DDIVISIONP(EN,s1,s2,d); ENO:=DDIVISIONP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data 7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) D/(P) Dividend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be divided by another is stored
D/(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) D/(P) Divisor data or the head device where the data -2147483648 to +2147483647 32-bit signed binary ANY32_S
by which another is to be divided is stored
D/(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) D/(P) Head device for storing the operation result 64-bit signed binary ANY32_ARRAY
(Number of elements:
D/(P)_U 64-bit unsigned binary
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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 division result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d) (d)+3 (d)+2
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) ÷ 123456 (BIN) 4 (BIN) 74066 (BIN)
• For the division result of word device, 64-bit binary is used to store the quotient and remainder. For bit device, 32-bit binary
is used to store quotient only.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 217
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
218 7.2 Arithmetic Operation Instructions
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);
ENO:=DDIVP(EN,s1,s2,d); ENO:=DDIVP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DDIV(P) Dividend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be divided by another is stored
DDIV(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DDIV(P) Divisor data or the head device where the data -2147483648 to +2147483647 32-bit signed binary ANY32_S 7
by which another is to be divided is stored
DDIV(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DDIV(P) Head device for storing the operation result 64-bit signed binary ANY32_S_ARRAY
(Number of elements:
2)
DDIV(P)_U 64-bit unsigned binary ANY32_U_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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 division result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d) (d)+3 (d)+2
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
567890 (BIN) ÷ 123456 (BIN) 4 (BIN) 74066 (BIN)
■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.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 219
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.
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.
3403H Signed operation is performed and the operation result exceeds 2147483647.
7 BASIC INSTRUCTIONS
220 7.2 Arithmetic Operation Instructions
Adding BCD 4-digit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Addend data or the device where the data that is added to 0 to 9999 BCD 4-digit ANY16
another is stored
(d) Device where the data to which another is added is stored 0 to 9999 BCD 4-digit ANY16
■Applicable devices 7
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• 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 addition result in the device specified by (d).
(d) (s) (d)
5 6 7 8 + 1 2 3 4 6 9 1 2
• If the addition result exceeds 9999, carry is ignored. In this case, the carry flag (SM700) does not turn ON.
6 4 3 2 + 3 5 8 3 0 0 1 5
Operation error
Error code Description
(SD/SD8067)
3405H BCD data in the device specified by (s) is outside of the valid range (0 to 9999).
BCD data in the device specified by (d) is outside of the valid range (0 to 9999).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 221
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);
ENO:=BPLUSP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Augend data or the device where the data to which 0 to 9999 BCD 4-digit ANY16
another is added is stored
(s2) Addend data or the device where the data that is added to 0 to 9999 BCD 4-digit ANY16
another is stored
(d) Device for storing the operation result 0 to 9999 BCD 4-digit ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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 addition result in the device specified by (d).
(s1) (s2) (d)
5 6 7 8 + 1 2 3 4 6 9 1 2
• If the addition result exceeds 9999, carry is ignored. In this case, the carry flag (SM700) does not turn ON.
6 4 3 2 + 3 5 8 3 0 0 1 5
Operation error
Error code Description
(SD0/SD8067)
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).
7 BASIC INSTRUCTIONS
222 7.2 Arithmetic Operation Instructions
Subtracting BCD 4-digit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Subtrahend data or the device where the data to be 0 to 9999 BCD 4-digit ANY16
subtracted from another is stored
(d) Device where the data from which another is to be 0 to 9999 BCD 4-digit ANY16
subtracted is stored
■Applicable devices
7
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions subtract the BCD 4-digit data in the device specified by (s) and the BCD 4-digit data in the device
specified by (d), and store the subtraction result in the device specified by (d).
(d) (s) (d)
0 6 7 8 - 0 2 3 4 0 4 4 4
0 is entered.
• If an underflow occurs, the result will be as follows. In this case, the carry flag (SM700) does not turn ON.
0 0 0 1 - 0 0 0 3 9 9 9 8
Operation error
Error code Description
(SD0/SD8067)
3405H BCD data in the device specified by (s) is outside of the valid range (0 to 9999).
BCD data in the device specified by (d) is outside of the valid range (0 to 9999).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 223
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);
ENO:=BMINUSP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Minuend data or the device where the data from which 0 to 9999 BCD 4-digit ANY16
another is to be subtracted is stored
(s2) Subtrahend data or the device where the data to be 0 to 9999 BCD 4-digit ANY16
subtracted from another is stored
(d) Device for storing the operation result 0 to 9999 BCD 4-digit ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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 subtraction result in the device specified by (d).
(s1) (s2) (d)
0 6 7 8 - 0 2 3 4 0 4 4 4
0 is entered.
• If an underflow occurs, the result will be as follows. In this case, the carry flag (SM700) does not turn ON.
0 0 0 1 - 0 0 0 3 9 9 9 8
Operation error
Error code Description
(SD0/SD8067)
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).
7 BASIC INSTRUCTIONS
224 7.2 Arithmetic Operation Instructions
Adding BCD 8-digit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Addend data or the head device where the data that is 0 to 99999999 BCD 8-digit ANY32
added to another is stored
(d) Head device where the data to which another is added is 0 to 99999999 BCD 8-digit ANY32
stored
■Applicable devices
7
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• 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 addition result in the device specified by (d).
(d)+1 (d) (s)+1 (s) (d)+1 (d)
0 9 8 7 1 0 6 8 + 0 0 3 2 3 4 5 6 1 0 1 9 4 5 2 4
0 is entered.
• If the addition result exceeds 99999999, carry is ignored. In this case, the carry flag (SM700) does not turn ON.
9 9 0 0 0 0 0 0 + 0 1 6 5 4 3 2 1 0 0 6 5 4 3 2 1
Operation error
Error code Description
(SD0/SD8067)
3405H BCD data in the device specified by (s) is outside of the valid range (0 to 99999999).
BCD data in the device specified by (d) is outside of the valid range (0 to 99999999).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 225
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);
ENO:=DBPLUSP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Augend data or the head device where the data to which 0 to 99999999 BCD 8-digit ANY32
another is added is stored
(s2) Addend data or the head device where the data that is 0 to 99999999 BCD 8-digit ANY32
added to another is stored
(d) Head device for storing the operation result 0 to 99999999 BCD 8-digit ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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 addition result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
5 6 7 8 9 1 2 3 + 0 1 2 3 4 5 6 7 5 8 0 2 3 6 9 0
0 is entered.
• If the addition result exceeds 99999999, carry is ignored. In this case, the carry flag (SM700) does not turn ON.
9 9 0 0 0 0 0 0 + 0 1 6 5 4 3 2 1 0 0 6 5 4 3 2 1
Operation error
Error code Description
(SD0/SD8067)
3405H BCD data in the device specified by (s1) is outside of the valid range (0 to 99999999).
BCD data in the device specified by (s2) is outside of the valid range (0 to 99999999).
7 BASIC INSTRUCTIONS
226 7.2 Arithmetic Operation Instructions
Subtracting BCD 8-digit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Subtrahend data or the device where the data to be 0 to 99999999 BCD 8-digit ANY32
subtracted from another is stored
(d) Minuend data or the device where the data from which 0 to 99999999 BCD 8-digit ANY32
another is to be subtracted is stored
■Applicable devices
7
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions subtract the BCD 8-digit data specified by (d) and the BCD 8-digit data specified by (s), and store the
results in the device specified by (d).
(d)+1 (d) (s)+1 (s) (d)+1 (d)
0 9 8 7 1 0 6 8 - 0 0 3 2 3 4 5 6 0 9 5 4 7 6 1 2
0 is entered.
• If an underflow occurs, the result will be as follows. In this case, the carry flag (SM700) does not turn ON.
1 2 3 4 5 6 7 8 - 1 2 3 4 5 6 7 9 9 9 9 9 9 9 9 9
Operation error
Error code Description
(SD0/SD8067)
3405H BCD data in the device specified by (s) is outside of the valid range (0 to 99999999).
BCD data in the device specified by (d) is outside of the valid range (0 to 99999999).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 227
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) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Minuend data or the head device where the data from 0 to 99999999 BCD 8-digit ANY32
which another is to be subtracted is stored
(s2) Subtrahend data or the head device where the data to be 0 to 99999999 BCD 8-digit ANY32
subtracted from another is stored
(d) Head device for storing the operation result 0 to 99999999 BCD 8-digit ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
5 6 7 8 9 1 2 3 - 0 1 2 3 4 5 6 7 5 5 5 5 4 5 5 6
0 is entered.
• If an underflow occurs, the result will be as follows. In this case, the carry flag (SM700) does not turn ON.
1 2 3 4 5 6 7 8 - 1 2 3 4 5 6 7 9 9 9 9 9 9 9 9 9
Operation error
Error code Description
(SD0/SD8067)
3405H BCD data in the device specified by (s1) is outside of the valid range (0 to 99999999).
BCD data in the device specified by (s2) is outside of the valid range (0 to 99999999).
7 BASIC INSTRUCTIONS
228 7.2 Arithmetic Operation Instructions
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
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s1) Multiplicand data or the device where the data to be 0 to 9999 BCD 4-digit ANY16
multiplied by another is stored
(s2) Multiplier data or the device where the data by which 0 to 9999 BCD 4-digit ANY16
another is to be multiplied is stored
(d) Head device for storing the operation result BCD 8-digit ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions multiply the BCD 4-digit data specified by (s1) and the BCD 4-digit data specified by (s2), and store the
multiplication results in the device specified by (d). ((d)+1: Upper 4 digits, (d): Lower 4 digits)
(s1) (s2) (d)+1 (d)
5 6 7 8 × 0 8 7 6 0 4 9 7 3 9 2 8
0 is entered.
Operation error
Error code Description
(SD0/SD8067)
2820H Device specified by (d) exceeds the allowable device range
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).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 229
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
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Dividend data or the device where the data to be divided 0 to 9999 BCD 4-digit ANY16
by another is stored
(s2) Divisor data or the device where the data by which 0 to 9999 BCD 4-digit ANY16
another is to be divided is stored
(d) Head device for storing the operation result BCD 8-digit ANY16_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions divide the BCD 4-digit data specified by (s1) by the BCD 4-digit data specified by (s2), and store the
results of division in the device specified by (d).
(s1) (s2) (d) (d)+1
5 6 7 8 ÷ 0 8 7 6 0 0 0 6 0 4 2 2
0 is entered.
(d): Quotient
(d)+1: Remainder
• The results of division are stored as quotient and remainder using 32 bit(s).
• Quotient (BCD 4-digit): Stored in lower 16 bit(s).
• Remainder (BCD 4-digit): Stored in upper 16 bit(s).
7 BASIC INSTRUCTIONS
230 7.2 Arithmetic Operation Instructions
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).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 231
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
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Multiplicand data or the head device where the data to be 0 to 99999999 BCD 8-digit ANY32
multiplied by another is stored
(s2) Multiplier data or the head device where the data by which 0 to 99999999 BCD 8-digit ANY32
another is to be multiplied is stored
(d) Head device for storing the operation result BCD 16-digit ANY32_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
232 7.2 Arithmetic Operation Instructions
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)
9 9 9 9 9 9 9 9 × 9 9 9 9 9 9 9 9
9 9 9 9 9 9 9 8 0 0 0 0 0 0 0 1
• When (d) is a bit device, only the lower 8 nibbles (32 bits) of the multiplication result are stored, and the higher 8 nibbles (32
bits) cannot be specified.
Ex.
Multiplication result when (d) is a bit device
• K1 ... Lower 1 nibble (b0 to b3)
• K4 ... Lower 4 nibbles (b0 to b15)
• K8 ... Lower 8 nibbles (b0 to b31)
Operation error
Error code Description
(SD0/SD8067)
2820H Device specified by (d) exceeds the allowable device range
7
3405H BCD data in the device specified by (s1) is outside of the valid range (0 to 99999999).
BCD data in the device specified by (s2) is outside of the valid range (0 to 99999999).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 233
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
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Dividend data or the head device where the data to be 0 to 99999999 BCD 8-digit ANY32
divided by another is stored
(s2) Divisor data or the head device where the data by which 0 to 99999999 BCD 8-digit ANY32
another is to be divided is stored
(d) Head device for storing the operation result BCD 16-digit ANY32_ARRAY
(Number of elements:
2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
7 BASIC INSTRUCTIONS
234 7.2 Arithmetic Operation Instructions
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)
5 6 7 8 9 1 2 3 ÷ 0 1 2 3 4 5 6 7
0 is entered.
0 0 0 0 0 0 4 5 0 1 2 3 3 6 0 8
• The results of division are stored as quotient and remainder using 64 bit(s) binary.
• Quotient (BCD 8-digit): Stored in lower 32 bit(s).
• Remainder (BCD 8-digit): Stored in upper 32 bit(s).
Operation error
Error code Description
(SD0/SD8067)
2820H Device specified by (d) exceeds the allowable device range 7
3400H 0 is specified for (s2) value.
3405H BCD data in the device specified by (s1) is outside of the valid range (0 to 99999999).
BCD data in the device specified by (s2) is outside of the valid range (0 to 99999999).
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 235
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*1
ENO:=BKPLUS(EN,s1,s2,n,d); ENO:=BKPLUS_U(EN,s1,s2,n,d);
ENO:=BKPLUSP(EN,s1,s2,n,d); ENO:=BKPLUSP_U(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) BK+(P) Head device where the data to which another -32768 to +32767 16-bit signed binary ANY16_S
data is added is stored
BK+(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) BK+(P) Addend data or the head device where the -32768 to +32767 16-bit signed binary ANY16_S
data that is added to another is stored
BK+(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) BK+(P) Head device for storing the operation result 16-bit signed binary ANY16_S
BK+(P)_U 16-bit unsigned binary ANY16_U
(n) Number of addition data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
(n)
7 BASIC INSTRUCTIONS
236 7.2 Arithmetic Operation Instructions
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).
• Block addition is performed in units of 16-bits.
Ex.
If device is specified for (s2) (signed)
b15 ∙∙∙ b0 b15 ∙∙∙ b0 b15 ∙∙∙ b0
(s1) 1234 (BIN) (s2) 4000 (BIN) (d) 5234 (BIN)
(s1)+1 4567 (BIN) (s2)+1 1234 (BIN) (d)+1 5801 (BIN)
(s1)+2 -2000 (BIN) (s2)+2 -1234 (BIN) (d)+2 -3234 (BIN)
(n) + (n) (n)
∙∙∙
∙∙∙
∙∙∙
(s1)+(n-2) -1234 (BIN) (s2)+(n-2) 5000 (BIN) (d)+(n-2) 3766 (BIN)
(s1)+(n-1) 4000 (BIN) (s2)+(n-1) 4321 (BIN) (d)+(n-1) 8321 (BIN)
∙∙∙
(s1)+(n-2) -1234 (BIN) (d)+(n-2) 3087 (BIN) 7
(s1)+(n-1) 4000 (BIN) (d)+(n-1) 8321 (BIN)
• If an underflow or overflow occurs for operation result, the result will be as follows. In this case, the carry flag (SM700) does
not turn ON.
If signed is specified If unsigned is specified
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 237
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*1
ENO:=BKMINUS(EN,s1,s2,n,d); ENO:=BKMINUS_U(EN,s1,s2,n,d);
ENO:=BKMINUSP(EN,s1,s2,n,d); ENO:=BKMINUSP_U(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) BK-(P) Head device where the data from which -32768 to +32767 16-bit signed binary ANY16_S
another is to be subtracted is stored
BK-(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) BK-(P) Subtrahend data or the head device where the -32768 to +32767 16-bit signed binary ANY16_S
data to be subtracted from another is stored
BK-(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) BK-(P) Head device for storing the operation result 16-bit signed binary ANY16_S
BK-(P)_U 16-bit unsigned binary ANY16_U
(n) Number of subtraction data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
(n)
7 BASIC INSTRUCTIONS
238 7.2 Arithmetic Operation Instructions
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).
• Block subtraction is performed in 16-bit units.
Ex.
If device has been specified for (s2)
b15 ∙∙∙ b0 b15 ∙∙∙ b0 b15 ∙∙∙ b0
(s1) 8765 (BIN) (s2) 1234 (BIN) (d) 7531 (BIN)
(s1)+1 8888 (BIN) (s2)+1 5678 (BIN) (d)+1 3210 (BIN)
(s1)+2 9325 (BIN) (s2)+2 9876 (BIN) (d)+2 -551 (BIN)
(n) - (n) (n)
∙∙∙
∙∙∙
∙∙∙
(s1)+(n-2) 5000 (BIN) (s2)+(n-2) 4321 (BIN) (d)+(n-2) 679 (BIN)
(s1)+(n-1) 4352 (BIN) (s2)+(n-1) 4000 (BIN) (d)+(n-1) 352 (BIN)
∙∙∙
(s1)+(n-2) 5000 (BIN) (d)+(n-2) -3880 (BIN) 7
(s1)+(n-1) 4352 (BIN) (d)+(n-1) -4528 (BIN)
• If an underflow or overflow occurs for operation result, the result will be as follows. In this case, the carry flag (SM700) does
not turn ON.
If signed is specified If unsigned is specified
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 239
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*1
ENO:=DBKPLUS(EN,s1,s2,n,d); ENO:=DBKPLUS_U(EN,s1,s2,n,d);
ENO:=DBKPLUSP(EN,s1,s2,n,d); ENO:=DBKPLUSP_U(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DBK+(P) Head device where the data to which another -2147483648 to +2147483647 32-bit signed binary ANY32_S
is added is stored
DBK+(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DBK+(P) Addend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data that is added to another is stored
DBK+(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DBK+(P) Head device for storing the operation result 32-bit signed binary ANY32_S
DBK+(P)_U 32-bit unsigned binary ANY32_U
(n) Number of addition data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
(n)
7 BASIC INSTRUCTIONS
240 7.2 Arithmetic Operation Instructions
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).
• Block addition is performed in 32-bit units.
Ex.
If device is specified for (s2) (signed)
∙∙∙
∙∙∙
∙∙∙
∙∙∙
∙∙∙
(s1)+(2n-1), (s1)+(2n-2) 60000 (BIN) (s2)+(2n-1), (s2)+(2n-2) -20000 (BIN) (d)+(2n-1), (d)+(2n-2) 40000 (BIN)
∙∙∙
∙∙∙
∙∙∙
(s1)+(2n-1), (s1)+(2n-2) 60000 (BIN) (d)+(2n-1), (d)+(2n-2) 110000 (BIN)
• Operation is enabled when (s1) or (s2) have been specified by same device as (d) (perfect match). An error occurs if the
7
device range of (n) point(s) from (s1) or (s2) partially matches (overlaps) the device range of (n) point(s) from (d).
Ex.
If 4 points of the device from (s2) and (d) match
W7, W6 D7, D6
D9, D8
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 241
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
242 7.2 Arithmetic Operation Instructions
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*1
ENO:=DBKMINUS(EN,s1,s2,n,d); ENO:=DBKMINUS_U(EN,s1,s2,n,d);
ENO:=DBKMINUSP(EN,s1,s2,n,d); ENO:=DBKMINUSP_U(EN,s1,s2,n,d
(s1) (s2) (d) (n)
);
FBD/LD
EN ENO
s1 d
s2
Setting data 7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DBK-(P) Head device where the data from which -2147483648 to +2147483647 32-bit signed binary ANY32_S
another is to be subtracted is stored
DBK-(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DBK-(P) Subtrahend data or the head device where the -2147483648 to +2147483647 32-bit signed binary ANY32_S
data to be subtracted from another is stored
DBK-(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DBK-(P) Head device for storing the operation result 32-bit signed binary ANY32_S
DBK-(P)_U 32-bit unsigned binary ANY32_U
(n) Number of subtraction data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
(n)
Processing details
• 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).
• Block subtraction is performed in 32-bit units.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 243
Ex.
If device is specified for (s2) (signed)
∙∙∙
∙∙∙
∙∙∙
∙∙∙
∙∙∙
(s1)+(2n-1), (s1)+(2n-2) 13579 (BIN) (s2)+(2n-1), (s2)+(2n-2) 12345 (BIN) (d)+(2n-1), (d)+(2n-2) 1234 (BIN)
∙∙∙
∙∙∙
∙∙∙
(s1)+(2n-1), (s1)+(2n-2) 79999 (BIN) (d)+(2n-1), (d)+(2n-2) 70000 (BIN)
• Operation is enabled when (s1) or (s2) have been specified by same device as (d) (perfect match). An error occurs if the
device range of (n) point(s) from (s1) or (s2) partially matches (overlaps) the device range of (n) point(s) from (d).
Ex.
If 4 points of the device from (s2) and (d) match
b31 ∙∙∙ b0 b31 ∙∙∙ b0 b31 ∙∙∙ b0
W1, W0 D1, D0 (1) Because it is a perfect match, operation is
W3, W2 D3, D2 possible.
(1)
W5, W4 D5, D4
W7, W6 D7, D6
W7, W6 D7, D6
D9, D8
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
244 7.2 Arithmetic Operation Instructions
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) INC(P) Device to be incremented by +1 -32768 to +32767 16-bit signed binary ANY16_S
EN
INC(P)_U
Execution condition
0 to 65535
16-bit unsigned binary
Bit
ANY16_U
BOOL
7
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions add +1 to the device (16-bit binary data) specified by (d).
(d) (d)
• If INC(P) instruction is executed when contents of device specified by (d) is 32767, -32768 is stored in the device specified
by (d). (If signed is specified)
• If INC(P)_U instruction is executed when contents of device specified by (d) is 65535, 0 is stored in the device specified by
(d). (If unsigned is specified)
• Flags (zero, carry and borrow) are not activated at this time.
Precautions
Note that data is incremented in every operation cycle in a continuous operation type (INC) instruction.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 245
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) DEC(P) Device to be decremented by -1 -32768 to +32767 16-bit signed binary ANY16_S
DEC(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions decrement device (16-bit binary data) specified by (d) by 1.
(d) (d)
• If DEC(P) instruction is executed when contents of device specified by (d) is -32768, 32767 is stored in the device specified
by (d). (If signed is specified)
• If DEC(P)_U instruction is executed when contents of device specified by (d) is 0, 65535 is stored in the device specified by
(d). (If unsigned is specified)
• Flags (zero, carry and borrow) are not activated at this time.
Precautions
Note that data is decremented in every operation cycle in a continuous operation type (DEC) instruction.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
246 7.2 Arithmetic Operation Instructions
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) DINC(P) Head device to be incremented by +1 -2147483648 to +2147483647 32-bit signed binary ANY32_S
EN
DINC(P)_U
Execution condition
0 to 4294967295
32-bit unsigned binary
Bit
ANY32_U
BOOL
7
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions add +1 to the contents of device (32-bit binary data) specified by (d).
(d)+1 (d) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
73500 (BIN) +1 73501 (BIN)
• If DINC(P) instruction is executed when contents of device specified by (d) is 2147483647, -2147483648 is stored in the
device specified by (d). (If signed is specified)
• If DINC(P)_U instruction is executed when contents of device specified by (d) is 4294967295, 0 is stored in the device
specified by (d). (If unsigned is specified)
• Flags (zero, carry and borrow) are not activated at this time.
Precautions
Note that data is incremented in every operation cycle in a continuous operation type instruction.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions 247
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);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) DDEC(P) Head device to be decremented by 1 -2147483648 to +2147483647 32-bit signed binary ANY32_S
DDEC(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions decrement contents of device (32-bit binary data) specified by (d) by 1.
(d)+1 (d) (d)+1 (d)
b31 ··· b16 b15 ··· b0 b31 ··· b16 b15 ··· b0
73500 (BIN) -1 73499 (BIN)
• If DDEC(P) instruction is executed when contents of device specified by (d) is 0, -1 is stored in the device specified by (d).
(If signed is specified)
• If DDEC(P)_U instruction is executed when contents of device specified by (d) is 0, 4294967295 is stored in the device
specified by (d). (If unsigned is specified)
• Flags (zero, carry and borrow) are not activated at this time.
Precautions
Note that data is decremented in every operation cycle in a continuous operation type (DDEC) instruction.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
248 7.2 Arithmetic Operation Instructions
7.3 Logical Operation Instructions
Performing an AND operation on 16-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for AND or device where the data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Device for storing AND results -32768 to +32767 16-bit signed binary ANY16
7
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• 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).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(d) 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
AND
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 249
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);
ENO:=WANDP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for AND or device where the data is stored -32768 to +32767 16-bit signed binary ANY16
(s2) Data for AND or device where the data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Device for storing AND results 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s1) 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
AND
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s2) 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
250 7.3 Logical Operation Instructions
Performing an AND operation on 32-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for AND or head device where the data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(d) Head device for storing AND results -2147483648 to +2147483647 32-bit signed binary ANY32
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
7
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• 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).
(d)+1 (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(d) 1 1 1 1 1 1 0 0 1 1 0 0 1 1
AND
(s)+1 (s)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s) 0 1 0 1 1 0 0 1 0 1 0 0 0 1
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 251
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);
ENO:=DANDP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for AND or head device where the data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Data for AND or head device where the data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(d) Head device for storing AND results 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• 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).
(s1)+1 (s1)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s1) 1 1 1 1 1 1 0 0 1 1 0 0 1 1
AND
(s2)+1 (s2)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s2) 0 1 0 1 1 0 0 1 0 1 0 0 0 1
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
252 7.3 Logical Operation Instructions
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);
ENO:=BKANDP(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
7
Operand Description Range Data type Data type (label)
(s1) Head device that stores data for AND -32768 to +32767 16-bit signed binary ANY16
(s2) Data for AND or head device where the data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Head device for storing AND results 16-bit signed binary ANY16
(n) Number of data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)*1
*1
(s2)
(d)*1
(n)
*1 The same device number can be specified for (s1) and (d) or (s2) and (d).
Processing details
• 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.
(s1)+(n-1) (s1)+1 (s1)
AND
(s2)+(n-1) (s2)+1 (s2)
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 … 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 … 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 253
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
254 7.3 Logical Operation Instructions
Performing an OR operation on 16-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Head device for storing the OR results -32768 to +32767 16-bit signed binary ANY16
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
7
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions OR 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).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(d) 0 1 0 1 1 1 1 1 0 0 0 0 0 0 1 1
OR
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 255
WOR(P) [using three operands]
These instructions OR 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:=WOR(EN,s1,s2,d);
ENO:=WORP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(s2) Data for OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Head device for storing the OR results 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions OR 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).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s1) 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0
OR
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s2) 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
256 7.3 Logical Operation Instructions
Performing an OR operation on 32-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for OR or head device where data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(d) Head device for storing the OR results -2147483648 to +2147483647 32-bit signed binary ANY32
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
7
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions OR 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).
(d)+1 (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(d) 1 1 1 1 0 0 0 0 0 0 0 0 1 1
OR
(s)+1 (s)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s) 1 0 0 1 0 0 0 1 1 1 0 0 1 1
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 257
DOR(P) [using three operands]
These instructions OR 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:=DOR(EN,s1,s2,d);
ENO:=DORP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for OR or head device where data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Data for OR or head device where data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(d) Head device for storing the OR results 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions OR 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).
(s1)+1 (s1)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s1) 0 0 1 1 0 0 1 1 0 0 1 1 0 0
OR
(s2)+1 (s2)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s2) 0 0 1 0 1 1 0 0 0 0 1 1 1 1
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
258 7.3 Logical Operation Instructions
Performing an OR operation on 16-bit block data
BKOR(P)
These instructions OR 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:=BKOR(EN,s1,s2,n,d);
ENO:=BKORP(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
7
Operand Description Range Data type Data type (label)
(s1) Head device where the logical operation data is stored -32768 to +32767 16-bit signed binary ANY16
(s2) Logical operation data or the head device where the -32768 to +32767 16-bit signed binary ANY16
logical operation data is stored
(d) Head device for storing the operation result 16-bit signed binary ANY16
(n) Number of data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)*1
(s2)*1
*1
(d)
(n)
*1 The same device number can be specified for (s1) and (d) or (s2) and (d).
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 259
Processing details
• These instructions seek OR of 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.
(s1)+(n-1) (s1)+1 (s1)
OR
(s2)+(n-1) (s2)+1 (s2)
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 … 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0
1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 … 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
260 7.3 Logical Operation Instructions
Performing an XOR operation on 16-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for exclusive OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Head device for storing exclusive OR results -32768 to +32767 16-bit signed binary ANY16
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
7
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions exclusive OR 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).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(d) 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
XOR
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 261
WXOR(P) [using three operands]
These instructions exclusive OR 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:=WXOR(EN,s1,s2,d);
ENO:=WXORP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for exclusive OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(s2) Data for exclusive OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Head device for storing exclusive OR results 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions exclusive OR 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).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s1) 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0
XOR
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s2) 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
262 7.3 Logical Operation Instructions
Performing an XOR operation on 32-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for exclusive OR or head device where data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(d) Head device for storing exclusive OR results -2147483648 to +2147483647 32-bit signed binary ANY32
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
7
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions exclusive OR 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).
(d)+1 (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(d) 0 1 0 1 0 1 0 1 0 1 0 1 0 1
XOR
(s)+1 (s)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s) 0 1 1 0 0 1 1 0 1 0 0 1 1 0
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 263
DXOR(P) [using three operands]
These instructions exclusive OR 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:=DXOR(EN,s1,s2,d);
ENO:=DXORP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for exclusive OR or head device where data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Data for exclusive OR or head device where data is stored -2147483648 to +2147483647 32-bit signed binary ANY32
(d) Head device for storing exclusive OR results 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions exclusive OR 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).
(s1)+1 (s1)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s1) 1 1 1 1 0 0 0 0 0 0 1 1 1 1
XOR
(s2)+1 (s2)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s2) 1 1 1 1 1 0 1 0 1 0 1 1 0 0
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
264 7.3 Logical Operation Instructions
Performing an XOR operation on 16-bit block data
BKXOR(P)
These instructions seek exclusive OR of 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:=BKXOR(EN,s1,s2,n,d);
ENO:=BKXORP(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types 7
Operand Description Range Data type Data type (label)
(s1) Data for exclusive OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(s2) Data for exclusive OR or head device where data is stored -32768 to +32767 16-bit signed binary ANY16
(d) Head device for storing the operation result 16-bit signed binary ANY16
(n) Number of data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)*1
(s2)*1
(d)*1
(n)
*1 The same device number can be specified for (s1) and (d) or (s2) and (d).
Processing details
• These instructions exclusive OR 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.
(s1)+(n-1) (s1)+1 (s1)
XOR
(s2)+(n-1) (s2)+1 (s2)
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 … 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0
0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 … 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 265
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
266 7.3 Logical Operation Instructions
Performing an XNOR operation on 16-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for exclusive NOR or head device where data is -32768 to +32767 16-bit signed binary ANY16
stored
(d) Head device for storing exclusive NOR results -32768 to +32767 16-bit signed binary ANY16
■Applicable devices 7
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions exclusive NOR 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).
b15 b8 b7 b0
(d) 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1
XNOR
b15 b8 b7 b0
(s) 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0
b15 b8 b7 b0
(d) 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 0
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 267
WXNR(P) [using three operands]
These instructions exclusive NOR 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:=WXNR(EN,s1,s2,d);
ENO:=WXNRP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for exclusive NOR or head device where data is -32768 to +32767 16-bit signed binary ANY16
stored
(s2) Data for exclusive NOR or head device where data is -32768 to +32767 16-bit signed binary ANY16
stored
(d) Head device for storing exclusive NOR results 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions exclusive NOR 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).
b15 b8 b7 b0
(s1) 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
XNOR
b15 b8 b7 b0
(s2) 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1
b15 b8 b7 b0
(d) 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
268 7.3 Logical Operation Instructions
Performing an XNOR operation on 32-bit data
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data for exclusive NOR or head device where data is -2147483648 to +2147483647 32-bit signed binary ANY32
stored
(d) Head device for storing exclusive NOR results -2147483648 to +2147483647 32-bit signed binary ANY32
■Applicable devices 7
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions exclusive NOR 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).
(d)+1 (d)
b31 b16 b15 b0
(d) 1 1 0 0 0 0 0 0 0 0 0 0 1 1
XNOR
(s)+1 (s)
b31 b16 b15 b0
(s) 1 1 1 1 0 0 0 0 1 1 1 1 0 0
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 269
DXNR(P) [using three operands]
These instructions exclusive NOR 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:=DXNR(EN,s1,s2,d);
ENO:=DXNRP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data for exclusive NOR or head device where data is -2147483648 to +2147483647 32-bit signed binary ANY32
stored
(s2) Data for exclusive NOR or head device where data is -2147483648 to +2147483647 32-bit signed binary ANY32
stored
(d) Head device for storing exclusive NOR results 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions exclusive NOR 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).
(s1)+1 (s1)
b31 b16 b15 b0
(s1) 0 0 1 1 0 0 1 1 1 1 0 0 1 1
XNOR
(s2)+1 (s2)
b31 b16 b15 b0
(s2) 0 1 0 1 0 1 0 1 0 1 0 1 0 1
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
270 7.3 Logical Operation Instructions
Performing an XNOR operation on 16-bit block data
BKXNR(P)
These instructions exclusive NOR 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:=BKXNR(EN,s1,s2,n,d);
ENO:=BKXNRP(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
7
Operand Description Range Data type Data type (label)
(s1) Head device where the logical operation data is stored -32768 to +32767 16-bit signed binary ANY16
(s2) Logical operation data or the head device where the -32768 to +32767 16-bit signed binary ANY16
logical operation data is stored
(d) Head device for storing the operation result 16-bit signed binary ANY16
(n) Number of data 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)*1
(s2)*1
*1
(d)
(n)
*1 The same device number can be specified for (s1) and (d) or (s2) and (d).
7 BASIC INSTRUCTIONS
7.3 Logical Operation Instructions 271
Processing details
• These instructions exclusive NOR 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) onward.
(s1)+(n-1) (s1)+1 (s1)
XNOR
(s2)+(n-1) (s2)+1 (s2)
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0
1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
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).
(Does not apply when same device has been specified for (s2) and (d).)
7 BASIC INSTRUCTIONS
272 7.3 Logical Operation Instructions
7.4 Bit Processing Instructions
Setting a bit in the word device
BSET(P)
These instructions set (to 1) (n)th bit of word device specified by (d).
Ladder diagram Structured text
ENO:=BSET(EN,n,d);
ENO:=BSETP(EN,n,d);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(d) Head device for which bit is to be set 16-bit signed binary ANY16
(n) Number of bit(s) to be set 0 to 15 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
• These instructions set (to 1) (n)th bit of word device specified by (d).
• If (n) exceeds 15, the processing will be done based on the lower 4 bits of (n).
BSETP D10 K6
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.4 Bit Processing Instructions 273
Resetting a bit in the word device
BRST(P)
These instructions reset (to 0) (n)th bit of word device specified by (d).
Ladder diagram Structured text
ENO:=BRST(EN,n,d);
ENO:=BRSTP(EN,n,d);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device for which bit is to be reset 16-bit signed binary ANY16
(n) Number of bit(s) to be reset 0 to 15 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
• These instructions reset (to 0) (n)th bit of word device specified by (d).
• If (n) exceeds 15, the processing will be done based on the lower 4 bits of (n).
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
274 7.4 Bit Processing Instructions
Performing a 16-bit test
TEST(P)
These instructions take bit data at position specified by (s2) from device specified by (s1) and write to bit device specified by
(d).
Ladder diagram Structured text
ENO:=TEST(EN,s1,s2,d);
ENO:=TESTP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s1) Device number where bit data to be extracted is stored 16-bit signed binary ANY16
(s2) Position of bit data to be extracted 0 to 15 16-bit unsigned binary ANY16
(d) Bit device number where extracted bit data is to be stored Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
Processing details
• These instructions take bit data at position specified by (s2) from device specified by (s1) and write to bit device specified
by (d).
(1)
• If relevant bit is "0", device specified by (d) is turned OFF, and if it is "1", device is turned ON.
• For (s2) specify the bit position (0 to 15) of word data. If 16 or more is specified for (s2), the value of the remainder of
(s2)÷16 is the bit position.
Ex.
For (s2) = 18, the remainder for 18÷16 is "2", so it becomes data of b2.
7 BASIC INSTRUCTIONS
7.4 Bit Processing Instructions 275
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
276 7.4 Bit Processing Instructions
Performing a 32-bit test
DTEST(P)
These instructions take bit data at position specified by (s2) from device specified by (s1) and write to bit device specified by
(d).
Ladder diagram Structured text
ENO:=DTEST(EN,s1,s2,d);
ENO:=DTESTP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s1) Device number where bit data to be extracted is stored 32-bit signed binary ANY32
(s2) Position of bit data to be extracted 0 to 31 16-bit unsigned binary ANY16
(d) Bit device number where extracted bit data is to be stored Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
Processing details
• These instructions take bit data at position specified by (s2) from device specified by (s1), (s1) +1 and write to bit device
specified by (d).
(1)
• If relevant bit is "0", device specified by (d) is turned OFF, and if it is "1", device is turned ON.
• For (s2) specify the bit position (0 to 31) of double word data. If 32 or more is specified for (s2), the value of the remainder
of (s2)÷32 is the bit position.
Ex.
For (s2) = 34, the remainder for 34÷32 is "2", so it becomes data of b2.
7 BASIC INSTRUCTIONS
7.4 Bit Processing Instructions 277
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
278 7.4 Bit Processing Instructions
Batch-resetting bit devices
BKRST(P)
These instructions reset (n) point(s) bit devices from the bit device specified by (d).
Ladder diagram Structured text
ENO:=BKRST(EN,n,d);
ENO:=BKRSTP(EN,n,d);
(d) (n)
FBD/LD
EN ENO
n d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device to be reset Bit ANY_BOOL
(n)
EN
Number of devices to be reset
Execution condition
16-bit unsigned binary
Bit
ANY16
BOOL
7
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
• These instructions reset (n) point(s) bit devices from the bit device specified by (d).
• Reset status of bit device is as follows.
Device Status
Annunciator (F) • (n) point(s) from annunciator (F) number specified by (d) are turned OFF.
• Annunciator numbers from SD64 to SD79 that were turned OFF are deleted and the subsequent numbers are
shifted forward.
• The number of annunciators stored in SD64 to SD79 is stored in SD63.
Timer (T), Counter (C) • Current value of (n) point(s) from timer (T) or counter (C) number specified by (d) is set to 0, and coil contact is
turned OFF.
Bit devices other than given above • Coils and contacts of (n) point(s) from the device specified by (d) are turned OFF.
Operation error
Error code Description
(SD0/SD8067)
2820H (n) point(s) of data starting from the device specified by (d) exceed the corresponding device range.
7 BASIC INSTRUCTIONS
7.4 Bit Processing Instructions 279
Batch-resetting devices
ZRST(P)
These instructions reset all data among devices of same type specified by (d1) and (d2). Use these instructions for restarting
operation from the beginning after pause or after resetting control data.
Ladder diagram Structured text
ENO:=ZRST(EN, d1, d2);
ENO:=ZRSTP(EN, d1, d2);
(d1) (d2)
FBD/LD
EN ENO
d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d1) Head bit or word device number to be reset Bit/16-bit signed binary ANY_ELEMENTARY
(d2) Last bit or word device number to be reset Bit/16-bit signed binary ANY_ELEMENTARY
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d1)
(d2)
Processing details
• These instructions reset all data among devices of same type specified by (d1) and (d2).
• OFF (reset) is written to the entire range of devices from (d1) to (d2) all at once if (d1) and/or (d2) are bit devices.
(d2) .... (d1)+9 (d1)+8 (d1)+7 (d1)+6 (d1)+5 (d1)+4 (d1)+3 (d1)+2 (d1)+1 (d1)
OFF
OFF .... OFF OFF OFF OFF OFF OFF OFF OFF OFF OFF
• K0 is written to the entire range of devices from (d1) to (d2) all at once if (d1) and/or (d2) are word devices.
(d2) .... (d1)+9 (d1)+8 (d1)+7 (d1)+6 (d1)+5 (d1)+4 (d1)+3 (d1)+2 (d1)+1 (d1)
K0
K0 .... K0 K0 K0 K0 K0 K0 K0 K0 K0 K0
7 BASIC INSTRUCTIONS
280 7.4 Bit Processing Instructions
• As a reset instruction for individual devices, the RST instruction can be used for bit devices and word devices.
X1
RST M0 (1)
RST T0 (2)
RST D0 (3)
(1): M0 is reset.
(2): The current value of T0 is reset.
(3): D0 is reset.
• The FMOV(P) instruction is a batch write instruction for a constant (K0 for example) that can write "0" for word devices
(including nibble specification of bit devices).
X2
FMOV K0 D0 K100 (1)
Precautions
• Specify the same type of device for (d1) and (d2) so that (d1) number is less than (d2) number. If the (d1) number≥(d2)
number, only the device specified by (d1) is reset.
• The ZRST(P) instruction is a 16-bit instruction, but long counter (LC) and long index register (LZ) can be specified for (d1)
and (d2). 7
X0
ZRST C180 C199
Operation error
Error code Description
(SD0/SD8067)
2820H The number of devices to be reset is 32768 or more when module access device has been specified for (d1) and/or (d2).
3405H Device type specified by (d1) differs from type specified by (d2).
Module number for (d1) and (d2) differ when module access device is specified.
7 BASIC INSTRUCTIONS
7.4 Bit Processing Instructions 281
7.5 Data Conversion Instructions
Converting binary data to BCD 4-digit data
BCD(P)
These instructions convert the binary data in the device specified by (s) to BCD data, and store the converted data in the
device specified by (d).
Binary data is used in operations in CPU module. Use this instruction to display numeric values on seven-segment display
unit equipped with BCD decoder.
Ladder diagram Structured text
ENO:=BCD(EN,s,d);
ENO:=BCDP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Binary data or the head device where the binary data is 0 to 9999 16-bit signed binary ANY16
stored
(d) Head device for storing the BCD data BCD 4-digit ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit binary data (0 to 9999) in the device specified by (s) to BCD 4-digit data, and store the
converted data in the device specified by (d).
-32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
(s) BIN 9999 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
(1) BCD
7 BASIC INSTRUCTIONS
282 7.5 Data Conversion Instructions
• Data specified by (s) can be converted if it is within the range from K0 to K9999 BCD (decimal).
• The table below shows nibble specification for the data in the device specified by (s) and (d).
X0 BIN
BCD (s) (d) CPU module BCD
Y14 to Y10 to Y4 to Y0 to
When "K4Y000" is specified
Y17 Y13 Y7 Y3
BCD
Precautions
• Binary data is used in all operations in CPU module including arithmetic operations (+-×÷), increment and decrement
instructions. When receiving digital switch information in binary-coded decimal (BCD) format into a CPU module, use the
BIN(P) instructions (for converting BCD data into binary data). Furthermore, to output data to seven-segment display unit
handling binary-coded decimal (BCD) data, use the BCD(P) instructions (for converting binary data into BCD data).
7
Operation error
Error code Description
(SD0/SD8067)
3401H Data in the device specified by (s) is out of the valid range (0 to 9999).
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 283
Converting binary data to BCD 8-digit data
DBCD(P)
These instructions convert the binary data in the device specified by (s) to BCD data, and store the converted data in the
device specified by (d).
Binary data is used in operations in CPU module. Use this instruction to display numeric values on seven-segment display
unit equipped with BCD decoder.
Ladder diagram Structured text
ENO:=DBCD(EN,s,d);
ENO:=DBCDP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Binary data or the head device where the binary data is 0 to 99999999 32-bit signed binary ANY32
stored
(d) Head device for storing the BCD data BCD 8-digit ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert 32-bit binary data (0 to 99999999) in device specified by (s) to BCD 8-digit data, and store the
converted data in the device specified by (d).
231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
(s) BIN 99999999 0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
(1) BCD
7 BASIC INSTRUCTIONS
284 7.5 Data Conversion Instructions
• Data specified by (s) can be converted if it is within the range from K0 to K99999999 BDC (decimal).
• The table below shows nibble specification for the data in the device specified by (s) and (d).
X0 BIN
DBCD (s) (d) CPU module DBCD
BCD
Precautions
• When using the SEGL instruction, because BCD⇔binary conversion is automatically executed, the BCD(P) instruction do 7
not have to be used.
• Binary data is used in all operations in CPU module including arithmetic operations (+-×÷), increment and decrement
instructions. When receiving digital switch information in binary-coded decimal (BCD) format into a CPU module, use the
BIN(P) instructions (for converting BCD data into binary data). Furthermore, to output data to seven-segment display unit
handling binary-coded decimal (BCD) data, use the BCD(P) instructions (for converting binary data into BCD data).
Operation error
Error code Description
(SD0/SD8067)
3401H Data in the device specified by (s) is out of the valid range (0 to 99999999).
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 285
Converting BCD 4-digit data to binary data
BIN(P)
These instructions convert the binary-coded decimal data in the device specified by (s) to binary data, and store the converted
data in the device specified by (d).
Use this instruction to convert a binary-coded decimal (BCD) value such as a value set by a digital switch into binary (BIN)
data and to receive the converted binary data so that the data can be handled in operations in CPU module.
Ladder diagram Structured text
ENO:=BIN(EN,s,d);
ENO:=BINP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Binary-coded decimal data or the head device where the 0 to 9999 BCD 4-digit ANY16
binary-coded decimal data is stored
(d) Head device for storing the binary data 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the BCD 4-digit data (0 to 9999) in the device specified by (s) to 16-bit binary data, and store the
converted data in the device specified by (d).
8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 1
BIN
(1)
(1): Filled with 0s.
7 BASIC INSTRUCTIONS
286 7.5 Data Conversion Instructions
• The data in the device specified by (s) can be converted if it is in the range from 0 to 9999 (BCD).
• The table below shows nibble specification for the data in the device specified by (s) and (d).
X0 BCD
BIN (s) (d)
6 7 8 9
In case of K4X0
X14 to X10 to X4 to X0 to
X17 X13 X7 X3
BIN
BIN CPU module
Precautions
• Binary data is used in all operations in CPU module including arithmetic operations (+-×÷), increment and decrement
instructions. When receiving digital switch information in binary-coded decimal (BCD) format into a CPU module, use the
BIN(P) instructions (for converting BCD data into binary data). Furthermore, to output data to seven-segment display unit
handling binary-coded decimal (BCD) data, use the BCD(P) instructions (for converting binary data into BCD data).
7
Operation error
Error code Description
(SD0/SD8067)
3401H The value of each digit of the device specified by (s) is other than 0 to 9. (The data is not binary-coded decimal data.)
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 287
Converting BCD 8-digit data to binary data
DBIN(P)
These instructions convert the binary-coded decimal data in the device specified by (s) to binary data, and store the converted
data in the device specified by (d).
Use this instruction to convert a binary-coded decimal (BCD) value such as a value set by a digital switch into binary (BIN)
data and to receive the converted binary data so that the data can be handled in operations in CPU module.
Ladder diagram Structured text
ENO:=DBIN(EN,s,d);
ENO:=DBINP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Binary-coded decimal data or the head device where the 0 to 99999999 BCD 8-digit ANY32
binary-coded decimal data is stored
(d) Head device for storing the binary data 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the BCD 8-digit data (0 to 99999999) in the device specified by (s) to 32-bit binary data, and
store the converted data in the device specified by (d).
(s)+1 (s)
BIN
(d)+1 (d)
231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
(d) BIN 99999999 0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
(1)
(1): Filled with 0s.
7 BASIC INSTRUCTIONS
288 7.5 Data Conversion Instructions
• The data in the device specified by (s) can be converted if it is in the range from 0 to 99999999 (BCD).
• The table below shows nibble specification for the data in the device specified by (s) and (d).
X0 BCD
DBIN (s) (d)
2 3 4 5 6 7 8 9
In case of K8X0
DBIN BIN
CPU module
Precautions
• Binary data is used in all operations in CPU module including arithmetic operations (+-×÷), increment and decrement
7
instructions. When receiving digital switch information in binary-coded decimal (BCD) format into a CPU module, use the
BIN instruction (for converting BCD data into binary data). Furthermore, to output data to seven-segment display unit
handling binary-coded decimal (BCD) data, use the BCD instruction (for converting binary data into BCD data).
Operation error
Error code Description
(SD0/SD8067)
3401H The value of each digit of the device specified by (s) is other than 0 to 9. (The data is not binary-coded decimal data.)
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 289
Converting single-precision real number to 16-bit signed binary
data
FLT2INT(P)
These instructions convert the single-precision real number in the device specified by (s) to 16-bit signed binary data, and
store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
Ladder diagram Structured text*1
ENO:=FLT2INT(EN,s,d);
ENO:=FLT2INTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -32768 to +32767 Single-precision real ANYREAL_32
number
(d) Data after conversion 16-bit signed binary ANY16_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the single-precision real number in the device specified by (s) to 16-bit signed binary data, and
store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
SM402
EMOVP E-1234.5 D0
(s) (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0 b15 ∙∙∙ b0
M0 (s) (d) D1, D0 C49AH 5000H D100 FB2EH
FLT2INT D0 D100
(-1234.5) (-1234)
Operation error
Error code Description
(SD0/SD8067)
3401H The single-precision real number in the device specified by (s) is out of the valid range (-32768 to +32767).
3402H When the contents of the specified device are outside the following range:
0, 2-126≤|specified value (stored value)|<2128
The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
7 BASIC INSTRUCTIONS
290 7.5 Data Conversion Instructions
Converting single-precision real number to 16-bit unsigned
binary data
FLT2UINT(P)
These instructions convert the single-precision real number in the device specified by (s) to 16-bit unsigned binary data, and
store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
Ladder diagram Structured text*1
ENO:=FLT2UINT(EN,s,d);
ENO:=FLT2UINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 65535 Single-precision real ANYREAL_32
number
(d) Data after conversion 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the single-precision real number in the device specified by (s) to 16-bit unsigned binary data,
and store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
SM402
EMOVP E-1234.5 D0
(s) (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0 b15 ∙∙∙ b0
M0 (s) (d)
D1, D0 449AH 5000H D100 04D2H
FLT2UINT D0 D100
(1234.5) (1234)
Operation error
Error code Description
(SD0/SD8067)
3401H The single-precision real number in the device specified by (s) is out of the valid range (0 to 65535).
3402H When the contents of the specified device are outside the following range:
0, 2-126≤|specified value (stored value)|<2128
The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 291
Converting single-precision real number to 32-bit signed binary
data
FLT2DINT(P)
These instructions convert the single-precision real number in the device specified by (s) to 32-bit signed binary data, and
store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
Ladder diagram Structured text*1
ENO:=FLT2DINT(EN,s,d);
ENO:=FLT2DINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -2147483648 to +2147483647 Single-precision real ANYREAL_32
number
(d) Data after conversion 32-bit signed binary ANY32_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the single-precision real number in the device specified by (s) to 32-bit signed binary data, and
store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
SM402
EMOVP E-123456.7 D0
(s) (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0 b31 ∙∙∙ b16 b15 ∙∙∙ b0
M0 (s) (d)
D1, D0 C7F1H 205AH D101, D100 FFFEH 1DC0H
FLT2DINT D0 D100
(-123456.7) (-123456)
Operation error
Error code Description
(SD0/SD8067)
3401H The single-precision real number in the device specified by (s) is out of the valid range (-2147483648 to +2147483647).
3402H When the contents of the specified device are outside the following range:
0, 2-126≤|specified value (stored value)|<2128
The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
7 BASIC INSTRUCTIONS
292 7.5 Data Conversion Instructions
Converting single-precision real number to 32-bit unsigned
binary data
FLT2UDINT(P)
These instructions convert the single-precision real number in the device specified by (s) to 32-bit unsigned binary data, and
store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
Ladder diagram Structured text*1
ENO:=FLT2UDINT(EN,s,d);
ENO:=FLT2UDINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
7
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 4294967295 Single-precision real ANYREAL_32
number
(d) Data after conversion 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the single-precision real number in the device specified by (s) to 32-bit unsigned binary data,
and store the converted data in the device specified by (d). After conversion, the digits after the decimal point of the single-
precision real number, specified with (s), are truncated.
SM402
EMOVP E-123456.7 D0
(s) (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0 b31 ∙∙∙ b16 b15 ∙∙∙ b0
M0 (s) (d)
D1, D0 47F1H 205AH D101, D100 0001H E240H
FLT2UDINT D0 D100
(123456.7) (123456)
Operation error
Error code Description
(SD0/SD8067)
3401H The single-precision real number in the device specified by (s) is out of the valid range (0 to 4294967295).
3402H When the contents of the specified device are outside the following range:
0, 2-126≤|specified value (stored value)|<2128
The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 293
Converting 16-bit signed binary data to 16-bit unsigned binary
data
INT2UINT(P)
These instructions convert the 16-bit signed binary data in the device specified by (s) to 16-bit unsigned binary data, and store
the result in the device specified by (d).
Ladder diagram Structured text*1
ENO:=INT2UINT(EN,s,d);
ENO:=INT2UINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -32768 to +32767 16-bit signed binary ANY16_S
(d) Data after conversion 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit signed binary data in the device specified by (s) to 16-bit unsigned binary data, and
store the result in the device specified by (d).
SM402
(s) b15 ∙∙∙ b0 (d) b15 ∙∙∙ b0
MOVP HC000 D0
D0 C000H D100 C000H
M0 (s) (d)
(-16384) (49152)
INT2UINT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
294 7.5 Data Conversion Instructions
Converting 16-bit signed binary data to 32-bit signed binary data
INT2DINT(P)
These instructions convert the 16-bit signed binary data in the device specified by (s) to 32-bit signed binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=INT2DINT(EN,s,d);
ENO:=INT2DINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 7
(s) Data before conversion -32768 to +32767 16-bit signed binary ANY16_S
(d) Data after conversion 32-bit signed binary ANY32_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit signed binary data in the device specified by (s) to 32-bit signed binary data, and store
the converted data in the device specified by (d).
(s) (d)
SM402
b15 ∙∙∙ b0 b31 ∙∙∙ b16 b15 ∙∙∙ b0
MOVP H0B000 D0
D0 B000H D101, D100 FFFFH B000H
M0 (s) (d)
(-20480) (-20480)
INT2DINT D0 D100
(1)
(2)
(1): The most significant bit of data before conversion is stored.
(2): Data before conversion is stored in the lower 16 bits.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 295
Converting 16-bit signed binary data to 32-bit unsigned binary
data
INT2UDINT(P)
These instructions convert the 16-bit signed binary data in the device specified by (s) to 32-bit unsigned binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=INT2UDINT(EN,s,d);
ENO:=INT2UDINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -32768 to +32767 16-bit signed binary ANY16_S
(d) Data after conversion 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit signed binary data in the device specified by (s) to 32-bit unsigned binary data, and
store the converted data in the device specified by (d).
(s) (d)
SM402
b15 ∙∙∙ b0 b31 ∙∙∙ b16 b15 ∙∙∙ b0
MOVP H0A000 D0
D0 A000H D101, D100 0000H A000H
M0 (s) (d)
(-24576) (40960)
INT2UDINT D0 D100
(1)
(2)
(1): The value 0 is stored.
(2): Data before conversion is stored in the lower 16 bits.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
296 7.5 Data Conversion Instructions
Converting 16-bit unsigned binary data to 16-bit signed binary
data
UINT2INT(P)
These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 16-bit signed binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UINT2INT(EN,s,d);
ENO:=UINT2INTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types 7
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 65535 16-bit unsigned binary ANY16_U
(d) Data after conversion 16-bit signed binary ANY16_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 16-bit signed binary data, and
store the converted data in the device specified by (d).
SM402
(s) b15 ∙∙∙ b0 (d) b15 ∙∙∙ b0
MOVP H0E000 D0
D0 E000H D100 E000H
M0 (s) (d)
(57344) (-8192)
UINT2INT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 297
Converting 16-bit unsigned binary data to 32-bit signed binary
data
UINT2DINT(P)
These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 32-bit signed binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UINT2DINT(EN,s,d);
ENO:=UINT2DINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 65535 16-bit unsigned binary ANY16_U
(d) Data after conversion 32-bit signed binary ANY32_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 32-bit signed binary data, and
store the converted data in the device specified by (d).
(s) (d)
SM402
b15 ∙∙∙ b0 b31 ∙∙∙ b16 b15 ∙∙∙ b0
MOVP H0D000 D0
D0 D000H D101, D100 0000H D000H
M0 (s) (d)
(53248) (53248)
UINT2DINT D0 D100
(1)
(2)
(1): The value 0 is stored.
(2): Data before conversion is stored in the lower 16 bits.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
298 7.5 Data Conversion Instructions
Converting 16-bit unsigned binary data to 32-bit unsigned binary
data
UINT2UDINT(P)
These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 32-bit unsigned binary data, and
store the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UINT2UDINT(EN,s,d);
ENO:=UINT2UDINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types 7
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 65535 16-bit unsigned binary ANY16_U
(d) Data after conversion 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 32-bit unsigned binary data, and
store the converted data in the device specified by (d).
(s) (d)
SM402
b15 ∙∙∙ b0 b31 ∙∙∙ b16 b15 ∙∙∙ b0
MOVP H0F000 D0
D0 F000H D101, D100 0000H F000H
M0 (s) (d)
(61440) (61440)
UINT2UDINT D0 D100
(1)
(2)
(1): The value 0 is stored.
(2): Data before conversion is stored in the lower 16 bits.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 299
Converting 32-bit signed binary data to 16-bit signed binary data
DINT2INT(P)
These instructions convert the 32-bit signed binary data in the device specified by (s) to 16-bit signed binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=DINT2INT(EN,s,d);
ENO:=DINT2INTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -2147483648 to +2147483647 32-bit signed binary ANY32_S
(d) Data after conversion 16-bit signed binary ANY16_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit signed binary data in the device specified by (s) to 16-bit signed binary data, and store
the converted data in the device specified by (d).
SM402
(s) b31 ∙∙∙ b16 b15 ∙∙∙ b0 (d) b15 ∙∙∙ b0
DMOVP H98765432 D0
D1, D0 9876H 5432H D100 5432H
M0 (s) (d)
(-1737075662) (21554)
DINT2INT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
300 7.5 Data Conversion Instructions
Converting 32-bit signed binary data to 16-bit unsigned binary
data
DINT2UINT(P)
These instructions convert the 32-bit signed binary data in the device specified by (s) to 16-bit unsigned binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=DINT2UINT(EN,s,d);
ENO:=DINT2UINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types 7
Operand Description Range Data type Data type (label)
(s) Data before conversion -2147483648 to +2147483647 32-bit signed binary ANY32_S
(d) Data after conversion 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit signed binary data in the device specified by (s) to 16-bit unsigned binary data, and
store the converted data in the device specified by (d).
SM402
(s) b31 ∙∙∙ b16 b15 ∙∙∙ b0 (d) b15 ∙∙∙ b0
DMOVP H87654321 D0
D1, D0 8765H 4321H D100 4321H
M0 (s) (d)
(-2023406815) (17185)
DINT2UINT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 301
Converting 32-bit signed binary data to 32-bit unsigned binary
data
DINT2UDINT(P)
These instructions convert the 32-bit signed binary data in the device specified by (s) to 32-bit unsigned binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=DINT2UDINT(EN,s,d);
ENO:=DINT2UDINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -2147483648 to +2147483647 32-bit signed binary ANY32_S
(d) Data after conversion 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit signed binary data in the device specified by (s) to 32-bit unsigned binary data, and
store the converted data in the device specified by (d).
SM402
(s) b31 ∙∙∙ b16 b15 ∙∙∙ b0 (d) b31 ∙∙∙ b16 b15 ∙∙∙ b0
DMOVP H76543210 D0
D1, D0 7654H 3210H D101, D100 7654H 3210H
M0 (s) (d)
(-2309737968) (1985229328)
DINT2UDINT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
302 7.5 Data Conversion Instructions
Converting 32-bit unsigned binary data to 16-bit signed binary
data
UDINT2INT(P)
These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 16-bit signed binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UDINT2INT(EN,s,d);
ENO:=UDINT2INTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types 7
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) Data after conversion 16-bit signed binary ANY16_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 16-bit signed binary data, and
store the converted data in the device specified by (d).
SM402 (s) b31 ∙∙∙ b16 b15 ∙∙∙ b0 (d) b15 ∙∙∙ b0
DMOVP H56789ABC D0
D1, D0 5678H 9ABCH D100 9ABCH
M0 (s) (d)
(1450744508) (-25924)
UDINT2INT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 303
Converting 32-bit unsigned binary data to 16-bit unsigned binary
data
UDINT2UINT(P)
These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 16-bit unsigned binary data, and
store the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UDINT2UINT(EN,s,d);
ENO:=UDINT2UINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) Data after conversion 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 16-bit unsigned binary data, and
store the converted data in the device specified by (d).
SM402
(s) b31 ∙∙∙ b16 b15 ∙∙∙ b0 (d) b15 ∙∙∙ b0
DMOVP H456789AB D0
D1, D0 4567H 89ABH D100 89ABH
M0 (s) (d)
(1164413355) (35243)
UDINT2UINT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
304 7.5 Data Conversion Instructions
Converting 32-bit unsigned binary data to 32-bit signed binary
data
UDINT2DINT(P)
These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 32-bit signed binary data, and store
the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UDINT2DINT(EN,s,d);
ENO:=UDINT2DINTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types 7
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) Data after conversion 32-bit signed binary ANY32_S
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 32-bit signed binary data, and
store the converted data in the device specified by (d).
SM402
(s) b31 b16 b15 b0 (d) b31 b16 b15 b0
DMOVP H80010001 D0
D1, D0 8001H 0001H D101, D100 8000H 0001H
M0 (s) (d)
(2147549185) (-2147418111)
UDINT2DINT D0 D100
(1)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 305
Converting 16-bit binary data to Gray code
GRY(P)(_U)
These instructions convert the 16-bit binary data in the device specified by (s) to 16-bit binary gray code data, and store the
converted data in the device specified by (d).
Ladder diagram Structured text
ENO:=GRY(EN,s,d); ENO:=GRY_U(EN,s,d);
ENO:=GRYP(EN,s,d); ENO:=GRYP_U(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) GRY(P) Binary data or the head device where the binary 0 to 32767 16-bit signed binary ANY16_S
data is stored
GRY(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) GRY(P) Head device for storing the gray code data after 16-bit signed binary ANY16_S
conversion
GRY(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit binary data in the device specified by (s) to 16-bit binary gray code data, and store the
converted data in the device specified by (d).
b15 ∙∙∙ b0
(s) BIN 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
b15 b0
(d) 1234 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 1
Precautions
The data conversion speed depends on the scan time of the CPU module.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
306 7.5 Data Conversion Instructions
Converting 32-bit binary data to Gray code
DGRY(P)(_U)
These instructions convert the 32-bit binary data in the device specified by (s) to 32-bit binary gray code data, and store the
converted data in the device specified by (d).
Ladder diagram Structured text
ENO:=DGRY(EN,s,d); ENO:=DGRY_U(EN,s,d);
ENO:=DGRYP(EN,s,d); ENO:=DGRYP_U(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) DGRY(P) Binary data or the head device where the binary
data is stored
0 to 2147483647 32-bit signed binary ANY32_S
7
DGRY(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DGRY(P) Head device for storing the gray code data after 32-bit signed binary ANY32_S
conversion
DGRY(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit binary data in the device specified by (s) to 32-bit binary gray code data, and store the
converted data in the device specified by (d).
(s)+1 (s)
(d)+1 (d)
Precautions
The data conversion speed depends on the scan time of the CPU module.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 307
Converting Gray code to 16-bit binary data
GBIN(P)(_U)
These instructions convert the 16-bit binary gray code data in the device specified by (s) to 16-bit binary data, and store the
converted data in the device specified by (d).
Ladder diagram Structured text
ENO:=GBIN(EN,s,d); ENO:=GBIN_U(EN,s,d);
ENO:=GBINP(EN,s,d); ENO:=GBINP_U(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) GBIN(P) Gray code data or head device storing the gray 0 to 32767 16-bit signed binary ANY16_S
code data
GBIN(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) GBIN(P) Head device for storing the binary data after 16-bit signed binary ANY16_S
conversion
GBIN(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit binary gray code data in the device specified by (s) to 16-bit binary data, and store the
converted data in the device specified by (d).
b15 ∙∙∙ b0
(s) 1234 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 1
b15 ∙∙∙ b0
(d) BIN 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
Precautions
When an input relay (X) is specified as (s), the response delay will be "Scan time of CPU module + Input filter constant".
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
308 7.5 Data Conversion Instructions
Converting Gray code to 32-bit binary data
DGBIN(P)(_U)
These instructions convert the 32-bit binary gray code data in the device specified by (s) to 32-bit binary data, and store the
converted data in the device specified by (d).
Ladder diagram Structured text
ENO:=DGBIN(EN,s,d); ENO:=DGBIN_U(EN,s,d);
ENO:=DGBINP(EN,s,d); ENO:=DGBINP_U(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) DGBIN(P) Gray code data or head device storing the gray
code data
0 to 2147483647 32-bit signed binary ANY32_S
7
DGBIN(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DGBIN(P) Head device for storing the binary data after 32-bit signed binary ANY32_S
conversion
DGBIN(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit binary gray code data in the device specified by (s) to 32-bit binary data, and store the
converted data in the device specified by (d).
(s)+1 (s)
(d)+1 (d)
Precautions
When an input relay (X) is specified as (s), the response delay will be "Scan time of CPU module + Input filter constant".
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 309
Converting decimal ASCII to 16-bit binary data
DABIN(P)(_U)
These instructions convert the decimal ASCII data in the device areas specified by (s) and later to 16-bit binary data, and
store the converted data in the device specified by (d).
Ladder diagram Structured text
ENO:=DABIN(EN,s,d); ENO:=DABIN_U(EN,s,d);
ENO:=DABINP(EN,s,d); ENO:=DABINP_U(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) ASCII data or the head device where the ASCII Character string ANYSTRING_SINGLE
data is stored
(d) DABIN(P) Head device for storing the converted data 16-bit signed binary ANY16_S
DABIN(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d)
Processing details
• These instructions convert the decimal ASCII data in the device areas specified by (s) and later to 16-bit binary data, and
store the converted data in the device specified by (d).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) ASCII 104 ASCII S b15 ∙∙∙ b0
(s)+1 ASCII 102 ASCII 103 (d)
(s)+2 ASCII 100 ASCII 101
BIN16
ASCII S: ASCII code for sign
ASCII 100: ASCII code for ones place
ASCII 101: ASCII code for the tens place
ASCII 102: ASCII code for the hundreds place
ASCII 103: ASCII code for the thousands place
ASCII 104: ASCII code for the ten-thousands place
7 BASIC INSTRUCTIONS
310 7.5 Data Conversion Instructions
Ex.
When the ASCII data, -25108 (signed), is specified by (s)
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 32H (2) 2DH (-) b15 ∙∙∙ b0
(s)+1 31H (1) 35H (5) (d) - 2 5 1 0 8
(s)+2 38H (8) 30H (0)
• The ASCII data that can be specified by (s) to (s)+2 is -32768 to +32767 for signed data, and 0 to 65535 for unsigned data.
• As signed data, "20H" is stored if the ASCII data is positive, and "2DH" is stored if the data is negative. (If a value other than
"20H" and "2DH" is set, the data will be processed as positive data.) (DABIN(P))
• A value "30H" to "39H" can be set in the each place of the ASCII code.
• If a value "20H" or "00H" is set, the value will be processed as "30H".
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (s) exceeds the corresponding device range.
3401H The signed data is other than 20H, 2DH.
A value specified by (s) to (s)+2 for each place of the ASCII code is other than "30H" to "39H", "20H", and "00H".
The ASCII data in the device specified by (s) to (s)+2 is out of the valid range (-32768 to +32767) (when a signed data is specified).
The ASCII data in the device specified by (s) to (s)+2 is out of the valid range (0 to 65535) (when unsigned data is specified).
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 311
Converting decimal ASCII to 32-bit binary data
DDABIN(P)(_U)
These instructions convert the decimal ASCII data in the device numbers specified by (s) and later to 32-bit binary data, and
store the converted data in the device specified by (d).
Ladder diagram Structured text
ENO:=DDABIN(EN,s,d); ENO:=DDABIN_U(EN,s,d);
ENO:=DDABINP(EN,s,d); ENO:=DDABINP_U(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) ASCII data or the head device where the ASCII Character string ANYSTRING_SINGLE
data is stored
(d) DDABIN(P) Head device for storing the converted data 32-bit signed binary ANY32_S
DDABIN(P)_ 32-bit unsigned binary ANY32_U
U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d)
7 BASIC INSTRUCTIONS
312 7.5 Data Conversion Instructions
Processing details
• These instructions convert the decimal ASCII data in the device numbers specified by (s) and later to 32-bit binary data,
and store the converted data in the device specified by (d).
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) ASCII 109 ASCII S
(s)+1 ASCII 107 ASCII 108 (d)+1 (d)
b31 ∙∙∙ b16 b15 ∙∙∙ b0
(s)+2 ASCII 105 ASCII 106
(2) (3)
(s)+3 ASCII 103 ASCII 104
(s)+4 ASCII 101 ASCII 102 BIN32
(s)+5 (1) ASCII 100
Ex. 7
When the ASCII data, -1234543210 (signed), is specified by (s)
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 31H (1) 2DH (-)
(s)+1 33H (3) 32H (2)
(d)+1 (d)
(s)+2 35H (5) 34H (4)
-12345 4 3 2 10
(s)+3 33H (3) 34H (4)
(s)+4 31H (1) 32H (2)
(s)+5 30H (0)
• The ASCII data that can be specified by (s) to (s)+5 is -2147483648 to +2147483647 for signed data, and 0 to 429496729
for unsigned data. The data stored in the high-order byte of (s)+5 is ignored.
• As signed data, "20H" is stored if the ASCII data is positive, and "2DH" is stored if the data is negative. (If a value other than
"20H" and "2DH" is set, the data will be processed as positive data.) (DABIN(P))
• A value "30H" to "39H" can be set in the each place of the ASCII code.
• If a value "20H" or "00H" is set, the value will be processed as "30H".
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (s) exceeds the corresponding device range.
3401H The signed data is other than 20H, 2DH.
A value specified by (s) to (s)+2 for each place of the ASCII code is other than "30H" to "39H", "20H", and "00H".
The ASCII data in the device specified by (s) to (s)+5 is out of the valid range (-2147483648 to +2147483647) (when a signed data is
specified).
The ASCII data in the device specified by (s) to (s)+5 is out of the valid range (0 to 4294967295) (when unsigned data is specified).
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 313
Converting ASCII to HEX
HEXA(P)
These instructions convert the ASCII data stored in the number of characters specified by (n) in the device numbers specified
by (s) and later to HEX code data, and store the converted data in the device numbers specified by (d) and later.
Ladder diagram Structured text
ENO:=HEXA(EN,s,n,d);
ENO:=HEXAP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device for storing the ASCII data to be converted to Character string ANYSTRING_SINGLE
hexadecimal code
(d) Head device for storing the hexadecimal code after 16-bit signed binary ANY16
conversion
(n) Number of characters (number of bytes) of ASCII data to 1 to 16383 16-bit unsigned binary ANY16_U
be converted
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d)
(n)
7 BASIC INSTRUCTIONS
314 7.5 Data Conversion Instructions
Processing details
• These instructions convert the ASCII data stored in the number of characters specified by (n) in the device numbers
specified by (s) and later to HEX code data, and store the converted data in the device numbers specified by (d) and later.
16-bit conversion mode and 8-bit conversion mode options are available for these instructions. For operation in each mode,
refer to the succeeding pages.
• 16-bit conversion mode (while SM8161 is OFF)
The ASCII data stored in high-order 8 bits and low-order 8 bits (byte) of the device specified by (s) is converted to hexadecimal code, and transferred to
the device specified by (d) in units of 4 digits. The number of characters to be converted is specified by (n).
SM8161 is also used for the RS2, ASCI(P), CCD(P), and CRC(P) instructions. When using the 16-bit conversion mode, set SM8161 to normally OFF.
SM8161 is cleared when the CPU module mode is changed from RUN to STOP.
Moreover, when using the 16-bit conversion mode, the ASCII data must also be stored in high-order 8 bits of the device specified by (s).
In the following program, conversion is executed as follows:
SM400
SM8161 (1)
X10
HEXA D200 D100 K4
(d)
(n) D200 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0
D102 D101 D100
41H to "A" 30H to "0"
1 0H
4 0ABCH
D100 0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0
5 0H ABC1H 0 A B C
6 0AH BC12H
7 0ABH C123H
8 0ABCH 1234H
9 0H ABC1H 2345H
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 315
SM400
SM8161 8-bit conversion mode 16 bits
(d)
(n)
D200 0 0 1 1 0 0 0 0
D102 D101 D100
30H to "0"
1 0H
4 0ABCH
D100 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
5 0H ABC1H
0 A
6 0AH BC12H
7 0ABH C123H
8 0ABCH 1234H
9 0H ABC1H 2345H
Precautions
• Make sure that only ASCII codes "0" to "9" and "A" to "F" are stored in the device specified by (s).
• If ASCII data is not stored in the device specified for (s) by the HEXA(P) instructions, an operation error occurs and
conversion into hexadecimal code is disabled. Especially, note that when SM8161 is OFF (16-bit conversion mode), ASCII
code should be stored in high-order 8 bits of the device specified by (s).
• The number of points occupied by the device specified by (d) varies depending on the ON/OFF status of SM8161. When
SM8161 is on (8-bit conversion mode), as many points as the number of characters are occupied, and when SM8161 is
OFF (16-bit conversion mode) as many points as the (number of characters ÷2) are occupied.
• The SM8161 flag is also used for the RS2, ASCI(P), CCD(P) and CRC(P) instructions. When using these instructions and
the HEXA(P) instructions in the same program, make sure to set SM8161 to ON or OFF just before each instruction so that
SM3161 does not affect another instruction.
7 BASIC INSTRUCTIONS
316 7.5 Data Conversion Instructions
Operation error
Error code Description
(SD0/SD8067)
2820H The (n) number of devices specified by (s) and (d) exceeds the corresponding device range.
2821H The range specified by (s) and (d) overlaps.
3401H An ASCII code other than 30H to 39H, and 41H to 46H is set in the device specified by (s).
3405H The value specified in (n) is outside the range specified below.
1 to 16383
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 317
Converting character string to 16-bit binary data
VAL(P)(_U)
These instructions convert the character string in the device numbers specified by (s) and later to 16-bit binary data, and store
the number of digits in the device specified by (d1) and the binary data in the device specified by (d2).
Ladder diagram Structured text
ENO:=VAL(EN,s,d1,d2); ENO:=VAL_U(EN,s,d1,d2);
ENO:=VALP(EN,s,d1,d2); ENO:=VALP_U(EN,s,d1,d2);
(s) (d1) (d2)
FBD/LD
EN ENO
s d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Character string to be converted to binary data, Character string ANYSTRING_SINGLE
or head device for storing the character string.
(d1) VAL(P) Head device for storing the number of digits of 16-bit signed binary ANY16_S_ARRAY
the binary data after conversion (Number of elements:
2)
VAL(P)_U 16-bit unsigned binary ANY16_U_ARRAY
(Number of elements:
2)
(d2) VAL(P) Head device for storing the binary data after 16-bit signed binary ANY16_S
VAL(P)_U conversion 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d1)
(d2)
Processing details
• These instructions convert the character string in the device numbers specified by (s) and later to 16-bit binary data, and
store the number of digits in the device specified by (d1) and the binary data in the device specified by (d2). When
converting a character string into binary data, the data from the device number specified by (s) to a device number storing
"00H" is handled as a character string.
7 BASIC INSTRUCTIONS
318 7.5 Data Conversion Instructions
• The total number of digits stored in (d1) is the total number of characters (including the sign and decimal point) representing
the numeric value. The number of digits in the decimal part stored in (d1)+1 is the number of characters representing the
decimal part after 2EH (.). The 16-bit binary data stored in (d2) is binary value converted from a character string with the
decimal point ignored.
Ex.
When the character string "-123.45" (signed) is specified by (s) and later
• The total number of characters of the character string specified by (s) is 2 to 8 characters.
• In the character string specified by (s), the number of characters that form the decimal part is 0 to 5 characters. However,
be sure to specify "Total number of digits - 3" or below. 7
• The range of the character string of the numeric value that can be converted to a binary value is -32768 to +32767 for a
signed value with the decimal point ignored, and 0 to 65535 for an unsigned value. A character string of a numeric value
excluding the sign and decimal point can be specified only within the range of 30H to 39H. (Value with the decimal point
ignored ... "-12345.6" becomes "-123456".)
• When representing a positive numeric value, 20H is set in the sign, and when representing a negative numeric value, 2DH
is set.
• 2EH is set in the decimal point.
• When "20H (space)" or "30H (0)" exists between the sign and the first non-zero number in a character string specified by
(s), "20H" or "30H" is ignored during conversion to a binary value.
Ex.
When "20H" exists between the sign and the first non-zero number (a signed value is specified)
BIN16 - 1 2 3 4 5
Ignore
Ex.
When "30H" exists between the sign and the first non-zero number
Sign BIN16 12
Ignore
Precautions
• Store signed data, "space (20H)" or "- (2DH)" only in the 1st byte (low-order 8 bits of the head device set in (s)). Only the
ASCII data "0 (30H)" to "9 (39H)", "space (20H)" and "decimal point (2EH)" can be stored from the 2nd byte to the "00H" at
the end of the character string in (s). If "- (2DH)" is stored in the 2nd byte or later, an operation error occurs.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 319
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (d1) exceeds the corresponding device range.
When "00H" is not set in the corresponding device range after the device specified in (s).
3401H The number of characters of the character string specified by (s) is other than 2 to 8 characters.
The number of characters of the decimal part of the character string specified by (s) is other than 0 to 5 characters.
The relationship between the total number of characters specified by (s) and the number of characters of the decimal part is other than
that described below.
Total number of characters - 3≥Number of characters in the decimal part
An ASCII code other than 20H, 2DH is set in the sign. (a signed value is specified)
An ASCII code other than 30H to 39H, and 2EH (decimal point) is set in the digits of each number
Two or more decimal points are set.
The converted binary value exceeds the range that can be converted by each instruction.
Signed operation: -32768 to +32767, unsigned operation: 0 to 65535
7 BASIC INSTRUCTIONS
320 7.5 Data Conversion Instructions
Converting character string to 32-bit binary data
DVAL(P)(_U)
These instructions convert the character string in the device numbers specified by (s) and later to 32-bit binary data, and store
the number of digits in the device specified by (d1) and the binary data in the device specified by (d2).
Ladder diagram Structured text
ENO:=DVAL(EN,s,d1,d2); ENO:=DVAL_U(EN,s,d1,d2);
ENO:=DVALP(EN,s,d1,d2); ENO:=DVALP_U(EN,s,d1,d2);
(s) (d1) (d2)
FBD/LD
EN ENO
s d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s) Character string to be converted to binary data, Character string ANYSTRING_SINGLE
or head device for storing the character string.
(d1) DVAL(P) Head device for storing the number of digits of 16-bit signed binary ANY16_S_ARRAY
the binary data after conversion (Number of elements:
2)
DVAL(P)_U 16-bit unsigned binary ANY16_U_ARRAY
(Number of elements:
2)
(d2) DVAL(P) Head device for storing the binary data after 32-bit signed binary ANY32_S
DVAL(P)_U conversion 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d1)
(d2)
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 321
Processing details
• These instructions convert the character string in the device numbers specified by (s) and later to 32-bit binary data, and
store the number of digits in the device specified by (d1) and the binary data in the device specified by (d2). When
converting a character string into binary data, the data from the device number specified by (s) to a device number storing
"00H" is handled as a character string.
• The total number of digits stored in (d1) is the total number of characters (including the sign and decimal point) representing
the numeric value. The number of digits in the decimal part stored in (d1)+1 is the number of characters representing the
decimal part after 2EH (.). The 32-bit binary data stored in (d2) is binary value converted from a character string with the
decimal point ignored.
Ex.
When the character string "-12345.678" (signed) is specified by (s) and later
b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 31H (1) 2DH (-)
(s)+1 33H (3) 32H (2)
(s)+2 35H (5) 34H (3)
(s)+5 00H
(d1) 10
(d1)+1 3
(d2)+1 (d2)
• The total number of characters of the character string specified by (s) is 2 to 13 characters.
• In the character string specified by (s), the number of characters that form the decimal part is 0 to 10 characters. However,
be sure to specify "Total number of digits - 3" or below.
• The range of the character string of the numeric value that can be converted to a binary value is -2147483648 to
2147483647 for a signed value with the decimal point ignored, and 0 to 4294967295 for an unsigned value. A character
string of a numeric value excluding the sign and decimal point can be specified only within the range of 30H to 39H. (Value
with the decimal point ignored ... "-12345.6" becomes "-123456".)
• When representing a positive numeric value, 20H is set in the sign, and when representing a negative numeric value, 2DH
is set.
• Set 2EH in the decimal point.
• When "20H (space)" or "30H (0)" exists between the sign and the first non-zero number in a character string specified by
(s), "20H" or "30H" is ignored during conversion to a binary value.
7 BASIC INSTRUCTIONS
322 7.5 Data Conversion Instructions
Ex.
When "20H" exists between the sign and the first non-zero number (a signed value is specified)
BIN32 - 6 5 4 3 2 1
Ignore
Ex.
When "30H" exists between the sign and the first non-zero number
Sign BIN32 5 4 3 2 1
Ignore
Precautions
• Store sign data, "space (20H)" or "- (2DH)" in the 1st byte (low-order 8 bits of the head device set in (s)). Only the ASCII
data "0 (30H)" to "9 (39H)", "space (20H)" and "decimal point (2EH)" can be stored from the 2nd byte to the "00H" at the
end of the character string in (s). If "- (2DH)" is stored in the 2nd byte or later, an operation error occurs.
Operation error
Error code Description 7
(SD0/SD8067)
2820H The device specified by (d1) exceeds the corresponding device range.
When "00H" is not set in the corresponding device range after the device specified in (s).
3401H The number of characters of the character string specified by (s) is other than 2 to 13 characters.
The number of characters of the decimal part of the character string specified by (s) is other than 0 to 10 characters.
The relationship between the total number of characters specified by (s) and the number of characters of the decimal part is other than
that described below.
Total number of characters - 3≥Number of characters in the decimal part
An ASCII code other than 20H, 2DH is set in the sign.
Two or more decimal points are set.
The converted binary value exceeds the range that can be converted by each instruction.
Signed operation: -2147483648 to +2147483647, unsigned operation: 0 to 4294967295
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 323
Two's complement of 16-bit binary data (sign inversion)
NEG(P)
These instructions invert the sign of the 16-bit binary data in the device specified by (d), and store the resultant data in the
device specified by (d).
Ladder diagram Structured text
ENO:=NEG(EN,d);
ENO:=NEGP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device for storing the data that performs two's -32768 to +32767 16-bit signed binary ANY16
complement
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions invert the sign of the 16-bit binary data in the device specified by (d), and store the resultant data in the
device specified by (d).
• They are used when a positive or negative sign is to be inverted.
b15 ∙∙∙ b0
Before execution (d) 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ∙∙∙ -21846
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sign conversion
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
-
b15 ∙∙∙ b0
After execution (d) 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 ∙∙∙ 21846
Precautions
Note that data is inverted in every operation cycle in a continuous operation type (NEG) instruction.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
324 7.5 Data Conversion Instructions
Two's complement of 32-bit binary data (sign inversion)
DNEG(P)
These instructions invert the sign of the 32-bit binary data in the device specified by (d), and store the resultant data in the
device specified by (d).
Ladder diagram Structured text
ENO:=DNEG(EN,d);
ENO:=DNEGP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device for storing the data that performs two's
complement
-2147483648 to +2147483647 32-bit signed binary ANY32
7
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions invert the sign of the 32-bit binary data in the device specified by (d), and store the resultant data in the
device specified by (d).
• They are used when a positive or negative sign is to be inverted.
b31 ∙∙∙ b0
Before execution (d) 1 1 1 1 1 1 1 0 1 0 0 1 0 0 ∙∙∙ -218460
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sign conversion
1 1 1 1 1 1 1 0 1 0 0 1 0 0
-
b31 ∙∙∙ b0
After execution (d) 0 0 0 0 0 0 0 1 0 1 1 1 0 0 ∙∙∙ 218460
Precautions
Note that data is inverted in every operation cycle in a continuous operation type (DNEG) instruction.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 325
Decoding from 8 to 256 bits
DECO(P)
These instructions decode the lower-order (n) bits of the device specified by (s), and store the result in the 2 (to the power (n))
bit from the device specified by (d).
Ladder diagram Structured text
ENO:=DECO(EN,s,n,d);
ENO:=DECOP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Decode data or device number for storing the decode data Bit/16-bit signed binary ANY_ELEMENTARY
(d) Head device for storing the decode result Bit/16-bit unsigned ANY_ELEMENTARY*
1
binary
(n) Valid bit length 1 to 8 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 When using a bit-type label, use a global label assigned to a bit device.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions turn ON the bit position of the device specified by (d) in correspondence to the BIN value specified by
the lower-order (n) bits of (s).
n=3
(s) 1 1 0 =6
7 6 5 4 3 2 1 0
(d) 0 1 0 0 0 0 0 0
ON
• When (n) is 0, no processing is performed, and the contents of the device specified by (d) do not change.
• The bit device is handled as a device storing one-bit data and the word device is handled as a device storing 16-bit data.
7 BASIC INSTRUCTIONS
326 7.5 Data Conversion Instructions
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (s) exceeds the corresponding device range.
The device specified by (d) exceeds the corresponding device range.
3401H (d) is specified as a bit device and (n) is other than 0 to 8.
(d) is specified as a word device and (n) is other than 0 to 4.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 327
Encoding from 256 to 8 bits
ENCO(P)
These instructions encode the 2(n) bits of data from the device specified by (s), and store it in (d).
Ladder diagram Structured text
ENO:=ENCO(EN,s,n,d);
ENO:=ENCOP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device for storing the encode data Bit/16-bit unsigned ANY_ELEMENTARY*
1
binary
(d) Device number for storing the encoding result 16-bit signed binary ANY_ELEMENTARY
(n) Valid bit length 1 to 8 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 When using a bit-type label, use a global label assigned to a bit device.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions store into (d) the binary value corresponding to the bit whose value is 1 in the data with 2(n) bits.
8 7 6 5 4 3 2 1 0
(s) 0 0 1 0 0 0 0 0 0
(d) 1 1 0 =6
• When (n) is 0, no processing is performed, and the contents of the device specified by (d) do not change.
• The bit device is handled as a device storing one-bit data and the word device is handled as a device storing 16-bit data.
• If two or more bits are 1, the higher bit position is processed.
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (s) exceeds the corresponding device range.
3401H The entire data from (s) to 2(n) number of bits is 0.
(s) is specified as a bit device and (n) is other than 0 to 8.
(s) is specified as a word device and (n) is other than 0 to 4.
7 BASIC INSTRUCTIONS
328 7.5 Data Conversion Instructions
Seven-segment decoding
SEGD(P)
This instruction decodes data, and turns the seven-segment display unit (1 digit) ON.
Ladder diagram Structured text
ENO:=SEGD(EN,s,d);
ENO:=SEGDP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device to be decoded -32768 to +32767 16-bit signed binary ANY16
(d) Device number storing the data to be displayed in the 16-bit signed binary ANY16 7
seven-segment display unit
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d) *1
*1 X cannot be used.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 329
Processing details
• "0" to "F" (hexadecimal numbers) in low-order 4 bits (1 digit) of (s) are decoded to data for the seven-segment display unit,
and stored in the low-order 8 bits of (d). Low-order 8 bits of (d) are occupied, and high-order 8 bits do not change.
• Seven-segment decode table is as follows.
(s) Seven-segment (d) Display
Hexadec b3 b2 b1 b0 data components b15 to b8 b7 b6 b5 b4 b3 b2 b1 b0 data
imal
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
b0
1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0
b5 b1
b6
2 0 0 1 0 0 0 0 0 1 0 1 1 0 1 1
b4 b2
3 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1
4 0 1 0 0 b3 0 0 0 0 1 1 0 0 1 1 0
5 0 1 0 1 0 0 0 0 1 1 0 1 1 0 1
6 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1
7 0 1 1 1 0 0 0 0 0 1 0 0 1 1 1
8 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 0 0 0 0 1 1 0 1 1 1 1
A 1 0 1 0 0 0 0 0 1 1 1 0 1 1 1
B 1 0 1 1 0 0 0 0 1 1 1 1 1 0 0
C 1 1 0 0 0 0 0 0 0 1 1 1 0 0 1
D 1 1 0 1 0 0 0 0 1 0 1 1 1 1 0
E 1 1 1 0 0 0 0 0 1 1 1 1 0 0 1
F 1 1 1 1 0 0 0 0 1 1 1 0 0 0 1
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
330 7.5 Data Conversion Instructions
Seven Segment With Latch
SEGL
This instruction controls one or two sets of 4-digit seven-segment display units having the latch function.
Ladder diagram Structured text
ENO:=SEGL(EN,s,n,d);
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device converted into the BCD format 0 to 9999 16-bit signed binary ANY16 7
(d) Head Y number to be output bit ANY_BOOL
(n) Parameter number 0 to 7 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d) *1
(n)
Processing details
The 4-digit numeric value stored in (s) is converted into BCD data, and each digit is output to the seven-segment display unit
with the BCD decoder by the time division method. For (s), binary data ranging from 0 to 9999 is valid.
Set the parameters (n) as follows according to the positive/negative logic of the PLC and the positive/negative logic of the
seven-segment display module.
PLC output logic Data input Strobe signal Parameter "n"
4 digits × 1 set 4 digits × 2 set
Negative logic Negative logic (match) Negative logic (mismatch) 0 4
Positive logic (match) 1 5
Positive logic (mismatch) Negative logic (mismatch) 2 6
Positive logic (match) 3 7
Positive logic Positive logic (match) Positive logic (match) 0 4
Negative logic (mismatch) 1 5
Negative logic (mismatch) Positive logic (match) 2 6
Negative logic (mismatch) 3 7
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 331
■When using one set of 4 digits (n = K0 to K3)
A 4-digit numeric value stored in (s) is converted from binary into BCD, and each digit is output in turn from (d) to (d)+3 by the
time division method. The strobe signal is output in turn from (d)+4 to (d)+7 by the time division method also to latch one set
of 4-digit seven-segment display unit.
Precautions
• The scan time (operation cycle) multiplied by 12 is required to update (one or two sets of) the 4-digit display.
• While the command input is ON, the operation is repeated. When the command contact is set to OFF in the middle of an
operation, the operation is paused. When the command contact is set to ON again, the operation is started from the
beginning.
• When one set of 4 digits is used, one device is occupied from the device specified in (s) and eight devices are occupied
from the device specified in (d).
• When two sets of 4 digits are used, two devices are occupied from the device specified in (s) and twelve devices are
occupied from the device specified in (d).
• SEGL instruction is executed in synchronization with the scan time (operation cycle) of the CPU module. For achieving a
series of display, the scan time of the PLC should be 10 ms or more. If the scan time is less than 10 ms, use the constant
scan mode so that the scan time exceeds 10 ms.
• Use a transistor output type CPU module.
• The SEGL instruction can only be executed four times in a program.
• When a constant (K or H) is specified as (s), operate as shown below.
When one set of 4 digits is used : It operates considering the constant specified by (s) as the 1st set.
When two sets of 4 digits are used : It operates considering the constant specified by (s) as the 1st set, and the 2nd set fixed to 0.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s), (d) exceeds the corresponding device range.
3405H (n) is other than 0 to 7.
The value specified by (s), (s)+1 is other than 0 to 9999.
1811H The number of the SEGL instructions which are used simultaneously exceeds four.
7 BASIC INSTRUCTIONS
332 7.5 Data Conversion Instructions
Separating 4 bits from 16-bit data
DIS(P)
These instructions store the data equivalent of the (n) nibbles (1-nibble/ 4-bits) of the 16-bit binary data specified by (s) in to
the lower-order 4 bits of (n) number of devices starting from the one specified by (d).
Ladder diagram Structured text
ENO:=DIS(EN,s,n,d);
ENO:=DISP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s) Head device for storing the data to be separated 16-bit signed binary ANY16
(d) Head device storing separated data 16-bit signed binary ANY16
(n) Number of separations (0 indicates no processing is 1 to 4 16-bit unsigned binary ANY16
performed)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions store the data equivalent of the (n) nibbles (1-nibble/ 4-bits) of the 16-bit binary data specified by (s) in to
the lower-order 4 bits of (n) number of devices starting from the one specified by (d).
b15∙∙∙b12 b11 ∙∙∙ b8b7 ∙∙∙ b4b3 ∙∙∙ b0 b15 ∙∙∙ b4 b3 ∙∙∙ b0
(s) (d)
(d)+1
(n)
(d)+2
(d)+3
(2) (1)
(1): Data storage area
(2): Filled with 0s.
• The higher-order 12 bits of (n) number of devices starting from the one specified by (s) becomes 0.
• When (n) is 0, no processing is performed, and the contents of the (n) number of devices starting from the one specified by
(d) do not change.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 333
Operation error
Error code Description
(SD0/SD8067)
2820H The range of (n) number of points from (d) exceed the corresponding device range.
3401H (n) is other than 0 to 4.
7 BASIC INSTRUCTIONS
334 7.5 Data Conversion Instructions
Connecting 4 bits to 16-bit data
UNI(P)
These instructions link the lower-order 4 bits of the 16-bit binary data of the (n) number of devices starting from the one
specified by (s) to the device storing 16-bit binary data specified by (d).
Ladder diagram Structured text
ENO:=UNI(EN,s,n,d);
ENO:=UNIP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 7
(s) Head device for storing the data to be linked 16-bit signed binary ANY16
(d) Head device for storing the linked data 16-bit signed binary ANY16
(n) Number of links 1 to 4 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions link the lower-order 4 bits of the 16-bit binary data of the (n) number of devices starting from the one
specified by (s) to the device storing 16-bit binary data specified by (d).
b15 ∙∙∙ b4 b3 ∙∙∙ b0
(s)
(s)+1
(s)+2 b15∙∙∙b12 b11 ∙∙∙ b8b7 ∙∙∙ b4b3 ∙∙∙ b0
(s)+3 (d)
(1) (2)
(1): Ignored
(2): Data to be connected
• The higher-order (4-n) nibble bits of the device specified by (d) becomes 0.
• When (n) is 0, no processing is performed, and the contents of the device specified by (d) do not change.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 335
Operation error
Error code Description
(SD0/SD8067)
2820H The range of (n) number of points from (d) exceed the corresponding device range.
3401H (n) is other than 0 to 4.
7 BASIC INSTRUCTIONS
336 7.5 Data Conversion Instructions
Separating the specified number of bits
NDIS(P)
These instructions separate each bit of the data in the device numbers specified by (s1) onwards into bit units specified by
(s2), and store the separated data in the device number specified by (d) onwards.
Ladder diagram Structured text
ENO:=NDIS(EN,s1,s2,d);
ENO:=NDISP(EN,s1,s2,d);
(s1) (d) (s2)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 7
(s1) Head device for storing the data to be separated 16-bit signed binary ANY16
(d) Head device for storing the separated data 16-bit signed binary ANY16
(s2) Head device for storing the separation unit 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(d)
(s2)
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 337
Processing details
• These instructions separate each bit of the data in the device numbers specified by (s1) and later into bit units specified by
(s2), and store the separated data in the device numbers starting from the one specified by (d).
(s2) 6
(s2)+1 8
(s2)+2 6
(s2)+3 4
(s2)+4 8
(s2)+5 10
(s2)+6 3
(s2)+7 0 (1)
b15 b14 b13 ∙∙∙ b6 b5 ∙∙∙ b0 b5 ∙∙∙ b0
(s1) (s2) (d)
b7 ∙∙∙ b0
(s2)+1 (d)+1
b3 ∙∙∙ b0
(s2)+3 (d)+3
b7 ∙∙∙ b0
(s2)+4 (d)+4
b2∙∙∙ b0
(s2)+6 (d)+6
• The number of separation bits specified by (s2) can be specified within the range of 1 to 16 bits.
• The number of bits specified in devices from the device number specified by (s2) up to the device number in which "0" is
stored are processed as the number of separation bits.
• If the device numbers specified by (s1), (s2), (d) are partially overlapping, an operation error occurs.
Operation error
Error code Description
(SD0/SD8067)
2820H The usage range of the device specified by (s1) or (d) exceeds the corresponding device range due to the specification of the number of
separation bits specified by (s2).
2821H The (s1), (s2) devices are overlapping.
The (s1), (d) devices are overlapping.
The (s2), (d) devices are overlapping.
3401H The specification of the number of separation bits specified by (s2) is not set within the range of 1 to 16 bits.
0 is not set in the range between the device specified by (s2) up to the corresponding device range.
7 BASIC INSTRUCTIONS
338 7.5 Data Conversion Instructions
Connecting the specified number of bits
NUNI(P)
These instructions link each bit of the data in the device numbers specified by (s1) onwards into bit units specified by (s2), and
store the connected data in the device number specified by (d) onwards.
Ladder diagram Structured text
ENO:=NUNI(EN,s1,s2,d);
ENO:=NUNIP(EN,s1,s2,d);
(s1) (d) (s2)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 7
(s1) Head device for storing the data to be linked 16-bit signed binary ANY16
(d) Head device for storing the linked data 16-bit signed binary ANY16
(s2) Head device for storing the link unit size 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(d)
(s2)
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 339
Processing details
• These instructions link each bit of the data in the device numbers specified by (s1) onwards into bit units specified by (s2),
and store the linked data in the device number specified by (d).
(s2) 6
(s2)+1 8
(s2)+2 6
(s2)+3 4
(s2)+4 8
(s2)+5 10
(s2)+6 3
(s2)+7 0 (1)
b5 b0 b15 b14 b13 b6 b5 b0
(s1) (s2) (d)
b7 b0
(s1)+1 (s2)+1
b5 b0 b15 b8 b7 b4 b3 b0
(s1)+2 (s2)+2 (d)+1
b3 b0
(s1)+3 (s2)+3
b7 b0
(s1)+4 (s2)+4
b9 b0 b12 b10 b0
(s1)+5 (s2)+5 (d)+2
b2 b0
(s1)+6 (s2)+6
• The number of link bits specified by (s2) can be specified within the range of 1 to 16 bits.
• The number of bits specified in devices from the device number specified by (s2) up to the device number in which "0" is
stored are processed as the number of connection bits.
• If the device numbers specified by (s1), (s2), (d) are partially overlapping, an operation error occurs.
Operation error
Error code Description
(SD0/SD8067)
2820H The usage range of the device specified by (s1) or (d) exceeds the corresponding device range due to the specification of the number of
link bits specified by (s2).
2821H The (s1), (s2) devices are overlapping.
The (s1), (d) devices are overlapping.
The (s2), (d) devices are overlapping.
3401H The specification of the number of link bits specified by (s2) is not set within the range of 1 to 16 bits.
0 is not set in the range between the device specified by (s2) up to the corresponding device range.
7 BASIC INSTRUCTIONS
340 7.5 Data Conversion Instructions
Separating data in byte units
WTOB(P)
These instructions separate the 16-bit binary data in the device numbers starting from the one specified by (s) onwards into
(n) byte units, and store the separated data in the device number specified by (d) onwards.
Ladder diagram Structured text
ENO:=WTOB(EN,s,n,d);
ENO:=WTOBP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s) Head device where the separation target data is stored 16-bit signed binary ANY16
(d) Head device for storing the result of separation in byte unit 16-bit signed binary ANY16
(n) Number of byte units 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions separate the 16-bit binary data in the device numbers starting from the one specified by (s) onwards into
(n) byte units, and store the separated data in the device number specified by (d) onwards.
b15 ∙∙∙ b8 b7 ∙∙∙ b0 b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) (1) (2) (d) 00H (4)
(s)+1 (1) (2) (d)+1 00H (3)
(d)+2 00H (4)
∙∙∙
∙∙∙
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 341
Ex.
For example, when (n) is 5, data starting from (s) to the lower 8 bits of (s)+2 is stored into (d) through (d)+4.
b15 ∙∙∙ b8 b7 ∙∙∙ b0 b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 12H 39H (d) 00H 39H
(s)+1 56H 78H (d)+1 00H 12H
(s)+2 FEH DCH (d)+2 00H 78H (n)=5
(d)+3 00H 56H
(1) (d)+4 00H DCH
(1): The data FEH is ignored when (n) is 5.
• Setting the number of bytes by (n) automatically determines the 16-bit binary data range specified by (s) and the device
range specified by (d) for storing the separated byte data.
• If (n) is 0, no processing is performed.
• In the upper byte of the devices specified by (d) to hold byte data, 00Hs are automatically stored.
Ex.
To store data in D12 to D14 into the lower 8 bits of D11 to D16
b15 ∙∙∙ b8 b7 ∙∙∙ b0 b15 ∙∙∙ b8 b7 ∙∙∙ b0
D12 32H 31H D11 00H 31H
D13 34H 33H D12 00H 32H
D14 36H 35H D13 00H 33H
D14 00H 34H
D15 00H 35H
D16 00H 36H
(1)
(1): 00H is automatically stored.
• Even if the device range of the data to be separated and the device range for storing the separated data overlap, the
processing is performed normally.
Device range where the data to be separated is stored Device range for storing the separated data
(d)+0 to (d)+(n)-1
n
(s) to (s)+( -1)
2
Operation error
Error code Description
(SD0/SD8067)
2820H The range of no. of bytes specified in (n) from the device number specified in (s) onwards exceed the corresponding device range.
The range of (n) points of devices from the device number specified in (d) onwards exceed the corresponding device range.
7 BASIC INSTRUCTIONS
342 7.5 Data Conversion Instructions
Connecting data in byte units
BTOW(P)
These instructions link the lower-order 8 bits of the 16-bit binary data of (n) number of bytes stored in the device numbers
starting from the one specified by (s) onwards into word units, and store the linked data in the device numbers starting from
the one specified by (d) onwards.
Ladder diagram Structured text
ENO:=BTOW(EN,s,n,d);
ENO:=BTOWP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
7
Operand Description Range Data type Data type (label)
(s) Head device for storing the data to be linked in byte units 16-bit signed binary ANY16
(d) Head device storing data acquired by combination in byte 16-bit signed binary ANY16
units
(n) Number of byte data to be linked 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions link the lower-order 8 bits of the 16-bit binary data of (n) number of bytes stored in the device numbers
starting from the one specified by (s) onwards, and store the linked data in the device numbers starting from the one
specified by (d) onwards.
• The higher-order 8 bits of the data of (n) words stored in device numbers starting from the one specified by (s) are ignored.
If (n) is an odd number, 0 is stored in the higher-order 8 bits of the device for storing the data of the (n)th byte.
b15 b8 b7 b0 b15 b8 b7 b0
(s) 1 (d) 2 1
(s)+1 2 (d)+1 4 3
(s)+2 3
(n) (s)+3 4 (d)+( n -1)*1 n n-1
2
(s)+(n-1) n
(1)
: th byte data
(1): The upper byte data are ignored.
*1 Values after the decimal point are rounded up.
7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions 343
Ex.
For example, when (n) is 5, lower 8 bits of data from (s) through (s+4) is stored into (d) through (d)+2.
b15 ∙∙∙ b8 b7 ∙∙∙ b0 b15 ∙∙∙ b8 b7 ∙∙∙ b0
(s) 00H 12H (d) 34H 12H
(s)+1 00H 34H (d)+1 78H 56H
(n)=5 (s)+2 00H 56H (d)+2 00H FEH
(s)+3 00H 78H
(s)+4 00H FEH (1)
• Setting the number of bytes by (n) automatically determines the byte data range specified by (s) and the device range
specified by (d) for storing the linked data.
• If (n) is 0, no processing is performed.
• The higher-order 8 bits of the device specified by (s) for storing byte data are ignored, and only the lower-order 8 bits are
applicable.
Ex.
To store data in lower 8 bits of D11 to D16 into D12 to D14
b15 ∙∙∙ b8 b7 ∙∙∙ b0 b15 ∙∙∙ b8 b7 ∙∙∙ b0
D11 00H 31H D11 00H 31H
D12 00H 32H D12 32H 31H
D13 00H 33H D13 34H 33H
D14 00H 34H D14 36H 35H
D15 00H 35H D15 00H 35H
D16 00H 36H D16 00H 36H
• Even if the device range of the data to be linked and the device range for storing the linked data overlap, the processing is
performed normally.
Device range where the data to be linked is stored Device range for storing the linked data
(s)+0 to (s)+(n)-1
n
(d) to (d)+( -1)
2
Operation error
Error code Description
(SD0/SD8067)
2820H The range of (n) points of devices from the device number specified in (s) onwards exceed the corresponding device range.
The range of no. of bytes specified in (n) from the device number specified in (d) onwards exceed the corresponding device range.
7 BASIC INSTRUCTIONS
344 7.5 Data Conversion Instructions
7.6 Digital Switch (Thumbwheel Input)
DSW
This instruction reads the set value of digital switches. This instruction can read a set of 4 digits (n = K1) or two sets of 4 digits
(n = K2).
Ladder diagram Structured text
ENO:=DSW(EN,s,n,d1,d2);
FBD/LD
EN ENO
s d1
n d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s) Head device number connected to a digital switch Bit ANYBIT_ARRAY
(Number of element: 4)
(d1) Head device number to which the strobe signal is output Bit ANYBIT_ARRAY
(Number of element: 4)
(d2) Device number storing the numeric value of a digital 0 to 9999 16-bit signed binary ANY16
switch
(n) Total number of 4-digit switch sets 1, 2 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d1) *2
(d2)
(n)
7 BASIC INSTRUCTIONS
7.6 Digital Switch (Thumbwheel Input) 345
Processing details
The value of each digital switch connected to (s) is input by the time division method (in which the value is input in turn from
the 1st digit by 100 ms interval output signal), and stored to (d2). A numeric value from 0 to 9999 (up to 4 digits) can be read,
the first set is stored to (d2), and the second set is stored to (d2)+1.
When using one set of 4 digits (n = K1)
A 4-digit BCD digital switch connected to (s) to (s)+3 is read in turn by the strobe signal (d1) to (d1)+3, and stored in binary
format to (d2).
When using two sets of 4 digits (n = K2)
A 4-digit BCD digital switch connected to (s) to (s)+3 is read in turn by the strobe signal (d1) to (d1)+3. (s) to (s3)+3 is stored
in (d2) and (s)+4 to (s)+7 is stored in (d2)+1 as BIN format.
For the connection example of digital switch, refer to the following manual.
MELSEC iQ-F FX5U User's Manual (Hardware)
MELSEC iQ-F FX5UC User's Manual (Hardware)
Precautions
• Though the contents of (d2) do not change, all of (d1) to (d1)+3 turn OFF.
• When one set of 4 digits (n = K1) are used, four devices are occupied starting from (s).
• When two sets of 4 digits (n = K2) are used, eight devices are occupied starting from (s), and two devices are occupied
starting from (d2).
• When connecting a digital switch of less than 4 digits, it is not necessary to wire the strobe signal (output for digit
specification) (d1) to unused digits. Because unused digits are occupied also by this instruction, however, they cannot be
used for any other purpose.
• For continuously receiving digital switch values, make sure to use a transistor output type CPU module.
• Use BCD output type digital switches.
• The DSW instruction can only be executed four times in a program.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s), (d1), (d2) exceeds the corresponding device range.
3405H (n) is other than 1 or 2.
The value specified by (s) to (s)+1 and (s)+4 to (s)+7 is other than 0 to 9.
1811H The number of the DSW instructions which are used simultaneously exceeds four.
7 BASIC INSTRUCTIONS
346 7.6 Digital Switch (Thumbwheel Input)
7.7 Data Transfer Instructions
Transferring 16-bit data
MOV(P)
These instructions transfer the 16-bit binary data in the device specified by (s) to the device specified by (d).
Ladder diagram Structured text
ENO:=MOV(EN,s,d);
ENO:=MOVP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s) Transfer source data or device number for storing data -32768 to +32767 16-bit signed binary ANY16
(d) Transfer destination device number 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions transfer the 16-bit binary data in the device specified by (s) to the device specified by (d).
b15 ∙∙∙ b0
(s) 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0
b15 ∙∙∙ b0
(d) 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 347
Transferring 32-bit data
DMOV(P)
These instructions transfer the 32-bit binary data in the device specified by (s) to the device specified by (d).
Ladder diagram Structured text
ENO:=DMOV(EN,s,d);
ENO:=DMOVP(EN,s,d)
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Transfer source data or device number for storing data -2147483648 to +2147483647 32-bit signed binary ANY32
(d) Transfer destination device number 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions transfer the 32-bit binary data in the device specified by (s) to the device specified by (d).
(s)+1 (s)
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
348 7.7 Data Transfer Instructions
Inverting and transferring 16-bit data
CML(P)
These instructions invert each bit of the 16-bit binary data in the device specified by (s), and transfer the result to the device
specified by (d).
Ladder diagram Structured text
ENO:=CML(EN,s,d);
ENO:=CMLP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data to be inverted or device number in which data is
stored
-32768 to +32767 16-bit signed binary ANY16
7
(d) Device number for storing the inversion result 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions invert each bit of the 16-bit binary data in the device specified by (s), and transfer the result to the device
specified by (d).
b15 ∙∙∙ b0
(s) 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0
b15 ∙∙∙ b0
(d) 0 1 0 0 1 0 1 1 1 0 0 0 1 1 0 1
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 349
Inverting and transferring 32-bit data
DCML(P)
These instructions invert each bit of the 32-bit binary data in the device specified by (s), and transfer the result to the device
specified by (d).
Ladder diagram Structured text
ENO:=DCML(EN,s,d);
ENO:=DCMLP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data to be inverted or device number in which data is -2147483648 to +2147483647 32-bit signed binary ANY32
stored
(d) Device number for storing the inversion result 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions invert each bit of the 32-bit binary data in the device specified by (s), and store the result in the device
specified by (d).
(s)+1 (s)
(d)+1 (d)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
350 7.7 Data Transfer Instructions
Digit move
SMOV(P)
These instructions distribute and compose data in units of nibble (4 bits).
Ladder diagram Structured text
ENO:=SMOV(EN,s,n1,n2,n3,d);
ENO:=SMOVP(EN,s,n1,n2,n3,d);
(s) (n1) (n2) (d) (n3)
FBD/LD
EN ENO
s d
n1
n2
n3
Setting data
■Descriptions, ranges, and data types
7
Operand Description Range Data type Data type (label)
(s) Word device number storing data whose nibbles will be 16-bit signed binary ANY16
moved
(n1)*1 Head nibble position to be moved 1 to 4 16-bit unsigned binary ANY16_U
(n2)*1 Number of nibbles to be moved 1 to 4 16-bit unsigned binary ANY16_U
(d) Word device number storing data whose nibbles are 16-bit signed binary ANY16
moved
(n3)*1 Head digit position of movement destination 1 to 4 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n1)
(n2)
(d)
(n3)
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 351
Processing details
These instructions distribute and compose data in units of nibble (4 bits). The contents of the transfer source (s) and transfer
destination (d) are converted into 4-digit BCD (0000 to 9999). (n2) nibbles starting from the (n1)th nibble are transferred to the
transfer destination (d) starting from the (n3)th nibble, converted into binary, and then stored to the transfer destination (d).
• While the command input is OFF, the transfer destination (d) does not change.
• When the command input turns ON, only the specified digits in the transfer destination (d) are changed. The transfer source (s) and unspecified digits in the
transfer destination (d) do not change.
4th nibble 3rd nibble 2nd nibble 1st nibble In the case of "n1 = 4, n2 = 2, n3 = 3". (1): (s) is converted from binary to → BCD data.
(s) (16-bit binary data) (2): (n2) digits starting from the (n1)th digit are transferred (combined) to
(d)' starting from the (n3)th digit. The first and fourth digits of (d)' are not
Data is automatically
affected even if data is transferred from (s)'.
converted(1)
(3): The combined data (BCD) is converted into binary, and stored to (d).
10 3 10 2 10 1 10 0 (s)' (4-digit BCD data)
When command input turns ON
Nibbles are moved(2)
Data is automatically
Do not change.
converted(3)
(d) (16-bit binary data)
■Extension function
When SM8168 is set to ON first and then SMOV instruction is executed, conversion from binary to BCD is not executed. Data
is moved in units of 4 bits.
Operation error
Error code Description
(SD0/SD8067)
3405H Any one of (n1), (n2), (n3) is 0.
Either (s) or (d) is other than 0 to 9999 when SM8168 is OFF.
Either (n1) or (n3) is larger than 4.
(n2) is larger than (n1) or (n3).
7 BASIC INSTRUCTIONS
352 7.7 Data Transfer Instructions
Inverting and transferring 1-bit data
CMLB(P)
These instructions invert the bit data in the device specified by (s), and transfer the result into the device specified by (d).
Ladder diagram Structured text
ENO:=CMLB(EN,s,d);
ENO:=CMLBP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Transfer-source data Bit ANY_BOOL
(d) Transfer-destination data Bit ANY_BOOL
7
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
These instructions invert the bit data in the device specified by (s), and transfer the result in the device specified by (d).
(d) (s)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 353
Transferring 16-bit block data (65535 points maximum)
BMOV(P)
These instructions block transfer the 16-bit binary data of (n) number of devices starting from the one specified by (s) to the
device specified by (d).
Ladder diagram Structured text
ENO:=BMOV(EN,s,n,d);
ENO:=BMOVP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device for storing the data to be transferred 16-bit signed binary/ ANY16
32-bit signed binary
(d) Head number of the transfer-destination device 16-bit signed binary/ ANY16
32-bit signed binary
(n) Number of transfers 1 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
7 BASIC INSTRUCTIONS
354 7.7 Data Transfer Instructions
Processing details
• These instructions block transfer the 16-bit binary data of (n) number of devices starting from the one specified by (s) to the
device specified by (d).
∙∙∙
(s)+(n-2) 6FFFH (d)+(n-2) 6FFFH
(s)+(n-1) 553FH (d)+(n-1) 553FH
• If the device number range is exceeded, data is transferred within the possible range.
• Data can be transferred even when the device range of the transfer-source device and transfer-destination device is
overlapping. To transfer data to a device having a smaller device number, transfer from (s), and to transfer data to a device
having a larger device number, transfer from (s)+(n)-1.
Ex.
When transferring data to a device having a smaller device number
X1 1)
D10 D9
BMOV D10 D9 K3
2)
D11 D10
3)
D12 D11
7
When transferring data to a device having a larger device number
X2 3)
D10 D11
BMOV D10 D11 K3
2)
D11 D12
1)
D12 D13
Precautions
• To perform nibble specification of bit device for both (s) and (d), be sure to set the same number of nibbles for (s) and (d).
• To use a module access device for (s) and (d), specify either (s) or (d).
Operation error
Error code Description
(SD0/SD8067)
3405H The number of nibbles of the nibble specification of bit device of (s) and (d) is different.
3420H A module access device is specified for both (s) and (d).
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 355
Transferring identical 16-bit block data (65535 points maximum)
FMOV(P)
These instructions transfer (n) point(s) of data identical to the 16-bit binary data in the device specified by (s) to the devices
specified by (d).
Ladder diagram Structured text
ENO:=FMOV(EN,s,n,d);
ENO:=FMOVP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data to be transferred or the head device for storing the -32748 to +32767 16-bit signed binary ANY16
data to be transferred
(d) Head device of the transfer-destination 16-bit signed binary ANY16
(n) Number of transfers 1 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions transfer (n) point(s) of data identical to the 16-bit binary data in the device specified by (s) to the device
specified by (d).
b15 ∙∙∙ b0
b15 ∙∙∙ b0 (d) 3456H
(s) 3456H (d)+1 3456H
(d)+2 3456H
(n)
∙∙∙
(d)+(n-2) 3456H
(d)+(n-1) 3456H
• If the number of points specified by (n) exceeds the device number range, data is transferred within the possible range.
• When a constant (K) is specified as the transfer source (s), it is automatically converted into binary.
7 BASIC INSTRUCTIONS
356 7.7 Data Transfer Instructions
Precautions
When the value specified in (n) is 0, an operation error does not occur, but no processing is performed,
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 357
Transferring identical 32-bit block data (65535 points maximum)
DFMOV(P)
These instructions transfer (n) point(s) of data identical to the 32-bit binary data in the device specified by (s) to the devices
specified by (d).
(65535 points maximum)
Ladder diagram Structured text
ENO:=DFMOV(EN,s,n,d);
ENO:=DFMOVP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data to be transferred or the head device for storing the -2147483648 to +2147483647 32-bit signed binary ANY32
data to be transferred
(d) Head device of the transfer-destination 32-bit signed binary ANY32
(n) Number of transfers 1 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions transfer (n) point(s) of data identical to the 32-bit binary data in the device specified by (s) to the device
specified by (d).
b31 ∙∙∙ b0
(d)+1, (d) 1234567H
∙∙∙
• If the number of points specified by (n) exceeds the device number range, data is transferred within the possible range.
• When a constant (K) is specified as the transfer source (s), it is automatically converted into binary.
7 BASIC INSTRUCTIONS
358 7.7 Data Transfer Instructions
Precautions
When the value specified in (n) is 0, an operation error does not occur, but no processing is performed.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 359
Exchanging 16-bit data
XCH(P)
These instructions exchange 16-bit binary data of (d1) and (d2).
Ladder diagram Structured text
ENO:=XCH(EN,d1,d2);
ENO:=XCHP(EN,d1,d2);
(d1) (d2)
FBD/LD
EN ENO
d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d1) Head device for storing the data to be exchanged 16-bit signed binary ANY16
(d2) Head device for storing the data to be exchanged 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d1)
(d2)
Processing details
These instructions exchange 16-bit binary data of (d1) and (d2).
(d1) (d2)
b15 ∙∙∙ b8b7 ∙∙∙ b0 b15 ∙∙∙ b8b7 ∙∙∙ b0
0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
(d1) (d2)
b15 ∙∙∙ b8b7 ∙∙∙ b0 b15 ∙∙∙ b8b7 ∙∙∙ b0
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
360 7.7 Data Transfer Instructions
Exchanging 32-bit data
DXCH(P)
These instructions exchange 32-bit binary data of (d1) and (d2).
Ladder diagram Structured text
ENO:=DXCH(EN,d1,d2);
ENO:=DXCHP(EN,d1,d2);
(d1) (d2)
FBD/LD
EN ENO
d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d1) Head device for storing the data to be exchanged 32-bit signed binary ANY32
7
(d2) Head device for storing the data to be exchanged 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d1)
(d2)
Processing details
These instructions exchange 32-bit binary data of (d1), (d1)+1 and (d2), (d2)+1
(d1)+1 (d1) (d2)+1 (d2)
b31 ∙∙∙ b16 b15 ∙∙∙ b0 b31 ∙∙∙ b16 b15 ∙∙∙ b0
1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 361
Exchanging the upper and lower bytes of 16-bit data
SWAP(P)
These instructions swap the value of 8 bits of the upper and lower bytes of the device specified by (d).
Ladder diagram Structured text
ENO:=SWAP(EN,d);
ENO:=SWAPP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device for storing the data to be swapped 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
These instructions swap the value of 8 bits of the upper and lower bytes of the device specified by (d).
b15 ∙∙∙ b12b11 ∙∙∙ b8b7 ∙∙∙ b4b3 ∙∙∙ b0
(d) 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0
Precautions
If a continuous operation type instruction is used, swap is done in each operation cycle.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
362 7.7 Data Transfer Instructions
Exchanging the upper and lower bytes of 32-bit data
DSWAP(P)
These instructions swap the value of 8 bits of the upper and lower bytes of the word devices specified by (d).
Ladder diagram Structured text
ENO:=DSWAP(EN,d);
ENO:=DSWAPP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device for storing the data to be swapped 32-bit signed binary ANY32
EN
ENO
Execution condition
Execution result
Bit
Bit
BOOL
BOOL
7
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
These instructions swap the value of each of the upper and lower 8 bits of the device specified by (d) and (d)+1.
b15 ∙∙∙ b12b11 ∙∙∙ b8b7 ∙∙∙ b4b3 ∙∙∙ b0 b15 ∙∙∙ b12b11 ∙∙∙ b8b7 ∙∙∙ b4b3 ∙∙∙ b0
(d)+1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 (d) 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0
b15 ∙∙∙ b12b11 ∙∙∙ b8b7 ∙∙∙ b4b3 ∙∙∙ b0 b15 ∙∙∙ b12b11 ∙∙∙ b8b7 ∙∙∙ b4b3 ∙∙∙ b0
(d)+1 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 (d) 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1
Precautions
If a continuous operation type instruction is used, swap is done in each operation cycle.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 363
Transferring 1-bit data
MOVB(P)
These instructions store bit data specified by (s) to (d).
Ladder diagram Structured text
ENO:=MOVB(EN,s,d);
ENO:=MOVBP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device for storing the transfer-source data Bit ANY_BOOL
(d) Head device for storing the transfer-destination data Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions transfer bit data specified by (s) to (d).
(d) (s)
Bit transfer
(d) (s)
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
364 7.7 Data Transfer Instructions
Transferring octal bits (16-bit data)
PRUN(P)
These instructions handle the device number of (s) and (d) with nibble specification as octal numbers, and transfer data.
Ladder diagram Structured text
ENO:=PRUN(EN,s,d);
ENO:=PRUNP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Nibble specification*1 16-bit signed binary ANY16
(d) Device number of transfer destination *1
16-bit signed binary ANY16
7
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Make sure that the least significant digit of a specified device number is "0".
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
*1
(d)
*1 B, SB cannot be used.
Processing details
• Octal bit device → Decimal bit device
(s) (d)
Command
input
PRUN K4X0 K4M0 X0 to X17 M0 to M7, M10 to M17
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 365
• Decimal bit device → Octal bit device
Not transferred
Decimal bit device (M)
M17 M16 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
Operation error
Error code Description
(SD0/SD8067)
2820H The devices specified by (s) and (d) exceed the range of the corresponding device.
7 BASIC INSTRUCTIONS
366 7.7 Data Transfer Instructions
Transferring octal bits (32-bit data)
DPRUN(P)
These instructions handle the device number of (s) and (d) with nibble specification as octal numbers, and transfer data.
Ladder diagram Structured text
ENO:=DPRUN(EN,s,d);
ENO:=DPRUNP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Nibble specification*1 32-bit signed binary ANY32
(d) Device number of transfer destination *1
32-bit signed binary ANY32
7
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Make sure that the least significant digit of a specified device number is "0".
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
*1
(d)
*1 B, SB cannot be used.
Processing details
• Octal bit device → Decimal bit device
Do not change.
Decimal bit device (M)
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 367
• Decimal bit device → Octal bit device
Operation error
Error code Description
(SD0/SD8067)
2820H The devices specified by (s) and (d) exceed the range of the corresponding device.
7 BASIC INSTRUCTIONS
368 7.7 Data Transfer Instructions
Transferring n-bit data
BLKMOVB(P)
These instructions block transfer the bit data of (n) point(s) from the device specified by (s) to the bit data of (n) point(s) from
(d).
Ladder diagram Structured text
ENO:=BLKMOVB(EN,s,n,d);
ENO:=BLKMOVBP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
7
(s) Head device for storing the transfer-source bit data Bit ANY_BOOL
(d) Head device for storing the transfer-destination bit data Bit ANY_BOOL
(n) Number of transfers 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d) *1
(n)
Processing details
• These instructions block transfer the bit data of (n) point(s) from the device specified by (s) to the bit data of (n) point(s)
from the device specified by (d).
• Data can be transferred even when the device range of the transfer-source device and transfer-destination device is
overlapping.
(n)
1 0 1 1
1 0 1 1
(n)
7 BASIC INSTRUCTIONS
7.7 Data Transfer Instructions 369
Operation error
Error code Description
(SD0/SD8067)
2820H The range of (n) point(s) of data starting from the device specified by (s) and (d) exceed the corresponding device range.
7 BASIC INSTRUCTIONS
370 7.7 Data Transfer Instructions
8 APPLICATION INSTRUCTION
ROR(P), RCR(P)
• ROR(P): These instructions rotate the 16-bit binary data in the device specified by (d) to the right by (n) bit(s) (not including
the carry flag).
• RCR(P): These instructions rotate the 16-bit binary data in the device specified by (d) to the right by (n) bit(s) (including the
carry flag).
Ladder diagram Structured text*1
ENO:=RORP(EN,n,d);
ENO:=RCR(EN,n,d);
(d) (n)
ENO:=RCRP(EN,n,d);
FBD/LD*1
EN ENO
n d
*1 The ROR instruction is not supported by the ST language and the FBD/LD language. Use ROR of the standard function. 8
Page 991 ROR(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number where the rotation target data is stored 16-bit signed binary ANY16
(n) Number of rotations 0 to 15 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
8 APPLICATION INSTRUCTION
8.1 Rotation Instruction 371
Processing details
■ROR(P)
• These instructions rotate the 16-bit binary data in the device specified by (d) to the right by (n) bit(s) (not including the carry
flag). The carry flag is on or off depending on the status prior to the execution of the instruction.
Value of b0
Value of b0
Rotating n-bit data to the right
(d)
Value of b(n-1)
Value of b(n-1)
• When (d) is a bit device, bits are rotated to the right within the device range specified by nibble specification. The number of
bits actually to be rotated is the remainder of (n)÷(specified number of bits). For example, when (n) is 15 and the specified
number of bits is 12, 3 bits are rotated because 15 divided by 12 equals 1 with a remainder of 3.
• Specify any value between 0 and 15 for (n). If a value 16 or bigger is specified, bits are rotated by the remainder value of
n÷16. For example, when (n) is 18, 2 bits are rotated because 18 divided by 16 equals 1 with a remainder of 2.
8 APPLICATION INSTRUCTION
372 8.1 Rotation Instruction
■RCR(P)
• These instructions rotate the 16-bit binary data in the device specified by (d) to the right by (n) bit(s) (including the carry
flag). The carry flag is on or off depending on the status prior to the execution of the instruction.
(d)
Value of b(n-1)
• When (d) is a bit device, bits are rotated to the right within the device range specified by digit specification. The number of
bits actually to be rotated is the remainder of (n)÷(specified number of bits). For example, when (n) is 15 and the specified 8
number of bits is 12, 3 bits are rotated because 15 divided by 12 equals 1 with a remainder of 3.
• Specify any value between 0 and 15 for (n). If a value 16 or bigger is specified, bits are rotated by the remainder value of
n÷16. For example, when (n) is 18, 2 bits are rotated because 18 divided by 16 equals 1 with a remainder of 2.
Precautions
• Do not set a negative value to the number of bits to be rotated (n).
• In the case of continuous operation type instructions (ROR and RCR), note that shift and rotation are executed in every
scan time (operation cycle).
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
8.1 Rotation Instruction 373
Rotating 16-bit data to the left
ROL(P), RCL(P)
• ROL(P): These instructions rotate the 16-bit binary data in the device specified by (d) to the left by (n) bit(s) (not including
the carry flag).
• RCL(P): These instructions rotate the 16-bit binary data in the device specified by (d) to the left by (n) bit(s) (including the
carry flag).
Ladder diagram Structured text*1
ENO:=ROLP(EN,n,d);
ENO:=RCL(EN,n,d);
(d) (n)
ENO:=RCLP(EN,n,d);
FBD/LD*1
EN ENO
n d
*1 The ROL instruction is not supported by the ST language and the FBD/LD language. Use ROL of the standard function.
Page 989 ROL(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number where the rotation target data is stored 16-bit signed binary ANY16
(n) Number of rotations 0 to 15 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
8 APPLICATION INSTRUCTION
374 8.1 Rotation Instruction
Processing details
■ROL(P)
• These instructions rotate the 16-bit binary data in the device specified by (d) to the left by (n) bit(s) (not including the carry
flag). The carry flag is on or off depending on the status prior to the execution of the instruction.
(SM700, SM8022)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 (d)
(SM700, SM8022)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 (d)
Value of b15
Value of b15 Rotating 1-bit data to the left
(SM700, SM8022)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 (d)
Value of b(16-n)
8
Value of b(16-n)
• When (d) is a bit device, bits are rotated to the left within the device range specified by nibble specification. The number of
bits actually to be rotated is the remainder of (n)÷(specified number of bits). For example, when (n) is 15 and the specified
number of bits is 12, 3 bits are rotated because 15 divided by 12 equals 1 with a remainder of 3.
• Specify any value between 0 and 15 for (n). If a value 16 or bigger is specified, bits are rotated by the remainder value of
n÷16. For example, when (n) is 18, 2 bits are rotated because 18 divided by 16 equals 1 with a remainder of 2.
8 APPLICATION INSTRUCTION
8.1 Rotation Instruction 375
■RCL(P)
• These instructions rotate the 16-bit binary data in the device specified by (d) to the left by (n) bit(s) (including the carry flag).
The carry flag is on or off depending on the status prior to the execution of the instruction.
(SM700, SM8022)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 (d)
(SM700, SM8022)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (d)
(SM700, SM8022)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 (d)
Value of b(16-n)
• When (d) is a bit device, bits are rotated to the left within the device range specified by nibble specification. The number of
bits actually to be rotated is the remainder of (n)÷(specified number of bits). For example, when (n) is 15 and the specified
number of bits is 12, 3 bits are rotated because 15 divided by 12 equals 1 with a remainder of 3.
• Specify any value between 0 and 15 for (n). If a value 16 or bigger is specified, bits are rotated by the remainder value of
n÷16. For example, when (n) is 18, 2 bits are rotated because 18 divided by 16 equals 1 with a remainder of 2.
Precautions
• Do not set a negative value to the number of bits to be rotated (n).
• In the case of continuous operation type instructions (ROL and RCL), note that shift and rotation are executed in every scan
time (operation cycle).
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
376 8.1 Rotation Instruction
Rotating 32-bit data to the right
DROR(P), DRCR(P)
• DROR(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s) (not
including the carry flag).
• DRCR(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s) (including
the carry flag).
Ladder diagram Structured text*1
ENO:=DRORP(EN,n,d);
ENO:=DRCR(EN,n,d);
(d) (n)
ENO:=DRCRP(EN,n,d);
FBD/LD*1
EN ENO
n d
*1 The DROR instruction is not supported by the ST language and the FBD/LD language. Use ROR of the standard function.
Page 991 ROR(_E)
Setting data
■Descriptions, ranges, and data types
Operand
(d)
Description
Head device number where the rotation target data is stored
Range
Data type
32-bit signed binary
Data type (label)
ANY32
8
(n) Number of rotations 0 to 31 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
■DROR(P)
• These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s) (not including the carry
flag). The carry flag is on or off depending on the status prior to the execution of the instruction.
(d)+1 (d)
b31 b30 b29 b28 b27 b18 b17 b16 b15 b14 b5 b4 b3 b2 b1 b0 (SM700, SM8022)
8 APPLICATION INSTRUCTION
8.1 Rotation Instruction 377
■DRCR(P)
• These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s) (including the carry
flag). The carry flag is on or off depending on the status prior to the execution of the instruction.
(d)+1 (d)
b31 b30 b29 b28 b27 b18 b17 b16 b15 b14 b5 b4 b3 b2 b1 b0 (SM700, SM8022)
Precautions
• Do not set a negative value to the number of bits to be rotated (n).
• In the case of continuous operation type instructions (DROR and DRCR), note that shift and rotation are executed in every
scan time (operation cycle).
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
378 8.1 Rotation Instruction
Rotating 32-bit data to the left
DROL(P), DRCL(P)
• DROL(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s) (not including
the carry flag).
• DRCL(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s) (including the
carry flag).
Ladder diagram Structured text*1
ENO:=DROLP(EN,n,d);
ENO:=DRCL(EN,n,d);
(d) (n)
ENO:=DRCLP(EN,n,d);
FBD/LD*1
EN ENO
n d
*1 The DROL instruction is not supported by the ST language and the FBD/LD language. Use ROL of the standard function.
Page 989 ROL(_E)
Setting data
■Descriptions, ranges, and data types
Operand
(d)
Description
Head device number where the rotation target data is stored
Range
Data type
32-bit signed binary
Data type (label)
ANY32
8
(n) Number of rotations 0 to 31 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
■DROL(P)
• These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s) (not including the carry
flag). The carry flag is on or off depending on the status prior to the execution of the instruction.
(d)+1 (d)
(SM700, SM8022) b31 b30 b29 b28 b27 b18 b17 b16 b15 b14 b5 b4 b3 b2 b1 b0
8 APPLICATION INSTRUCTION
8.1 Rotation Instruction 379
■DRCL(P)
• These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s) (including the carry flag).
The carry flag is on or off depending on the status prior to the execution of the instruction.
(d)+1 (d)
(SM700, SM8022) b31 b30 b29 b28 b27 b18 b17 b16 b15 b14 b5 b4 b3 b2 b1 b0
Precautions
• Do not set a negative value to the number of bits to be rotated (n).
• In the case of continuous operation type instructions (DROL and DRCL), note that shift and rotation are executed in every
scan time (operation cycle).
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
380 8.1 Rotation Instruction
8.2 Program Branch Instruction
Pointer branch
CJ(P)
These instructions execute the program specified by the pointer number within the same program file when the jump
command is on.
Ladder diagram Structured text
Not supported
(P)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(P) Pointer number of the jump destination Device name POINTER
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
8
F, B, SB, S SD, SW, R
(P)
Processing details
■CJ(P)
• These instructions execute the program specified by the pointer number when the execution command is on.
• When the execution command is off, the program in the next step is executed.
ON
OFF
(1)
CJ
(2)
CJP
(3)
Precautions
• If the timer with its coil on is skipped by these instructions, time cannot be measured correctly.
• If the OUT instruction is skipped by these instructions, the scan time will be shortened.
• If these instructions specify and jump to a later step, the scan time will be shortened.
8 APPLICATION INSTRUCTION
8.2 Program Branch Instruction 381
• These instructions can specify and jump from the current step to a smaller step number. In this case, consider a method to
exit a loop so that the watchdog timer does not time out.
P8 X0
Y4 (1) While X3 is on, the loop is repeated.
(1) (2) To exit the loop, turn on X7.
X7
CJ P9
X3
CJ P8
P9 X6
Y5 (2)
• The value in the device skipped with these instructions remains the same.
X2
When X2 turns on, the program jumps to the label, P19.
CJ P19
Y4 and Y5 remain the same even if X2 and X4 turn on/off during the
X4 execution of the CJ instruction.
Y4
X2
Y5
P19 X7
Y6
• Only the pointer numbers within the same program file can be specified.
• During skip operation, if the program jumps to the pointer number within the skip range, the programs of the jump
destination pointer number and later are executed.
• The figure below shows programming of a label. When creating a circuit program, move the cursor to the left side of the bus
line in the ladder diagram, and input a label (P) at the head of the circuit block.
X30
CJ P20
X31
Y10
X32
P20 Y11
(1)
(2)
(1): Bus line
(2): Label
• A label can be programmed in a smaller number step than CJ instruction. However, note that a watchdog timer error occurs
when the scan time exceeds 200 ms (default setting).
P10
CJ P10
8 APPLICATION INSTRUCTION
382 8.2 Program Branch Instruction
• When the pointer number in operands is same and there is one label, the following operation is caused:
X20
(1) (1) When X20 turns ON, the program execution jumps from CJ
CJ P9
instruction corresponding to X20 to the label P9.
X21 (2) When X20 turns OFF and X21 turns ON, the program execution
(2)
CJ P9 jumps from CJ instruction corresponding to X21 to the label P9.
P9
• When a label number (including labels for CALL instructions described later) is used two or more times, an error is caused.
X20
CJ P9
X30
CJ P9
P9 A
P9 A
END
A: User program
8
X1
CALL P15
X2 K10
C0
FEND (1)
SM400
P15 A
RUN Monitor
(2)
RET
A: User program
(1): Subroutine program dedicated to CALL instruction
(2): Program a label (P) after FEND instruction.
• Because SM400/SM8000 is normally ON while a PLC is operating, unconditional jump is applied when SM400 is used as
shown in the following example:
SM400
CJ P5
RUN Monitor
A*
P5 A
Operation error
Error code Description
(SD0/SD8067)
3380H A pointer number which is not used as a label in the same program file is specified.
8 APPLICATION INSTRUCTION
8.2 Program Branch Instruction 383
Jump to END
GOEND
This instruction moves the program execution to the FEND or END instruction in the same program file.
Ladder diagram Structured text
Not supported
FBD/LD
Not supported.
Processing details
• This instruction moves the program execution to the FEND or END instruction in the same program file.
Precautions
• When a GOEND instruction is executed by invalid jump during interrupt program execation, it becomes the same operation
as the IRET instruction.
Operation error
Error code Description
(SD0/SD8067)
3340H After the FOR instruction is executed, the GOEND instruction is executed before the NEXT instruction is executed.
3381H After the CALL(P) or XCALL instruction is executed, the GOEND instruction is executed before the RET instruction is executed.
8 APPLICATION INSTRUCTION
384 8.2 Program Branch Instruction
8.3 Program Execution Control Instruction
Disabling/enabling interrupt programs
DI, EI
Interrupts are usually disabled in CPU module. These instructions enable interrupts in CPU module (EI instruction) or disable
interrupts again (DI instruction).
• DI: Disables the execution of the interrupt program.
• EI: Releases the execution disabled state of interrupt programs.
Ladder diagram Structured text
ENO:=DI(EN);
ENO:=EI(EN);
FBD/LD
EN ENO
Processing details
■DI
• This instruction disables the execution of the interrupt program until the EI instruction is executed, even if the interrupt
cause occurs. 8
• When the power is turned on or the CPU module is reset, the state in which the DI instruction is executed is applied.
• For the operation of the DI instruction (DI instruction without an argument) when using the interrupt disable instruction with
a specified priority or lower (DI instruction with an argument), refer to Page 387 Disabling the interrupt program with
specified priority or lower.
■EI
• This instruction releases the execution disabled state of interrupt programs when the DI instruction is executed, and
enables the execution of the interrupt program with the interrupt pointer number enabled by the IMASK instruction.
• For the operation of the EI instruction when using the interrupt disable instruction with a specified priority or lower (DI
instruction with an argument), refer to Page 387 Disabling the interrupt program with specified priority or lower.
EI
FEND
In B
A: Sequence program
B: Interrupt Program
8 APPLICATION INSTRUCTION
8.3 Program Execution Control Instruction 385
• An interrupt pointer occupies two steps. (In (1) below, I10 is the step 50, X2 is the step 52, and Y10 is the
step 54.)
I10 X2
(1)
50 Y10
X5
56 Y30
60 IRET
• If the master control contains the EI or DI instruction, such an instruction is executed regardless of the
execution of the MC instruction.
Precautions
Interrupts (requests) that are generated after the DI instruction execution, are processed after the EI instruction is executed.
Operation error
Error code Description
(SD0/SD8067)
3362H Nesting of the DI instruction exceeds 16 levels.
8 APPLICATION INSTRUCTION
386 8.3 Program Execution Control Instruction
Disabling the interrupt program with specified priority or lower
DI
This instruction disables the execution of the interrupt program with a priority specified by (s) or lower until the EI instruction is
executed, even if the interrupt cause occurs.
Ladder diagram Structured text
ENO:=DI_1(EN,s);
(s)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Priority for disabling interrupts 1 to 3 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL 8
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
Processing details
• This instruction disables the execution of the interrupt program of the interrupt pointer number with an interrupt priority
specified by (s) or lower.
Interrupt priority setting
DI K3 (1): Interrupt-disabled section for the priority 3 or lower
I No. Priority (Interrupt-enabled section for the priority 2 or higher)
I01 2 (2): Can be executed because of the priority 2.
I02 3 A (1) (3): Cannot be executed because of the priority 3.
FEND
I01 B (2)
IRET
I02 B (3)
IRET
A: Sequence program
B: Interrupt Program
8 APPLICATION INSTRUCTION
8.3 Program Execution Control Instruction 387
• By executing the EI instruction, the interrupt with the priority disabled by the counterpart DI instruction is enabled. However,
when interrupts are disabled only with the DI instruction without an argument, interrupts with all the priorities are enabled by
executing the EI instruction once.
A: Sequence program
(1): Interrupt-enabled section for all priority
EI
(2): Interrupt-disabled section for the priority 3 or lower
A (1) (Interrupt-enabled section for the priority 2 or higher)
(3): Interrupt-disabled section for the priority 2 or lower
DI K3 (Interrupt-enabled section for the priority 1 or higher)
(4): Interrupt-disabled section for the priority 3 or lower
A (2) (Interrupt-enabled section for the priority 2 or higher)
(5): Interrupt-enabled section for all priority
DI K2
(6): EI, which is the counterpart of [DI K2]
A (3) (7): EI, which is the counterpart of [DI K3]
EI
(6) A (4)
EI
(7) A (5)
• Interrupts (requests) that are generated after the DI instruction are processed after the EI instruction is executed.
• When multiple DI instructions are executed and the argument has a priority higher than the currently disabled priority,
interrupts with a priority lower than that of the argument are disabled.
• When multiple DI instructions are executed and the argument has a priority lower than the currently disabled priority, the
interrupt disabled state is not changed.
• The DI instruction can be nested in up to 16 levels.
• The interrupt priority of the interrupt pointer can be set with parameters. (MELSEC iQ-F FX5 User's Manual
(Application))
• The interrupt-disabled priority can be checked with SD758 (interrupt-disabling priority setting value).
• The following shows the interrupt-disabled section when the DI or EI instruction is executed.
• When multiple DI instructions are executed (when interrupts with a priority higher than the currently disabled priority are specified and disabled)
A EI DI K3 DI K2 EI EI
t
• When multiple DI instructions are executed (when interrupts with a priority lower than the currently disabled priority are specified and disabled)
A EI DI K2 DI K3 EI EI
t
(3)
8 APPLICATION INSTRUCTION
388 8.3 Program Execution Control Instruction
• When the DI instruction is executed in an interrupt program
B DI K2 EI IRET
A EI DI K3 EI
A EI DI DI DI EI
t
(3)
A: Scan execution type program
(1): Interrupt-enabled section for all priority
(2): Interrupt-disabled section for the priority 1 or lower (where all the interrupts are disabled)
(3): Because interrupts are disabled with the DI instruction without an argument, interrupts with all the priorities are enabled by executing the EI instruction
once.
8
• When the DI instructions with and without an argument are executed (Execution order is DI instruction with an argument → DI instruction without an
argument)
A EI DI K2 DI DI EI EI EI
t
A: Scan execution type program
(1): Interrupt-enabled section for all priority
(2): Interrupt-disabled section for the priority 2 or lower (interrupt-enabled section for the priority 1 or higher)
(3): Interrupt-disabled section for the priority 1 or lower (where all the interrupts are disabled)
• When the DI instructions with and without an argument are executed (Execution order is DI instruction without an argument → DI instruction with an
argument)
A EI DI DI DI K2 EI EI
Operation error
Error code Description
(SD0/SD8067)
3405H The value specified by (s) is other than the following.
1 to 3
3362H Nesting of the DI instruction exceeds 16 levels.
8 APPLICATION INSTRUCTION
8.3 Program Execution Control Instruction 389
Interrupt program mask
IMASK
This instruction enables or disables the execution of the interrupt program with the specified interrupt pointer number
according to the 16-point bit pattern starting from the device specified in (s).
Ladder diagram Structured text
ENO:=IMASK(EN,s);
(s)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number where the interrupt mask data is stored 16-bit signed binary ANY16_ARRAY
The device specified in (s) and following 15 devices are used. (Number of elements: 16)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
8 APPLICATION INSTRUCTION
390 8.3 Program Execution Control Instruction
Processing details
• This instruction enables or disables the execution of the interrupt program with the specified interrupt pointer number
according to the 16-point bit pattern starting from the device specified in (s).
• 1 (ON): The execution of interrupt programs is enabled.
• 0 (OFF): The execution of interrupt programs is disabled.
• The following shows the assignment of the interrupt pointer numbers to each bit.
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
(s) I15 I14 I13 I12 I11 I10 I9 I8 I7 I6 I5 I4 I3 I2 I1 I0
(s)+1 I31 I30 I29 I28 - - - - I23 I22 I21 I20 I19 I18 I17 I16
(s)+2 - - - - - - - - - - - - - - - -
(s)+3 I63 I62 I61 I60 I59 I58 I57 I56 I55 I54 I53 I52 I51 I50 - -
(s)+4 I79 I78 I77 I76 I75 I74 I73 I72 I71 I70 I69 I68 I67 I66 I65 I64
(s)+5 I95 I94 I93 I92 I91 I90 I89 I88 I87 I86 I85 I84 I83 I82 I81 I80
(s)+6 I111 I110 I109 I108 I107 I106 I105 I104 I103 I102 I101 I100 I99 I98 I97 I96
(s)+7 I127 I126 I125 I124 I123 I122 I121 I120 I119 I118 I117 I116 I115 I114 I113 I112
(s)+8 I143 I142 I141 I140 I139 I138 I137 I136 I135 I134 I133 I132 I131 I130 I129 I128
(s)+9 I159 I158 I157 I156 I155 I154 I153 I152 I151 I150 I149 I148 I147 I146 I145 I144
(s)+10 I175 I174 I173 I172 I171 I170 I169 I168 I167 I166 I165 I164 I163 I162 I161 I160
(s)+12 - - - - - - - - - - - - - - - -
(s)+13 - - - - - - - - - - - - - - - -
(s)+14 - - - - - - - - - - - - - - - -
8
(s)+15 - - - - - - - - - - - - - - - -
• When the power is turned on or the CPU module is reset, execution status of the interrupt programs of I0 to I177 is applied.
• The states of the device (s) to (s)+15 are stored in SD1400 to SD1415 (IMASK instruction mask pattern).
The IMASK instruction can enable or disable the interrupt pointers I0 to I177 in a batch.
Operation error
Error code Description
(SD0/SD8067)
2820H The 16-point range starting from the device specified by (s) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
8.3 Program Execution Control Instruction 391
Disabling/enabling the specified interrupt pointer
SIMASK
This instruction enables or disables the interrupt pointer number specified by (I) according to the value of (s).
Ladder diagram Structured text
ENO:=SIMASK(EN,In,s);
(I) (s)
FBD/LD
EN ENO
In
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(I) Interrupt pointer number for which interrupts are enabled or disabled I0 to I177 Device name POINTER
(s) Enabled or disabled state of the specified interrupt pointer number 0: Disabled 16-bit signed binary ANY16
1: Enabled
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, I displays as In.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(I)
(s)
Processing details
• This instruction enables or disables the execution of the interrupt program with the interrupt pointer number specified by (I)
according to the data specified by (s)
• When 1 is set in (s): The execution of the interrupt program is enabled.
• When 0 is set in (s): The execution of the interrupt program is disabled.
• When the power is turned on or the CPU module is reset, the execution status of the interrupt programs of I0 to I177 is
applied.
• The execution-enabled/disabled states of interrupt pointers are stored in SD1400 to 1415 (IMASK instruction mask
pattern).
Operation error
Error code Description
(SD0/SD8067)
3405H The interrupt pointer number specified by (I) exceeds the range of the interrupt pointer number (I0 to I177).
The value in (s) is other than the interrupt disabled (0) or interrupt enabled (1).
8 APPLICATION INSTRUCTION
392 8.3 Program Execution Control Instruction
Returning from the interrupt program
IRET
This instruction indicates an end of the processing of an interrupt program.
Ladder diagram Structured text
Not supported
FBD/LD
Not supported.
Processing details
When an interrupt (input or timer) is generated while the main program is executing, the program execution jumps to an
interrupt (I) routine. The IRET instruction returns the program execution to the main routine.
The table below shows two types of jump to an interrupt routine.
Function Interrupt No. Description
Interrupt from inputs (including I0 to I23 Interrupt pointer used for the CPU built-in functions (such as input interrupt, high-speed comparison
counter) match interrupt)
Internal timer interrupt I28 to I31 Interrupt pointer used for fixed-cycle interrupts of the internal timer
Operation error
Error code Description 8
(SD0/SD8067)
33E6H The IRET instruction is executed in the main program.
8 APPLICATION INSTRUCTION
8.3 Program Execution Control Instruction 393
Resetting the watchdog timer
WDT(P)
These instructions reset the watchdog timer in a program.
Ladder diagram Structured text
ENO:=WDT(EN);
ENO:=WDTP(EN);
FBD/LD
EN ENO
Processing details
• These instructions reset the watchdog timer in a program.
• These instructions are used when the scan time exceeds the value set for the watchdog timer depending on the condition.
If the scan time exceeds the value set for the watchdog timer every scan, change the setting of the watchdog timer in the
parameter setting of the engineering tool.
• Design a program so that t1 from the step 0 to the WDT(P) instruction and t2 from the WDT(P) instruction to the END
(FEND) instruction do not exceed the setting value of the watchdog timer.
Step 0 END (FEND)
WDT
t1 t2
• The WDT(P) instruction can be used more than once in one scan. However, note that turning off the output takes some time
if an error occurs.
Precautions
• The time of the watchdog timer can be changed in the [RAS] tab of [CPU Parameter]. The default value is 200 ms.
• By overwriting the contents of SD8000 (watchdog timer time), the watchdog timer detection time can be changed using a
program. When the program shown below is input, the sequence program will be monitored with the new watchdog timer
time.
SM402
MOV K300 SD8000 (1)
Initial pulse
WDT (2)
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
394 8.3 Program Execution Control Instruction
8.4 Structuring Instruction
FOR to NEXT
FOR, NEXT
When the processing between the FOR and NEXT instructions is executed (n) times without any condition, the processing of
the step following the NEXT instruction is executed.
Ladder diagram Structured text
Not supported
FOR (n)
NEXT
A: Repetition program
FBD/LD
FOR NEXT
EN ENO EN ENO
8
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(n) Number of repetitions of the loop between FOR and NEXT 1 to 32767 16-bit signed binary ANY16
instructions
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(n)
Processing details
• When the processing between the FOR and NEXT instructions is executed (n) times without any condition, the processing
of the step following the NEXT instruction is executed.
• In (n), any of 1 to 32767 can be specified. If any of -32768 to 0 is specified, the processing of (n)=1 is applied.
• To skip the processing between the FOR and NEXT instructions, jump the program execution with the CJ instruction.
• Up to 16 FOR instructions can be nested.
8 APPLICATION INSTRUCTION
8.4 Structuring Instruction 395
Precautions
• The FOR-NEXT loop can be nested up to 16 levels.
FOR FOR
3rd level 2nd level
FOR FOR
2nd level 1st level
FOR NEXT
1st level
NEXT FOR
1st level
NEXT NEXT
NEXT NEXT
• The FOR-NEXT loop cannot be interrupted by the I, IRET, SRET, RET, FEND, or END instruction.
• When FOR-NEXT loop is repeated many times, the operation cycle is too long, and a watchdog timer error may occur. In
such a case, change the watchdog timer time or reset the watchdog timer.
• The following programs are regarded as errors.
When the NEXT instruction is located before FOR No NEXT instruction
NEXT FOR
When the number of FOR instructions is not equivalent to the number of When the NEXT instruction is located after the FEND or END instruction
NEXT instructions
FOR
FOR
FEND
FOR
NEXT
NEXT
END
NEXT Not programmed
NEXT
Operation error
Error code Description
(SD0/SD8067)
3340H After the FOR instruction is executed, the END or GOEND instruction is executed before the NEXT instruction is executed.
3361H When the FOR instruction is nested, the 17th level is executed.
33E3H A program is written where the nesting of the FOR to NEXT instructions exceeds 16 levels.
• To terminate the FOR to NEXT instruction loop halfway, use the BREAK instruction. (Page 397 Forcibly
terminating the FOR to NEXT instruction loop)
8 APPLICATION INSTRUCTION
396 8.4 Structuring Instruction
Forcibly terminating the FOR to NEXT instruction loop
BREAK(P)
This instruction forcibly terminates the FOR to NEXT instruction loop and shifts the program execution to the pointer specified
by (P).
Ladder diagram Structured text
Not supported
(d) (P)
FBD/LD
EN ENO
Pn d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Device number storing the number of remaining loops 16-bit signed binary ANY16
(P)*1 Pointer number of the branch destination when the loop is Device name POINTER
forcibly terminated
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
8
*1 In the case of the FBD/LD language, P displays as Pn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(P)
Processing details
• This instruction forcibly terminates the FOR to NEXT instruction loop and shifts the program execution to the pointer
specified by (P). Only the pointer numbers within the same program file can be specified in (P). If a pointer in another
program is specified in (P), an operation error occurs.
FOR K**
When the BREAK instruction is
(1) not executed, the program
BREAK (d) (P) execution returns to the FOR
instruction as many times as
(2) specified by the FOR
NEXT instruction.
(P)
• In (d), the number of remaining FOR to NEXT instruction loops at the forced termination is stored. Note that the number
includes the loop when the BREAK(P) instructions are executed.
• The BREAK(P) instructions can be used only between the FOR and NEXT instructions.
• The BREAK(P) instructions can be used for only one nesting level. To forcibly terminate multiple nesting levels, execute as
many BREAK(P) instructions as the number of nesting levels.
8 APPLICATION INSTRUCTION
8.4 Structuring Instruction 397
Precautions
• If the branch pointer number of the BREAK instruction outside two nesting levels or more is specified, an operation error
occurs and the program execution stops when the BREAK instruction is executed.
Operation error
Error code Description
(SD0/SD8067)
3340H The branch pointer number outside two nesting levels or more is specified.
3342H The BREAK(P) instructions are used other than between the FOR and NEXT instructions.
3380H The destination pointer specified by (P) does not exist.
A pointer in other program file is specified in (P).
8 APPLICATION INSTRUCTION
398 8.4 Structuring Instruction
Calling a subroutine program
CALL(P)
This instruction executes the subroutine program specified by (P).
Ladder diagram Structured text
Not supported
(P)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(P) Start pointer number of the subroutine program Device name POINTER
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(P)
Processing details 8
• When the CALL(P) instructions are executed, the subroutine program specified by the pointer (P) is executed. The
CALL(P) instructions can execute a subroutine program specified by a pointer in the same program file or by a common
pointer.
A B
(P)
END
A: Main routine program
B: Subroutine program
8 APPLICATION INSTRUCTION
8.4 Structuring Instruction 399
• While the command input is ON, the CALL instruction is executed and the program execution jumps to a step with a label
(Pn). Then, a subroutine program with the label (Pn) is executed. When the RET (SRET) instruction is executed, the
program execution returns to the step following the CALL instruction. At the end of the main program, put FEND instruction.
Put a label (Pn) for the CALL instruction after the FEND instruction.
A: User program
A
(1): Main program
Command Program area from the step 0 to FEND instruction
CALL Pn
(2): Subroutine program
(1)
Program area from a label Pn to RET instruction
A
FEND
SM400
Pn A
RUN Monitor (2)
(normally on)
RET
• The CALL(P) instructions can be nested up to 16 levels. However, the 16 levels are the total of the CALL(P) and XCALL
instructions.
END
Precautions
• In the CALL instruction, the same number can be used two or more times in operands (P). However, do not use a label (P)
and number used in another instruction (CJ instruction).
X20
CJ P9
X30
CALLP P9
P9 A
A: User program
• In a subroutine (or interrupt routine), use timers for routine programs. These timers count when a coil instruction or END
instruction is executed. After a timer reaches the set value, the output contact is activated when the coil instruction or END
instruction is executed. Because general timers count only when the coil instruction is executed, they do not count if they
are used in subroutines in which the coil instruction is executed only under some conditions.
• If a retentive type 1 ms timer is used in a subroutine (interrupt routine), note that the output contact is activated when the
first coil instruction (or subroutine) is executed after the timer reaches its set value.
• Devices which were set to ON in a subroutine (or interrupt routine) are latched in the ON status even after the subroutine is
finished. (Refer to the program example shown below). When the RST instruction for a timer or counter is executed, the
reset status of the timer or counter is latched also. For turning OFF such a device latched in the ON status or for canceling
such a timer or counter latched in the reset status, reset such a device in the main program after the subroutine is finished,
or program a sequence for resetting such a device or for deactivating the RST instruction in the subroutine. (Refer to the
program example shown below).
8 APPLICATION INSTRUCTION
400 8.4 Structuring Instruction
Example in which outputs are latched
In the following program example, the counter C0 is provided to count X1. When X0 is input, the subroutine P0 is executed only in one scan, and then the
counter is reset and Y7 is output.
[Program example]
X0
CALLP P0
X1 K10
C0
FEND
X0
P0 RST C0
Y7
RET
X1
3 (1)
Current 2 Counter 8
value of reset
C0 1
RST
C0 Remains reset
Y7 Y7 being output
(2)
Example in which latched outputs are reset (countermeasures)
[Program example] (1): Program to reset Y7 at an arbitrary timing
(2): Program to reset the preceding C0 reset
X0
instruction inside the subroutine
CALLP P0
X1 K10
C0
X2
RST Y7 (1)
FEND
X0
P0 RST C0 A
SM401
RST C0 B
RUN Monitor
(normally OFF) (2)
Y7
RET
8 APPLICATION INSTRUCTION
8.4 Structuring Instruction 401
[Timing chart] A: Execution of subroutine P0 triggered by X0
Subroutine is executed.
X1
3 3
Current 2 2
value of
C0 1 1
Counter is reset Counter reset instruction is
RST (part A in above deactivated (part B in
C0 program). above program).
Y7
Resets Y7.
X2
Operation error
Error code Description
(SD0/SD8067)
3360H The 17th level of the nesting is executed.
3380H The subroutine program specified by the pointer in the CALL(P) instructions do not exist.
3381H After the CALL(P) instructions are executed, the END, FEND, GOEND, or STOP instruction is executed before the RET (SRET)
instruction is executed.
3382H The RET (SRET) instruction is executed before the CALL(P) instructions are executed.
8 APPLICATION INSTRUCTION
402 8.4 Structuring Instruction
Returning from the subroutine program
RET/SRET
These instructions indicate an end of a subroutine program.
The RET instruction can be used as SRET.
Ladder diagram Structured text
Not supported
FBD/LD
Not supported.
Processing details
• These instructions indicate an end of a subroutine program.
• When the RET instruction is executed, the program execution returns to the step following the CALL(P) or XCALL
instruction that called the subroutine program.
A B
(P)
8
END
A: Main routine program
B: Subroutine program
Precautions
• If the RET (SRET) instruction is executed in a user interrupt program (I-IRET), a compiling error occurs.
Operation error
Error code Description
(SD0/SD8067)
3381H The END, FEND, GOEND, or STOP instruction is executed before the RET instruction is executed.
3382H While the number of nesting levels is decreased by the return instruction, the result becomes negative.
(The number of RET (SRET) instructions is larger than that of the CALL instructions.)
33E3H The RET instruction is programmed and written between the FOR and NEXT instructions.
33E5H The RET instruction is programmed and written between the STL and RETSTL instructions.
33E6H The program for executing the RET instruction is written before the CALL or XCALL instruction is executed.
33E7H The RET instruction is programmed and written between the MC and MCR instructions.
A program is written with no (P) before the RET instruction.
The program for executing the RET instruction is written between the I and IRET instructions.
8 APPLICATION INSTRUCTION
8.4 Structuring Instruction 403
Calling a subroutine program
XCALL
This instruction executes CALL for (turns on and executes) the subroutine program specified by (P) when the execution
condition is established. When the condition is turned off, this instruction executes turns off and terminates for the subroutine
program.
Ladder diagram Structured text
Not supported
(P)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(P) Start pointer number of the subroutine program Device name POINTER
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(P)
Processing details
• The XCALL instruction controls the execution and non-execution processing of subroutine programs.
• In the execution of subroutine programs, each coil instruction is operated according to the ON/OFF status of the condition contact.
• In the non-execution processing of subroutine programs, each coil instruction is operated with the OFF status of the condition contact applied.
• The following table lists the operation result of each coil instruction after the non-execution processing. Regardless of the
status of the condition contact, the following result is applied.
Device used for operation Operation result (device status)
1 ms timer, 10 ms timer, 100 ms timer 0
1 ms retentive timer, 10 ms retentive timer, 100 ms retentive timer, counter The current status is held.
Device in the OUT instruction Forcibly turned off.
Device in the SET, RST, or SFT(P) instruction or basic/applied instruction The current status is held.
PLS instruction, pulse instruction (P) Same as when the condition contact is off
FEND
P1 M0 M1 (2)
(3)
(1)
ON
RET OFF
X0
(1) Rising edge of X0 (OFF → ON): The subroutine program of P1 is executed.
(2) While X0 is on: The subroutine program of P1 is executed. (The rising edge of X0 is not included.)
(3) Falling edge of X0 (ON → OFF): The non-execution processing of the subroutine program of P1 is executed.
8 APPLICATION INSTRUCTION
404 8.4 Structuring Instruction
• The XCALL instruction can be nested up to 16 levels. However, the 16 levels are the total of the CALL(P) and XCALL
instructions.
END
Operation error
Error code Description
(SD0/SD8067)
3360H The 17th level of the nesting is executed.
3380H The subroutine program specified by the pointer in the XCALL instruction does not exist.
3381H After the XCALL instruction is executed, the END, FEND, GOEND, or STOP instruction is executed before the RET instruction is
executed.
3382H The RET (SRET) instruction is executed before the XCALL instruction is executed.
8 APPLICATION INSTRUCTION
8.4 Structuring Instruction 405
8.5 Data Table Operation Instruction
Reading the oldest data from the data table
SFRD(P)
These instructions read data for first-in first-out control.
Ladder diagram Structured text
ENO:=SFRD(EN,s,n,d);
ENO:=SFRDP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Start number of the word device storing the data 16-bit signed binary ANY16
(The start is a pointer. The data is stored starting from (s)+1.)
(d) Word device number storing data taken out first 16-bit signed binary ANY16
(n) Number of stored points plus "1". "+1" is required for the pointer. 2 to 32768 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
406 8.5 Data Table Operation Instruction
Processing details
• These instructions transfer (read) (s)+1, which was sequentially written by the SFWR instruction, to (d), and shift the word
data of (n)-1 points starting from (s)+1 upward by 1 word. Then, these instructions decrease the number of data points
stored in (s) by 1.
(s)+9 (s)+10
(s)+10
(s)+(n)
(s)+(n) Word data is Word data is
(s)+(n)
shifted. shifted.
(s)+(n) (s)+(n) (s)+(n) 8
• The data of (s)+1 is transferred (read) to (d). Accompanied by this transfer, the contents of the pointer (s) decrease, and the
data is shifted upward by 1 word. (When the continuous operation type SFRD instruction is used, the contents are stored in
turn in each operation cycle. Use the pulse operation type SFRDP instruction in programming.)
Precautions
• The contents of (s)+(n) do not change by reading.
• When the continuous operation type (SFRD) instruction is used, data is read in turn in each scan time (operation cycle), but
the contents of (s)+(n) do not change.
• When 0 is set in the pointer (s), no processing is executed and the contents of (d) do not change.
Operation error
Error code Description
(SD0/SD8067)
2820H The number of device points (n) from (s) exceed the device range.
3405H The value set in (n) is other than the following.
2≤(n)≤32768
In (s), a negative value is specified.
8 APPLICATION INSTRUCTION
8.5 Data Table Operation Instruction 407
Reading the newest data from the data table
POP(P)
These instructions read the latest data written by a shift write (SFWR) instruction for FIFO/FILO control.
Ladder diagram Structured text
ENO:=POP(EN,s,n,d);
ENO:=POPP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number storing the first-in data (including pointer 16-bit signed binary ANY16
data) (start number of the word device storing the data)
(d) Device number storing last-out data 16-bit signed binary ANY16
(n) Length of data array 2 to 32768 16-bit unsigned binary ANY16_U
(Add "1" because pointer data is also included.)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
408 8.5 Data Table Operation Instruction
Processing details
• Every time the instruction is executed for the word devices (s) to (s)+(n)-1, a device "(s) + Pointer data (s)" is read to (d).
(The last data entry written by the shift write (SFWR) instruction for first-in first-out control is read to (d).) Specify any value
between 2 and 32767 for (n).
• Subtract "1" from the value of the pointer data (s).
Data for FILO control
Description
(s) Pointer data (amount of data stored)
(s)+1 Data area
(First-in data written by shift write (SFWR) instruction)
(s)+2
(s)+3
(s)+(n)-3
(s)+(n)-2
(s)+(n)-1
Pointer Pointer
(s) (s) (d)
K4 K4 K3
(s)+1 (s)+1
(s)+2 (s)+2
(s)+3 (s)+3
(s)+4 (s)+4
Data area
(s)+5 (s)+5
(s)+6
No data area
(s)+6
8
(s)+(n)-2 (s)+(n)-2
(s)+(n)-1 (s)+(n)-1
Precautions
• If programed in the continuous operation type, the POP(P) instructions are executed in every operation cycle. As a result,
expected operation may not be achieved. Usually, program the POP(P) instructions in the "pulse operation type", or let
them be executed by a "pulsed command contact".
• When the current value of the pointer (s) is "0", the zero flag SM8020 turns ON and the POP(P) instructions are not
executed.
• When the current value of the pointer (s) is "1", "0" is written to (s) and the zero flag SM8020 turns ON.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range (s)+(n)-1 exceeds the device.
3405H (s) is larger than (n)-1.
(s) is smaller than 0.
The value set in (n) is other than the following.
2≤(n)≤32768
8 APPLICATION INSTRUCTION
8.5 Data Table Operation Instruction 409
Writing data to the data table
SFWR(P)
These instructions write data for first-in first-out (FIFO) and last-in first-out (LIFO) control.
Ladder diagram Structured text
ENO:=SFWR(EN,s,n,d);
ENO:=SFWRP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Word device number storing data to be put in first 16-bit signed binary ANY16
(d) Start word device number storing and shifting data 16-bit signed binary ANY16
(The start is a pointer. The data is stored starting from (d)+1.)
(n) Number of stored points plus "1". 2 to 32768 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
410 8.5 Data Table Operation Instruction
Processing details
• The contents of (s) are written to "(n)-1" devices from (d)+1, and "1" is added to the number of data stored in (d). For
example, for (d)=0, the contents are written to (d)+1, and for (d)=1, to (d)+2.
Pointer Pointer
(d) Pointer (d) (d)+1 (d)
(d) (d)+1 (d)
(K0) (K1) (K1) (K2)
Precautions
• In the case of the continuous operation type instruction (SFWR), note that data is stored (overwritten) in every scan time
(operation cycle).
Operation error
Error code Description
(SD0/SD8067)
2820H The number of device points (n) from (d) exceeds the device range.
3405H The value set in (n) is other than the following.
2≤(n)≤32768
In (d), a negative value is specified.
8 APPLICATION INSTRUCTION
8.5 Data Table Operation Instruction 411
Inserting data to the data table
FINS(P)
These instructions insert 16-bit data specified by (s) to the data table specified by (d) as the (n)th data.
After these instructions are executed, the data after the (n)th data in the data table is moved down by one data point.
Ladder diagram Structured text
ENO:=FINS(EN,s,n,d);
ENO:=FINSP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number where the insertion-target data is stored 16-bit signed binary ANY16
(d) Start number of the table Word ANY16
(n) Data insertion position in the table 1 to 32767 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions insert 16-bit binary data specified by (s) to the data table specified by (d) as the (n)th data. After these
instructions are executed, the data after the (n)th data in the data table is moved down by one data point.
(d) 3 N (d) 4
N: Number of stored data
(d)+1 5432 (d)+1 5432 DTr: Data table range
(d)+2 1234 (d)+2 4444
DTr
(d)+3 -123 (d)+3 1234 When 2 is set in (n), the data is inserted
(d)+4 0 (d)+4 -123 in (d)+2.
(d)+5 0 (d)+5 0
0 0
(s) 4444
Precautions
• The device range used in a data table should be controlled by the user.
• The data table has (d) number of stored data starting from ((d)+1).
8 APPLICATION INSTRUCTION
412 8.5 Data Table Operation Instruction
Operation error
Error code Description
(SD0/SD8067)
2820H When the FINS(P) instructions are executed, the data table range exceeds the corresponding device range.
3405H When the FINS(P) instructions are executed, the value (n) exceeds the corresponding device range of the table (d).
When the FINS(P) instructions are executed, the table position (n) where the data is inserted exceeds "the number of stored data points +
1".
The value set in (n) is other than the following.
2≤(n)≤32767
8 APPLICATION INSTRUCTION
8.5 Data Table Operation Instruction 413
Deleting data from the data table
FDEL(P)
These instructions remove the (n)th data in the data table specified by (d) and store the data in the device specified by (s).
After these instructions are executed, the data after the (n)+1th data in the data table is moved up by one data point.
Ladder diagram Structured text
ENO:=FDEL(EN,s,n,d);
ENO:=FDELP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number for storing the data to be deleted 16-bit signed binary ANY16
(d) Start number of the table Word ANY16
(n) Position of the data to be deleted in the table 1 to 32767 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions remove the (n)th data in the data table specified by (d) and store the data in the device specified by (s).
After these instructions are executed, the data after the (n)+1th data in the data table is moved up by one data point.
(d) 4 (d) 3
(d)+1 5432 (d)+1 5432
(d)+2 3333 (d)+2 3333
(d)+3 4444 (d)+3 1234
(d)+4 1234 (d)+4 0 (2)
(d)+5 0 (d)+5 0
0 0
(1)
(s) 4444
(1): When (n) is 3, (d)+3 is the target.
(2): Filled with 0.
Precautions
• The device range used in a data table should be controlled by the user.
• The data table has (d) number of stored data starting from ((d)+1).
8 APPLICATION INSTRUCTION
414 8.5 Data Table Operation Instruction
Operation error
Error code Description
(SD0/SD8067)
2820H When the FDEL(P) instructions are executed, the data table range exceeds the corresponding device range.
3405H When the FDEL(P) instructions are executed, the value (n) exceeds the corresponding device range of the table (d).
When 0 is set in (d), and the FDEL(P) instructions are executed.
When the FDEL(P) instructions are executed, the table position (n) where the data to be deleted is stored exceeds the number of stored
data points.
The value set in (n) is other than the following.
2≤(n)≤32767
8 APPLICATION INSTRUCTION
8.5 Data Table Operation Instruction 415
8.6 Character String Operation Instruction
Comparing character strings
OR$
(s1) (s2)
FBD/LD
s1 s1 s1
s2 s2 s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Comparison data or head device number where the comparison Character string ANYSTRING_SINGLE
data is stored
(s2) Comparison data or head device number where the comparison Character string ANYSTRING_SINGLE
data is stored
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
8 APPLICATION INSTRUCTION
416 8.6 Character String Operation Instruction
Processing details
• These instructions perform a comparison operation between the character string data specified by (s1) and the character
string data specified by (s2). (Devices are used as a normally open contact.)
• In the comparison operation, the ASCII codes of the character strings are compared one by one from the start of the
strings.
• Character strings in the devices specified by (s1) and (s2) to a device that stores 00H are compared.
• When all the character strings match, the comparison is considered as matched.
b15 b8 b7 b0 b15 b8 b7 b0
(s1) 42H (B) 41H (A) (s2) 42H (B) 41H (A)
(s1)+1 44H (D) 43H (C) = (s2)+1 44H (D) 43H (C)
(s1)+2 00H 45H (E) (s2)+2 00H 45H (E)
"ABCDE" "ABCDE"
• When the character strings are different, the string with a large character code is considered as the large one.
b15 b8 b7 b0 b15 b8 b7 b0
(s1) 42H (B) 41H (A) (s2) 42H (B) 41H (A)
(s1)+1 44H (D) 43H (C) > (s2)+1 44H (D) 43H (C)
(s1)+2 00H 46H (F) (s2)+2 00H 45H (E)
"ABCDF" "ABCDE"
• When the character strings are different, the magnitude relation between them is determined based on the size of the first different character code.
b15 b8 b7 b0 b15 b8 b7 b0
(s1) 32H (2) 31H (1) (s2) 32H (2) 31H (1)
(s1)+1 34H (4) 33H (3) < (s2)+1 33H (3) 34H (4)
(s1)+2 00H 35H (5) (s2)+2 00H 35H (5)
"12345" "12435"
• When the length of the character string data differs for (s1) and (s2), the relative sizes of the character strings are determined based on the size of the
first different character code.
b15 b8 b7 b0 b15 b8 b7 b0
(s1) 32H (2) 31H (1) (s2) 32H (2) 31H (1)
(s1)+1 33H (3) 34H (4) > (s2)+1 34H (4) 33H (3)
(s1)+2 36H (6) 35H (5) (s2)+2 36H (6) 35H (5)
(s1)+3 00H 00H (s2)+3 00H 37H (7)
"124356" "1234567"
• If the character string specified by (s1) or (s2) has more than 16383 characters, the operation result is the non-conductive
state.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 417
Precautions
• In character string comparison operation, if the target device range does not have "00H", the values until the last number of
the device are retrieved. Thus, even if the target device range does not have "00H", a comparison operation result is output
when a mismatch between the acquired character strings is detected.
Ex.
• For the data specified by (s1) and (s2) as shown above, the second character is different between them. Thus, the
operation result is non-conductive.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
418 8.6 Character String Operation Instruction
Concatenating character strings
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number storing data to be concatenated or data, or Character string ANYSTRING_SINGLE
directly specified character string
(d) Head device number storing data to which another data is Character string ANYSTRING_SINGLE
concatenated
■Applicable devices
Operand Bit Word Double word Indirect Constant Others 8
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d) *1
Processing details
• These instructions concatenate the character string data stored in the device specified by (s) and later to the end of the
character string data stored in the device specified by (d) and later, and store the concatenated string in the device
specified by (d) and later.
b15 b8 b7 b0 b15 b8 b7 b0 b15 b8 b7 b0
(d) 42H (B) 41H (A) (s) 32H (2) 31H (1) (d) 42H (B) 41H (A)
(d)+1 44H (D) 43H (C) + (s)+1 34H (4) 33H (3) (d)+1 44H (D) 43H (C)
(d)+2 00H 45H (E) (s)+2 36H (6) 35H (5) (d)+2 31H (1) 45H (E)
"ABCDE" (s)+3 0000H (d)+3 33H (3) 32H (2)
"123456" (d)+4 35H (5) 34H (4)
(d)+5 00H 36H (6)
"ABCDE123456"
• Character strings in the devices specified by (s) and (d) up to a device that stores 00H are concatenated.
• When character strings are concatenated, 00H indicating an end of the character string specified by (d) is ignored and the
character string specified by (s) is concatenated to the last character of (d).
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 419
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range after the device specified by (s), "00H" does not exist.
In the corresponding device range after the device specified by (d), "00H" does not exist.
3406H The whole concatenated character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
The number of characters of the character string in the device specified by (s)+(d) exceeds 16383..
3405H The character string specified by (s) has more than 16383 characters.
The character string specified by (d) has more than 16383 characters.
8 APPLICATION INSTRUCTION
420 8.6 Character String Operation Instruction
$+(P) [For 3 operands]
These instructions concatenate the character string data stored in the device specified by (s2) and later to the end of the
character string data stored in the device specified by (s1) and later, and store the concatenated string in the device specified
by (d) and later.
Ladder diagram Structured text
Not supported
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number storing data to which another data is Character string ANYSTRING_SINGLE
concatenated or data, or directly specified character string
(s2) Head device number storing data to be concatenated or data, or Character string ANYSTRING_SINGLE
directly specified character string
8
(d) Head device number for storing the concatenated data Character string ANYSTRING_SINGLE
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
*1
(d)
Processing details
• These instructions concatenate the character string data stored in the device specified by (s2) and later to the end of the
character string data stored in the device specified by (s1) and later, and store the concatenated string in the device
specified by (d) and later.
• Character strings in the devices specified by (s1) and (s2) up to a device that stores 00H are concatenated.
b15 b8 b7 b0 b15 b8 b7 b0 b15 b8 b7 b0
(s1) 46H (F) 48H (H) (s2) 35H (5) 31H (1) (d) 46H (F) 48H (H)
(s1)+1 2DH (-) 41H (A) + (s2)+1 39H (9) 33H (3) (d)+1 2DH (-) 41H (A)
(s1)+2 00H (s2)+2 00H 41H (A) (d)+2 35H (5) 31H (1)
(d)+3 39H (9) 33H (3)
(d)+4 00H 41H (A)
• When character strings are concatenated, 00H indicating an end of the character string specified by (s1) is ignored and the
character string specified by (s2) is concatenated to the last character of (s1).
• After two character strings are connected, "00H" is automatically added at the end. When the number of characters after
the concatenation is odd, 00H is stored in the upper byte of the device storing the last character. When the number is even,
0000H is stored in the device after the last character.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 421
Precautions
• For direct specification, up to 32 characters can be specified (input). When word devices are specified in (s1) or (s2), this
restriction (up to 32 characters) is not applicable.
• When the values in both (s1) and (s2) start from "00H" (that is, when the number of characters is "0"), "0000H" is stored in
(d).
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range after the device specified by (s1), "00H" does not exist.
In the corresponding device range after the device specified by (s2), "00H" does not exist.
2821H The numbers of the character string-storing devices specified by (s1), (s2), and (d) overlap.
3405H The character string specified by (s1) has more than 16383 characters.
The character string specified by (s2) has more than 16383 characters.
3406H The character string specified by (d) has more than 16383 characters.
The whole concatenated character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
8 APPLICATION INSTRUCTION
422 8.6 Character String Operation Instruction
Transferring character strings
$MOV(P)
These instructions transfer the character string data specified by (s) to the device specified by (d) and later.
Ladder diagram Structured text*1
ENO:=STRINGMOV(EN,s,d);
ENO:=STRINGMOVP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Character string to be transferred (up to 255 characters) or head Character string ANYSTRING_SINGLE
device number storing a character string
(d) Head device number storing transferred character string Character string ANYSTRING_SINGLE
EN Execution condition Bit BOOL
8
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d) *1
Processing details
• These instructions transfer the character string data specified by (s) to the device specified by (d) and later. A character
string enclosed with double quotation marks and specified by (s) or stored in the devices from the device specified by (s) to
the device storing 00H is transferred in a batch.
b15 b8 b7 b0 b15 b8 b7 b0
(s) 2nd character 1st character (d) 2nd character 1st character
(s)+1 4th character 3rd character (d)+1 4th character 3rd character
(s)+2 6th character 5th character (d)+2 6th character 5th character
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 423
• Even though the device range of the data to be transferred (s) to (s)+n and the device range for storing the transferred data
(d) to (d)+n overlap, the processing is performed normally. For example, when a character string stored in D10 to D13 is
transferred to D11 to D14, the transfer is executed as shown below:
b15 b8 b7 b0 b15 b8 b7 b0
D10 32H (2) 31H (1) D10 32H (2) 31H (1) (1)
D11 34H (4) 33H (3) D11 32H (2) 31H (1)
D12 36H (6) 35H (5) D12 34H (4) 33H (3)
D13 0000H D13 36H (6) 35H (5)
D14 D14 0000H
• When "00H" is stored in the lower byte of (s)+n, "00H" is stored to both the upper byte and lower byte of (d)+n.
b15 b8 b7 b0 b15 b8 b7 b0
(s) 42H (B) 41H (A) (d) 42H (B) 41H (A) (2)
(s)+1 44H (D) 43H (C) (d)+1 44H (D) 43H (C)
(s)+2 45H (E) 00H (d)+2 00H 00H
(1) (3)
(1): The high-order byte is not transferred.
(2): It is the same as the character string before transfer.
(3): "00H" is automatically stored in the high-order byte.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "00H" does not exist.
3405H The character string specified by (s) has more than 16383 characters.
3406H The whole specified character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
8 APPLICATION INSTRUCTION
424 8.6 Character String Operation Instruction
Converting 16-bit binary data to decimal ASCII
BINDA(P)(_U)
These instructions convert 16-bit binary data specified by (s) into decimal ASCII codes, and store the converted data in the
device specified by (d) and later.
Ladder diagram Structured text
ENO:=BINDA(EN,s,d); ENO:=BINDA_U(EN,s,d);
(s) (d) ENO:=BINDAP(EN,s,d) ENO:=BINDAP_U(EN,s,d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) BINDA(P) Binary data to be converted into ASCII codes -32768 to +32767 16-bit signed binary ANY16_S
BINDA(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) Head device number storing conversion result Character string ANYSTRING_SINGLE
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL 8
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
*1
(d)
Processing details
• These instructions convert 16-bit binary data specified by (s) into decimal ASCII codes, and store the converted data in the
device specified by (d) and later.
b15 b8 b7 b0
b15 b0 (d) ASCII code for ten-thousands place ASCII code for sign
(s) (d)+1 ASCII code for hundreds place ASCII code for thousands place
(d)+2 ASCII code for ones place ASCII code for tens place
BIN16 "0" is stored only
(d)+3 0 when SM701 is off.
Ex.
When -12345 is specified in (s) (when signed data is specified)
b15 b8 b7 b0
b15 b0 (d) 31H (1) 2DH (-)
(s) - 1 2 3 4 5 (d)+1 33H (3) 32H (2)
(d)+2 35H (5) 34H (4)
BIN16 (d)+3 0000H
• The following shows the operation result to be stored in (d).
• As sign data, "20H" is stored if the 16-bit binary data is positive, and "2DH" is stored if the data is negative.
• "20H" is stored for "0" on the left side of the valid digits (zero suppression). For "00325", 20H is stored for "00", and the number of digits is 3 based on
"325".
• In the device specified by (d)+3, 0 is stored when SM701 (output character number selector signal) is off, and the original data remains when SM701 is
on.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 425
Precautions
• The number of occupied points of (d) is 3 when SM701 is on, and 4 when SM701 is off.
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (d) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
426 8.6 Character String Operation Instruction
Converting 32-bit binary data to decimal ASCII
DBINDA(P)(_U)
These instructions convert 32-bit binary data specified by (s) into decimal ASCII codes, and store the converted data in the
device specified by (d) and later.
Ladder diagram Structured text
ENO:=DBINDA(EN,s,d); ENO:=DBINDA_U(EN,s,d);
ENO:=DBINDAP(EN,s,d); ENO:=DBINDAP_U(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) DBINDA(P) Binary data to be converted into ASCII codes -2147483648 to +2147483647 32-bit signed binary ANY32_S
DBINDA(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) Head device number storing conversion result Character string ANYSTRING_SINGLE
EN Execution condition Bit BOOL 8
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
*1
(d)
Processing details
• These instructions convert 32-bit binary data specified by (s) into decimal ASCII codes, and store the converted data in the
device specified by (d) and later.
b15 b8 b7 b0
(d) ASCII code for billions place ASCII code for sign
(d)+1 ASCII code for ten-millions place ASCII code for hundred-millions place
(s)+1 (s)
(d)+2 ASCII code for hundred-thousands place ASCII code for millions place
high-order 16 bits Low-order 16 bits
(d)+3 ASCII code for thousands place ASCII code for ten-thousands place
BIN32 (d)+4 ASCII code for tens place ASCII code for hundreds place
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 427
Ex.
When -12345678 is specified in (s) (when signed data is specified)
b15 b8 b7 b0
(d) 20H (SP) 2DH (-)
(d)+1 31H (1) 20H (SP)
(s)+1 (s)
(d)+2 33H (3) 32H (2)
- 1 2 3 4 5 6 7 8
(d)+3 35H (5) 34H (4)
(d)+4 37H (7) 36H (6)
(d)+5 00H or 20H 38H (8)
Precautions
• (d) occupies six points.
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (d) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
428 8.6 Character String Operation Instruction
Converting HEX code data to ASCII
ASCI(P)
These instructions convert the (n) characters (digits) within the hexadecimal code data specified by (s) to ASCII, and store the
converted data in the device specified by (d) and later.
Ladder diagram Structured text
ENO:=ASCI(EN,s,n,d);
ENO:=ASCIP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number storing hexadecimal code to be converted 16-bit signed binary ANY16
(d) Head device number storing converted ASCII code Character string ANYSTRING_SINGLE
(n) Number of characters (digits) of hexadecimal code to be
converted
1 to 32767 16-bit unsigned binary ANY16_U
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d) *1
(n)
Processing details
• These instructions convert the (n) characters (digits) within the hexadecimal code data specified by (s) to ASCII, and store
the converted data in the device specified by (d) and later.
• The 16-bit mode and 8-bit mode options are available for the ASCI(P) instructions. For the operation in each mode, refer to
the proceeding pages.
• 16-bit conversion mode (while SM8161 is OFF)
Each digit of hexadecimal data stored in the device specified by (s) and later is converted into ASCII code, and transferred to the upper 8 bits and lower 8
bits of each device specified by (d) and later. SM8161 must always be off in the 16-bit conversion mode.
In the following program, conversion is executed as follows:
SM400
Devices specified by (s) and later
SM8161 (1)
(D100)=0ABCH
X10 (D101)=1234H
(D102)=5678H
ASCI D100 D200 K4
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 429
Number of specified digits (characters) and conversion result
(n)
K1 K2 K3 K4 K5 K6 K7 K8 K9
(d)
D200 lowest-order byte "C" "B" "A" "0" "4" "3" "2" "1" "8"
D200 highest-order byte "C" "B" "A" "0" "4" "3" "2" "1"
D201 lowest-order byte "C" "B" "A" "0" "4" "3" "2"
D100 = 0ABCH
0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 ASCII code
SM400
Devices specified by (s) and later
SM8161 (1)
(D100)=0ABCH
X10 (D101)=1234H
ASCI D100 D200 K4 (D102)=5678H
16 bits
0 Low-order 8 bits
Destination
8 APPLICATION INSTRUCTION
430 8.6 Character String Operation Instruction
Number of specified digits (characters) and conversion result
(n)
K1 K2 K3 K4 K5 K6 K7 K8 K9
(d)
D200 "C" "B" "A" "0" "4" "3" "2" "1" "8"
D208 "C"
D100 = 0ABCH
0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 ASCII code
D200 = ASCII code of B = 42H "A" = 41H "2" = 32H "6" = 36H
0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0
4 2
"B" = 42H "3" = 33H "7" = 37H
8
"C" = 43H "4" = 34H "8" = 38H
D201 = ASCII code of C = 34H
0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1
4 3
Precautions
• When outputting data in the BCD format for a printer, for example, it is necessary to convert binary data into BCD data
before executing the ASCI(P) instructions.
• Whether NULL (00H) is stored after the last character or not depends on the ON/OFF status of the output character number
selector signal SM701. When SM701 is off, NULL (00H) is stored. When SM701 is on, the original data remains.
• Depending on the ON/OFF status of SM701 and SM8161, the number of devices occupied by (d) differs.
SM701 SM8161 Number of devices occupied by (d)
ON ON Number of letters
ON OFF Number of letters ÷ 2
OFF ON Number of letters ÷ 1
OFF OFF (Number of letters ÷ 2) + 1
• When RS2, HEX, or CCD is used, the extension flag SM8161 is common to other instructions. When using an instruction
described above and the ASCI(P) instructions in the same program, make sure to set SM8161 to ON or OFF just before
each instruction so that SM8161 does not apply to another instruction.
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (s) or (d) exceeds the corresponding device range.
3405H The value specified by (s) is other than any of 1 to 32767.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 431
Converting 16-bit binary data to character string
STR(P)(_U)
These instructions add a decimal point to the 16-bit binary data in the device specified by (s2) at the location specified by (s1),
convert the data to character string data, and store the converted data in the device areas specified by (d) and later.
Ladder diagram Structured text
ENO:=STR(EN,s1,s2,d); ENO:=STR_U(EN,s1,s2,d);
ENO:=STRP(EN,s1,s2,d); ENO:=STRP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) STR(P) Head device number where the number of digits of the 16-bit signed binary ANY16_S_ARRAY
conversion target data is stored (Number of elements: 2)
STR(P)_U 16-bit unsigned binary ANY16_U_ARRAY
(Number of elements: 2)
(s2) STR(P) Conversion target data -32768 to +32767 16-bit signed binary ANY16_S
STR(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) Head device number for storing the converted data Character string ANYSTRING_SINGLE
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
8 APPLICATION INSTRUCTION
432 8.6 Character String Operation Instruction
Processing details
• These instructions add a decimal point to the 16-bit binary data in the device specified by (s2) at the location specified by
(s1), convert the data to character string data, and store the converted data in the device areas specified by (d) and later.
(s1) (1)
b15 b8 b7 b0
(s1)+1 (2)
ASCII code in "(Value specifying number of
(d) all digits - 1)"th digit ASCII code for sign
ASCII code in "(Value specifying number of ASCII code in "(Value specifying number of
. (d)+1 all digits - 3)"th digit all digits - 2)"th digit
ASCII code in "(Value specifying number of ASCII code in "(Value specifying number of
(3) (d)+2 all digits - 5)"th digit all digits - 4)"th digit
(5)
ASCII code in "(Value specifying number of ASCII code in "(Value specifying number of
(d)+3 all digits - 7)"th digit all digits - 6)"th digit
(s2) BIN16
(d)+4 0000H
(4)
(1): Total number of digits
(2): Number of digits of decimal part
(3): Sign
(4): "0000H" is automatically stored at the end of the character string.
(5): For specifying number of all digits
(s1) 6
(s1)+1 2 1 2 . 3 4
BIN16 1 2 3 4 (1)
(2)
(s1) 6
(s1)+1 3 0 . 0 1 2
BIN16 1 2
(1)
(s1) 8
(s1)+1 1 - 1 2 . 3
BIN16 - 1 2 3 (1)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 433
Operation error
Error code Description
(SD0/SD8067)
3401H The number of digits specified by (s1) is smaller than the number of digits plus 2 of the 16-bit binary data in the device specified by (s2).
(The additional 2 digits indicate the sign (+/-) and the decimal point.)
The total number of digits specified by (s1) is out of the valid range (2 to 8).
The number of digits in the decimal part specified by (s1)+1 is out of the valid range (0 to 5).
The relationship between the total number of digits specified by (s1) and the number of digits in the decimal part specified by (s1)+1 does
not satisfy the following.
(Total number of digits)-3 ≥ Number of digits in the decimal part
3406H The device areas storing the character string specified by (d) exceed the corresponding device range.
2820H The device range specified by (s1) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
434 8.6 Character String Operation Instruction
Converting 32-bit binary data to character string
DSTR(P)(_U)
These instructions add a decimal point to the 32-bit binary data in the device specified by (s2) at the location specified by (s1),
convert the data to character string data, and store the converted data in the device areas specified by (d) and later.
Ladder diagram Structured text
ENO:=DSTR(EN,s1,s2,d); ENO:=DSTR_U(EN,s1,s2,d);
ENO:=DSTRP(EN,s1,s2,d); ENO:=DSTRP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DSTR(P) Head device number where the number of digits 16-bit signed binary ANY16_S_ARRAY
of the conversion target data is stored (Number of elements: 2)
DSTR(P)_U 16-bit unsigned binary ANY16_U_ARRAY
(Number of elements: 2) 8
(s2) DSTR(P) Conversion target data -2147483648 to +2147483647 16-bit signed binary ANY32_S
DSTR(P)_U 0 to 4294967295 16-bit unsigned binary ANY32_U
(d) Head device number for storing the converted Character string ANYSTRING_SINGLE
data
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
*1
(d)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 435
Processing details
• These instructions add a decimal point to the 32-bit binary data in the device specified by (s2) at the location specified by
(s1), convert the data to character string data, and store the converted data in the device areas specified by (d) and later.
(s1) (1)
(2) b15 b8 b7 b0
(s1)+1
ASCII code in "(Value specifying
(d) number of all digits - 1)"th digit ASCII code for sign
(s1) 10
(s1)+1 3 1 2 3 4 5 . 6 7 8
BIN32 1 2 3 4 5 6 7 8 (1)
(2)
(1): Number of digits of decimal part
(2): Added automatically
• If the specified number of digits in the decimal part is greater than the number of digits of the 32-bit binary data, 0(s) is automatically added and the data
is regarded as "0.".
(s1) 13
(s1)+1 10 0 . 0 0 0 0 0 5 4 3 2 1
BIN32 5 4 3 2 1
(1)
(1): Added automatically
• If the total number of digits excluding the sign and the decimal point is greater than the number of digits of the 32-bit binary data, "20H" (space) is stored
between the sign and the numeric value. If the number of digits of the 32-bit binary data is greater, an error occurs.
(s1) 13
(s1)+1 2 - 5 4 3 2 . 1 0
BIN32 - 5 4 3 2 1 0
(1)
(1): "20H (SP)" is stored.
8 APPLICATION INSTRUCTION
436 8.6 Character String Operation Instruction
• The value "00H" is automatically stored at the end of the converted character string.
• When the number of all digits is even, "0000H" is stored in the device after the last character. When the number of all digits is odd, "00H" is stored in the
upper byte (8 bits) of the device storing the final character.
Operation error
Error code Description
(SD0/SD8067)
3401H The number of digits specified by (s1) is smaller than the number of digits plus 2 of the 16-bit binary data in the device specified by (s2).
(The additional 2 digits indicate the sign (+/-) and the decimal point.)
The total number of digits specified by (s1) is out of the valid range (2 to 13).
The number of digits in the decimal part specified by (s1)+1 is out of the valid range (0 to 10).
The relationship between the total number of digits specified by (s1) and the number of digits in the decimal part specified by (s1)+1 does
not satisfy the following.
(Total number of digits)-3 ≥ Number of digits in the decimal part
3406H The device areas storing the character string specified by (d) exceed the corresponding device range.
2820H The device range specified by (s1) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 437
Converting single-precision real number to character string
ESTR(P)/DESTR(P)
These instructions convert the single-precision real number data stored in the device specified by (s1) into a character string
according to the display specification stored in the device specified by (s2) and later, and store the string in the device
specified by (d) and later.
The ESTR(P) instructions can also be used as DESTR(P).
Ladder diagram Structured text
ENO:=ESTR(EN,s1,s2,d);
ENO:=ESTRP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Single-precision real number data to be converted or the start 0, 2-126<|(s1)|<2128 Single-precision real ANYREAL_32
number of the device where data is stored number
(s2) Head device number storing the display specification of a 16-bit signed binary ANY16_ARRAY
numeric value to be converted (Number of elements: 3)
The device specified in (s2) and following 2 devices are used.
(d) Head device number for storing the converted data Character string ANYSTRING_SINGLE
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1
Processing details
• These instructions convert the single-precision real number data stored in the device specified by (s1) into a character
string according to the display specification stored in the device specified by (s2) and later, and store the string in the device
specified by (d) and later. A real number can be directly specified as (s1).
• The data after conversion varies depending on the display specification stored in (s2).
(s2) (1)
8 APPLICATION INSTRUCTION
438 8.6 Character String Operation Instruction
■Decimal point format
• When 0 is specified in (s2), the decimal point format is applied.
(s2) (1)
(s2)+1 (2)
b15 b8 b7 b0
(s2)+2
(3) ASCII code in "(Value specifying number
(d) of all digits - 1)"th digit
ASCII code for sign
ASCII code in "(Value specifying number ASCII code in "(Value specifying number
. (d)+1 of all digits - 3)"th digit of all digits - 2)"th digit
(d)+4 0000H
(5)
(6)
• When the number of decimal part digits is 0, the number of digits that can be specified by (s2)+1 is "the number of digits (24
at a maximum) ≥ 2". For other than 0, the number of digits that can be specified by (s2)+1 is "the number of digits (24 at a
maximum) ≥ (the number of decimal point digits + 3)".
• The number of digits in the decimal part that can be specified by (s2)+2 is 0 to 7. Note that the number of digits in the
decimal part must be smaller than the total number of digits minus 3.
• For example, when the total number of digits is "8", the number of digits of the decimal part is "3", and "-1.23456" is 8
specified, data is stored in (d) and later as shown below:
(s2) 0 (1)
(s2)+1 8 b15 b8 b7 b0
(s2)+2 3 (2)
(d) 20H (SP) 2DH(-)
(s1)+1 (s1)
(d)+3 35H(5) 33H(3)
-1.23 4 5 6
(d)+4 0000H
(4)
(5)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 439
• The converted character string data are stored in the device areas specified by (d) and later as shown below.
• As sign data, "20H" (space) is stored if the single-precision real number is positive, and "2DH" (-) is stored if the data is negative.
• If the decimal part of the single-precision real number data cannot be accommodated in the number of digits of the decimal part, lower digits of the
decimal part are rounded off.
(s2) 0
(s2)+1 8 (1)
(s2)+2 2
- 1 . 2 3 4 5 6
(s2) 0
(1)
(s2)+1 8
(s2)+2 2 - 1 . 2 3
(s2) 0
(s2)+1 8 (1)
(s2)+2 2
- 1 . 2 3
■Exponent format
• When 1 is specified in (s2), the exponent format is applied.
(4)
ASCII code in "(Value specifying number ASCII code in "(Value specifying number
(d)+5 of all digits - 11)"th digit (exponent) of all digits - 10)"th digit (exponent)
0000H
(d)+6
(8)
(1): Exponent format
(2): Total number of digits
(3): Number of digits of decimal part
(4): Single-precision real number
(5): Sign (integer part)
(6): Sign (exponent part)
(7): Added automatically
(8): "0000H" is automatically stored at the end of the character string.
8 APPLICATION INSTRUCTION
440 8.6 Character String Operation Instruction
• When the number of decimal part digits is 0, the number of digits that can be specified by (s2)+1 is "the number of digits (24
at a maximum) ≥ 6". For other than 0, the number of digits that can be specified by (s2)+1 is "the number of digits (24 at a
maximum) > (the number of decimal point digits + 7)".
• The number of digits in the decimal part that can be specified by (s2)+2 is 0 to 7. Note that the number of digits in the
decimal part must be equal to or smaller than the total number of digits minus 7.
• For example, when the total number of digits is "12", the number of digits of the decimal part is "4", and "-12.34567" is
specified, data is stored in (d) and later as shown below:
b15 b8 b7 b0
(s2) 1 (1)
(s2)+1 (d) 20H (SP) 2DH(-)
12
(s2)+2 4 (2)
(d)+1 2EH(.) 31H(1)
(3)
(d)+3 36H(6) 34H(4)
(4) (5)
(s2) (1)
1
(s2)+1 12 (2)
(s2)+2 4
- 1 . 2 3 4 6 E + 0 1
(s1)+1 (s1)
-12.34 5 6 7 (3)
(s2) 1
(s2)+1 12 (1)
(s2)+2 4
- 1 . 2 3 4 6 6 7 E + 0 1
(s1)+1 (s1)
(2) (3)
-12.34 5 6 7
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 441
• If the number of digits in the decimal part is set to other than 0, "2EH" (.) is automatically stored at the position before the specified number of digits. If
the number of digits in the decimal part is 0, "2EH" (.) is not stored.
(s2) 1
(s2)+1 12 (1)
(s2)+2 4
- 1 . 2 3 4 6 E + 0 1
(s1)+1 (s1)
(2)
-12.34 5 6 7
(3)
(1): Total number of digits
(2): Number of digits of decimal part
(3): Added automatically
• For the sign of the exponent part, "2BH (+)" is stored when the exponent is positive, and "2DH (-)" is stored when the exponent is negative.
• The exponent part is fixed to 2 digits. When the exponent part is 1 digit, "30H (0)" is stored after the sign of the exponent part.
(s2) (1)
1
(s2)+1 12 (2)
(s2)+2 4
- 1 . 2 3 4 6 E + 0 1
(s1)+1 (s1)
(3)
-12.34 5 6 7
Operation error
Error code Description
(SD0/SD3067)
2820H The device specified by (s2) exceeds the corresponding device range.
3401H The number of total digits specified by (s1)+1 exceeds 24.
The format specified by (s2) is any value other than "0" or "1".
The total number of digits specified by (s2)+1 is not within the following range in the decimal point format.
When the number of digits of the decimal part is "0": Total number of digits ≥ 2
When the number of digits of the decimal part is any value other than "0": Total number of digits ≥ (Number of digits of decimal part + 3)
The total number of digits specified by (s2)+1 is not within the following range in the exponent format.
When the number of digits of the decimal part is "0": Total number of digits ≥ 6
When the number of digits of the decimal part is any value other than "0": Total number of digits ≥ (Number of digits of decimal part + +7)
The number of digits of the decimal part specified by (s2)+2 is not within the following range.
In the decimal part format ≤ (Total number of digits - 3)
In the exponent format ≤ (Total number of digits - 7)
When the conversion result exceeds the specified total number of digits
3402H (s1) is not within the following range
0, ±2-126 ≤ (s1) < ±2128
The specified device value is denormalized number, NaN (not a number), or ±∞.
3405H The number of digits of the decimal part specified by (s2)+2 is not within the following range.
0 to 7
3406H The device areas that store the character string specified by (d) exceed the corresponding device range.
8 APPLICATION INSTRUCTION
442 8.6 Character String Operation Instruction
Detecting a character string length
LEN(P)
These instructions detect the length of the character string specified by (s), and store the length in the device specified by (d)
and later.
These instructions handle data stored in the device specified by (s) to the device storing 00H as a character string.
Ladder diagram Structured text*1
ENO:=LENP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The LEN instruction is not supported by the ST language and the FBD/LD language. Use LEN of the standard function.
Page 1008 LEN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Character string or head device number storing a character string Character string ANYSTRING_SINGLE
8
(d) Device number storing the detected character string length 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d)
Processing details
• These instructions detect the length of the character string specified by (s), and store the length in the device specified by
(d) and later.
• These instructions handle data stored in the device specified by (s) to the device storing 00H as a character string.
b15 b8 b7 b0
(s) 2nd character 1st character
(s)+1 4th character 3rd character
b15 b0
(s)+2 6th character 5th character
(d) Character string length
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 443
Ex.
When "ABCDEFGHI" is stored in (s) and later
b15 b8 b7 b0
(s) 42H (B) 41H (A)
(s)+1 44H (D) 43H (C) "ABCDEFGHI" b15 b0
(s)+2 46H (F) 45H (E) (d) 9
(s)+3 48H (H) 47H (G)
(s)+4 00H 49H (I)
Precautions
The LEN(P) instructions can handle character codes other than ASCII codes, but the character string length is handled in byte
units (8 bits). Accordingly, in the case of character codes in which 2 bytes express 1 character such as shift JIS codes, the
length of 1 character is detected as "2".
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "00H" does not exist.
3405H The character string specified by (s) has more than 16383 characters.
8 APPLICATION INSTRUCTION
444 8.6 Character String Operation Instruction
Extracting character string data from the right
RIGHT(P)
These instructions extract "n" characters of the character string data stored in the device specified by (s) and later from the
right end (from the end), and store the extracted characters in the device specified by (d) and later.
Ladder diagram Structured text*1
ENO:=RIGHTP(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The RIGHT instruction is not supported by the ST language and the FBD/LD language. Use RIGHT of the standard function.
Page 1009 LEFT(_E), RIGHT(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s)
(d)
Character string or head device number storing a character string
Head device number for storing "n" characters extracted from the
Character string
Character string
ANYSTRING_SINGLE
ANYSTRING_SINGLE
8
right of the device specified by (s)
(n) Number of characters to be extracted 1 to 16383 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
*1
(d)
(n)
Processing details
• These instructions extract "n" characters of the character string data stored in the device specified by (s) and later from the
right end (from the end), and store the extracted characters in the device specified by (d) and later.
b15 b8 b7 b0
(s) ASCII code for 2nd character ASCII code for 1st character
(s)+1 ASCII code for 4th character ASCII code for 3rd character b15 b8 b7 b0
ASCII code for "(last character -n+2)"th ASCII code for "(last character -n+1)"th
(d) character character
ASCII code for "(last character -n+4)"th ASCII code for "(last character -n+3)"th
ASCII code for "(last character -n+2)"th ASCII code for "(last character -n+1)"th (d)+1 character character
character character
ASCII code for "(last character -n+4)"th ASCII code for "(last character -n+3)"th
character character
ASCII code for "(last character -1)"th ASCII code for "(last character -2)"th
character character
ASCII code for "(last character -1)"th ASCII code for "(last character -2)"th 00H ASCII code for the last character
character character
00H ASCII code for the last character
• A character string stored in (s) indicates data stored in devices from the specified device until "00H" is first detected in units
of 1 byte.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 445
Ex.
When 5 is specified in (n)
b15 b8 b7 b0
b15 b8 b7 b0
(s) 42H (B) 41H (A)
(d) 32H (2) 31H (1)
(s)+1 44H (D) 43H (C)
(d)+1 34H (4) 33H (3)
(s)+2 46H (F) 45H (E)
(d)+2 00H 35H (5)
(s)+3 32H (2) 31H (1)
"12345"
(s)+4 34H (4) 33H (3)
(1)
(s)+5 00H 35H (5)
"ABCDEF12345"
(1): ASCII code for 5th character
• A NULL code (00H), which indicates an end of a character string, is automatically added at the end of the character string
data.
• When the number of extracted characters is odd, "00H" is stored in the upper byte of a device storing the last character.
When the number of extracted characters is even, "0000H" is stored in the device after the last character.
• When the number of characters specified by (n) is 0, a NULL code (00H) is stored in (d).
Precautions
When handling character codes other than ASCII codes, note the following points:
• The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in which 2 bytes
express 1 character such as shift JIS codes, 1 character is detected as "2".
• When extracting characters from a character string including character codes in which 2 bytes express 1 character such as
shift JIS codes, consider the number of characters to be extracted in units of character codes for 1 character. Note that the
expected character code is not retrieved if only 1 byte is extracted out of a 2-byte character code.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "00H" does not exist.
3405H (n) is not within the following range
0 to 16383
The character string specified by (s) has more than 16383 characters.
"n" exceeds the number of characters specified by (s)
3406H The (n) points of data in the device starting from the one specified by (d) exceed the corresponding device range.
8 APPLICATION INSTRUCTION
446 8.6 Character String Operation Instruction
Extracting character string data from the left
LEFT(P)
These instructions extract "n" characters of the character string data stored in the device specified by (s) and later from the left
end (from the start), and store the extracted characters in the device specified by (d) and later.
Ladder diagram Structured text*1
ENO:=LEFTP(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The LEFT instruction is not supported by the ST language and the FBD/LD language. Use LEFT of the standard function.
Page 1009 LEFT(_E), RIGHT(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s)
(d)
Character string or head device number storing a character string
Head device number for storing "n" characters extracted from the
Character string
Character string
ANYSTRING_SINGLE
ANYSTRING_SINGLE
8
left of the device specified by (s)
(n) Number of characters to be extracted 1 to 16383 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
*1
(d)
(n)
Processing details
• These instructions extract "n" characters of the character string data stored in the device specified by (s) and later from the
left end (from the start), and store the extracted characters in the device specified by (d) and later.
b15 b8 b7 b0
(s) ASCII code for 2nd character ASCII code for 1st character
(s)+1 ASCII code for 4th character ASCII code for 3rd character b15 b8 b7 b0
(d) ASCII code for 2nd character ASCII code for 1st character
ASCII code for (n-1) th character ASCII code for (n-2) th character (d)+1 ASCII code for 4th character ASCII code for 3rd character
ASCII code for (n+1) th character ASCII code for (n) th character
ASCII code for (n-1) th character ASCII code for (n-2) th character
00H ASCII code for the last character 00H ASCII code for (n) th character
• A character string stored in (s) indicates data stored in devices from the specified device until "00H" is first detected in units
of 1 byte.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 447
Ex.
When 7 is specified in (n)
b15 b8 b7 b0
b15 b8 b7 b0
(s) 42H (B) 41H (A)
(d) 42H (B) 41H (A)
(s)+1 44H (D) 43H (C)
(d)+1 44H (D) 43H (C)
(s)+2 46H (F) 45H (E)
(d)+2 46H (F) 45H (E)
(s)+3 32H (2) 31H (1)
(d)+3 00H 31H (1)
(s)+4 34H (4) 33H (3)
"ABCDEF1"
(s)+5 00H 35H (5) (1)
"ABCDEF12345"
(1): ASCII code for 7th character
• A NULL code (00H), which indicates an end of a character string, is automatically added at the end of the character string
data.
• When the number of extracted characters is odd, "00H" is stored in the upper byte of a device storing the last character.
When the number of extracted characters is even, "0000H" is stored in the device after the last character.
• When the number of characters specified by (n) is 0, a NULL code (00H) is stored in (d).
Precautions
When handling character codes other than ASCII codes, note the following points:
• The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in which 2 bytes
express 1 character such as shift JIS codes, 1 character is detected as "2".
• When extracting characters from a character string including character codes in which 2 bytes express 1 character such as
shift JIS codes, consider the number of characters to be extracted in units of character codes for 1 character. Note that the
expected character code is not retrieved if only 1 byte is extracted out of a 2-byte character code.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "00H" does not exist.
3405H (n) is not within the following range
0 to 16383
The character string specified by (s) has more than 16383 characters.
"n" exceeds the number of characters specified by (s)
3406H The (n) points of data in the device starting from the one specified by (d) exceed the corresponding device range.
8 APPLICATION INSTRUCTION
448 8.6 Character String Operation Instruction
Storing the specified number of character strings
MIDR(P)
These instructions extract the number of characters specified by (s2)+1 of the character string data stored in the device
specified by (s1) and later from the position specified by (s2), and store the extracted characters in the device specified by (d)
and later.
Ladder diagram Structured text
ENO:=MIDR(EN,s1,s2,d);
ENO:=MIDRP(EN,s1,s2,d);
(s1) (d) (s2)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Character string or head device number storing a character string Character string ANYSTRING_SINGLE
(d) Head device number for storing the character string data of the
operation result
Character string ANYSTRING_SINGLE 8
(s2) Head device number for storing the number of characters and position 16-bit signed binary ANY16_ARRAY
of the start character (Number of elements: 2)
(s2)+0: Position of the start character, (s2)+1: Number of characters
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(d) *1
(s2)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 449
Processing details
• These instructions extract the number of characters specified by (s2)+1 of the character string data stored in the device
specified by (s1) and later from the position specified by (s2), and store the extracted characters in the device specified by
(d) and later.
b15 b8 b7 b0
b15 b8 b7 b0
(s1) 42H (B) 41H (A)
(d) 46H (F) 45H (E)
(s1)+1 44H (D) 43H (C)
(d)+1 48H (H) 47H (G)
(s1)+2 46H (F) 45H (E)
(1) (d)+2 00H 49H (I)
(s1)+3 48H (H) 47H (G)
"EFGHI"
(s1)+4 4AH (J) 49H (I)
(s1)+5 00H 4BH (K) (2)
"ABCDEFGHIJK"
(s2) 5
(s2)+1 5
(1): 5th character position (s2)
(2): ASCII code for 5th character (s2)+1
• A character string stored in (s1) indicates data stored in devices from the specified device until "00H" is first detected in
units of byte.
• A NULL code (00H), which indicates an end of a character string, is automatically added at the end of the character string
data.
• When the number of extracted characters "(s2)+1" is odd, "00H" is stored in the upper byte of a device storing the last
character. When the number of extracted characters "(s2)+1" is even, "0000H" is stored in the device after the last
character.
• If the number of characters specified by (s2)+1 is 0, no processing is performed.
• When (s2)+1 (the number of characters to be extracted) is "-1", the entire character string stored in (s1) and later is stored
to (d) and later.
b15 b8 b7 b0
b15 b8 b7 b0
(s1) 42H (B) 41H (A)
(d) 46H (F) 45H (E)
(s1)+1 44H (D) 43H (C)
(d)+1 48H (H) 47H (G)
(s1)+2 46H (F) 45H (E)
(1) (d)+2 4AH (J) 49H (I)
(s1)+3 48H (H) 47H (G)
(d)+3 00H 4BH (K)
(s1)+4 4AH (J) 49H (I)
"EFGHIJK"
(s1)+5 00H 4BH (K)
"ABCDEFGHIJK"
(s2) 5
(s2)+1 -1
Precautions
When handling character codes other than ASCII codes, note the following points:
• The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in which 2 bytes
express 1 character such as shift JIS codes, 1 character is detected as "2".
• When extracting characters from a character string including character codes in which 2 bytes express 1 character such as
shift JIS codes, consider the number of characters to be extracted in units of character codes for 1 character. Note that the
expected character code is not retrieved if only 1 byte is extracted out of a 2-byte character code.
8 APPLICATION INSTRUCTION
450 8.6 Character String Operation Instruction
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s1) and later, "00H" does not exist.
3405H The value stored in a device specified in (s2)+1 is -2 or lower.
The value stored in a device specified in (s2) exceeds the number of characters of (s1).
A negative value is specified in (s2).
The value stored in a device specified in (s2)+1 exceeds the number of characters of (s1).
The character string specified by (s1) has more than 16383 characters.
The total of the values stored in devices specified in (s2) and (s2)+1 exceeds the number of characters of (s1).
3406H The number of characters from the position specified by (d) to (s2)+1 exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 451
Replacing the specified number of character strings
MIDW(P)
These instructions extract the number of characters specified by (s2)+1 from the character string data stored in the device
specified by (s1) and later, and store the extracted data in the position specified by (s2) and later of the character string data
stored in the device specified by (d) and later.
Ladder diagram Structured text
ENO:=MIDW(EN,s1,s2,d);
ENO:=MIDWP(EN,s1,s2,d);
(s1) (d) (s2)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Character string or head device number storing a character string Character string ANYSTRING_SINGLE
(d) Head device number for storing the character string data of the Character string ANYSTRING_SINGLE
operation result
(s2) Head device number for storing the number of characters and 16-bit signed binary ANY16_ARRAY
position of the start character (Number of elements: 2)
(s2)+0: Position of the start character, (s2)+1: Number of characters
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(d) *1
(s2)
8 APPLICATION INSTRUCTION
452 8.6 Character String Operation Instruction
Processing details
• These instructions extract the number of characters specified by (s2)+1 from the character string data stored in the device
specified by (s1) and later, and store the extracted data in the position specified by (s2) and later of the character string
data stored in the device specified by (d) and later.
Before execution
b15 b8 b7 b0
(d) 42H (B) 41H (A)
b15 b8 b7 b0
(s1) 31H (1) 30H (0) (d)+1 44H (D) 43H (C)
(s1)+1 33H (3) 32H (2) (d)+2 46H (F) 45H (E)
(s1)+2 35H (5) 34H (4) (d)+3 48H (H) 47H (G)
(s1)+2 35H (5) 34H (4) (d)+3 48H (H) 47H (G)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 453
• When (s2)+1 (the number of characters to be extracted) is "-1", the entire character string stored in (s1) and later is stored
to (d) and later.
Before execution
b15 b8 b7 b0
(d) 42H (B) 41H (A)
(d)+1 44H (D) 43H (C)
b15 b8 b7 b0
(d)+2 46H (F) 45H (E)
(s1) 31H (1) 30H (0)
(d)+3 48H (H) 47H (G)
(s1)+1 33H (3) 32H (2)
(d)+4 4AH (J) 49H (I)
(s1)+2 35H (5) 34H (4)
(d)+5 00H 4BH (K)
(s1)+3 0000H
"012345" "ABCDEFGHIJK"
After execution
b15 b8 b7 b0
(d) 30H (0) 41H (A)
Position from the left end in the character
(s2) 2 string stored in (d) and later (d)+1 32H (2) 31H (1)
Number of characters from the left end in the
(s2)+1 -1 character string stored in (s1) and later (d)+2 34H (4) 33H (3)
(d)+3 48H (H) 35H (5)
(d)+4 4AH (J) 49H (I)
(d)+5 00H 4BH (K)
"A012345HIJK"
Precautions
When handling character codes other than ASCII codes, note the following points:
• The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in which 2 bytes
express 1 character such as shift JIS codes, 1 character is detected as "2".
• When extracting characters from a character string including character codes in which 2 bytes express 1 character such as
shift JIS codes, consider the number of characters to be extracted in units of character codes for 1 character. Note that the
expected character code is not retrieved if only 1 byte is extracted out of a 2-byte character code.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s1) and later, "00H" does not exist.
The device specified by (d) exceeds the corresponding device range.
3405H The value stored in a device specified in (s2)+1 is -2 or lower.
The value stored in a device specified in (s2) exceeds the number of characters of (d).
The value stored in a device specified in (s2)+1 exceeds the number of characters of (s1).
The character string specified by (s1) has more than 16383 characters.
The character string specified by (d) has more than 16383 characters.
8 APPLICATION INSTRUCTION
454 8.6 Character String Operation Instruction
Searching character string
INSTR(P)
These instructions search the character string data stored in the device specified by (s2) and later starting from the (s3)th
character from the left, for the character string data stored in the device specified by (s1) and later and store the search result
in the device specified by (d).
Ladder diagram Structured text
ENO:=INSTR(EN,s1,s2,s3,d);
ENO:=INSTRP(EN,s1,s2,s3,d);
(s1) (s2) (d) (s3)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Character string to be searched for or head device number
storing a character string to be searched for
Character string ANYSTRING_SINGLE 8
(s2) Character string to be searched or head device number storing a Character string ANYSTRING_SINGLE
character string to be searched
(d) Head device number storing search result 16-bit signed binary ANY16
(s3) Search start position 1 to 16383 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
(d)
(s3)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 455
Processing details
• These instructions search the character string data stored in the device specified by (s2) and later starting from the (s3)th
character from the left, for the character string data stored in the device specified by (s1) and later and store the search
result in the device specified by (d). The search result stores the position where the first detected character is located from
the start character in the character string data stored in (s2).
b15 b8 b7 b0 b15 b8 b7 b0
(s2) 42H (B) 41H (A) (s1) 46H (F) 45H (E)
(s2)+1 44H (D) 43H (C) (1) (s1)+1 48H (H) 47H (G)
(s2)+2 46H (F) 45H (E) (2) (s1)+2 00H
(s2)+3 48H (H) 47H (G) "EFGH"
(s2)+4 4AH (J) 49H (I)
(s2)+5 00H 4BH (K)
"ABCDEFGHIJK"
(s3) 3 (d) 5
(1): Search start position (s3): 3rd character
(2): Fifth character from the head character
(s3) 3
(1): Search start position (s3): 3rd character
(2): Fifth character from the head character
Operation error
Error code Description
(SD0/SD8067)
2820H No NULL code (00H) exists in the corresponding device range of the device specified by (s1) and later.
No NULL code (00H) exists in the corresponding device range of the device specified by (s2) and later.
3405H The value stored in a device specified in (s3) exceeds the number of characters of (s2).
The character string specified by (s1) has more than 16383 characters.
The character string specified by (s2) has more than 16383 characters.
8 APPLICATION INSTRUCTION
456 8.6 Character String Operation Instruction
Inserting character string
STRINS(P)
These instructions insert the character string specified by (s1) at the (s2)th character from the start of the character string
specified by (d).
Ladder diagram Structured text
ENO:=STRINS(EN,s1,s2,d);
ENO:=STRINSP(EN,s1,s2,d);
(s1) (d) (s2)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Character string to be inserted or head device number storing the Character string ANYSTRING_SINGLE
character string to be inserted
(d) Head device number storing a character string to which another
character string is inserted
Character string ANYSTRING_SINGLE
8
(s2) Insertion position (in units of bytes) 1 to 16383 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(d) *1
(s2)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 457
Processing details
• These instructions insert the character string specified by (s1) at the (s2)th character from the start of the character string
specified by (d).
b15 b8 b7 b0
(s1) 31H (1) 30H (0)
b15 b8 b7 b0
(s1)+1 33H (3) 32H (2) (d)
The character string data of the 42H (B) 41H (A)
(s1)+2 00H 34H (4) (d)+1
3rd character and later is 31H (1) 30H (0)
The inserted
shifted leftward by 5 characters, (d)+2 33H (3) 32H (2) character
and "01234" is inserted. string data (s1)
(s2) 3 (d)+3 43H (C) 34H (4)
(d)+4 45H (E) 44H (D)
(d)+5 47H (G) 46H (F)
(d)+6 00H 48H (H)
b15 b8 b7 b0
(d)+7 66H (f) 65H (e)
(d) 42H (B) 41H (A)
Insertion start position (s2):
(d)+1 44H (D) 43H (C)
3rd character The character string data of (d)+5 and
(d)+2 46H (F) 45H (E) later before insertion is overwritten for the
(d)+3 48H (H) 47H (G) number of character to be inserted.
(d)+4 0000H
(d)+5 62H (b) 61H (a)
(d)+6 64H (d) 63H (c)
(d)+7 66H (f) 65H (e)
• When the number of characters after insertion, (s1)+(d), is even, a NULL code (00H) is stored in the device (1 word) after
the last device storing the character string.
• When the number of characters after insertion, (s1)+(d), is odd, a NULL code (00H) is stored in the last device (upper 8
bits) of the character string.
• If the number of characters exceeding (d) by one character is specified in (s2), the character string in (s1) is added to the
end of the character string in (d).
Operation error
Error code Description
(SD0/SD8067)
2820H No NULL code (00H) exists in the corresponding device range of the device specified by (s1) and later.
No NULL code (00H) exists in the corresponding device range of the device specified by (d) and later.
2821H A device of the character strings (s1) and (d) overlaps.
The device storing the character string after insertion, (s1)+(d), overlaps with the character string-storing device of (s1).
3405H The character string specified by (s1) has more than 16383 characters.
The character string specified by (d) has more than 16383 characters.
(s2) is not within the range (1≤(s2)≤16383)
The value specified by (s2) exceeds "the number of characters of the character string (d) + 1".
3406H The character string after insertion, (s1)+(d), has more than 16383 characters.
The character string after insertion, (s1)+(d), exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
458 8.6 Character String Operation Instruction
Deleting character string
STRDEL(P)
These instructions delete (n) characters starting from the (s)th character (deletion start position) from the start of the character
string data specified by (d).
Ladder diagram Structured text
ENO:=STRDEL(EN,s,n,d);
ENO:=STRDELP(EN,s,n,d);
(d) (s) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number storing a character string having characters Character string ANYSTRING_SINGLE
to be deleted
(s)
(n)
Deletion start position
Number of characters to be deleted
1 to 16383
0 to 16384
16-bit signed binary
16-bit signed binary
ANY16
ANY16
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
(s)
(n)
8 APPLICATION INSTRUCTION
8.6 Character String Operation Instruction 459
Processing details
• These instructions delete (n) characters starting from the (s)th character (deletion start position) from the start of the
character string data specified by (d).
The character string data of the deleted character After shifting, "00H" is stored
and later is shifted rightward by 5 characters. in the vacant device.
b15 b8 b7 b0 b15 b8 b7 b0 b15 b8 b7 b0
(d) 42H (B) 41H (A) Number of (d) 42H (B) 41H (A) (d) 42H (B) 41H (A)
characters to be
(d)+1 44H (D) 43H (C) deleted (n): 5 (d)+1 (d)+1 49H (I) 48H (H)
(d)+2 46H (F) 45H (E) (d)+2 (d)+2 4BH (K) 4AH (J)
(d)+3 48H (H) 47H (G) (d)+3 48H (H) (d)+3 00H 4CH (L)
(d)+4 4AH (J) 49H (I) (d)+4 4AH (J) 49H (I) (d)+4 0000H
(d)+5 4CH (L) 4BH (K) (d)+5 4CH (L) 4BH (K) (d)+5 0000H
(d)+6 0000H (d)+6 0000H (d)+6 0000H
(d)+7 31H (1) 30H (0) (d)+7 31H (1) 30H (0) (d)+7 31H (1) 30H (0)
(d)+8 33H (3) 32H (2) (d)+8 33H (3) 32H (2) (d)+8 33H (3) 32H (2)
(d)+9 35H (5) 34H (4) Deletion start (d)+9 35H (5) 34H (4) (d)+9 35H (5) 34H (4)
position (s):
3rd character
The character string data of (d)+7
(s) 3 and later does not change.
• When the number of characters after deletion, (d), is even, a NULL code (00H) is stored in the device after the last device
storing the character string.
• When the number of characters after deletion, (d), is odd, a NULL code (00H) is stored in the last device (upper 8 bits) of
the character string.
• The character string after the deleted character string is shifted by (n) characters, a NULL code (00H) is stored in vacant
devices.
Operation error
Error code Description
(SD0/SD8067)
2820H No NULL code (00H) exists in the corresponding device range of the device specified by (d) and later.
3405H The character string specified by (d) has more than 16383 characters.
(s) is not within the range (1≤(s)≤16383)
The value specified by (s) exceeds the number of characters of the character string (d).
The value specified by (n) exceeds the number of characters from (s) to the last of the character string (d).
8 APPLICATION INSTRUCTION
460 8.6 Character String Operation Instruction
8.7 Real Number Instruction
Comparing single-precision real numbers
ORE
(s1) (s2)
FBD/LD
s2 s2 s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Comparison data or the head device number where the 0, 2-126<|(s1)|<2128 Single-precision real number ANYREAL_32
comparison data is stored
(s2) Comparison data or the head device number where the 0, 2-126<|(s2)|<2128 Single-precision real number ANYREAL_32
comparison data is stored
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 461
Processing details
• These instructions perform a comparison operation between the single-precision real number in the device specified by
(s1) and the single-precision real number in the device specified by (s2). (Devices are used as a normally open contact.)
• The following table lists the comparison operation results of each instruction.
Instruction symbol Condition Result Instruction symbol Condition Result
E= (s1)=(s2) Conductive state E= (s1)(s2) Non-conductive state
E<> (s1)(s2) E<> (s1)=(s2)
E> (s1)>(s2) E> (s1)<(s2)
E<= (s1)<(s2) E<= (s1)>(s2)
E< (s1)<(s2) E< (s1)>(s2)
E>= (s1)>(s2) E>= (s1)<(s2)
• When an input value is set from the engineering tool, a rounding error may occur.
Operation error
There is no operation error.
When the E= instruction is used, note that values in the devices may not be equal.
X0
EMOV E1.23 D0
E* D0 E4.56 D2
E/ D2 E4.56 D2
M0
E= D0 D2
(1)
8 APPLICATION INSTRUCTION
462 8.7 Real Number Instruction
Single-precision real number comparison
DECMP(P)
These instructions compare two data values (single-precision real number), and output the result (larger, same or smaller) to
three consecutive bit devices.
Ladder diagram Structured text
ENO:=DECMP(EN,s1,s2,d);
ENO:=DECMPP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Comparison data or the number of the device where the 0, 2-126≤|(s1)|<2128 Single-precision real number ANYREAL_32
comparison data is stored
(s2) Comparison data or the number of the device where the 0, 2-126≤|(s2)|<2128 Single-precision real number ANYREAL_32
comparison data is stored 8
(d) Start bit device number to which comparison result is output Bit ANYBIT_ARRAY
(Three devices are occupied). (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions compare the comparison value (s1) with the comparison source (s2) as floating point data, and one of
the bits among (d), (d)+1, and (d)+2 turns on according to the result (smaller, same or larger).
X0
DECMP (s1) (s2) (d)
(d)
Turns on in the case of [(s1)+1, (s1)] > [(s2)+1, (s2)]
(d+1)
Turns on in the case of [(s1)+1, (s1)] = [(s2)+1, (s2)]
(d+2)
Turns on in the case of [(s1)+1, (s1)] < [(s2)+1, (s2)]
(1)
(1): Even if the command input X0 turns off before the DECMP instruction is fully executed, (d) to (d)+2 hold the status.
• When the constant (K or H) is specified the device specified by (s1) and (s2), these instructions convert the binary value
into single-precision real number automatically.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 463
Precautions
• Three devices ((d), (d)+1, and (d)+2) specified by (d) are occupied. Note that these devices are not used for any other
purpose.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
8 APPLICATION INSTRUCTION
464 8.7 Real Number Instruction
Single-precision real number data band comparison
DEZCP(P)
These instructions compare the comparison range of two points, upper and lower, with the binary floating point, and output the
result to three consecutive bit devices in accordance with the larger, smaller, and band.
Ladder diagram Structured text
ENO:=DEZCP (EN, s1, s2, s3, d);
ENO:=DEZCPP(EN, s1, s2, s3, d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Comparison data or the number of the device where the 0, 2-126≤|(s1)|<2128 Single-precision real number ANYREAL_32
comparison data is stored
(s2) Comparison data or the number of the device where the 0, 2-126≤|(s2)|<2128 Single-precision real number ANYREAL_32
8
comparison data is stored
(s3) Comparison data or the number of the device where the 0, 2-126≤|(s3)|<2128 Single-precision real number ANYREAL_32
comparison data is stored
(d) Start bit device number to which comparison result is output Bit ANYBIT_ARRAY
(Three devices are occupied). (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 465
Processing details
• These instructions compare the comparison values (s1) and (s2) with the comparison source (s3) as floating point data,
and one of the bits among (d), (d)+1, and (d)+2 turns on according to the result (smaller, within the range or larger).
X0
DEZCP (s1) (s2) (s3) (d)
(d)
Turns on in the case of [(s1)+1, (s1)] > [(s3)+1, (s3)]
(d+1)
Turns on in the case of [(s1)+1, (s1)] ≤ [(s3)+1, (s3)] ≤ [(s2)+1, (s2)]
(d+2)
Turns on in the case of [(s3)+1, (s3)] > [(s2)+1, (s2)]
(1)
(1): Even if the command input X0 turns off before the DECMP instruction is fully executed, (d) to (d)+2 hold the status.
• When the constant (K or H) is specified the device specified by (s1), (s2) and (s3), these instructions convert the binary
value into single-precision real number automatically.
Precautions
• Three devices ((d), (d)+1, and (d)+2) specified by (d) are occupied. Note that these devices are not used for any other
purpose.
• The size relationship of the comparison data should be [(s1)+1, (s1)] ≤ [(s2)+1, (s2)]. If the relationship is [(s1)+1, (s1)] >
[(s2)+1, (s2)], the value of [(s2)+1, (s2)] is regarded as the same as that of [(s1)+1, (s1)], and is compared.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
8 APPLICATION INSTRUCTION
466 8.7 Real Number Instruction
Adding single-precision real numbers
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Addend data or the head device number where the data that 0, 2-126≤|(s)|<2128 Single-precision real number ANYREAL_32
is added to another is stored
(d) Head device number where the data to which another is Single-precision real number ANYREAL_32
added is stored
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ 8
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions add the single-precision real number in the device specified by (s) to the single-precision real number in
the device specified by (d), and store the result in the device specified by (d).
(d)+1 (d) (s)+1 (s) (d)+1 (d)
+
• Values in the devices specified (stored) by (s) and (d) should be 0 or 2-126≤ |specified value (stored value)| <2128.
• When an input value is set from the engineering tool, a rounding error may occur.
• The table below shows the related devices.
Device Name Description
Condition Operation
128
SM700 Carry The absolute value of the operation result ≥ 2 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 467
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|Specified device value|<2128
8 APPLICATION INSTRUCTION
468 8.7 Real Number Instruction
E+(P) [For 3 operands]
These instructions add the single-precision real number in the device specified by (s2) to the single-precision real number in
the device specified by (s1), and store the result in the device specified by (d).
Ladder diagram Structured text
ENO:=EPLUS(EN, s1, s2, d);
ENO:=EPLUSP(EN, s1, s2, d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
-126 128
(s1) Augend data or the head device number where the data to 0, 2 ≤|(s1)|<2 Single-precision real number ANYREAL_32
which another is added is stored
(s2) Addend data or the head device number where the data that 0, 2-126≤|(s2)|<2128 Single-precision real number ANYREAL_32
is added to another is stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions add the single-precision real number in the device specified by (s2) to the single-precision real number
in the device specified by (s1), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
+
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 469
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|specified device value|<2128
8 APPLICATION INSTRUCTION
470 8.7 Real Number Instruction
Subtracting single-precision real numbers
(s) (d)
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Subtrahend data or the head device number where the data 0, 2-126≤|(s)|<2128 Single-precision real number ANYREAL_32
to be subtracted from another is stored
(d) Head device number where the data from which another is Single-precision real number ANYREAL_32
to be subtracted is stored
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ 8
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions subtract the single-precision real number in the device specified by (s) from the single-precision real
number in the device specified by (d), and store the result in the device specified by (d).
(d)+1 (d) (s)+1 (s) (d)+1 (d)
-
• Values in the devices specified (stored) by (s) and (d) should be 0 or 2-126≤ |specified value (stored value)| <2128.
• When an input value is set from the engineering tool, a rounding error may be occur.
• The table below shows the related devices.
Device Name Description
Condition Operation
128
SM700 Carry The absolute value of the operation result ≥ 2 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 471
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|specified device value|<2128
8 APPLICATION INSTRUCTION
472 8.7 Real Number Instruction
E-(P) [For 3 operands]
These instructions subtract the single-precision real number in the device specified by (s2) from the single-precision real
number in the device specified by (s1), and store the result in the device specified by (d).
Ladder diagram Structured text
ENO:=EMINUS(EN, s1, s2, d);
ENO:=EMINUSP(EN, s1, s2, d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
-126 128
(s1) Minuend data or head device number where the data from 0, 2 ≤|(s1)|<2 Single-precision real number ANYREAL_32
which another is to be subtracted is stored
(s2) Subtrahend data or head device number where the data to 0, 2-126≤|(s2)|<2128 Single-precision real number ANYREAL_32
be subtracted from another is stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions subtract the single-precision real number in the device specified by (s2) from the single-precision real
number in the device specified by (s1), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
-
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 473
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|specified device value|<2128
8 APPLICATION INSTRUCTION
474 8.7 Real Number Instruction
Adding single-precision real numbers
DEADD(P)
These instructions add the single-precision real number in the device specified by (s2) to the single-precision real number in
the device specified by (s1), and store the result in the device specified by (d).
Ladder diagram Structured text
ENO:=DEADD(EN,s1,s2,d);
ENO:=DEADDP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Augend data or head device number where the data to 0, 2-126≤|(s1)|≤2128 Single-precision real number ANYREAL_32
which another is added is stored
0, 2-126≤|(s2)|≤2128
(s2) Addend data or head device number where the data that is
added to another is stored
Single-precision real number ANYREAL_32
8
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions add the single-precision real number in the device specified by (s2) to the single-precision real number
in the device specified by (s1), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
+
• When the constant (K or H) is specified in (s1) and (s2), these instructions convert values into single-precision real number
automatically.
(s1)+1 (s1) (d)+1 (d)
+ [ K2346 ]
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 475
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Precautions
The same device number can be specified for (s1), (s2), and (d). In this case, note that the addition result changes in every
operation cycle when the continuous operation type instruction (DEADD) is used.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
8 APPLICATION INSTRUCTION
476 8.7 Real Number Instruction
Subtracting single-precision real numbers
DESUB(P)
These instructions subtract the single-precision real number in the device specified by (s2) from the single-precision real
number in the device specified by (s1), and store the result in the device specified by (d).
Ladder diagram Structured text
ENO:=DSUB(EN,s1,s2,d);
ENO:=DSUBP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Minuend data or head device number where the data from 0, 2-126≤|(s1)|≤2128 Single-precision real number ANYREAL_32
which another is subtracted is stored
0, 2-126≤|(s2)|≤2128
(s2) Minuend data or head device number where the data that is
subtracted another is stored
Single-precision real number ANYREAL_32
8
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions subtract the single-precision real number in the device specified by (s2) from the single-precision real
number in the device specified by (s1), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
-
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 477
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Precautions
The same device number can be specified for (s1), (s2), and (d). In this case, note that the subtraction result changes in every
operation cycle when the continuous operation type instruction (DESUB) is used.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
8 APPLICATION INSTRUCTION
478 8.7 Real Number Instruction
Multiplying single-precision real numbers
E*(P)
These instructions multiply the single-precision real number in the device specified by (s2) to the single-precision real number
in the device specified by (s1), and store the result in the device specified by (d).
Ladder diagram Structured text*1
ENO:=EMULTI(EN,s1,s2,d);
ENO:=EMULTIP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Multiplicand data or head device number where the data to
be multiplied by another is stored
0, 2 -126
≤|(s1)|<2128
Single-precision real number ANYREAL_32
8
(s2) Multiplier data or head device number where the data by 0, 2-126≤|(s2)|<2128 Single-precision real number ANYREAL_32
which another is to be multiplied is stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions multiply the single-precision real number in the device specified by (s2) to the single-precision real
number in the device specified by (s1), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 479
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|specified device value|<2128
8 APPLICATION INSTRUCTION
480 8.7 Real Number Instruction
Dividing single-precision real numbers
E/(P)
These instructions divide the single-precision real number in the device specified by (s1) by the single-precision real number
in the device specified by (s2), and store the result in the device specified by (d).
Ladder diagram Structured text*1
ENO:=EDIVISION(EN,s1,s2,d);
ENO:=EDIVISIONP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Dividend data or head device number where the data which
is divided by another is stored.
0, 2 -126
≤|(s1)|<2128
Single-precision real number ANYREAL_32
8
(s2) Divisor data or head device number where the data that 0, 2-126≤|(s2)|<2128 Single-precision real number ANYREAL_32
divides another is stored.
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions divide the single-precision real number in the device specified by (s1) by the single-precision real
number in the device specified by (s2), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 481
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3400H The divisor is 0.
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|specified device value|<2128
8 APPLICATION INSTRUCTION
482 8.7 Real Number Instruction
Multiplying single-precision real numbers
DEMUL(P)
These instructions multiply the single-precision real number in the device specified by (s2) to the single-precision real number
in the device specified by (s1), and store the result in the device specified by (d).
Ladder diagram Structured text
ENO:=DEMUL(EN,s1,s2,d);
ENO:=DEMULP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Multiplicand data or head device number where the data to 0, 2-126≤|(s1)|≤2128 Single-precision real number ANYREAL_32
be multiplied by another is stored
0, 2-126≤|(s2)|≤2128
(s2) Multiplier data or head device number where the data by
which another is to be multiplied is stored
Single-precision real number ANYREAL_32
8
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions multiply the single-precision real number in the device specified by (s2) to the single-precision real
number in the device specified by (s1), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 483
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|specified device value|<2128
8 APPLICATION INSTRUCTION
484 8.7 Real Number Instruction
Dividing single-precision real numbers
DEDIV(P)
These instructions divide the single-precision real number in the device specified by (s1) by the single-precision real number
in the device specified by (s2), and store the result in the device specified by (d).
Ladder diagram Structured text
ENO:=DEDIV(EN,s1,s2,d);
ENO:=DEDIVP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Dividend data or head device number where the data which Single-precision real number ANYREAL_32
is divided by another is stored.
(s2) Divisor data or head device number where the data that
divides another is stored.
Single-precision real number ANYREAL_32
8
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions divide the single-precision real number in the device specified by (s1) by the single-precision real
number in the device specified by (s2), and store the result in the device specified by (d).
(s1)+1 (s1) (s2)+1 (s2) (d)+1 (d)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 485
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3400H The divisor is 0.
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
The value stored in specified device is outside the following range
0, 2-126≤|specified device value|<2128
8 APPLICATION INSTRUCTION
486 8.7 Real Number Instruction
Converting 16-bit signed binary data to single-precision real
number
INT2FLT(P)
These instructions convert the 16-bit signed binary data in the device specified by (s) to single-precision real number, and
store the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=INT2FLT(EN,s,d);
ENO:=INT2FLTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -32768 to +32767 16-bit signed binary ANY16_S
(d) Data after conversion Single-precision real number ANYREAL_32 8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit signed binary data in the device specified by (s) to single-precision real number, and
store the converted data in the device specified by (d).
SM402
MOVP K-1234 D0
(s) b15 b0 (d) b31 b16 b15 b0
M0 (s) (d)
D0 FB2EH D101, D100 C49AH 4000H
INT2FLT D0 D100
(-1234) (-1234.0)
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 487
Converting 16-bit unsigned binary data to single-precision real
number
UINT2FLT(P)
These instructions convert the 16-bit unsigned binary data in the device specified by (s) to single-precision real number, and
store the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UINT2FLT(EN,s,d);
ENO:=UINT2FLTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 65535 16-bit unsigned binary ANY32_U
(d) Data after conversion Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 16-bit unsigned binary data in the device specified by (s) to single-precision real number,
and store the converted data in the device specified by (d).
SM402
MOVP K1234 D0
(s) b15 b0 (d) b31 b16 b15 b0
M0 (s) (d)
D0 04D2H D101, D100 449AH 4000H
UINT2FLT D0 D100
(1234) (1234.0)
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
488 8.7 Real Number Instruction
Converting 32-bit signed binary data to single-precision real
number
DINT2FLT(P)
These instructions convert the 32-bit signed binary data in the device specified by (s) to single-precision real number, and
store the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=DINT2FLT(EN,s,d);
ENO:=DINT2FLTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion -2147483648 to +2147483647 32-bit signed binary ANY32_S
(d) Data after conversion Single-precision real number ANYREAL_32 8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit signed binary data in the device specified by (s) to single-precision real number, and
store the converted data in the device specified by (d).
SM402
DMOVP K-123456 D0
(s) (d)
b31 b16 b15 b0 b31 b16 b15 b0
M0 (s) (d)
D1, D0 FFFEH 1DC0H D101, D100 C7F1H 2000H
DINT2FLT D0 D100
(-123456) (-123456.0)
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 489
Converting 32-bit unsigned binary data to single-precision real
number
UDINT2FLT(P)
These instructions convert the 32-bit unsigned binary data in the device specified by (s) to single-precision real number, and
store the converted data in the device specified by (d).
Ladder diagram Structured text*1
ENO:=UDINT2FLT(EN,s,d);
ENO:=UDINT2FLTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data before conversion 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) Data after conversion Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the 32-bit unsigned binary data in the device specified by (s) to single-precision real number,
and store the converted data in the device specified by (d).
SM402
DMOVP K123456 D0
(s) (d)
b31 b16 b15 b0 b31 b16 b15 b0
M0 (s) (d)
D1, D0 0001H E240H D101, D100 47F1H 2000H
UDINT2FLT D0 D100
(123456) (123456.0)
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
490 8.7 Real Number Instruction
Converting character string to single-precision real number
EVAL(P)/DEVAL(P)
These instructions convert the character strings in the device areas specified by (s) and later to single-precision real number,
and store the converted data in the device specified by (d).
The EVAL(P) instructions can also be used as DEVAL(P).
Ladder diagram Structured text
ENO:=EVAL(EN,s,d);
ENO:=EVALP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Character string data to be converted to single-precision Character string ANYSTRING_SINGLE
real number or head device number where the character
string data is stored
(d) Head device number storing converted single-precision real Single-precision real number ANYREAL_32
8
number
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d)
Processing details
• These instructions convert the character strings in the device areas specified by (s) and later to single-precision real
number, and store the converted data in the device specified by (d).
• A specified character string may be in the decimal point format or exponent format. A character string in either format can
be converted into single-precision real number.
b15 b8 b7 b0
(s) ASCII code for 1st character ASCII code for sign
(s)+1 ASCII code for 3rd character ASCII code for 2nd character (d)+1 (d)
(s)+2 ASCII code for 5th character ASCII code for 4th character
(s)+3 ASCII code for 7th character ASCII code for 6th character
(s)+4 00H
(2)
(1)
(1): Indicates the end of the character string.
(2): Single-precision real number
• A character string can consist of up to 24 characters. 20H (space) and 30H (0) in a character string are counted as one
character each.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 491
■Decimal point format
• When the character string specified by (s) is decimal point format, the operation is executed as follows.
b15 b8 b7 b0
(s) 31H (1) 2DH (-)
(s)+1 30H (0) 2EH (.) (d)+1 (d)
(s)+2 38H (8) 37H (7) -1.078 12
(s)+3 32H (2) 31H (1)
(s)+4 (1)
00H
- 1 . 0 7 8 1 2
• With regard to character string, six digits excluding the sign, decimal point and exponent part are valid, and the 7th and later
digits are discarded during conversion.
b15 b8 b7 b0
(s) 20H (SP) 2DH (-)
(s)+1 31H (1) 20H (SP)
(d)+1 (d)
(s)+2 33H (3) 2EH (.)
- 1 . 3 0 156
(s)+3 31H (1) 30H (0)
(s)+4 36H (6) 35H (5) (2)
(s)+5 31H (1) 38H (8)
(s)+6 00H 32H (2)
- 1 . 3 0 1 5 6 8 1 2
(1)
(1): These values are discarded.
(2): Single-precision real number
• When 2BH (+) is specified as the sign in the floating point format or when the sign is omitted, a character string is converted
into a positive value. It is handled as negative value during conversion when the sign is set to 2DH (-).
• When 20H (space) or 30H (0) exists between numbers except the first 0 in a character string specified by (s), 20H or 30H is
ignored during conversion.
b15 b8 b7 b0
(s) 20H (SP) 2DH (-)
(s)+1 31H (1) 30H (0) (d)+1 (d)
(s)+2 32H (2) 2EH (.) - 1 . 2 31
(s)+3 31H (1) 33H (3)
(s)+4 (2)
00H
- 0 1 . 2 3 1
(1)
(1): Ignored
(2): Single-precision real number
■Exponent format
• When the character string specified by (s) is in exponent format, the operation is executed as follows.
b15 b8 b7 b0
(s) 20H (SP) 2DH (-)
(s)+1 2EH (.) 31H (1)
(d)+1 (d)
(s)+2 32H (2) 33H (3)
-1.320 1E+10
(s)+3 31H (1) 30H (0)
(s)+4 2BH (+) 45H (E) (1)
(s)+5 30H (0) 31H (1)
(s)+6 00H
- 1 . 3 2 0 1 E + 1 0
(1): Single-precision real number
8 APPLICATION INSTRUCTION
492 8.7 Real Number Instruction
• With regard to character string, six digits excluding the sign, decimal point and exponent part are valid, and the 7th and later
digits are discarded during conversion.
b15 b8 b7 b0
(s) 20H (SP) 2DH (-)
(s)+1 2EH (.) 31H (1)
(d)+1 (d)
(s)+2 35H (5) 33H (3)
-1.350 34E-2
(s)+3 33H (3) 30H (0)
(s)+4 31H (1) 34H (4) (2)
(s)+5 45H (E) 32H (2)
(s)+6 30H (0) 2DH (-)
(s)+7 00H 32H (2)
- 1 . 3 5 0 3 4 1 2 E - 0 2
(1)
(1): These values are discarded.
(2): Single-precision real number
• String data in the exponent format is handled as positive value during conversion when the sign of the exponent part is set
to 2BH (+) or when the sign is omitted. When 2DH (-) is specified as the sign, a character string is converted into a negative
value.
• When 20H (space) or 30H (0) exists between numbers except the first 0 in a character string specified by (s), 20H or 30H is
ignored during conversion.
• When 30H (0) exists between a number and "E" in a character string in the exponent format, 30H is ignored during
conversion.
b15 b8 b7 b0
(s) 20H (SP) 2DH (-)
(s)+1
(s)+2
2EH (.) 31H (1)
(d)+1 (d) 8
34H (4) 30H (0)
- 1 . 0 4 5 3 E+3
(s)+3 33H (3) 35H (5)
(s)+4 2BH (+) 45H (E) (2)
(s)+5 33H (3) 30H (0)
(s)+6 00H
- 1 . 0 4 5 3 E + 0 3
(1)
(1): Ignored
(2): Single-precision real number
Operation error
Error code Description
(SD0/SD8067)
2820H 00H does not exist in the corresponding device range starting from (s)
3401H Characters other than 30 (0) to 39 (9) exist in a character string specified by (s)
2EH (.) exists in two or more positions in a character string specified by (s)
Any character other than 45H (E), 2BH (+), or 2DH (-) exists in the exponent part specified by (s), or two or more exponent parts exist
3405H The number of characters after (s) is 0 or more than 24
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 493
Converting binary floating point to decimal floating point
DEBCD(P)
These instructions convert the binary floating point specified by (s) to decimal floating point, and store the converted data in
the device specified by (d).
Ladder diagram Structured text
ENO:=DEBCD(EN,s,d);
ENO:=DEBCDP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number storing binary floating point data Single-precision real number ANYREAL_32
(d) Device number storing converted decimal floating point Real number ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the binary floating point specified by (s) to decimal floating point, and store the converted data in
the device specified by (d).
(d)+1 (d)
(d) 10
(d)+1
8 APPLICATION INSTRUCTION
494 8.7 Real Number Instruction
Precautions
In floating point operations, all data is handled in binary floating point. Because binary floating point is difficult to understand
(requiring a dedicated monitoring method), it is converted into scientific notation (decimal floating point) so that monitoring can
be easily executed by peripheral equipment.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 495
Converting decimal floating point to binary floating point
DEBIN(P)
These instructions convert the decimal floating point specified by (s) to the binary floating point, and store the converted data
in the device specified by (d).
Ladder diagram Structured text
ENO:=DEBIN(EN,s,d);
ENO:=DEBINP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number storing decimal floating-point data Real number ANY32
(d) Device number storing converted binary floating-point data Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the decimal floating point specified by (s) to the binary floating point, and store the converted
data in the device specified by (d).
(s)+1 (s)
(s) 10
(s)+1
8 APPLICATION INSTRUCTION
496 8.7 Real Number Instruction
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 497
Inverting the sign of single-precision real number
ENEG(P)/DENEG(P)
These instructions invert the sign of the single-precision real number specified by (d), and store the data of the device
specified by (d).
The ENEG(P) instructions can also be used as DENEG(P).
Ladder diagram Structured text
ENO:=ENEG(EN,d);
ENO:=ENEGP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number storing single-precision real number Single-precision real number ANYREAL_32
whose sign is to be inverted
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions invert the sign of the single-precision real number specified by (d), and store the data in the device
specified by (d).
(d)+1 (d) (d)+1 (d)
1.2345 -1.2345
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
498 8.7 Real Number Instruction
Transferring single-precision real number data
EMOV(P)/DEMOV(P)
These instructions transfer the single-precision real number data stored in the device specified by (s) to the device specified
by (d).
The EMOV(P) instructions can also be used as DEMOV(P).
Ladder diagram Structured text
ENO:=EMOV(EN,s,d);
ENO:=EMOVP(EN,s,d)
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data to be transferred or head device number where the 0, 2-126<|(s)|<2128 Single-precision real number ANYREAL_32
data to be transferred is stored
(d)
EN
Device number storing the data in transfer destination
Execution condition
Single-precision real number
Bit
ANYREAL_32
BOOL
8
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions transfer the single-precision real number data stored in the device specified by (s) to the device
specified by (d).
(s)+1 (s) (d)+1 (d)
4.23542 4.23542
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 499
Calculating the sine of single-precision real number
SIN(P)/DSIN(P)
These instructions calculate the sine of the angle specified by (s), and store the operation result in the device specified by (d).
The SIN(P) instructions can also be used as DSIN(P).
Ladder diagram Structured text*1
ENO:=SINP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The SIN instruction is not supported by the ST language and the FBD/LD language. Use SIN of the standard function.
Page 965 SIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Angle data or head device number where the angle data is Single-precision real number ANYREAL_32
stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions calculate the sine of the angle specified by (s), and store the operation result in the device specified by
(d).
(s)+1 (s) (d)+1 (d)
SIN ( )
8 APPLICATION INSTRUCTION
500 8.7 Real Number Instruction
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
For the angle↔radian conversion, refer to the DRAD(P) and DDEG(P) instructions.
(Page 512 Converting single-precision real number angle to radian, Page 514 Converting single-precision
real number radian to angle)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 501
Calculating the cosine of single-precision real number
COS(P)/DCOS(P)
These instructions calculate the cosine of the angle specified by (s), and store the operation result in the device specified by
(d).
The COS(P) instructions can also be used as DCOS(P).
Ladder diagram Structured text*1
ENO:=COSP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The COS instruction is not supported by the ST language and the FBD/LD language. Use COS of the standard function.
Page 966 COS(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Angle data or head device number where the angle data is Single-precision real number ANYREAL_32
stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
8 APPLICATION INSTRUCTION
502 8.7 Real Number Instruction
Processing details
• These instructions calculate the cosine of the angle specified by (s), and store the operation result in the device specified
by (d).
(s)+1 (s) (d)+1 (d)
COS ( )
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
8
For the angle↔radian conversion, refer to the DRAD(P) and DDEG(P) instructions.
(Page 512 Converting single-precision real number angle to radian, Page 514 Converting single-precision
real number radian to angle)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 503
Calculating the tangent of single-precision real number
TAN(P)/DTAN(P)
These instructions calculate the tangent of the angle specified by (s), and store the operation result in the device specified by
(d).
The TAN(P) instructions can also be used as DTAN(P).
Ladder diagram Structured text*1
ENO:=TANP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The TAN instruction is not supported by the ST language and the FBD/LD language. Use TAN of the standard function.
Page 967 TAN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Angle data or head device number where the angle data is Single-precision real number ANYREAL_32
stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
8 APPLICATION INSTRUCTION
504 8.7 Real Number Instruction
Processing details
• These instructions calculate the tangent of the angle specified by (s), and store the operation result in the device specified
by (d).
(s)+1 (s) (d)+1 (d)
TAN ( )
Precautions
When the angle specified by (s) is π/2 radian or (3/2)π radian, no error occurs because an operation error occurs in a radian
value.
Operation error 8
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
For the angle↔radian conversion, refer to the DRAD(P) and DDEG(P) instructions.
(Page 512 Converting single-precision real number angle to radian, Page 514 Converting single-precision
real number radian to angle)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 505
Calculating the arc sine of single-precision real number
ASIN(P)/DASIN(P)
These instructions calculate the angle from the sine of the angle specified by (s), and store the operation result in the word
device specified by (d).
The ASIN(P) instructions can also be used as DASIN(P).
Ladder diagram Structured text*1
ENO:=ASINP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The ASIN instruction is not supported by the ST language and the FBD/LD language. Use ASIN of the standard function.
Page 968 ASIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) A sine value used in SIN-1
(arc sine) operation or head -1.0 to +1.0 Single-precision real number ANYREAL_32
device number storing the sine value
(d) Head device number for storing the operation result -π/2 to +π/2 Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
8 APPLICATION INSTRUCTION
506 8.7 Real Number Instruction
Processing details
• These instructions calculate the angle from the sine of the angle specified by (s), and store the operation result in the
device specified by (d).
(s)+1 (s) (d)+1 (d)
SIN-1 ( )
• The sine value specified by (s) can be set ranging from -1.0 to 1.0.
• The angle (operation result) stored in (d) is expressed in radians (from (-π/2) to (π/2)).
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞. 8
3405H A value specified in (s) is outside the range from -1.0 to 1.0.
For the radian↔angle conversion, refer to the DRAD(P) and DDEG(P) instructions.
(Page 512 Converting single-precision real number angle to radian, Page 514 Converting single-precision
real number radian to angle)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 507
Calculating the arc cosine of single-precision real number
ACOS(P)/DACOS(P)
These instructions calculate the angle from the cosine of the angle specified by (s), and store the operation result in the word
device specified by (d).
The ACOS(P) instructions can also be used as DACOS(P).
Ladder diagram Structured text*1
ENO:=ACOSP(EN,s,d)
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The ACOS instruction is not supported by the ST language and the FBD/LD language. Use ACOS of the standard function.
Page 969 ACOS(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) A cosine value used in COS-1 (arc cosine) operation or -1.0 to +1.0 Single-precision real number ANYREAL_32
head device number storing the cosine value
(d) Head device number for storing the operation result 0 to π Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
8 APPLICATION INSTRUCTION
508 8.7 Real Number Instruction
Processing details
• These instructions calculate the angle from the cosine of the angle specified by (s), and store the operation result in the
device specified by (d).
(s)+1 (s) (d)+1 (d)
COS-1 ( )
• The cosine value specified by (s) can be set ranging from -1.0 to 1.0
• The angle (operation result) stored in (d) is expressed in radians (0 to π).
• The table below shows the related devices.
Device Name Description
Condition Operation
128
SM700 Carry The absolute value of the operation result ≥ 2 The value of (d) is the maximum value (2128) of 32-bit real numbers
and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real numbers
and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real numbers
and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞. 8
3405H A value specified in (s) is outside the range from -1.0 to 1.0.
For the radian↔angle conversion, refer to the DRAD(P) and DDEG(P) instructions.
(Page 512 Converting single-precision real number angle to radian, Page 514 Converting single-precision
real number radian to angle)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 509
Calculating the arc tangent of single-precision real number
ATAN(P)/DATAN(P)
These instructions calculate the angle from the tangent of the angle specified by (s), and store the operation result in the word
device specified by (d).
The ATAN(P) instructions can also be used as DATAN(P).
Ladder diagram Structured text*1
ENO:=ATANP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The ATAN instruction is not supported by the ST language and the FBD/LD language. Use ATAN of the standard function.
Page 970 ATAN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) A tangent value used in the TAN-1(arc tangent) operation or Single-precision real number ANYREAL_32
head device number storing the tangent value
(d) Head device number for storing the operation result -π/2 to +π/2 Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
8 APPLICATION INSTRUCTION
510 8.7 Real Number Instruction
Processing details
• These instructions calculate the angle from the tangent of the angle specified by (s), and store the operation result in the
device specified by (d).
(s)+1 (s) (d)+1 (d)
TAN-1 ( )
• The angle (operation result) stored in (d) is expressed in radians (from -π/2 to π/2).
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
8
For the radian↔angle conversion, refer to the DRAD(P) and DDEG(P) instructions.
(Page 512 Converting single-precision real number angle to radian, Page 514 Converting single-precision
real number radian to angle)
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 511
Converting single-precision real number angle to radian
RAD(P)/DRAD(P)
These instructions convert a unit of angle from degrees (DEG.) specified by (s) into radians, and store the converted angle in
the device specified by (d).
The RAD(P) instructions can also be used as DRAD(P).
Ladder diagram Structured text
ENO:=RAD(EN,s,d);
ENO:=RADP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) A value in degrees to be converted into a value in radians or Single-precision real number ANYREAL_32
the start number storing the value in degrees
(d) Head device number storing a value in radians acquired by Single-precision real number ANYREAL_32
conversion
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
8 APPLICATION INSTRUCTION
512 8.7 Real Number Instruction
Processing details
• These instructions convert a unit of angle from degrees (DEG.) specified by (s) into radians, and store the converted angle
in the device specified by (d).
(s)+1 (s) (d)+1 (d)
( ) ( ) rad
Operation error
Error code Description
(SD0/SD8067) 8
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 513
Converting single-precision real number radian to angle
DEG(P)/DDEG(P)
These instructions convert a unit of angle from radians specified by (s) into degrees (DEG.), and store the converted angle in
the device specified by (d). The DEG(P) instructions can also be used as DDEG(P).
Ladder diagram Structured text
ENO:=DEG(EN,s,d);
ENO:=DEGP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) A value in radians to be converted into a value in degrees or Single-precision real number ANYREAL_32
the head device number storing a value in radians
(d) Head device number storing a value in degrees acquired by Single-precision real number ANYREAL_32
conversion
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert a unit of angle from radians specified by (s) into degrees (DEG.), and store the converted angle
in the device specified by (d).
(s)+1 (s) (d)+1 (d)
( ) rad ( )
8 APPLICATION INSTRUCTION
514 8.7 Real Number Instruction
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 515
Calculating the square root of single-precision real number
DESQR(P)/ESQRT(P)
These instructions calculate the square root of a value specified by (s), and store the operation result in the device specified
by (d). The DESQR(P) instructions can also be used as ESQRT(P).
Refer to Added and Changed Functions for details on the ESQRT(P) instruction.
Ladder diagram Structured text
ENO:=DESQR(EN,s,d);
ENO:=DESQRP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data whose square root is calculated or head device Single-precision real number ANYREAL_32
number where the data is stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions calculate the square root of a value specified by (s), and store the operation result in the device specified
by (d).
8 APPLICATION INSTRUCTION
516 8.7 Real Number Instruction
Operation error
Error code Description
(SD0/SD8067)
2822H Device that cannot be specified is specified.
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
3405H The value stored in a device specified in (s) is negative.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 517
Calculating the exponent of single-precision real number
EXP(P)/DEXP(P)
These instructions calculate the exponent of a value specified by (s), and store the operation result in the device specified by
(d).
The EXP(P) instructions can also be used as DEXP(P).
Ladder diagram Structured text*1
ENO:=EXPP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The EXP instruction is not supported by the ST language and the FBD/LD language. Use EXP of the standard function.
Page 964 EXP(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data whose exponent is calculated or head device number Single-precision real number ANYREAL_32
where the data is stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions calculate the exponent of a value specified by (s), and store the operation result in the device specified
by (d).
(s)+1 (s) (d)+1 (d)
e( )
8 APPLICATION INSTRUCTION
518 8.7 Real Number Instruction
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
• The EXP(P) instructions execute operations in natural logarithm. For obtaining a value in common
logarithm, specify a common logarithm value divided by 0.4342945 in (s).
X
10X = e 0.4342945
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 519
Calculating the natural logarithm of single-precision real number
LOG(P)/DLOGE(P)
These instructions calculate the logarithm whose base is natural logarithm e of a value specified by (s), and store the
operation result in the device specified by (d).
The LOG(P) instructions can also be used as DLOGE(P).
Ladder diagram Structured text*1
ENO:=LOGP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The LOG instruction is not supported by the ST language and the FBD/LD language. Use LOG of the standard function.
Page 962 LOG(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data whose natural logarithm is calculated or head device Single-precision real number ANYREAL_32
number where the data is stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
8 APPLICATION INSTRUCTION
520 8.7 Real Number Instruction
Processing details
• These instructions calculate the logarithm whose base is natural logarithm e of a value specified by (s), and store the
operation result in the device specified by (d).
(s)+1 (s) (d)+1 (d)
log ( )
• Only a positive value can be set in (s). (The natural logarithm operation cannot be executed for a negative value).
• The table below shows the related devices.
Device Name Description
Condition Operation
128
SM700 Carry The absolute value of the operation result ≥ 2 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
3405H The value stored in a device specified in (s) is negative. 8
The value stored in a device specified in (s) is 0.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 521
Calculating the exponentiation of single-precision real number
POW(P)
These instructions raise float (single precision) data stored in a device specified by (s1) by the single-precision real number
specified by (s2), and store the operation result in a device specified by (d).
Ladder diagram Structured text
ENO:=POW(EN,s1,s2,d);
ENO:=POWP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data to be raised, or head device number which stores such 0, 2-126≤|(s1)|<2128 Single-precision real number ANYREAL_32
data
(s2) Power data, or head device number which stores such data 0, 2-126≤|(s2)|<2128 Single-precision real number ANYREAL_32
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
8 APPLICATION INSTRUCTION
522 8.7 Real Number Instruction
Processing details
• These instructions raise float (single precision) data stored in a device specified by (s1) by the single-precision real number
specified by (s2), and store the operation result in a device specified by (d).
Power data
(s2)+1 (s2)
Data to be raised
• Values in the devices specified (stored) by (s1) and (s2) should be 0 or 2 -126≤|specified value (stored value)| <2128.
• When the operation result is -0 or underflow occurs, the operation result is regarded as 0.
• When the operation result is within the following range, the operation result is regarded as 2128, and the carry flag SM716
turns on.
2128≤ |operation result|
• When an input value is set from the engineering tool, a rounding error may be occur.
Operation error
Error code Description
(SD0/SD8067)
3402H The value specified by (s1) or (s2) is outside the following range.
8
0, 2-126≤|specified value (stored value)|<2128
The specified device value is -0, denormalized number, NaN (not a number), or ±∞.
3403H The operation result is within the following range. (An overflow has occurred.)
2128≤ |operation result|
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 523
Calculating the common logarithm of single-precision real
number
LOG10(P)/DLOG10(P)
These instructions calculate the common logarithm (the logarithm whose base is 10) of a value specified by (s), and store the
operation result in the device specified by (d).
The LOG10(P) instructions can also be used as DLOG10(P).
Ladder diagram Structured text
ENO:=LOG10(EN,s,d);
ENO:=LOG10P(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Data whose common logarithm is calculated or head device Single-precision real number ANYREAL_32
number where the data is stored
(d) Head device number for storing the operation result Single-precision real number ANYREAL_32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions calculate the common logarithm (the logarithm whose base is 10) of a value specified by (s), and store
the operation result in the device specified by (d).
• Only a positive value can be set in (s). (The common logarithm operation cannot be executed for a negative value).
• The table below shows the related devices.
Device Name Description
Condition Operation
SM700 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM700 turns on.
SM8020 Zero The operation result is true "0". The zero flag SM8020 turns on.
(The mantissa part is "0").
SM8021 Borrow The absolute value of the operation result < 2-126 The value of (d) is the minimum value (2-126) of 32-bit real
numbers and the borrow flag SM8021 turns on.
SM8022 Carry The absolute value of the operation result ≥ 2128 The value of (d) is the maximum value (2128) of 32-bit real
numbers and the carry flag SM8022 turns on.
8 APPLICATION INSTRUCTION
524 8.7 Real Number Instruction
Operation error
Error code Description
(SD0/SD8067)
3402H The specified device value is denormalized number, NaN (not a number), or ±∞.
3405H The value stored in a device specified in (s) is negative.
The value stored in a device specified in (s) is 0.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 525
Searching the maximum value of single-precision real number
EMAX(P)
These instructions search for the maximum value in the (n) point(s) of single-precision real number block data in the device
starting from the one specified by (s), and store the maximum value in the device areas specified by (d) and (d)+1.
These instructions also store the location of the first maximum value from (s) in the device specified by (d)+2 and the number
of maximum values in the device specified by (d)+3.
Ladder diagram Structured text*1
ENO:=EMAXP(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The EMAX instruction is not supported by the ST language and the FBD/LD language. Use MAX of the standard function.
Page 998 MAX(_E), MIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Search target data Single-precision real number ANYREAL_32
(d) Search result Single-precision real number ANY_REAL_32_ARRAY
(Number of elements: 4)
(n) Number of search target data points 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
526 8.7 Real Number Instruction
Processing details
• These instructions search for the maximum value in the (n) point(s) of single-precision real number block data in the device
starting from the one specified by (s), and store the maximum value in the device areas specified by (d). These instructions
also store the location of the first maximum value from (s) in the device specified by (d)+2 and the number of maximum
values in the device specified by (d)+3.
• The start of the block data in the device specified by (s) is counted as 1st point when the location is counted.
Operation error 8
Error code Description
(SD0/SD8067)
2820H The device areas specified by (s) exceed the corresponding device range.
The device areas specified by (d) exceed the corresponding device range.
3402H The block data in the device areas specified by (s) includes a value other than single-precision real number.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 527
Searching the minimum value of single-precision real number
EMIN(P)
These instructions search for the minimum value in the (n) point(s) of single-precision real number block data in the device
starting from the one specified by (s), and store the minimum value in the device areas specified by (d) and (d)+1.
These instructions also store the location of the first minimum value from (s) in the device specified by (d)+2 and the number
of minimum values in the device specified by (d)+3.
Ladder diagram Structured text*1
ENO:=EMINP(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The EMIN instruction is not supported by the ST language and the FBD/LD language. Use MIN of the standard function.
Page 998 MAX(_E), MIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Search target data Single-precision real number ANYREAL_32
(d) Search result Single-precision real number ANY_REAL_32_ARRAY
(Number of elements: 4)
(n) Number of search target data points 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
528 8.7 Real Number Instruction
Processing details
• These instructions search for the minimum value in the (n) point(s) of single-precision real number block data in the device
starting from the one specified by (s), and store the minimum value in the device areas specified by (d) and (d)+1. These
instructions also store the location of the first minimum value from (s) in the device specified by (d)+2 and the number of
minimum values in the device specified by (d)+3.
• The start of the block data in the device specified by (s) is counted as 1st point when the location is counted.
Operation error 8
Error code Description
(SD0/SD8067)
2820H The device areas specified by (s) exceed the corresponding device range.
The device areas specified by (d) exceed the corresponding device range.
3402H The block data in the device areas specified by (s) includes a value other than single-precision real number.
8 APPLICATION INSTRUCTION
8.7 Real Number Instruction 529
8.8 Random Number Instruction
Generating random number
RND(P)
These instructions generate a pseudo-random number ranging from 0 to 32767, and store it as a random number to a device
specified by (d).
Ladder diagram Structured text
ENO:=RND(EN,d);
ENO:=RNDP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number storing a random number 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions generate a pseudo-random number ranging from 0 to 32767, and store it as a random number to a
device specified by (d).
• In the pseudo-random number sequence, the source value of a random number is calculated every time, and this
instruction calculates a pseudo-random number using the source value.
Pseudo-random number calculation equation:
(SD8311, SD8310)=(SD8311, SD8310)*1×1103515245+12345
(d) ="([SD8311, SD8310]>>16)&<logical product>00007FFFh"
*1 To (SD8311, SD8310), write a non-negative value (0 to 2147483647) only once when the CPU module mode switches from STOP to
RUN. (K1 is written to (SD8311, SD8310) as the initial value when the power is restored.)
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
530 8.8 Random Number Instruction
8.9 Index Register Operation Instruction
Saving all data of the index register
ZPUSH(P)
These instructions save the contents of index registers and long index registers in the devices specified by (d) and later.
Ladder diagram Structured text
ENO:=ZPUSH(EN,d);
ENO:=ZPUSHP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number for saving the data of index registers and 16-bit signed binary ANY16
long index registers
EN Execution condition Bit BOOL 8
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions save the contents of index registers and long index registers in the devices specified by (d) and later.
• When the contents of index registers are saved, "1" is added to (d).
• These instructions save the contents of index registers and long index registers for 24 words regardless of the assignment
of the number of the registers. Thus, when the number of index registers is 0, the contents of long index registers are saved
for 12 points.
• The ZPOP(P) instructions are used to return the data. The ZPUSH(P) and ZPOP(P) instructions are used in pairs, and by
using the same device in (d) a nesting structure can be adopted. (Page 533 Returning all data of the index register)
• When a nesting structure is adopted, the areas to be used are added to (d) and later every time the ZPUSH(P) instructions
are used. Check the number of index registers and long index registers by SD300 and SD302, and secure the areas for the
number of instructions to be used in advance.
8 APPLICATION INSTRUCTION
8.9 Index Register Operation Instruction 531
• The following shows the areas of (d) and later to be used.
(d)+0 (1)
+1 Z0
+2 Z1
(2)
+24 Z23
+25 Z0
+26 Z1
(3)
Precautions
• When a nesting structure is not adopted, clear (d) before executing the ZPUSH(P) instructions.
• When a nesting structure is adopted, clear (d) before executing the first ZPUSH(P) instructions.
• When the ZPOP(P) instructions are used to return the data of index registers, use the ZPOP(P) instructions corresponding
to the ZPUSH(P) instructions that were used for saving the data.
ZPUSH(P) (One setting data) → ZPOP(P) (One setting data)
ZPUSH(P) (Two setting data) → ZPOP(P) (Two setting data)
• Secure the areas so that the save destination specified by (d) do not exceed the device range.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of points used in (d) or later exceeds the range of the target device/label area.
3405H (d) is negative.
8 APPLICATION INSTRUCTION
532 8.9 Index Register Operation Instruction
Returning all data of the index register
ZPOP(P)
These instructions read the data saved in the devices specified by (d) and later to index registers and long index registers.
Ladder diagram Structured text
ENO:=ZPOP(EN,d);
ENO:=ZPOPP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number for returning the data of index registers 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
8
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions read the data saved in the devices specified by (d) and later to index registers and long index registers.
• When the saved contents of the index registers and long index registers are read, "1" is subtracted from (d).
• The ZPUSH(P) instructions are used to temporarily save the data. The ZPUSH(P) and ZPOP(P) instructions are used in
pairs.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of points used in (d) or later exceeds the range of the target device/label area.
3405H (d) is 0 or negative.
8 APPLICATION INSTRUCTION
8.9 Index Register Operation Instruction 533
Saving the selected data of the index register and long index
register
ZPUSH(P)
These instructions save the contents of index registers and long index registers within the range specified by (s) in the devices
specified by (d) and later.
Ladder diagram Structured text
ENO:=ZPUSH_2(EN,s,d);
ENO:=ZPUSHP_2(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Type of the index register or long index register to be saved 0 to 2 16-bit unsigned binary ANY16
(d) Head device number for saving the data of index registers 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions save the contents of index registers and long index registers within the range specified by (s) in the
devices specified by (d) and later. The type of the index register or long index register saved is stored in the end of the
saved data.
• When the contents of the index registers and long index registers are saved, "1" is added to (d).
• The following shows values specified by (s) and the index register or long index register to be saved.
(s) value Z or LZ to be saved
0 Z, LZ (whole range)
1 Z (whole range)
2 LZ (whole range)
• The selected data of index register/long index register return instructions (ZPOP(P) instructions) are used to return the
data. The selected data of index register/long index register save instructions (ZPUSH(P) instructions) and the selected
data of index register/long index register return instructions (ZPOP(P) instructions) can be used in pairs and to adopt a
nesting structure. (Page 536 Returning the selected data of the index register and long index register)
• When a nesting structure is adopted, the areas to be used are added to (d) and later every time the selected data of index
register/long index register save instructions (ZPUSH(P) instructions) are executed. Check the number of index registers
and long index registers by SD300 and SD302, and secure the areas for the number of instructions to be used in advance.
8 APPLICATION INSTRUCTION
534 8.9 Index Register Operation Instruction
• The following shows the areas of (d) and later used for the instructions (when Z0 to 13 and LZ0 to 4 are used).
(d)+3 Z0
(d)+4 Z1
ZPUSH K0 D0
(Save the whole range (d)+16 Z13
of Z and LZ)
(d)+17
LZ0
(d)+18 1st nesting
(25 words for one nesting)
(d)+19
LZ1
(d)+20
(d)+25
LZ4
(d)+26
(d)+27 Z, LZ save type = 0
(d)+28
LZ0
ZPUSH K2 D0 (d)+29
(Save the whole range
2nd nesting
of LZ) (11 words for two nesting)
(d)+36
LZ4
(d)+37
(d)+38 Z, LZ save type = 2
8
3rd nesting
Precautions
• When a nesting structure is not adopted, clear (d) before executing the ZPUSH(P) instructions.
• When a nesting structure is adopted, clear (d) before executing the first ZPUSH(P) instructions.
• When the ZPOP(P) instructions are used to return the data of index registers, use the ZPOP(P) instructions corresponding
to the ZPUSH(P) instructions that were used for saving the data.
ZPUSH(P) (One setting data) → ZPOP(P) (One setting data)
ZPUSH(P) (Two setting data) → ZPOP(P) (Two setting data)
• Do not change the values of (d)+1 and (d)+2 because they are used by the system. Do not change the values of the Z and
LZ save types stored in the devices specified by (d) and later because they are used by the system.
• Secure the areas so that the save destination specified by (d) does not exceed the device range.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of points used in (d) or later exceeds the range of the target device/label area.
3405H A value other than 0 to 2 is specified in (s).
When the number of index registers is 0, "1" is specified in (s).
When the number of long index registers is 0, "2" is specified in (s).
8 APPLICATION INSTRUCTION
8.9 Index Register Operation Instruction 535
Returning the selected data of the index register and long index
register
ZPOP(P)
These instructions read the data saved in the devices specified by (d) and later to index registers and long index registers.
Ladder diagram Structured text
ENO:=ZPOP_2(EN,s,d);
ENO:=ZPOPP_2(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Dummy 16-bit unsigned binary ANY16
(d) Head device number for returning the data of index 16-bit signed binary ANY16
registers
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions read the data saved in the devices specified by (d) and later to index registers and long index registers.
• When the saved contents of the index registers and long index registers are read, "1" is subtracted from (d).
• The data specified by (s) is regarded as dummy data and ignored.
Operation error
Error code Description
(SD0/SD8067)
2820H The range of points used in (d) or later exceeds the range of the target device/label area.
3405H (d) is 0 or negative.
8 APPLICATION INSTRUCTION
536 8.9 Index Register Operation Instruction
8.10 Data Control Instruction
Upper and lower limit control of 16-bit binary data
LIMIT(P)(_U)
These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit binary
data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2).
Ladder diagram Structured text*1
ENO:=LIMITP(EN,s1,s2,s3,d); ENO:=LIMITP_U(EN,s1,s2,s3,d);
FBD/LD*1
EN ENO
s1 d
s2
s3
*1 The LIMIT and LIMIT_U instructions are not supported by the ST language and the FBD/LD language. Use LIMIT of the standard
function.
Page 1000 LIMIT(_E)
Setting data 8
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) LIMIT(P) Lower limit value (minimum output value) -32768 to 32767 16-bit signed binary ANY16_S
LIMIT(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) LIMIT(P) Upper limit value (maximum output value) -32768 to 32767 16-bit signed binary ANY16_S
LIMIT(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s3) LIMIT(P) Input value controlled by the upper and lower limit values -32768 to 32767 16-bit signed binary ANY16_S
LIMIT(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) LIMIT(P) Head device number storing the output value controlled by 16-bit signed binary ANY16_S
the upper and lower limit values
LIMIT(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 537
Processing details
• These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit
binary data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2). The output value
is controlled as follows.
Condition Output value
Lower limit value (s1) > Input value (s3) Lower limit value (s1)
Upper limit value (s2) < Input value (s3) Upper limit value (s2)
Lower limit value (s1) ≤ Input value (s3) ≤ Upper limit value (s2) Input value (s3)
(d)
(s2)
(s3)
(s1) 0
• To control the input value only with the upper limit, set the minimum value within the setting range in (s1).
• To control the input value only with the lower limit, set the maximum value within the setting range in (s2).
Operation error
Error code Description
(SD0/SD8067)
3405H The lower limit value specified by (s1) is greater than the upper limit value specified by (s2).
8 APPLICATION INSTRUCTION
538 8.10 Data Control Instruction
Upper and lower limit control of 32-bit binary data
DLIMIT(P)(_U)
These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit binary
data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2).
Ladder diagram Structured text*1
ENO:=DLIMITP(EN,s1,s2,s3,d); ENO:=DLIMITP_U(EN,s1,s2,s3,d);
FBD/LD*1
EN ENO
s1 d
s2
s3
*1 The DLIMIT and DLIMIT_U instructions are not supported by the ST language and the FBD/LD language. Use LIMIT of the standard
function.
Page 1000 LIMIT(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
8
(s1) DLIMIT(P) Lower limit value (minimum output value) -2147483648 to +2147483647 32-bit signed binary ANY32_S
DLIMIT(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DLIMIT(P) Upper limit value (maximum output value) -2147483648 to +2147483647 32-bit signed binary ANY32_S
DLIMIT(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s3) DLIMIT(P) Input value controlled by the upper and lower -2147483648 to +2147483647 32-bit signed binary ANY32_S
limit values
DLIMIT(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DLIMIT(P) Head device number storing the output value 32-bit signed binary ANY32_S
controlled by the upper and lower limit values
DLIMIT(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 539
Processing details
• These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit
binary data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2). The output value
is controlled as follows.
Condition Output value
Lower limit value ((s1), (s1)+1) > Input value ((s3), (s3)+1) Lower limit value ((s1), (s1)+1)
Upper limit value ((s2), (s2)+1) < Input value ((s3), (s3)+1) Upper limit value ((s2), (s2)+1)
Lower limit value ((s1), (s1)+1) ≤ Input value ((s3), (s3)+1) ≤ Upper limit value ((s2), (s2)+1) Input value ((s3), (s3)+1)
(d+1, d)
(s2+1, s2)
(s3+1, s3)
0
(s1+1, s1)
• To control the input value only with the upper limit, set the minimum value within the setting range in (s1).
• To control the input value only with the lower limit, set the maximum value within the setting range in (s2).
Operation error
Error code Description
(SD0/SD8067)
3405H The lower limit value specified by (s1) is greater than the upper limit value specified by (s2).
8 APPLICATION INSTRUCTION
540 8.10 Data Control Instruction
Dead band control of 16-bit binary data
BAND(P)(_U)
These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit binary
data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2).
Ladder diagram Structured text
ENO:=BAND(EN,s1,s2,s3,d); ENO:=BAND_U(EN,s1,s2,s3,d);
ENO:=BANDP(EN,s1,s2,s3,d); ENO:=BANDP_U(EN,s1,s2,s3,d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) BAND(P) Lower limit value of the dead band (no-output band) -32768 to +32767 16-bit signed binary ANY16_S
BAND(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
8
(s2) BAND(P) Upper limit value of the dead band (no-output band) -32768 to +32767 16-bit signed binary ANY16_S
BAND(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s3) BAND(P) Input value controlled by the dead band -32768 to +32767 16-bit signed binary ANY16_S
BAND(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) BAND(P) Head device number for storing the output value controlled 16-bit signed binary ANY16_S
by the dead band
BAND(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 541
Processing details
• These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit
binary data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2).
The output value is controlled as follows.
Condition Output value
Lower limit value of the dead band (s1) > Input value (s3) Input value (s3) - Lower limit value of the dead band (s1)
Upper limit value of the dead band (s2) < Input value (s3) Input value (s3) - Upper limit value of the dead band (s2)
Lower limit value of the dead band (s1) ≤ Input value (s3) ≤ Upper limit value of the dead band (s2) 0
(d)
(s1)
(s3)
0
(s2)
• When the output value to be stored in the device specified by (d) is a 16-bit signed binary value and the operation result
exceeds the range of -32768 to 32767, the output value is calculated as follows.
Ex.
When (s1) is 10 and (s3) is -32768: Output value = -32768-10 = 8000H-000AH = 7FFFH = 32758
• When the output value to be stored in the device specified by (d) is a 16-bit unsigned binary value and the operation result
exceeds the range of 0 to 65535, the output value is calculated as follows.
Ex.
When (s1) is 100 and (s3) is 50: Output value = 50-100 = 0032H-0064H = FFCEH = 65486
Operation error
Error code Description
(SD0/SD8067)
3405H The lower limit value specified by (s1) is greater than the upper limit value specified by (s2).
8 APPLICATION INSTRUCTION
542 8.10 Data Control Instruction
Dead band control of 32-bit binary data
DBAND(P)(_U)
These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit binary
data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2).
Ladder diagram Structured text
ENO:=DBAND(EN,s1,s2,s3,d); ENO:=DBAND_U(EN,s1,s2,s3,d);
ENO:=DBANDP(EN,s1,s2,s3,d); ENO:=DBANDP_U(EN,s1,s2,s3,d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DBAND(P) Lower limit value of the dead band (no-output -2147483648 to +2147483647 32-bit signed binary ANY32_S
DBAND(P)_U
band)
0 to 4294967295 32-bit unsigned binary ANY32_U
8
(s2) DBAND(P) Upper limit value of the dead band (no-output -2147483648 to +2147483647 32-bit signed binary ANY32_S
band)
DBAND(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s3) DBAND(P) Input value controlled by the dead band -2147483648 to +2147483647 32-bit signed binary ANY32_S
DBAND(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DBAND(P) Head device number for storing the output value 32-bit signed binary ANY32_S
controlled by the dead band
DBAND(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 543
Processing details
• These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit
binary data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2).
The output value is controlled as follows.
Condition Output value
Lower limit value of the dead band ((s1), (s1)+1) > Input value ((s3), (s3)+1) Input value ((s3), (s3)+1) - Lower limit value of the dead
band ((s1), (s1)+1)
Upper limit value of the dead band ((s2), (s2)+1) < Input value ((s3), (s3)+1) Input value ((s3), (s3)+1) - Upper limit value of the dead
band ((s2), (s2)+1)
Lower limit value of the dead band ((s1), (s1)+1) ≤ Input value ((s3), (s3)+1) ≤ Upper limit value of 0
the dead band ((s2), (s2)+1)
(d+1, d)
(s1+1, s1)
(s3+1, s3)
0
(s2+1, s2)
• When the output value to be stored in the device specified by (d) is a 32-bit signed binary value and the operation result
exceeds the range of -2147483648 to 2147483647, the output value is calculated as follows.
Ex.
When (s1) and (s1)+1 are 1000, and (s3) and (s3)+1 are -2147483648: Output value = -2147483648-1000 = 80000000H-
000003E8H = 7FFFFC18H = 2147482648
• When the output values to be stored in the devices specified by (d) and (d)+1 are 32-bit unsigned binary values and the
operation result exceeds the range of 0 to 4294967295, the output value is calculated as follows.
Ex.
When (s1) and (s1)+1 are 100, and (s3) and (s3)+1 are 50: Output value = 50-100 = 00000032H-00000064H = FFFFFFCEH
= 4294967246
Operation error
Error code Description
(SD0/SD8067)
3405H The lower limit value specified by (s1) is greater than the upper limit value specified by (s2).
8 APPLICATION INSTRUCTION
544 8.10 Data Control Instruction
Zone control of 16-bit binary data
ZONE(P)(_U)
These instructions add the bias value specified by (s1) or (s2) to the input value specified by (s3), and store the operation
result in the device specified by (d).
Ladder diagram Structured text
ENO:=ZONE(EN,s1,s2,s3,d); ENO:=ZONE_U(EN,s1,s2,s3,d);
ENO:=ZONEP(EN,s1,s2,s3,d); ENO:=ZONEP_U(EN,s1,s2,s3,d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) ZONE(P) Negative bias value to be added to the input value -32768 to +32767 16-bit signed binary ANY16_S
ZONE(P)_U 0 to 65535 16-bit unsigned binary ANY16_U 8
(s2) ZONE(P) Positive bias value to be added to the input value -32768 to +32767 16-bit signed binary ANY16_S
ZONE(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s3) ZONE(P) Input value for performing the zone control -32768 to +32767 16-bit signed binary ANY16_S
ZONE(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(d) ZONE(P) Head device number storing the output value controlled by 16-bit signed binary ANY16_S
the zone
ZONE(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 545
Processing details
• These instructions add the bias value specified by (s1) or (s2) to the input value (16-bit binary data) specified by (s3), and
store the operation result in the device specified by (d). The bias value is controlled as follows.
Condition Output value
Input value (s3) < 0 Input value (s3) + Negative bias value (s1)
Input value (s3) = 0 0
Input value (s3) > 0 Input value (s3) + Positive bias value (s2)
(d)
(s2)
(s3)
0
(s1)
• When the output value to be stored in the device specified by (d) is a 16-bit signed binary value and the operation result
exceeds the range of -32768 to 32767, the output value is calculated as follows.
Ex.
When (s1) is -100 and (s3) is -32768: Output value = -32768+(-100) = 8000H-FF9CH = 7F9CH = 32668
• When the output value to be stored in the device specified by (d) is a 16-bit unsigned binary value and the operation result
exceeds the range of 0 to 65535, the output value is calculated as follows.
Ex.
When (s2) is 100 and (s3) is 65535: Output value =65535+100 = FFFFH-0064H = 0063H = 99
• When the ZONE(P)_U instructions are used, (s1) is regarded as dummy data and ignored.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
546 8.10 Data Control Instruction
Zone control of 32-bit binary data
DZONE(P)(_U)
These instructions add the bias value specified by (s1) or (s2) to the input value specified by (s3), and store the operation
result in the device specified by (d).
Ladder diagram Structured text
ENO:=DZONE(EN,s1,s2,s3,d); ENO:=DZONE_U(EN,s1,s2,s3,d);
ENO:=DZONEP(EN,s1,s2,s3,d); ENO:=DZONEP_U(EN,s1,s2,s3,d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DZONE(P) Negative bias value to be added to the input -2147483648 to +2147483647 32-bit signed binary ANY32_S
value
DZONE(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
8
(s2) DZONE(P) Positive bias value to be added to the input value -2147483648 to +2147483647 32-bit signed binary ANY32_S
DZONE(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s3) DZONE(P) Input value for performing the zone control -2147483648 to +2147483647 32-bit signed binary ANY32_S
DZONE(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) DZONE(P) Head device number storing the output value 32-bit signed binary ANY32_S
controlled by the zone
DZONE(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 547
Processing details
• These instructions add the bias value specified by (s1) or (s2) to the input value (32-bit binary data) specified by (s3), and
store the operation result in the device specified by (d). The bias value is controlled as follows.
Condition Output value
Input value ((s3), (s3)+1) < 0 Input value ((s3), (s3)+1) + Negative bias value (s1), (s1)+1
Input value ((s3), (s3)+1) = 0 0
Input value ((s3), (s3)+1) > 0 Input value ((s3), (s3)+1) + Positive bias value (s2), (s2)+1
(d+1, d)
(s2+1, s2)
(s3+1, s3)
0
(s1+1, s1)
• When the output values to be stored in the devices specified by (d) and (d)+1 are 32-bit signed binary values and the
operation result exceeds the range of -2147483648 to 2147483647, the output value is calculated as follows.
Ex.
When (s1) and (s1)+1 are -1000, and (s3) and (s3)+1 are -2147483648: Output value = -2147483648+(-1000) = 80000000H-
FFFFFC18H = 7FFFFC18H = 2147482648
• When the output values to be stored in the devices specified by (d) and (d)+1 are 32-bit unsigned binary values and the
operation result exceeds the range of 0 to 4294967295, the output value is calculated as follows.
Ex.
When (s2) and (s2)+1 are 1000, and (s3) and (s3)+1 are 4294967295: Output value =4294967295+1000 = FFFFFFFFH-
00003E8H = 000003E7H = 999
• When the DZONE(P)_U instructions are used, (s1) and (s1)+1 are regarded as dummy data and ignored.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
548 8.10 Data Control Instruction
Scaling 16-bit binary data (point coordinates)
SCL(P)(_U)
These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the input
value specified by (s1), and store the operation result in the device specified by (d).
Ladder diagram Structured text
ENO:=SCL(EN,s1,s2,d); ENO:=SCL_U(EN,s1,s2,d);
ENO:=SCLP(EN,s1,s2,d); ENO:=SCLP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) SCL(P) Input value used in scaling or head device number storing -32768 to +32767 16-bit signed binary ANY16_S
the input value
SCL(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) SCL(P)
SCL(P)_U
Head device number where the scaling conversion data is
stored
16-bit signed binary*1
16-bit unsigned binary*1
ANY16_S
ANY16_U
8
(d) SCL(P) Head device number storing the output value controlled by 16-bit signed binary ANY16_S
SCL(P)_U scaling 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 549
Processing details
• These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the
input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is
performed based on the scaling conversion data stored in the device specified by (s2) and later.
Setting item ("n" indicates the number of coordinate points Device assignment
specified by (s2).)
Number of coordinate points (s2)
Point 1 X coordinate (s2)+1
Y coordinate (s2)+2
Point 2 X coordinate (s2)+3
Y coordinate (s2)+4
Point n X coordinate (s2)+2n-1
Y coordinate (s2)+2n
Point 2
Point 3
Output value (d)
Point 1
Point n
Point n-1
X
Input value (s1)
• If the operation result is not an integer, the number in the first decimal place is rounded off.
• Set the X coordinate data of the scaling conversion data in the ascending order.
• Set (s1) within the scaling conversion data range (device value of (s2)).
• If the same X coordinate is specified by multiple points, the Y coordinate value of the point whose number is the largest is
output.
• Set the number of coordinate points for the scaling conversion data within the range of 1 to 65535.
• Setting example of the conversion table for scaling
In the case of the conversion characteristics for scaling shown in the figure below, set each value as shown in the following data table.
Point 3
Point 7
(50, 100)
Point 5 (250, 90) Point 8 (350, 90)
(200, 70)
Point 2
(20, 30)
Point 9
(350, 30)
Point 1 (5, 7)
Point 4 (200, 25) Point 10 (400, 7)
8 APPLICATION INSTRUCTION
550 8.10 Data Control Instruction
Setting item Setting device and setting contents Remarks
When R0 is specified in (s2) Setting details
Point 3 X coordinate (s2)+5 R5 K50
Y coordinate (s2)+6 R6 K100
Point 4 X coordinate (s2)+7 R7 K200 When coordinates are specified using three points in this way,
the output value can be set to an intermediate value.
Y coordinate (s2)+8 R8 K25
In this example, the output value (intermediate value) is
Point 5 X coordinate (s2)+9 R9 K200 specified by the Y coordinate of the point 5.
Y coordinate (s2)+10 R10 K70 Even if the X coordinate is the same at three points or more, the
value at the second point is output.
Point 6 X coordinate (s2)+11 R11 K200
Y coordinate (s2)+12 R12 K250
Point 7 X coordinate (s2)+13 R13 K250
Y coordinate (s2)+14 R14 K90
Point 8 X coordinate (s2)+15 R15 K350 When coordinates are specified using two points in this way, the
output value is the Y coordinate at the next point.
Y coordinate (s2)+16 R16 K90
In this example, the output value is specified by the Y
Point 9 X coordinate (s2)+17 R17 K350 coordinate of the point 9.
Y coordinate (s2)+18 R18 K30
Point 10 X coordinate (s2)+19 R19 K400
Y coordinate (s2)+20 R20 K7
Operation error
Error code Description
(SD0/SD8067)
3405H The Xn data is not set in the ascending order in the data table.
However, the instructions before the occurrence of an error are executed.
The input value specified by (s1) is out of the range for the set scaling conversion data.
8
The value in the middle of operation exceeds the 32-bit data range.
In this case, verify that the distance between points is not "65535" or more.
If the distance is "65535" or more, reduce the distance between points.
The number of coordinate points from the device specified by (s2) is 0 or less.
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 551
Scaling 32-bit binary data (point coordinates)
DSCL(P)(_U)
These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the input
value specified by (s1), and store the operation result in the device specified by (d).
Ladder diagram Structured text
ENO:=DSCL(EN,s1,s2,d); ENO:=DSCL_U(EN,s1,s2,d);
ENO:=DSCLP(EN,s1,s2,d); ENO:=DSCLP_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DSCL(P) Input value used in scaling or head device -2147483648 to +2147483647 32-bit signed binary ANY32_S
number storing the input value
DSCL(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
*1
(s2) DSCL(P) Head device number where the scaling 32-bit signed binary ANY32_S
conversion data is stored
DSCL(P)_U 32-bit unsigned binary*1 ANY32_U
(d) DSCL(P) Head device number storing the output value 32-bit signed binary ANY32_S
controlled by scaling
DSCL(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 The numbers of coordinate points of (s2)+1 and (s2) are 32-bit unsigned binary data.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
8 APPLICATION INSTRUCTION
552 8.10 Data Control Instruction
Processing details
• These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the
input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is
performed based on the scaling conversion data stored in the device specified by (s2) and later.
Setting item ("n" indicates the number of coordinate points Device assignment
specified by (s2).)
Number of coordinate points (s2)+1, (s2)
Point 1 X coordinate (s2)+3, (s2)+2
Y coordinate (s2)+5, (s2)+4
Point 2 X coordinate (s2)+7, (s2)+6
Y coordinate (s2)+9, (s2)+8
Point n X coordinate (s2)+4n-1, (s2)+4n-2
Y coordinate (s2)+4n+1, (s2)+4n
Point n-1
Point 2
• If the operation result is not an integer, the number in the first decimal place is rounded off.
8
• Set the X coordinate data of the scaling conversion data in the ascending order.
• Set (s1) within the scaling conversion data range (device values of (s2) and (s2)+1).
• If the same X coordinate is specified by multiple points, the Y coordinate value of the point whose number is the largest is
output.
• Set the number of coordinate points for the scaling conversion data within the range of 1 to 4294967295.
• Setting example of the conversion table for scaling
In the case of the conversion characteristics for scaling shown in the figure below, set each value as shown in the following data table.
Point 3
Point 7
(50, 100)
Point 5 (250, 90) Point 8 (350, 90)
(200, 70)
Point 2
(20, 30)
Point 9
(350, 30)
Point 1 (5, 7)
Point 4 (200, 25) Point 10 (400, 7)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 553
Setting item Setting device and setting contents Remarks
When R0 is specified in (s2) Setting details
Point 4 X coordinate (s2)+15, (s2)+14 R15, R14 K200 When coordinates are specified using three points in this way,
the output value can be set to an intermediate value.
Y coordinate (s2)+17, (s2)+16 R17, R16 K25
In this example, the output value (intermediate value) is
Point 5 X coordinate (s2)+19, (s2)+18 R19, R18 K200 specified by the Y coordinate of the point 5.
Y coordinate (s2)+21, (s2)+20 R21, R20 K70 Even if the X coordinate is the same at three points or more, the
value at the second point is output.
Point 6 X coordinate (s2)+23, (s2)+22 R23, R22 K200
Y coordinate (s2)+25, (s2)+24 R25, R24 K250
Point 7 X coordinate (s2)+27, (s2)+26 R27, R26 K250
Y coordinate (s2)+29, (s2)+28 R29, R28 K90
Point 8 X coordinate (s2)+31, (s2)+30 R31, R30 K350 When coordinates are specified using two points in this way, the
output value is the Y coordinate at the next point.
Y coordinate (s2)+33, (s2)+32 R33, R32 K90
In this example, the output value is specified by the Y
Point 9 X coordinate (s2)+35, (s2)+34 R35, R34 K350 coordinate of the point 9.
Y coordinate (s2)+37, (s2)+36 R37, R36 K30
Point 10 X coordinate (s2)+39, (s2)+38 R39, R38 K400
Y coordinate (s2)+41, (s2)+40 R41, R40 K7
Operation error
Error code Description
(SD0/SD8067)
3405H The Xn data is not set in the ascending order in the data table.
However, the instructions before the occurrence of an error are executed.
The input value specified by (s1) is out of the range for the set scaling conversion data.
The value in the middle of operation exceeds the 32-bit data range.
In this case, verify that the distance between points is not "65535" or more.
If the distance is "65535" or more, reduce the distance between points.
The number of coordinate points from the device specified by (s2) is 0 or less.
8 APPLICATION INSTRUCTION
554 8.10 Data Control Instruction
Scaling 16-bit binary data (XY coordinates)
SCL2(P)(_U)
These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the input
value specified by (s1), and store the operation result in the device specified by (d).
Ladder diagram Structured text
ENO:=SCL2(EN,s1,s2,d); ENO:=SCL2_U(EN,s1,s2,d);
ENO:=SCL2P(EN,s1,s2,d); ENO:=SCL2P_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) SCL2(P) Input value used in scaling or head device number storing -32768 to +32767 16-bit signed binary ANY16_S
the input value
SCL2(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
(s2) SCL2(P) Head device number where the scaling conversion data is
stored
16-bit signed binary*1 ANY16_S
8
SCL2(P)_U 16-bit unsigned binary*1 ANY16_U
(d) SCL2(P) Head device number storing the output value controlled by 16-bit signed binary ANY16_S
scaling
SCL2(P)_U 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 555
Processing details
• These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the
input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is
performed based on the scaling conversion data stored in the device specified by (s2) and later.
Setting item ("n" indicates the number of coordinate points specified by (s2).) Device assignment
Number of coordinate points (s2)
X coordinate Point 1 (s2)+1
Point 2 (s2)+2
Point n (s2)+n
Y coordinate Point 1 (s2)+n+1
Point 2 (s2)+n+2
Point n (s2)+2n
Point 2
Output value (d) Point 3
Point n-1
Point 1 Point n
X
Input value (s1)
• If the operation result is not an integer, the number in the first decimal place is rounded off.
• Set the X coordinate data of the scaling conversion data in the ascending order.
• Set (s1) within the scaling conversion data range (device value of (s2)).
• If the same X coordinate is specified by multiple points, the Y coordinate value of the point whose number is the largest is
output.
• Set the number of coordinate points for the scaling conversion data within the range of 1 to 65535.
• Setting example of the conversion table for scaling
In the case of the conversion characteristics for scaling shown in the figure below, set each value as shown in the following data table.
Point 3
Point 7
(50, 100)
Point 5 (250, 90) Point 8 (350, 90)
(200, 70)
Point 2
(20, 30)
Point 9
(350, 30)
Point 1 (5, 7)
Point 4 (200, 25) Point 10 (400, 7)
8 APPLICATION INSTRUCTION
556 8.10 Data Control Instruction
Setting item Setting device and setting contents Remarks
When R0 is specified in (s2) Setting details
Number of coordinate points (s2) R0 K10
X coordinate Point 1 (s2)+1 R1 K5
Point 2 (s2)+2 R2 K20
Point 3 (s2)+3 R3 K50
Point 4 (s2)+4 R4 K200 Refer to *1.
Point 5 (s2)+5 R5 K200
Point 6 (s2)+6 R6 K200
Point 7 (s2)+7 R7 K250
Point 8 (s2)+8 R8 K350 Refer to *2.
Point 9 (s2)+9 R9 K350
Point 10 (s2)+10 R10 K400
Y coordinate Point 1 (s2)+11 R11 K7
Point 2 (s2)+12 R12 K30
Point 3 (s2)+13 R13 K100
Point 4 (s2)+14 R14 K25 Refer to *1.
Point 5 (s2)+15 R15 K70
Point 6 (s2)+16 R16 K250
Point 7 (s2)+17 R17 K90
Point 8 (s2)+18 R18 K90 Refer to *2.
Point 9 (s2)+19 R19 K30
Point 10 (s2)+20 R20 K7
*1 When coordinates are specified using three points as shown in the points 4, 5 and 6, the output value can be set to an intermediate 8
value.
In this example, the output value (intermediate value) is specified by the Y coordinate of the point 5.
Even if the X coordinate is the same at three points or more, the value at the second point is output.
*2 When coordinates are specified using two points as shown in the points 8 and 9, the output value is the Y coordinate at the next point.
In this example, the output value is specified by the Y coordinate of the point 9.
Operation error
Error code Description
(SD0/SD8067)
3405H The Xn data is not set in the ascending order in the data table.
However, the instructions before the occurrence of an error are executed.
The input value specified by (s1) is out of the range for the set scaling conversion data.
The value in the middle of operation exceeds the 32-bit data range.
In this case, verify that the distance between points is not "65535" or more.
If the distance is "65535" or more, reduce the distance between points.
The number of coordinate points from the device specified by (s2) is 0 or less.
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 557
Scaling 32-bit binary data (XY coordinates)
DSCL2(P)(_U)
These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the input
value specified by (s1), and store the operation result in the device specified by (d).
Ladder diagram Structured text
ENO:=DSCL2(EN,s1,s2,d); ENO:=DSCL2_U(EN,s1,s2,d);
ENO:=DSCL2P(EN,s1,s2,d); ENO:=DSCL2P_U(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) DSCL2(P) Input value used in scaling or head device -2147483648 to +2147483647 32-bit signed binary ANY32_S
number storing the input value
DSCL2(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
*1
(s2) DSCL2(P) Head device number where the scaling 32-bit signed binary ANY32_S
conversion data is stored
DSCL2(P)_U 32-bit unsigned binary*1 ANY32_U
(d) DSCL2(P) Head device number storing the output value 32-bit signed binary ANY32_S
controlled by scaling
DSCL2(P)_U 32-bit unsigned binary ANY32_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 The numbers of coordinate points of (s2)+1 and (s2) are 32-bit unsigned binary data.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
8 APPLICATION INSTRUCTION
558 8.10 Data Control Instruction
Processing details
• These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the
input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is
performed based on the scaling conversion data stored in the device specified by (s2) and later.
Setting item ("n" indicates the number of coordinate points specified by (s2).) Device assignment
Number of coordinate points (s2)+1, (s2)
X coordinate Point 1 (s2)+3, (s2)+2
Point 2 (s2)+5, (s2)+4
Point n (s2)+2n+1, (s2)+2n
Y coordinate Point 1 (s2)+2n+3, (s2)+2n+2
Point 2 (s2)+2n+5, (s2)+2n+4
Point n (s2)+4n+1, (s2)+4n
Point 2
• If the operation result is not an integer, the number in the first decimal place is rounded off. 8
• Set the X coordinate data of the scaling conversion data in the ascending order.
• Set (s1) within the scaling conversion data range (device values of (s2) and (s2)+1).
• If the same X coordinate is specified by multiple points, the Y coordinate value of the point whose number is the largest is
output.
• Set the number of coordinate points for the scaling conversion data within the range of 1 to 4294967295.
• Setting example of the conversion table for scaling
In the case of the conversion characteristics for scaling shown in the figure below, set each value as shown in the following data table.
Point 3
Point 7
(50, 100)
Point 5 (250, 90) Point 8 (350, 90)
(200, 70)
Point 2
(20, 30)
Point 9
(350, 30)
Point 1 (5, 7)
Point 4 (200, 25) Point 10 (400, 7)
8 APPLICATION INSTRUCTION
8.10 Data Control Instruction 559
Setting item Setting device and setting contents Remarks
When R0 is specified in (s2) Setting details
Number of coordinate points (s2)+1, (s2) R1, R0 K10
X coordinate Point 1 (s2)+3, (s2)+2 R3, R2 K5
Point 2 (s2)+5, (s2)+4 R5, R4 K20
Point 3 (s2)+7, (s2)+6 R7, R6 K50
Point 4 (s2)+9, (s2)+8 R9, R8 K200 Refer to *1.
Point 5 (s2)+11, (s2)+10 R11, R10 K200
Point 6 (s2)+13, (s2)+12 R13, R12 K200
Point 7 (s2)+15, (s2)+14 R15, R14 K250
Point 8 (s2)+17, (s2)+16 R17, R16 K350 Refer to *2.
Point 9 (s2)+19, (s2)+18 R19, R18 K350
Point 10 (s2)+21, (s2)+20 R21, R20 K400
Y coordinate Point 1 (s2)+23, (s2)+22 R23, R22 K7
Point 2 (s2)+25, (s2)+24 R25, R24 K30
Point 3 (s2)+27, (s2)+26 R27, R26 K100
Point 4 (s2)+29, (s2)+28 R29, R28 K25 Refer to *1.
Point 5 (s2)+31, (s2)+30 R31, R30 K70
Point 6 (s2)+33, (s2)+32 R33, R32 K250
Point 7 (s2)+35, (s2)+34 R35, R34 K90
Point 8 (s2)+37, (s2)+36 R37, R36 K90 Refer to *2.
Point 9 (s2)+39, (s2)+38 R39, R38 K30
Point 10 (s2)+41, (s2)+40 R41, R40 K7
*1 When coordinates are specified using three points as shown in the points 4, 5 and 6, the output value can be set to an intermediate
value.
In this example, the output value (intermediate value) is specified by the Y coordinate of the point 5.
Even if the X coordinate is the same at three points or more, the value at the second point is output.
*2 When coordinates are specified using two points as shown in the points 8 and 9, the output value is the Y coordinate at the next point.
In this example, the output value is specified by the Y coordinate of the point 9.
Operation error
Error code Description
(SD0/SD8067)
3405H The Xn data is not set in the ascending order in the data table.
However, the instructions before the occurrence of an error are executed.
The input value specified by (s1) is out of the range for the set scaling conversion data.
The value in the middle of operation exceeds the 32-bit data range.
In this case, verify that the distance between points is not "65535" or more.
If the distance is "65535" or more, reduce the distance between points.
The number of coordinate points from the device specified by (s2) is 0 or less.
8 APPLICATION INSTRUCTION
560 8.10 Data Control Instruction
8.11 Special Timer Instruction
Teaching timer
TTMR
This instruction measures the period of time in which TTMR instruction is ON.
Use this instruction to adjust the set value of a timer by a pushbutton switch.
Ladder diagram Structured text
ENO:=TTMR(EN,s,d);
(d) (s)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Device storing the teaching data 16-bit signed binary ANY16_ARRAY
(Number of elements: 2) 8
(s) Magnification applied to the teaching data 0 to 2 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(s)
■Control data
Operand: (d)
Device Description Setting range Set by
+0 Teaching time System
+1 Current value of the pressing and holding time System
8 APPLICATION INSTRUCTION
8.11 Special Timer Instruction 561
Processing details
• This instruction measures the period of time to press and hold the command input (pushbutton switch) in 1-second units,
multiplies the measured value by the magnification (10s) which is specified by (s), and stores it in the device specified by
(d).
Execution
command
(d)+1
(d)
(d)+1
(d)
0 0
Pressing and holding time Pressing and holding time
• The table below shows the actual value indicated by (d) depending on the magnification specified by (s) and the pressing
and holding time τ0.
(s) Magnification (d)
K0 τ0 (d)×1
K1 10τ0 (d)×10
K2 100τ0 (d)×100
Precautions
• When the command contact turns from on to off, the current value (d)+1 of the pressing and holding time is cleared, and the
teaching time (d) will not change any more.
• Two devices are occupied from a device specified as the teaching time (d). Make sure that such devices are not used in
other controls for the machine.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (s) is outside the following range.
0 to 2
8 APPLICATION INSTRUCTION
562 8.11 Special Timer Instruction
Special function timer
STMR
This instruction uses the four devices from the device specified by (d) to perform four types of timer output.
Ladder diagram Structured text
ENO:=STMR(EN,s1,s2,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Used timer number (operates as a 100 ms timer) Device name ANY16
(s2) Timer set value 1 to 32767 16-bit signed binary ANY16
(d) Start bit number to be output Bit ANYBIT_ARRAY
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2)
(d)
■Control data
Operand: (d)
Device Description Setting range Set by
+0 Off delay timer output: System
Turns on at the rising edge of the command of the STMR instruction and turns off when the time specified by
(s2) elapses after the falling edge.
+1 One-shot timer output after turning off: System
Turns on at the falling edge of the command of the STMR instruction and turns off when the time specified by
(s2) elapses.
+2 One-shot timer output after turning on System
Turns on at the rising edge of the command of the STMR instruction and turns off when the command of the
STMR instruction is turned off or when the time specified by (s2) elapses.
+3 On delay timer + Off delay timer output: System
Turns on at the falling edge of the timer coil and turns off when the time specified by (s2) elapsed after the falling
edge of the command of the STMR instruction.
8 APPLICATION INSTRUCTION
8.11 Special Timer Instruction 563
Processing details
• This instruction uses the four devices from the device specified by (d) to perform four types of timer output.
(1)
(d)+1
(d)+2
(d)+3
• The flickering effect is produced using (d)+1 and (d)+2 with the following program, which turns on/off at the normally closed
contact of (d)+3 (T10 is assigned to (s1), K100 is assigned to (s2), and M0 is assigned to (d)).
Command
input M3
STMR T10 K100 M0
(d)+3
(s1) (s2) (d)
Command
input
Precautions
• The timer number specified in this instruction cannot be used in other general circuits (such as OUT instruction). If the timer
number is used in other general circuits, the timer malfunctions.
• The timer specified by (s1) starts counting as a 100 ms timer on the rising edge of the command contact.
• Four devices are occupied from a device specified in (d). Make sure that such devices are not used in other controls for the
machine.
• If the command contact is turned off, (d), (d)+1, and (d)+3 turn off when the set time elapses. (d)+2 and the timer (s1) are
immediately reset.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (s2) is outside the following range.
1 to 32767
8 APPLICATION INSTRUCTION
564 8.11 Special Timer Instruction
8.12 Special Counter Instruction
Signed 32-bit bi-directional counters
UDCNTF
This instruction increments the current value of the counter specified by (d) by 1 when the 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. The high-speed pulse input/output module is not supported.
When the long counter specified by (d) is a high-speed counter, up-counting and down-counting are enabled.
For details on the high-speed counter, refer to MELSEC iQ-F FX5 User's Manual (Application).
Ladder diagram Structured text
ENO:= UDCNTF(EN, s, d);
(d) (s)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types 8
Operand Description Range Data type Data type (label)
(d) Long counter number Device name ANY32
(s) Long counter set value -2147483648 to 32-bit signed binary ANY32_S
2147483647
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
*1 *2
(d)
Processing details
• This instruction increments the current value of the counter specified by (d) by 1 when the 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.
• When the long counter specified by (d) is a high-speed counter, up-counting and down-counting are enabled.
• During up-counting, the output contact turns ON when the current value changes from a value less than the set value to a
value not less than the set value.
• During down-counting (only when using a high-speed counter for (d)), the output contact turns OFF when the current value
changes from a value not less than the set value to a value equivalent to the “set value -1” or less.
• Counting is continued also when the drive contact changes from OFF to ON after the output contact changes. (Only when
specify other than a high-speed counter for (d))
8 APPLICATION INSTRUCTION
8.12 Special Counter Instruction 565
• When unsigned (0 to 4294967295) is assigned to the LC, the OUT LC instruction is used. For the OUT LC instruction, refer
to Page 118 OUT LC.
• The current value operates as a ring counter.
(1)
(2)
(1)
(2)
(1): Up counting
(2): Down counting (only when using a high-speed counter)
Precautions
• The last number of a word device cannot be input as the long counter set value.
• Indirect specification cannot be input as the long counter set value.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
566 8.12 Special Counter Instruction
8.13 Shortcut Control Instruction
Rotary table shortest direction control
ROTC
This instruction is suitable for efficient control of the rotary table for putting/taking a product on/off the rotary table.
Ladder diagram Structured text
ENO:=ROTC(EN,s,n1,n2,d);
FBD/LD
EN ENO
s d
n1
n2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Registers specifying (s)+0: Works as a register for counting. 16-bit signed binary ANY16_ARRAY
8
the calling condition (Number of elements: 3)
(s)+1: Sets the station No. to be called.
(Set them in advance
using the transfer (s)+2: Sets the product No. to be
instruction.) called.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n1)
(n2)
(d)
8 APPLICATION INSTRUCTION
8.13 Shortcut Control Instruction 567
Processing details
• The table rotation is controlled by conditions of "n2", (s), and (d) so that a product can be efficiently put on or taken off the
rotary table divided into "n1" (=10) sections as shown in the figure below. When the following conditions are specified,
forward/backward rotation and high-speed/low-speed/stop are output to (d)+3 to (d)+7.
Station No. 0
Zero point detection
Product
X2(M2)
8
9 7
X0(M0)
0 6
Detection Forward
rotation
Switches
1 5
X1(M1)
Station No. 1 4
2
3
Rotary table
• Provide a 2-phase switch (X0 and X1) for detecting the rotation direction (forward or backward) of the table and the switch
X2 which turns ON when the product No. 0 reaches the station No. 0. X0 to X2 are replaced with internal contacts of (d) to
(d)+2. Any head device number can be specified by X or (d).
2-phase switch
(d)
X0
A phase
M0
Up-counting signal during forward rotation
(d)+1
X1
M1 B phase
(d)+2
X2
M2 Zero point detection switch
• The counter (s) detects which product number is located at the station No. 0.
• Set the station No. to be called in (s)+1.
• Set the product No. to be called in (s)+2.
• Specify the number of divisions (n1) of the table, and number of low-speed sections (n2).
Precautions
• When the command input is set to ON and this instruction is executed, the result will be automatically output to (d)+3 to
(d)+7. When the command input is set to OFF, (d)+3 to (d)+7 are set to OFF accordingly.
• For example, when the rotation detection signal ((d) to (d)+2) is activated 10 times in one division, set a value multiplied by
"10" to each division, station No. to be called and product No. to be called. As a result, an intermediate value of the division
number can be set to a low-speed section.
• When the zero point detection signal (M2) turns ON while the command input is ON, the contents of the register for
counting (s) are cleared to "0". This clear operation should be executed before starting the operation.
• Up to four ROTC instructions can be used simultaneously.
8 APPLICATION INSTRUCTION
568 8.13 Shortcut Control Instruction
Operation error
Error code Description
(SD0/SD8067)
1811H The number of the ROTC instructions which are used simultaneously exceeds four.
2820H The device range specified by (s) exceeds the corresponding device range.
The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (n1) is outside the following range.
2 to 32767
The value specified by (n2) is outside the following range.
0 to 32767
The value specified by (n1) or (n2) is in the following condition.
(n1) < (n2)
Either (s), (s)+1, or (s)+2 is negative.
Either (s), (s)+1, or (s)+2 is equal to (n1) or larger.
8 APPLICATION INSTRUCTION
8.13 Shortcut Control Instruction 569
8.14 Ramp Signal Instruction
Ramp signal
RAMPF
This instruction obtains the data which changes between the start value (initial value) and the end value (target value) over the
specified "n" times.
Ladder diagram Structured text
ENO:=RAMPF(EN,s1,s2,n,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Initial value of ramp 16-bit signed binary ANY16
(s2) Target value of ramp 16-bit signed binary ANY16
(d) (d)+0: Current value 16-bit signed binary ANY16_ARRAY
(Number of elements: 2)
(d)+1: Number of scans
(n) Ramp transfer time (scan) 1 to 32767 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
(n)
8 APPLICATION INSTRUCTION
570 8.14 Ramp Signal Instruction
Processing details
• When the start value (s1) and the end value (s2) have been specified and the command input is set to ON, the value
obtained by adding a value divided equally by "n" times to (s1) in the next operation cycle is stored to (d). By combining this
instruction and an analog output, the cushion start/stop command can be output.
(s2) (s1)
(d)
(d)
(s2)
(s1)
Command
8
(s2)
(s1)
(d)
(SM8029)
• When the operation result is acquired at a constant time interval (constant scan mode), write a prescribed scan time (which
is longer than the actual scan time) to SD8039 and set SM8039 to ON. For example, when "20 ms" is written to SD8039
and "n" is set to 100, the (d) value will change from (s1) to (s2) in 2 seconds.
• The value used in the constant scan mode can be set in the parameter setting of an engineering tool (constant scan
execution interval setting of CPU parameter).
For details on the constant scan, refer to MELSEC iQ-F FX5 User's Manual (Application).
For details on the engineering tool, refer to GX Works3 Operating Manual.
8 APPLICATION INSTRUCTION
8.14 Ramp Signal Instruction 571
• The contents of (d) are changed as follows depending on the ON/OFF status of the mode flag SM8026.
Command Command
(s2) (s2)
(s1) (s1)
(d) (d)
(SM8029) (SM8029)
Precautions
To specify a latched (battery backed) type device as (d) when setting the CPU module to the RUN mode while the command
input is ON, clear (d) in advance.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (n) is outside the following range.
1 to 32767
8 APPLICATION INSTRUCTION
572 8.14 Ramp Signal Instruction
8.15 Pulse Related Instruction
Instruction correspondence table for CPU module built-in positioning and high-speed
pulse input/output module
The table for instructions corresponding to the CPU module and the high-speed pulse input/output module are shown below.
: Supported, : Not supported
Instruction CPU module High-speed pulse input/
output module
SPD
DSPD
PLSY [For the FX3 compatible operand specification]
PLSY [For the FX5 operand specification]
DPLSY [For the FX3 compatible operand specification]
DPLSY [For the FX5 operand specification]
PWM
DPWM
SPD
This instruction counts the number of times the device input specified by (s1) turns off → on only for the time (in 16-bit data
units) specified by (s2) × 1ms and stores the operation result in the device specified by (d). The high-speed pulse input/output
8
module is not supported.
Ladder diagram Structured text
ENO:=SPD(EN,s1,s2,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Pulse input Bit/Word ANY_ELEMENTARY
(s2) Measurement time (Unit: ms) -32768 to +32767 16-bit signed binary ANY16
(d) Head device number for storing the measurement result 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 573
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1 *2
(s2)
(d)
Processing details
• This instruction counts the number of times the device input specified by (s1) turns off → on only for the time (in 16-bit data
units) specified by (s2) × 1ms and stores the operation result in the device specified by (d).
Counting start
(s2)ms (s2)ms
ON
Execution OFF
command
ON
(s1) OFF
(1) (1)
(1): The elapsed time is judged using the 1ms interrupt and the counted result is stored in (d).
• The channel number of the high-speed counter specified by (s1) interlocks with the channel number in which parameters
are set.
• When a word device is specified by (s1), this instruction counts the number of pulses by the high-speed counter setting of
the channel number corresponding to each word device.
• When a bit device is specified by (s1), the following input assignment devices (shaded area) are valid.
• When the high-speed counter FX3 compatibility function is enabled, only the 1-phase 1-input pulse input mode (S/W)
(general-purpose input assignment of the 1-phase 1-input counter (switching S/W up or down)) is enabled.
General-purpose input assignment of the 1-phase 1-input counter (switching S/W up or down)
U/D: UP/DOWN pulse input, P: Preset input (reset), E: Enable input (start)
CH1 U/D(A) P E
CH2 U/D(A) P E
CH3 U/D(A) P E
CH4 U/D(A) P E
CH5 U/D(A) P E
CH6 U/D(A) P E
CH7 U/D(A) P E
CH8 U/D(A) P E
If one of X10 to X17 is specified as a device, an error occurs.
8 APPLICATION INSTRUCTION
574 8.15 Pulse Related Instruction
General-purpose input assignment of the 1-phase 1-input counter (switching H/W up or down)
C: Pulse input, D: Direction input, P: Preset input (reset), E: Enable input (start)
CH1 A B P E
CH2 A B P E
CH3 A B P E
CH4 A B P E
CH5 A B P E
CH6 A B P E
CH7 A B P E
CH8 A B
If one of X1, X3, X5, X7, X11, X13, X15, X17 is specified as a device, an error occurs.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 575
• The table below shows the related devices.
Function CH1 CH2 CH3 CH4 CH5 CH6 CH7 CH8
Monitor in operation SM4500 SM4501 SM4502 SM4503 SM4504 SM4505 SM4506 SM4507
High-speed counter pulse SD4507, SD4537, SD4567, SD4597, SD4627, SD4657, SD4687, SD4717,
density SD4506 SD4536 SD4566 SD4596 SD4626 SD4656 SD4686 SD4716
Measurement unit time SD4517, SD4547, SD4577, SD4607, SD4637, SD4667, SD4697, SD4727,
SD4516 SD4546 SD4576 SD4606 SD4636 SD4666 SD4696 SD4726
Precautions
• The maximum input frequency of turning the inputs ON and OFF is shown below:
FX5U-32M/ FX5UC-32M CPU module
• When the SPD instruction is used, the UP/DOWN pulse input, preset input and enable input operate in accordance with the
contents set by the parameters of the high-speed counter.
• When the measurement time is changed while the SPD instruction is executed, the changed time is applied every time the
measurement time ends.
• When the current value of the high-speed counter is overwritten, a preset input is executed, or the high-speed counter is
reset by the DHCMOV instruction while the SPD instruction is executed, the operation continues, but the pulse density
cannot be measured normally.
• When the SPD instruction is used, pulses per unit time which exceeds the ring length of the high-speed counter cannot be
input.
• The measurement time specified by (s2) overwrites the value stored in the SD device specified for the measurement unit
time.
• When the measurement time specified by (s2) is outside the range from 1 to 32767, the specified measurement time is
rounded into “1” with the sign.
Operation error
Error code Description
(SD0/SD8067)
3600H The channel number or device number in which parameters are not set in (s1) is specified.
3405H An unavailable bit device is set in (s1).
A channel number other than 1 to 8 is specified in (s1).
When FX3 compatible function of a high-speed counter is valid and a channel number is specified to (s1).
1810H The input specified in (s1) is already used by another instruction.
8 APPLICATION INSTRUCTION
576 8.15 Pulse Related Instruction
Measuring the density of 32 bit binary pulses
DSPD
This instruction counts the number of times the device input specified by (s1) turns off → on only for the time (in 32-bit data
units) specified by (s2) × 1ms and stores the operation result in the device specified by (d). The high-speed pulse input/output
module is not supported.
Ladder diagram Structured text
ENO:=DSPD(EN,s1,s2,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Pulse input Bit/Word/Double word ANY_ELEMENTARY
(s2) Measurement time (Unit: ms) -2147483648 to
+2147483647
32-bit signed binary ANY32 8
(d) Head device number for storing the measurement result 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1 *2
(s2)
(d)
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 577
Processing details
• This instruction counts the number of times the device input specified by (s1) turns off → on only for the time (in 32-bit data
units) specified by (s2) × 1ms and stores the operation result in the device specified by (d).
Counting start
(s2)+1,(s2)ms (s2)+1,(s2)ms
ON
Execution
command OFF
ON
(s1) OFF
(1) (1)
(1): The elapsed time is judged using the 1ms interrupt and the counted result is stored in (d)+1 and (d).
• The channel number of the high-speed counter specified by (s1) interlocks with the channel number in which parameters
are set.
• When a word device is specified by (s1), this instruction counts the number of pulses by the high-speed counter setting of
the channel number corresponding to each word device.
• When a bit device is specified by (s1), the following input assignment devices (shaded area) are valid.
• When the high-speed counter FX3 compatibility function is enabled, only the 1-phase 1-input pulse input mode (S/W)
(general-purpose input assignment of the 1-phase 1-input counter (switching S/W up or down)) is enabled.
General-purpose input assignment of the 1-phase 1-input counter (switching S/W up or down)
U/D: UP/DOWN pulse input, P: Preset input (reset), E: Enable input (start)
CH1 U/D(A) P E
CH2 U/D(A) P E
CH3 U/D(A) P E
CH4 U/D(A) P E
CH5 U/D(A) P E
CH6 U/D(A) P E
CH7 U/D(A) P E
CH8 U/D(A) P E
If one of X10 to X17 is specified as a device, an error occurs.
General-purpose input assignment of the 1-phase 1-input counter (switching H/W up or down)
C: Pulse input, D: Direction input, P: Preset input (reset), E: Enable input (start)
8 APPLICATION INSTRUCTION
578 8.15 Pulse Related Instruction
General-purpose input assignment of the 1-phase 2-input counter
U: UP pulse input, D: DOWN pulse input, P: Preset input (reset), E: Enable input (start)
CH1 A B P E
CH2 A B P E
CH3 A B P E
CH4 A B P E
CH5 A B P E
CH6 A B P E 8
CH7 A B P E
CH8 A B
If one of X1, X3, X5, X7, X11, X13, X15, X17 is specified as a device, an error occurs.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 579
Precautions
• The maximum input frequency of turning the inputs ON and OFF is shown below:
FX5U-32M/FX5UC-32M CPU module
• When the DSPD instruction is used, the UP/DOWN pulse input, preset input and enable input operate in accordance with
the contents set by the parameters of the high-speed counter.
• When the measurement time is changed while the DSPD instruction is executed, the changed time is applied every time
the measurement time ends.
• When the current value of the high-speed counter is overwritten, a preset input is executed, or the high-speed counter is
reset by the DHCMOV instruction while the SPD instruction is executed, the operation continues, but the pulse density
cannot be measured normally.
• When the DSPD instruction is used, pulses per unit time which exceeds the ring length of the high-speed counter cannot be
input.
• The measurement time specified by (s2) overwrites the value stored in the SD device specified for the measurement unit
time.
• When the measurement time specified by (s2) is outside the range from 1 to 2147483647, the specified measurement time
is rounded into “1” with the sign.
Operation error
Error code Description
(SD0/SD8067)
3600H The channel number or device number in which parameters are not set in (s1) is specified.
3405H An unavailable bit device is set in (s1).
A channel number other than 1 to 8 is specified in (s1).
When FX3 compatible function of a high-speed counter is valid and a channel number is specified to (s1).
1810H The input specified in (s1) is already used by another instruction.
8 APPLICATION INSTRUCTION
580 8.15 Pulse Related Instruction
16 bit binary pulse output
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed or word device number storing data 0 to 65535 16-bit unsigned binary ANY16 8
(n) Positioning address or word device number storing data 0 to 65535 16-bit unsigned binary ANY16
(d) Bit device number from which pulses are to be output 0 to 3 bit ANY_ELEMENTARY
(BOOL)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n)
(d) *1
*1 Y0 to Y3 can be used.
Processing details
• This instruction outputs 16-bit pulse trains specified by the command speed (s) from the device specified by the output (d)
for the amount of 16-bit pulses specified by the positioning address (n).
(n)
(s)
• Set the value from 0 to 65535 (in user unit) to the command speed (s), so that the command speed is 200 kpps or less
when the command speed is converted to frequency.
• Set the value from 0 to 65535 (in user unit) to the positioning address (n), so that the positioning address is within the range
from 0 to 2147483647 when the positioning address is converted to number of pulses.
• Specify the Y device number (Y0 to Y3) in (d).
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 581
• The following tables show the special relays and special registers related to the PLSY instruction.
[Special relays]
Axis number Name Descriptions
1 2 3 4
SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated
activation
SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop
SM5532 SM5533 SM5534 SM5535 Positioning error occurrence On: Error occurred, OFF: Error not occurred
SM5628 SM5629 SM5630 SM5631 Pulse output stop command ON: Stop command is on, OFF: Stop command is off
SM5644 SM5645 SM5646 SM5647 Pulse deceleration stop ON: Deceleration stop command is on, OFF:
command*1 Deceleration stop command is off
SM5660 SM5661 SM5662 SM5663 Forward limit ON: Forward limit is on, OFF: Forward limit is off
SM5676 SM5677 SM5678 SM5679 Reverse limit ON: Reverse limit is on, OFF: Reverse limit is off
*1 Because the PLSY instruction does not have the acceleration/deceleration function, the operation is stopped immediately even though
the pulse deceleration stop command is turned on.
[Special registers]
Axis number Name
1 2 3 4
SD5500, SD5540, SD5580, SD5620, Current address (in user unit)
SD5501 SD5541 SD5581 SD5621
SD5502, SD5542, SD5582, SD5622, Current address (in pulse unit)
SD5503 SD5543 SD5583 SD5623
SD5504, SD5544, SD5584, SD5624, Current speed (in user unit)
SD5505 SD5545 SD5585 SD5625
SD5510 SD5550 SD5590 SD5630 Positioning error error code
8 APPLICATION INSTRUCTION
582 8.15 Pulse Related Instruction
Precautions
• The operation cannot be performed normally in an environment such as user program where the instruction cannot be
executed at each scan or if the instruction is jumped by the CJ(P) instruction. However, the pulse output is continued.
• The same devices as the ones of position instruction, PWM output or general-purpose output cannot be used for the output
in the PLSY instruction.
• When the pulse output is stopped, the operation is stopped immediately by the PLSY instruction. Note that the motor is
stopped without deceleration and this may damage the system. For stopping method of the pulse output, refer to
MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
• If the positioning address is 0 when the PLSY instruction is activated, pulses are output without limitation.
• Overwrite the positioning address during the pulse output to change the positioning address in operation. The written value
is reflected at the first time that the instruction is executed after the device is overwritten. The positioning address becomes
invalid if it is changed from 0 to a value other than 0 or from a value other than 0 to 0 during positioning operation.
• When the positioning address is changed during the pulse output, the operation is stopped immediately if the changed
value is the number of pulses which have already been output or less.
• Overwrite the command speed during the pulse output to change the command speed in operation. The written value is
reflected at the first time that the instruction is executed after the device is overwritten.
• When the numbers of pulses (by the pulses conversion) of the command speed and positioning address exceed the 32-bit
range, an error occurs and the operation cannot be performed.
• The PLSY instruction always increases the current address because the setting of rotation direction is disabled due to the
absence of direction.
• When the output mode is CW/CCW mode, output is always performed from the device set to CW.
• If reverse limit is used, it operates as forward limit.
• Do not set the value of 200 kpps or more by the frequency conversion when changing the command speed during the pulse
output.
8
• If the command speed is set to 0 when the PLSY instruction is activated, the operation ends with an error and stops pulse
output.
• If the command speed is changed to 0 during pulse output, the operation immediately stops without abnormal end flag.
However, if the drive contact is not turned off, pulse output will restart when the command speed is changed.
• The command speed is changed to negative value during pulse output, it is the operation ends with an error.
• The following table shows the operation timing of the complete flag and abnormal end flag of the PLSY instruction.
Complete flag (SM8029) Abnormal end flag (SM8329)
ON condition • From when the output of the specified positioning address is completed until From the following stops until the drive contact is
the drive contact is turned off turned off
• Pulse deceleration stop command (when unlimited pulses are being output) • The specified axis is already used*1
• Pulse output stop command
• Pulse deceleration stop command (when
unlimited pulses are not being output)
• Drive direction limit
• All outputs disabled (SM8034)
• Write during RUN
• Positioning address error
ON→OFF condition • When the drive contact is turned off • When the drive contact is turned off
*1 The flag turns on only during one scan time when the activation contact of the instruction turns off and on.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 583
Operation error
Error code Description
(SD0/SD8067)
Axis 1 Axis 2 Axis 3 Axis 4
SD5510 SD5550 SD5590 SD5630
1810H The axis number specified by (d) is used by another instruction.
2820H The value specified by (s) is outside the following range.
0 to 65535
The value specified by (n) is outside the following range.
0 to 65535
The value specified by (d) is outside the following range.
0 to 3
3600H The axis number specified by (d) is not set by parameters.
A function which is set to be not used by parameters (such as interrupt input signal 1 and zero return
relations) is used.
3631H 3632H 3633H 3634H The numbers of pulses (by the pulses conversion) of the positioning address specified by (n) exceed the 32-
bit range.
3641H 3642H 3643H 3644H The numbers of pulses (by the pulses conversion) of the command speed specified by (s) exceed the 32-bit
range.
3651H 3652H 3653H 3654H The operation decelerates and stops by the forward limit or reverse limit during the pulse output or at the
activating of the positioning.
3661H 3662H 3663H 3664H The operation decelerates and stops by the pulse output stop command or special relay whose all outputs
are disabled during the pulse output or at the activating of the positioning.
8 APPLICATION INSTRUCTION
584 8.15 Pulse Related Instruction
PLSY [For the FX5 operand specification]
This instruction outputs 16-bit pulse trains specified by the command speed (s) from the device specified by the output (d) for
the amount of 16-bit pulses specified by the positioning address (n). The high-speed pulse input/output module is not
supported.
Ladder diagram Structured text
ENO:=PLSY(EN,s,n,d);
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed or word device number storing data 0 to 65535 16-bit unsigned binary ANY16
(n) Positioning address or word device number storing data 0 to 65535 16-bit unsigned binary ANY16
(d) Axis number from which pulses are to be output 1 to 4 16-bit unsigned binary ANY_ELEMENTARY
(WORD) 8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n)
(d)
Processing details
• This instruction outputs 16-bit pulse trains specified by the command speed (s) from the device specified by the output (d)
for the amount of 16-bit pulses specified by the positioning address (n).
(n)
(s)
• Set the value from 0 to 65535 (in user unit) in the command speed (s), so that the command speed is 200 kpps or less
when the command speed is converted to frequency.
• Set the value from 0 to 65535 (in user unit) in the positioning address (n), so that the positioning address is within the range
from 0 to 2147483647 when the positioning address is converted to number of pulses.
• Specify the axis number (K1 to K4) in which positioning parameters exist in (d).
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 585
• The following tables show the special relays and special registers related to the PLSY instruction.
[Special relays]
Axis number Name Descriptions
1 2 3 4
SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated
activation
SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop
SM5532 SM5533 SM5534 SM5535 Positioning error occurrence On: Error occurred, OFF: Error not occurred
SM5628 SM5629 SM5630 SM5631 Pulse output stop command ON: Stop command is on, OFF: Stop command is off
SM5644 SM5645 SM5646 SM5647 Pulse deceleration stop ON: Deceleration stop command is on, OFF:
command*1 Deceleration stop command is off
SM5660 SM5661 SM5662 SM5663 Forward limit ON: Forward limit is on, OFF: Forward limit is off
SM5676 SM5677 SM5678 SM5679 Reverse limit ON: Reverse limit is on, OFF: Reverse limit is off
*1 Because the PLSY instruction does not have the acceleration/deceleration function, the operation is stopped immediately even though
the pulse deceleration stop command is turned on.
[Special registers]
Axis number Name
1 2 3 4
SD5500, SD5540, SD5580, SD5620, Current address (in user unit)
SD5501 SD5541 SD5581 SD5621
SD5502, SD5542, SD5582, SD5622, Current address (in pulse unit)
SD5503 SD5543 SD5583 SD5623
SD5504, SD5544, SD5584, SD5624, Current speed (in user unit)
SD5505 SD5545 SD5585 SD5625
SD5510 SD5550 SD5590 SD5630 Positioning error error code
8 APPLICATION INSTRUCTION
586 8.15 Pulse Related Instruction
Precautions
• The operation cannot be performed normally in an environment such as user program where the instruction cannot be
executed at each scan or if the instruction is jumped by the CJ(P) instruction. However, the pulse output is continued.
• The same devices as the ones of position instruction, PWM output or general-purpose output cannot be used for the output
in the PLSY instruction.
• When the pulse output is stopped, the operation is stopped immediately by the PLSY instruction. Note that the motor is
stopped without deceleration and this may damage the system. For stopping method of the pulse output, refer to
MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
• If the positioning address is 0 when the PLSY instruction is activated, pulses are output without limitation.
• Overwrite the positioning address during the pulse output to change the positioning address in operation. The written value
is reflected at the first time that the instruction is executed after the device is overwritten. The positioning address becomes
invalid if it is changed from 0 to a value other than 0 or from a value other than 0 to 0 during positioning operation.
• When the positioning address is changed during the pulse output, the operation is stopped immediately if the changed
value is the number of pulses which have already been output or less.
• Overwrite the command speed during the pulse output to change the command speed in operation. The written value is
reflected at the first time that the instruction is executed after the device is overwritten.
• When the numbers of pulses (by the pulses conversion) of the command speed and positioning address exceed the 32-bit
range, an error occurs and the operation cannot be performed.
• The PLSY instruction always increases the current address because the setting of rotation direction is disabled due to the
absence of direction.
• When the output mode is CW/CCW mode, output is always performed from the device set to CW.
• If reverse limit is used, it operates as forward limit.
• Do not set the value of 200 kpps or more by the frequency conversion when changing the command speed during the pulse
output.
8
• If the command speed is set to 0 when the PLSY instruction is activated, the operation ends with an error and stops pulse
output.
• If the command speed is changed to 0 during pulse output, the operation immediately stops without abnormal end flag.
However, if the drive contact is not turned off, pulse output will restart when the command speed is changed.
• The command speed is changed to negative value during pulse output, it is the operation ends with an error.
• The following table shows the operation timing of the complete flag and abnormal end flag of the PLSY instruction.
Complete flag (SM8029) Abnormal end flag (SM8329)
ON condition • From when the output of the specified positioning address is completed until From the following stops until the drive contact is
the drive contact is turned off turned off
• Pulse decelerate and stop command (when unlimited pulses are being • The specified axis is already used*1
output) • Pulse output stop command
• Pulse deceleration stop command (when unlimited
pulses are not being output)
• Drive direction limit
• All outputs disabled (SM8034)
• Write during RUN
• Positioning address error
ON→OFF condition • When the drive contact is turned off • When the drive contact is turned off
*1 The flag turns on only during one scan time when the activation contact of the instruction turns off and on.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 587
Operation error
Error code Description
(SD0/SD8067)
Axis 1 Axis 2 Axis 3 Axis 4
SD5510 SD5550 SD5590 SD5630
1810H The axis number specified by (d) is used by another instruction.
2820H The value specified by (s) is outside the following range.
0 to 65535
The value specified by (n) is outside the following range.
0 to 65535
The value specified by (d) is outside the following range.
0 to 3
3600H The axis number specified by (d) is not set by parameters.
A function which is set to be not used by parameters (such as interrupt input signal 1 and zero return
relations) is used.
3631H 3632H 3633H 3634H The numbers of pulses (by the pulses conversion) of the positioning address specified by (n) exceed the 32-
bit range.
3641H 3642H 3643H 3644H The numbers of pulses (by the pulses conversion) of the command speed specified by (s) exceed the 32-bit
range.
3651H 3652H 3653H 3654H The operation decelerates and stops by the forward limit or reverse limit during the pulse output or at the
activating of the positioning.
3661H 3662H 3663H 3664H The operation decelerates and stops by the pulse output stop command or special relay whose all outputs
are disabled during the pulse output or at the activating of the positioning.
8 APPLICATION INSTRUCTION
588 8.15 Pulse Related Instruction
32 bit binary pulse output
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed or word device number storing data 0 to 2147483647 32-bit unsigned binary ANY32 8
(n) Positioning address or word device number storing data 0 to 2147483647 32-bit unsigned binary ANY32
(d) Bit device number from which pulses are to be output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n)
(d) *1
*1 Y0 to Y3 can be used.
Processing details
• This instruction outputs 32-bit pulse trains specified by the command speed (s) from the device specified by the output (d)
for the amount of 32-bit pulses specified by the positioning address (n).
[(n)+1, (n)]
[(s)+1, (s)]
• Set the value from 0 to 2147483647 (in user unit) to the command speed (s), so that the command speed is 200 kpps or
less when the command speed is converted to frequency.
• Set the value from 0 to 2147483647 (in user unit) to the positioning address (n), so that the positioning address is within the
range from 0 to 2147483647 when the positioning address is converted to number of pulses.
• Specify the Y device number (Y0 to Y3) in (d).
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 589
• The following tables show the special relays and special registers related to the DPLSY instruction.
[Special relays]
Axis number Name Descriptions
1 2 3 4
SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated
activation
SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop
SM5532 SM5533 SM5534 SM5535 Positioning error occurrence On: Error occurred, OFF: Error not occurred
SM5628 SM5629 SM5630 SM5631 Pulse output stop command ON: Stop command is on, OFF: Stop command is off
SM5644 SM5645 SM5646 SM5647 Pulse deceleration stop ON: Deceleration stop command is on, OFF:
command*1 Deceleration stop command is off
SM5660 SM5661 SM5662 SM5663 Forward limit ON: Forward limit is on, OFF: Forward limit is off
SM5676 SM5677 SM5678 SM5679 Reverse limit ON: Reverse limit is on, OFF: Reverse limit is off
*1 Because the DPLSY instruction does not have the acceleration/deceleration function, the operation is stopped immediately even though
the pulse deceleration stop command is turned on.
[Special registers]
Axis number Name
1 2 3 4
SD5500, SD5540, SD5580, SD5620, Current address (in user unit)
SD5501 SD5541 SD5581 SD5621
SD5502, SD5542, SD5582, SD5622, Current address (in pulse unit)
SD5503 SD5543 SD5583 SD5623
SD5504, SD5544, SD5584, SD5624, Current speed (in user unit)
SD5505 SD5545 SD5585 SD5625
SD5510 SD5550 SD5590 SD5630 Positioning error error code
8 APPLICATION INSTRUCTION
590 8.15 Pulse Related Instruction
Precautions
• The operation cannot be performed normally in an environment such as user program where the instruction cannot be
executed at each scan or if the instruction is jumped by the CJ(P) instruction. However, the pulse output is continued.
• The same devices as the ones of position instruction, PWM output or general-purpose output cannot be used for the output
in the DPLSY instruction.
• When the pulse output is stopped, the operation is stopped immediately by the DPLSY instruction. Note that the motor is
stopped without deceleration and this may damage the system. For stopping method of the pulse output, refer to
MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
• If the positioning address is 0 when the DPLSY instruction is activated, pulses are output without limitation.
• Overwrite the positioning address during the pulse output to change the positioning address in operation. The written value
is reflected at the first time that the instruction is executed after the device is overwritten. The positioning address becomes
invalid if it is changed from 0 to a value other than 0 or from a value other than 0 to 0 during positioning operation.
• When the positioning address is changed during the pulse output, the operation is stopped immediately if the changed
value is the number of pulses which have already been output or less.
• Overwrite the command speed during the pulse output to change the command speed in operation. The written value is
reflected at the first time that the instruction is executed after the device is overwritten.
• When the numbers of pulses (by the pulses conversion) of the command speed and positioning address exceed the 32-bit
range, an error occurs and the operation cannot be performed.
• The DPLSY instruction always increases the current address because the setting of rotation direction is disabled due to the
absence of direction.
• When the output mode is CW/CCW mode, output is always performed from the device set to CW.
• If reverse limit is used, it operates as forward limit.
• Do not set the value of 200 kpps or more by the frequency conversion when changing the command speed during the pulse
output.
8
• If the command speed is set to 0 when the DPLSY instruction is activated, the operation ends with an error and stops pulse
output.
• If the command speed is changed to 0 during pulse output, the operation immediately stops without abnormal end flag.
However, if the drive contact is not turned off, pulse output will restart when the command speed is changed.
• The command speed is changed to negative value during pulse output, it is the operation ends with an error.
• The following table shows the operation timing of the complete flag and abnormal end flag of the DPLSY instruction.
Complete flag (SM8029) Abnormal end flag (SM8329)
ON condition • From when the output of the specified positioning address is completed until From the following stops until the drive contact is
the drive contact is turned off turned off
• Pulse decelerate and stop command (when unlimited pulses are being output) • The specified axis is already used*1
• Pulse output stop command
• Pulse deceleration stop command (when
unlimited pulses are not being output)
• Drive direction limit
• All outputs disabled (SM8034)
• Write during RUN
• Positioning address error
ON→OFF condition • When the drive contact is turned off • When the drive contact is turned off
*1 The flag turns on only during one scan time when the activation contact of the instruction turns off and on.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 591
Operation error
Error code Description
(SD0/SD8067)
Axis 1 Axis 2 Axis 3 Axis 4
SD5510 SD5550 SD5590 SD5630
1810H The axis number specified by (d) is used by another instruction.
2820H The value specified by (s) is outside the following range.
0 to 65535
The value specified by (n) is outside the following range.
0 to 65535
The value specified by (d) is outside the following range.
0 to 3
3600H The axis number specified by (d) is not set by parameters.
A function which is set to be not used by parameters (such as interrupt input signal 1 and zero return
relations) is used.
3631H 3632H 3633H 3634H The numbers of pulses (by the pulses conversion) of the positioning address specified by (n) exceed the 32-
bit range.
3641H 3642H 3643H 3644H The numbers of pulses (by the pulses conversion) of the command speed specified by (s) exceed the 32-bit
range.
3651H 3652H 3653H 3654H The operation decelerates and stops by the forward limit or reverse limit during the pulse output or at the
activating of the positioning.
3661H 3662H 3663H 3664H The operation decelerates and stops by the pulse output stop command or special relay whose all outputs
are disabled during the pulse output or at the activating of the positioning.
8 APPLICATION INSTRUCTION
592 8.15 Pulse Related Instruction
DPLSY [For the FX5 operand specification]
This instruction outputs 32-bit pulse trains specified by the command speed (s) from the device specified by the output (d) for
the amount of 32-bit pulses specified by the positioning address (n). The high-speed pulse input/output module is not
supported.
Ladder diagram Structured text
ENO:=DPLSY(EN,s,n,d);
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed or word device number storing data 0 to 2147483647 32-bit signed binary ANY32
(n) Positioning address or word device number storing data 0 to 2147483647 32-bit signed binary ANY32
(d) Axis number from which pulses are to be output 1 to 4 16-bit unsigned binary ANY_ELEMENTARY
(WORD) 8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n)
(d)
Processing details
• This instruction outputs 32-bit pulse trains specified by the command speed (s) from the device specified by the output (d)
for the amount of 32-bit pulses specified by the positioning address (n).
[(n)+1, (n)]
[(s)+1, (s)]
• Set the value from 0 to 2147483647 (in user unit) to the command speed (s), so that the command speed is 200 kpps or
less when the command speed is converted to frequency.
• Set the value from 0 to 2147483647 (in user unit) to the positioning address (n), so that the positioning address is within the
range from 0 to 2147483647 when the positioning address is converted to number of pulses.
• Specify the axis number (K1 to K4) in which positioning parameters exist in (d).
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 593
• The following tables show the special relays and special registers related to the DPLSY instruction.
[Special relays]
Axis number Name Descriptions
1 2 3 4
SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated
activation
SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop
SM5532 SM5533 SM5534 SM5535 Positioning error occurrence On: Error occurred, OFF: Error not occurred
SM5628 SM5629 SM5630 SM5631 Pulse output stop command ON: Stop command is on, OFF: Stop command is off
SM5644 SM5645 SM5646 SM5647 Pulse deceleration stop ON: Deceleration stop command is on, OFF:
command*1 Deceleration stop command is off
SM5660 SM5661 SM5662 SM5663 Forward limit ON: Forward limit is on, OFF: Forward limit is off
SM5676 SM5677 SM5678 SM5679 Reverse limit ON: Reverse limit is on, OFF: Reverse limit is off
*1 Because the DPLSY instruction does not have the acceleration/deceleration function, the operation is stopped immediately even though
the pulse deceleration stop command is turned on.
[Special registers]
Axis number Name
1 2 3 4
SD5500, SD5540, SD5580, SD5620, Current address (in user unit)
SD5501 SD5541 SD5581 SD5621
SD5502, SD5542, SD5582, SD5622, Current address (in pulse unit)
SD5503 SD5543 SD5583 SD5623
SD5504, SD5544, SD5584, SD5624, Current speed (in user unit)
SD5505 SD5545 SD5585 SD5625
SD5510 SD5550 SD5590 SD5630 Positioning error error code
8 APPLICATION INSTRUCTION
594 8.15 Pulse Related Instruction
Precautions
• The operation cannot be performed normally in an environment such as user program where the instruction cannot be
executed at each scan or if the instruction is jumped by the CJ(P) instruction. However, the pulse output is continued.
• The same devices as the ones of position instruction, PWM output or general-purpose output cannot be used for the output
in the DPLSY instruction.
• When the pulse output is stopped, the operation is stopped immediately by the DPLSY instruction. Note that the motor is
stopped without deceleration and this may damage the system. For stopping method of the pulse output, refer to
MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
• If the positioning address is 0 when the DPLSY instruction is activated, pulses are output without limitation.
• Overwrite the positioning address during the pulse output to change the positioning address in operation. The written value
is reflected at the first time that the instruction is executed after the device is overwritten. The positioning address becomes
invalid if it is changed from 0 to a value other than 0 or from a value other than 0 to 0 during positioning operation.
• When the positioning address is changed during the pulse output, the operation is stopped immediately if the changed
value is the number of pulses which have already been output or less.
• Overwrite the command speed during the pulse output to change the command speed in operation. The written value is
reflected at the first time that the instruction is executed after the device is overwritten.
• When the numbers of pulses (by the pulses conversion) of the command speed and positioning address exceed the 32-bit
range, an error occurs and the operation cannot be performed.
• The PLSY instruction always increases the current address because the setting of rotation direction is disabled due to the
absence of direction.
• When the output mode is CW/CCW mode, output is always performed from the device set to CW.
• If reverse limit is used, it operates as forward limit.
• Do not set the value of 200 kpps or more by the frequency conversion when changing the command speed during the pulse
output.
8
• If the command speed is set to 0 when the PLSY instruction is activated, the operation ends with an error and stops pulse
output.
• If the command speed is changed to 0 during pulse output, the operation immediately stops without abnormal end flag.
However, if the drive contact is not turned off, pulse output will restart when the command speed is changed.
• The command speed is changed to negative value during pulse output, it is the operation ends with an error.
• The following table shows the operation timing of the complete flag and abnormal end flag of the DPLSY instruction.
Complete flag (SM8029) Abnormal end flag (SM8329)
ON condition • From when the output of the specified positioning address is completed until From the following stops until the drive contact is
the drive contact is turned off turned off
• Pulse decelerate and stop command (when unlimited pulses are being • The specified axis is already used*1
output) • Pulse output stop command
• Pulse deceleration stop command (when unlimited
pulses are not being output)
• Drive direction limit
• All outputs disabled (SM8034)
• Write during RUN
• Positioning address error
ON→OFF condition • When the drive contact is turned off • When the drive contact is turned off
*1 The flag turns on only during one scan time when the activation contact of the instruction turns off and on.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 595
Operation error
Error code Description
(SD0/SD8067)
Axis 1 Axis 2 Axis 3 Axis 4
SD5510 SD5550 SD5590 SD5630
1810H The axis number specified by (d) is used by another instruction.
2820H The value specified by (s) is outside the following range.
0 to 65535
The value specified by (n) is outside the following range.
0 to 65535
The value specified by (d) is outside the following range.
0 to 3
3600H The axis number specified by (d) is not set by parameters.
A function which is set to be not used by parameters (such as interrupt input signal 1 and zero return
relations) is used.
3631H 3632H 3633H 3634H The numbers of pulses (by the pulses conversion) of the positioning address specified by (n) exceed the 32-
bit range.
3641H 3642H 3643H 3644H The numbers of pulses (by the pulses conversion) of the command speed specified by (s) exceed the 32-bit
range.
3651H 3652H 3653H 3654H The operation decelerates and stops by the forward limit or reverse limit during the pulse output or at the
activating of the positioning.
3661H 3662H 3663H 3664H The operation decelerates and stops by the pulse output stop command or special relay whose all outputs
are disabled during the pulse output or at the activating of the positioning.
8 APPLICATION INSTRUCTION
596 8.15 Pulse Related Instruction
16 bit binary pulse width modulation
PWM
This instruction outputs the pulse (in 16-bit data units) of the ON time (in 16-bit data units) specified by (s1) and the period
specified by (s2) to the output destination specified by (d).
Ladder diagram Structured text
ENO:=PWM(EN,s1,s2,d);
FBD/LD
EN ENO
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) ON time or the device number storing the ON time 1 to 65535 16-bit unsigned binary ANY16
(s2) Period or the device number storing the period 1 to 65535 16-bit unsigned binary ANY16 8
(d) Channel number or device number from which pulses are to be Bit/Word ANY_ELEMENTARY
output
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1 *2 *2 *2 *2
Processing details
• This instruction outputs the pulse of the ON time specified by (s1) and the period specified by (s2) to the output destination
specified by (d).
ON
OFF
(s1)
(s2)
• Time with a unit selected on the parameter setting screen (μs or ms) can be specified by (s1) and (s2).
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 597
• The pulse output destination channel number selected on the parameter setting screen can be specified by (d).
• This instruction store the number of pulses, pulse width, and period output from each channel to an SD device. The pulse
width and period are stored in the units set by the parameters. When 0 is specified in the pulse output, pulses are output
without any limitation.
Pulse output Number of output pulses R/W Initial Timing of reflection on Timing of clearing to initial
destination channel value operation value
CH1 SD5301, SD5300 R/W 0 • When the DHCMOV STOP/PAUSE→RUN
instruction is executed*1
CH2 SD5317, SD5316
• When the PWM instruction is
CH3 SD5333, SD5332 executed
CH4 SD5349, SD5348 • END processing
Pulse output ON time R/W Initial Timing of reflection on Timing of clearing to initial
destination channel value operation value
CH1 SD5303, SD5302 R/W 0*2 • When the DHCMOV STOP/PAUSE→RUN
CH2 SD5319, SD5318 instruction is executed*1
• When this instruction is
CH3 SD5335, SD5334 executed*3
CH4 SD5351, SD5350 • END processing
Pulse output Period R/W Initial Timing of reflection on Timing of clearing to initial
destination channel value operation value
CH1 SD5305, SD5304 R/W 0*2 • When the DHCMOV STOP/PAUSE→RUN
instruction is executed*1
CH2 SD5321, SD5320
• When this instruction is
CH3 SD5337, SD5336 executed*3
CH4 SD5353, SD5352 • END processing
*1 When the DHCMOV instruction is used, the latest value can be read. A writable device can be updated immediately.
*2 Parameter setting values are set to an SD device at STOP to RUN.
*3 When this instruction is executed, the pulse width and period specified (s1) and (s2) are set to an SD device.
8 APPLICATION INSTRUCTION
598 8.15 Pulse Related Instruction
• After the pulse output is started from each channel, the pulse output monitor turns on.
Pulse output Pulse output monitor R/W Initial ON timing OFF timing
destination channel value
CH1 SM5300 R OFF • When the HIOEN instruction is • Power on
executed • Reset
CH2 SM5301
• When this instruction is • RUN→STOP/PAUSE
CH3 SM5302 executed • When the specified number of
CH4 SM5303 pulses are output.
• The drive contact is turned off
CH5 SM5304
CH6 SM5305
CH7 SM5306
CH8 SM5307
CH9 SM5308
CH10 SM5309
CH11 SM5310
CH12 SM5311
• This instruction stores the number of pulses output from each channel.
Pulse output Monitoring the current R/W Initial Timing of reflection on Timing of clearing to initial
destination channel number of output pulses value operation value
CH1 SD5307, SD5306 R/W 0 • When the DHCMOV • Power-on
instruction is executed • Reset
CH2 SD5323, SD5322
→ An SD device is updated • STOP/PAUSE→RUN
CH3 SD5339, SD5338 • When the PWM instruction is
CH4 SD5355, SD5354 executed
• END processing
• The number of output pulses set to an SD device is valid for this instruction as well. The setting values are always read and
updated. 8
• When the specified number of output pulses is equal to or less than the number of pulses which have already been output,
pulse output stops after outputting pulses which are being output.
• When the specified number of output pulses is larger than the number of pulses which have already been output, pulse
output stops after outputting set number of pulses.
• When the number of output pulses is set from the no limitation output setting (number of output pulses is 0), the number of
output pulses is not updated (because outputting pulses continues or stops in the no limitation output).
• The maximum number of output pulses which can be output when the PWM instruction is executed once (= maximum
value which can be set to an SD device) is “2147483647”.
• The ON time and period can be set during the pulse output. Setting values are always read and updated.
• When the number of output pulses is 0 (no limitation output setting), the monitor of the current number of output pulses is
set to 0.
• When the number of output pulses is specified, the output pulses are monitored. When the PWM output is executed several
times, the monitor of the number of output pulses is an integrated value.
• The monitor of the current number of output pulses can be changed during the pulse output.
• The monitor of the current number of output pulses is updated when the number of pulses is counted at the falling edge of
pulses in the positive logic and at the rising edge of pulses in the negative logic.
• When the output always remains ON or OFF, the monitor of the current number of output pulses does not change.
• The maximum value of the monitor of the current number of output pulses is “FFFFFFFFH”. After the current number of
output pulses reaches the maximum value, the monitor of the current number of output pulses starts to count again from
“0”.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 599
Precautions
• Specify the ON time by (s1) and the period by (s2) so that [(s2)-(s1)] is equal to or larger than 3 μs.
• For the ON time specified by (s1), specify 2 μs or more in Y0 to Y3 of the CPU module and the output of the high-speed
pulse input/output module, and 200 μs or more in Y4 to Y7 of the CPU module. For the period specified by (s2), specify 5
μs or more for Y0 to Y3 in the CPU module and the output of the high-speed pulse input/output module, and 400 μs or more
in Y4 to Y7 of the CPU module.
• When a channel number that is not selected for the PWM output in the parameter setting is specified for (d), this instruction
is not executed. An operation error occurs.
• Do not specify the channel numbers of the high-speed pulse input/output module (5 to 12) in a program with interrupt
priority set to "1".
• Operations when the PWM output is stopped (while the output pulse is on)
ON time ON time
setting is 5 s setting is 5 s
or less or less
Period
ON time ON time
setting is 5 s setting is 5 s
or more or more
Period
5 s or
more
8 APPLICATION INSTRUCTION
600 8.15 Pulse Related Instruction
• Operations when the PWM output is stopped (while the output pulse is off)
Output stop command
Period
5 s or
less
Period
When the OFF time setting is 5 s or more and 5 s or
less time has elapsed when an output stop command is
issued, outputting pulses stops in 5 s from the stop
command.
5 s or
more
Period
8
When the OFF time setting is 5 s or more and 5 s or
more time has elapsed when an output stop command is
issued, outputting pulses stops with the stop command.
• The PWM output stops when SM8034 is on, and starts when SM8034 is off.
• PWM output does not stop, even if a pulse stop command for positioning is driven.
• When specifying the number of output pulses, executing the PWM instruction, and then outputting pulses again after the
pulse output stops due to the completion of output of the specified number of pulses, turn OFF the contact which drove the
PWM instruction. When driving PWM output by the HIOEN instruction, use the HIOEN instruction to turn PWM output off.
• When the period setting is equivalent to the ON time setting, the output always remains ON. The output ON state continues
even after “Period x Number of output pulses” is finished in this condition.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 601
Operation error
Error code Description
(SD0/SD8067)
1810H The output destination specified by (d) is already used by another instruction (positioning instruction).
(The PWM output is not executed.)
A Y device is specified as the output destination specified by (d), and there is no unused channel number in the parameter setting.
3405H Y10 or later is specified as the output destination specified by (d).
(The PWM output stops.)
3580H An instruction that cannot be used in an interrupt program is used
3600H A channel number that is not selected in the parameter setting are specified for the output destination specified by (d).
(The PWM output is not executed.)
3611H(CH1) The ON time specified by (s1) is larger than the period specified by (s2).
3612H(CH2) (The PWM output stops.)
3613H(CH3)
The ON time or period is less than “1”.
3614H(CH4)
3615H(CH5) The SD device specified for the number of output pulses stores a value outside the available range (0 to 2147483647).
3616H(CH6)
3617H(CH7)
3618H(CH8)
3619H(CH9)
361AH(CH10)
361BH(CH11)
361CH(CH12)
8 APPLICATION INSTRUCTION
602 8.15 Pulse Related Instruction
32 bit binary pulse width modulation
DPWM
This instruction outputs the pulse (in 32-bit data units) of the ON time (in 32-bit data units) specified by (s1) and the period
specified by (s2) to the output destination specified by (d).
Ladder diagram Structured text
ENO:=DPWM(EN,s1,s2,d);
FBD/LD
EN ENO
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) ON time or the device number storing the ON time 1 to 2147483647 32-bit unsigned binary ANY32
(s2) Period or the device number storing the period 1 to 2147483647 32-bit unsigned binary ANY32 8
(d) Channel number or device number from which pulses are to be Bit/Word ANY_ELEMENTARY
output
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d) *1 *2 *2 *2 *2
Processing details
• This instruction outputs the pulse of the ON time specified by (s1) and the period specified by (s2) to the output destination
specified by (d).
ON
OFF
(s1)
(s2)
• Time with a unit selected on the parameter setting screen (μs or ms) can be specified by (s1) and (s2).
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 603
• The pulse output destination channel number selected on the parameter setting screen can be specified by (d).
• This instruction stores the number of pulses, pulse width, and period output from each channel to an SD device. The pulse
width and period are stored in the units set by the parameters. When 0 is specified in the pulse output, pulses are output
without any limitation.
Pulse output Number of output pulses R/W Initial Timing of reflection on Timing of clearing to initial
destination channel value operation value
CH1 SD5301, SD5300 R/W 0 • When the DHCMOV STOP/PAUSE→RUN
instruction is executed*1
CH2 SD5317, SD5316
• When the PWM instruction is
CH3 SD5333, SD5332 executed
CH4 SD5349, SD5348 • END processing
Pulse output ON time R/W Initial Timing of reflection on Timing of clearing to initial
destination channel value operation value
CH1 SD5303, SD5302 R/W 0*2 • When the DHCMOV STOP/PAUSE→RUN
CH2 SD5319, SD5318 instruction is executed*1
• When this instruction is
CH3 SD5335, SD5334 executed*3
CH4 SD5351, SD5350 • END processing
Pulse output Period R/W Initial Timing of reflection on Timing of clearing to initial
destination channel value operation value
CH1 SD5305, SD5304 R/W 0*2 • When the DHCMOV STOP/PAUSE→RUN
instruction is executed*1
CH2 SD5321, SD5320
• When this instruction is
CH3 SD5337, SD5336 executed*3
CH4 SD5353, SD5352 • END processing
*1 When the DHCMOV instruction is used, the latest value can be read. A writable device can be updated immediately.
*2 Parameter setting values are set to an SD device at STOP to RUN.
*3 When this instruction is executed, the pulse width and period specified (s1) and (s2) are set to an SD device.
8 APPLICATION INSTRUCTION
604 8.15 Pulse Related Instruction
• After the pulse output is started from each channel, the pulse output monitor turns on.
Pulse output Pulse output monitor R/W Initial ON timing OFF timing
destination channel value
CH1 SM5300 R OFF • When the HIOEN instruction is • Power on
executed • Reset
CH2 SM5301
• When this instruction is • RUN→STOP/PAUSE
CH3 SM5302 executed • When the specified number of
CH4 SM5303 pulses are output.
• The drive contact is turned off
CH5 SM5304
CH6 SM5305
CH7 SM5306
CH8 SM5307
CH9 SM5308
CH10 SM5309
CH11 SM5310
CH12 SM5311
• This instruction stores the number of pulses output from each channel.
Pulse output Monitoring the current R/W Initial Timing of reflection on Timing of clearing to initial
destination channel number of output pulses value operation value
CH1 SD5307, SD5306 R/W 0 • When the DHCMOV • Power-on
instruction is executed • Reset
CH2 SD5323, SD5322
→ An SD device is updated • STOP/PAUSE→RUN
CH3 SD5339, SD5338 • When the DPWM instruction is
CH4 SD5355, SD5354 executed
• END processing
• The number of output pulses set to an SD device is valid for this instruction as well. The setting values are always read and
updated. 8
• When the specified number of output pulses is equal to or less than the number of pulses which have already been output,
pulse output stops after outputting pulses which are being output.
• When the specified number of output pulses is larger than the number of pulses which have already been output, pulse
output stops after outputting set number of pulses.
• When the number of output pulses is set from the no limitation output setting (number of output pulses is 0), the number of
output pulses is not updated (because outputting pulses continues or stops in the no limitation output).
• The maximum number of output pulses which can be output when the DPWM instruction is executed once (= maximum
value which can be set to an SD device) is “2147483647”
• The ON time and period can be set during the pulse output. Setting values are always read and updated.
• When the number of output pulses is 0 (no limitation output setting), the monitor of the current number of output pulses is
set to 0.
• When the number of output pulses is specified, the output pulses are monitored. When the DPWM output is executed
several times, the monitor of the number of output pulses is an integrated value.
• The monitor of the current number of output pulses can be changed during the pulse output.
• The monitor of the current number of output pulses is updated when the number of pulses is counted at the falling edge of
pulses in the positive logic and at the rising edge of pulses in the negative logic.
• When the output always remains ON or OFF, the monitor of the current number of output pulses does not change.
• The maximum value of the monitor of the current number of output pulses is “FFFFFFFFH”. After the current number of
output pulses reaches the maximum value, the monitor of the current number of output pulses starts to count again from
“0”.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 605
Precautions
• Specify the ON time by (s1) and the period by (s2) so that [(s2)-(s1)] is equal to or larger than 3 μs.
• When a negative value is specified for the ON time by (s1) and the period by (s2), an operation error occurs. (In 16-bit
instruction PWM, no error occurs.)
• For the ON time specified by (s1), specify 2 μs or more in Y0 to Y3 of the CPU module and the output of the high-speed
pulse input/output module, and 200 μs or more in Y4 to Y7 of the CPU module. For the period specified by (s2), specify 5
μs or more for Y0 to Y3 in the CPU module and the output of the high-speed pulse input/output module, and 400 μs or more
in Y4 to Y7 of the CPU module.
• When a channel number that is not selected for the PWM output in the parameter setting is specified for (d), this instruction
is not executed. An operation error occurs.
• Do not specify the channel numbers of the high-speed pulse input/output module (5 to 12) in a program with interrupt
priority set to "1".
• Operations when the PWM output is stopped (while the output pulse is on)
ON time ON time
setting is 5 s setting is 5 s
or less or less
Period
ON time ON time
setting is 5 s setting is 5 s
or more or more
Period
5 s or
more
8 APPLICATION INSTRUCTION
606 8.15 Pulse Related Instruction
• Operations when the PWM output is stopped (while the output pulse is off)
Output stop command
Period
5 s or
less
Period
When the OFF time setting is 5 s or more and 5 s or
less time has elapsed when an output stop command is
issued, outputting pulses stops in 5 s from the stop
command.
5 s or
more
Period
8
When the OFF time setting is 5 s or more and 5 s or
more time has elapsed when an output stop command is
issued, outputting pulses stops with the stop command.
• The PWM output stops when SM8034 is on, and starts when SM8034 is off.
• PWM output does not stop, even if a pulse stop command for positioning is driven.
• When specifying the number of output pulses, executing the PWM instruction, and then outputting pulses again after the
pulse output stops due to the completion of output of the specified number of pulses, turn OFF the contact which drove the
PWM instruction. When driving PWM output by the DHIOEN instruction, use the DHIOEN instruction to turn PWM output
off.
• When the period setting is equivalent to the ON time setting, the output always remains ON. The output ON state continues
even after “Period x Number of output pulses” is finished in this condition.
8 APPLICATION INSTRUCTION
8.15 Pulse Related Instruction 607
Operation error
Error code Description
(SD0/SD8067)
1810H The output destination specified by (d) is already used by another instruction (positioning instruction).
(The PWM output is not executed.)
A Y device is specified as the output destination specified by (d), and there is no unused channel number in the parameter setting
3405H Y10 or later is specified as the output destination specified by (d).
(The PWM output stops.)
3580H An instruction that cannot be used in an interrupt program is used.
3600H A channel number that is not selected in the parameter setting are specified for the output destination specified by (d).
(The PWM output is not executed.)
3611H(CH1) The ON time specified by (s1) is larger than the period specified by (s2).
3612H(CH2) (The PWM output stops.)
3613H(CH3)
In (s1) and (s2), a negative value is specified.
3614H(CH4)
(The PWM output stops.)
3615H(CH5)
3616H(CH6) Values of an SD device for setting pulse width and period of this instruction are incorrect.
3617H(CH7) (The PWM output stops.)
3618H(CH8) The ON time or period is less than “1”.
3619H(CH9)
The SD device specified for the number of output pulses stores a value outside the available range (0 to 2147483647).
361AH(CH10)
361BH(CH11)
361CH(CH12)
8 APPLICATION INSTRUCTION
608 8.15 Pulse Related Instruction
8.16 Input Matrix Instruction
Input matrix
MTR
Reads matrix input as 8-point input × "n"-point output (transistor) in the time division method.
Ladder diagram Structured text
ENO:=MTR(EN, s, n, d1, d2);
FBD/LD
EN ENO
s d1
n d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Input device (X) number of matrix signal input Bit ANYBIT_ARRAY
X0, X10, X20 … final input device number (Only "0" is allowed in (Number of elements: 8) 8
the least significant digit of device numbers.)
(d1) Head device (Y) number of matrix signal output Bit ANY_BOOL
Y0, Y10, Y20 … final output device number (Only "0" is allowed
in the least significant digit of device numbers.))
(d2) Head bit device (Y, M or S) number of ON output destination Bit ANY_BOOL
Y0, Y10, Y20 … final Y number, M0, M10, M20 … final M number
or S0,S10, S20 … final S number (Only "0" is allowed in the least
significant digit of device numbers.)
(n) Number of columns in matrix input 2 to 8 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
*2
(d1)
(d2) *3
(n)
Processing details
• An input signal of 8 points x "n" columns is controlled in the time division method using 8 inputs specified in (s) and
transistor outputs specified in (d1). Each column is read in turn, and then output to devices specified in (d2).
• For each output, the I/O processing is executed immediately in turn in interrupt at every 10 ms or 20 ms.
8 APPLICATION INSTRUCTION
8.16 Input Matrix Instruction 609
• For wiring details, refer to the hardware manual of each CPU module.
Diode Command
(d2)+14
(d2)+15
(d2)+16
(d2)+17
(d2)+10
(d2)+11
(d2)+12
(d2)+13
0.1A(50V) contact
2nd
column 1st column input is received.
(d2)+1
(d2)+2
(d2)+3
(d2)+4
(d2)+5
(d2)+6
(d2)+7
2nd column input is received.
(d2)
1st
column
(d1)+1 [2] [4] [6]
20ms
24V 0V S/S (S) (S)+1 (S)+2 (S)+3 (S)+4 (S)+5 (S)+6 (S)+7 SM8029 (execution
Input (X) [sink] complete)
CPU module Output (Y) [sink]
"n" points
are
occupied.
• In this program example, n=Three outputs (Y20, Y21 and Y22) are set to ON in turn repeatedly. Every time an output is set
to ON, eight inputs in the 1st, 2nd and 3rd columns are received in turn repeatedly, and stored to M30 to M37, M40 to M47
and M50 to M57 respectively. For wiring details, refer to the hardware manual of each CPU module.
(s) (d1) (d2) (n)
M0
MTR X20 Y20 M30 K3
Diode M0
M 50
M 51
M 52
M 53
M 54
M 55
M 56
M 57
0.1A(50V)
1st column input is received.
3rd
column
Y20 [1] [4]
X21 X22 X23 X24 X25 X26 X27
2nd column input is received.
Diode
0.1A(50V)
M 40
M 41
M 42
M 43
M 44
M 45
M 46
M 47
X21 X22 X23 X24 X25 X26 X27 Y22 [3] [6]
Diode 20ms
0.1A(50V)
M 30
M 31
M 32
M 33
M 34
M 35
M 36
M 37
SM8029 (execution
1st complete)
column
24V 0V S/S X20 X21 X22 X23 X24 X25 X26 X27
Sink input
CPU module Sink output
Precautions
• Eight devices are occupied from the device specified in (s).
• When specifying the output in( d2) , make sure that "n" output numbers specified in (d1) does not overlap the output
specified in (d2).
8 APPLICATION INSTRUCTION
610 8.16 Input Matrix Instruction
• The MTR instruction can only be used once in a program.
• One diode of 0.1 A/50 V is required for each switch.
• Use the transistor output format.
• If write during RUN is executed while the MTR instruction is being executed, the control right is released by the END
processing. The MTR instruction executed first in the next scan will acquire the control right next.
• For the MTR instruction, set the command input to normally Open.
M
(normally Open)
MTR X20 Y40 M0 K8
• Inputs available in MTR instruction , use inputs X20 and later under normal conditions.
• When using the inputs X0 to X17,the receiving speed is higher. Because the output transistor recovery time is long and the
input sensitivity is high, however, erroneous input pulses may be counted. Change the input response time of unit
parameter setting to “5 ms” to input at intervals of 10 ms. To prevent erroneous input pulses, connect pull-up resistors (3.3
kΩ/0.5 W) to transistor outputs used in MTR instruction. For pull-up resistors, use the power supply shown in the table
below. The figure below shows an example of the FX5U-64MT/ES (sink input/sink output).
Power supply used for pull-up resistors transistor output
AC power type CPU module. Service power supply
Matrix
circuit
Refer to the
24V S/S 0V X0 X1 X2 X3 X4 X5 X6 X7 previous page.
FX5U-64MT/ES
3.3k /0.5W
Pull-up resistor
• Because 64 input points (8 rows × 8 columns) are received in a cycle of 80 or 160 ms, the ON/OFF duration of each input
signal should be greater than or equal to the value shown below:
When inputs X0 to When inputs X20 or
X17 are used later are used
80 ms 80 ms 160 ms 160 ms
Operation error
Error code Description
(SD0/SD8067)
3405H The value specified by (n) is outside the following range.
2 to 8
2820H The device range specified by (s) exceeds the corresponding device range.
The device range specified by (d1) exceeds the corresponding device range.
The device range specified by (d2) exceeds the corresponding device range.
1811H The number of times the MTR instruction is simultaneously driven exceeds 1.
3582H The MTR instruction is used in the interrupt program.
8 APPLICATION INSTRUCTION
8.16 Input Matrix Instruction 611
8.17 Initial State
Initial State
IST
Automatically controls the initial state and special relays in a step ladder program.
Ladder diagram Structured text
ENO:=IST(EN, s, d1, d2);
FBD/LD
EN ENO
s d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head bit device number of the selector switch in the operation Bit ANYBIT_ARRAY
mode (Number of elements: 8)
(d1) Smallest state relay number of practical state relays in the Bit ANY_BOOL
automatic mode
((d1) < (d2))
(d2) Largest state relay number of practical state relays in the Bit ANY_BOOL
automatic mode
((d1) < (d2))
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1 *3
(d1) *2
*2
(d2)
*1 S cannot be used.
*2 Only S can be used.
*3 T, ST, C cannot be used.
Processing details
• Specify the head input in the operation mode in (s).
• Selector switches in the operation mode occupy eight devices from the head device.
8 APPLICATION INSTRUCTION
612 8.17 Initial State
• The switch functions shown in the table below are assigned to each of the devices specified for selector switches in the
operation mode. When X20 is assigned, it is necessary to set X20 to X24 as rotary switches so that they do not turn ON at
the same time. It is not necessary to wire unused switches, but they cannot be used for any other purpose because they
are occupied by IST instruction.
Source Device number Switch function Descriptions
(example)
(s) X20 Individual operation Each load is turned ON and OFF by an individual pushbutton switch.
(s)+1 X21 Return to zero point When the pushbutton switch for zero return is pressed, the machine automatically returns to
the zero point.
(s)+2 X22 Stepping Every time the start button is pressed, the machine performs one process.
(s)+3 X23 Cycle operation When the start button is pressed while the machine is located at the zero point, the machine
performs one cycle of automatic operation and stops at the zero point.
If the stop button is pressed in the middle of one cycle, the machine stops immediately. When
the start button is pressed after that, the machine performs the continuous operation from the
last position, and automatically stops at the zero point.
(s)+4 X24 Continuous operation When the start button is pressed while the machine is located at the zero point, the machine
starts continuous operation.
When the stop button is pressed, the machine finishes the current cycle until the zero point,
and then stops at the zero point.
(s)+5 X25 Zero return start Starts return to the zero point.
(s)+6 X26 Automatic start Starts the stepping operation, cycle operation or continuous operation.
(s)+7 X27 Stop Stops each operation.
• Specify the smallest device number of practical state relays in (d1) (for the automatic mode).
• Specify the largest device number of practical state relays in (d2) (for the automatic mode).
• While the command input is ON, the following devices are automatically switched and controlled. While the command input
is OFF, the devices are not switched.
Device number Descriptions ON/OFF condition 8
SM8040 STL transfer disable ON condition Always remains ON in the individual operation.
Always remains ON in the stepping operation except when the [START] button is
pressed.
Turns ON when the [STOP] button is pressed during return to the zero point and in
the cycle operation.
OFF condition Turns OFF when the [START] button is pressed in the stepping operation.
Turns OFF after the [STOP] button is pressed during return to the zero point and in
the cycle operation.
SM8041 Transfer start ON condition Turns ON when the [START] button is pressed in the stepping operation and cycle
operation.
Turns ON after the [START] button is pressed in the cycle operation.
OFF condition Turns OFF when the operation mode is changed from RUN to STOP.
Always remains OFF in the individual operation and during return to the zero point.
Turns OFF after the [STOP] button is pressed in the continuous operation.
SM8042 Start pulse ON condition Instantaneously turns ON when the [START] button is pressed.
OFF condition Remains OFF except in the ON condition.
SM8043 Zero return complete ON condition Turns ON when return to the zero point is completed (in the user program).
OFF condition Turns OFF when the operation mode is changed from RUN to STOP.
Remains OFF while return to the zero point is not completed.
SM8044 Zero return condition ON condition Turns ON when the zero point condition is established (in the user program).
OFF condition Turns OFF when the operation mode is changed from RUN to STOP.
Remains OFF while return to the zero point is not completed.
SM8045 All output reset disable ON condition Turns ON when all-output reset is not executed (in the user program).
OFF condition Turns OFF when all-output reset is executed (in the user program).
SM8046 STL state ON ON condition Turns ON when SM8047 (Enable STL monitoring) is ON and either step relay (device
S) is ON.
OFF condition Turns OFF when SM8047 (Enable STL monitoring) is OFF or when SM8047 (STL
monitor enable) is ON and all step relays (device S) are OFF.
SM8047 Enable STL monitoring ON condition Turns ON when the IST instruction command is given.
OFF condition Turns OFF when the step ladder is finished (in the user program).
8 APPLICATION INSTRUCTION
8.17 Initial State 613
Device number Descriptions ON/OFF condition
S0 Individual operation ON condition when a individual operation mode is selected.
initial state
OFF condition Except a individual operation mode.
S1 Zero return initial state ON condition when a zero return operation mode is selected.
OFF condition Except a zero return operation mode.
S2 Automatic operation ON condition when a automatic operation mode is selected.
initial state OFF condition Except a automatic operation mode.
• If the devices are switched among individual operation (X20), zero return (X21) and automatic operation (X22, 23 and X24)
while the zero return complete device (SM8043) is OFF, all outputs are set to OFF. Automatic operation can be started
again after zero return is completed.
Precautions
• It is not necessary to use all switches for mode selection. When some switches are not used, leave the corresponding
numbers in the unused status. Such numbers cannot be used for any other purpose.
• The IST instruction should be programmed earlier than a series of STL circuit such as state relays S0 to S2.
• Use the state relays S10 to S19 for the zero return operation. In the final state in the zero return operation, set SM8043 to
ON, and then let it be reset to OFF by itself.
• The IST instruction can only be used once in a program.
8 APPLICATION INSTRUCTION
614 8.17 Initial State
■IST instruction equivalent circuit
• The details on special relays (M) and initial state relays (S0 to S9) which are automatically controlled by the IST instruction
is as shown in the equivalent circuit below. (Refer to the equivalent circuit below for reference.) This equivalent circuit
cannot be programmed.
Continuous
operation Stepping
X24 SM8041 X27 X22 operation
SM8041 is set to ON when the start button
SM8041 is pressed in the automatic mode.
Stop Cycle
X26 Automatic start X23 operation Transfer Especially in the continuous mode,
start SM8041 holds its status by itself, and is
Continuous reset when the stop button is pressed.
X24 operation
X26 Automatic start X20
PLS SM8042
X25 Zero return start Individual
operation Start pulse
SM8002Initial pulse
SM8040Self-holding
Even if the mode is switched from automatic operation to zero return operation while S2 is ON, state relays
(except initial state relays) and outputs are not reset.
8 APPLICATION INSTRUCTION
8.17 Initial State 615
■Example of IST instruction introduction (example of workpiece transfer mechanism)
• Operation mode
Stepping
Mechanism for transferring a workpiece from the
operation X22 point A to the point B using the robot hand
Zero return Zero return
operation mode
Cycle
operation mode Y3
PB
X21 X23 Rightward Right limit X003
X25 Y4
Left limit X4 Leftward
Individual Continuous Power supply
operation mode operation mode Upper
X20 X24 PB
Leftward limit X2 Moving down
Moving up travel Unclamping
PB PB PB PB
Y2 Y0
X5 X6 X7 Start X26
Rightward Emergency stop
Moving down travel Clamping
PB
Moving Lower
PB PB PB PB
up limit X1
X10 X11 X12 Stop X27
Clamping Y1
Pushbutton switches for individual operations Unclamping Y1
of the robot hand shown in the figure on the right Workpiece
Pushbutton switches for the external circuit to
Point A Point B
turn ON and OFF the load power supply
• Transfer mechanism
Start Left limit X4
X26
(4) Rightward Y3
Zero point
(8) Leftward Y4
Upper
Right limit limit
(1) Moving X3 X2
down Upper limit X2
Y0 (1) Moving down
Y0 (7) Moving up
Lower (3) Moving up Y2
limit Y2
X1 Lower
limit
What is the zero point condition? X1
Clamping Upper limit X2 is ON, left limit Unclamping
X4 is ON and unclamping Y1
(2) Clamping is OFF. (6) Unclamping
Y1 ON Y1 OFF
• For using IST instruction, it is necessary to assign inputs having consecutive device numbers as shown below for mode
inputs. When using non-consecutive inputs or omitting some modes, change the layout by using an auxiliary relay as the
head input for mode specification as shown in the figure below.
Input device Assignment
X20 Individual operation mode
X21 Zero return operation mode
X22 Stepping operation mode
8 APPLICATION INSTRUCTION
616 8.17 Initial State
Input device Assignment
X23 Cycle operation mode
X24 Continuous operation mode
X25 Zero return start
X26 Automatic mode start
X27 Stop
8 APPLICATION INSTRUCTION
8.17 Initial State 617
• Special relay (SM) used in the IST instruction are classified into two types. Some special relays are automatically controlled
by the IST instruction itself according to the situation. Other special relays should be controlled by a program for
preparation of operation or for purpose of control.
Special relay Description Remarks
SM8040 When this special relay turns ON, transfer of every state is disabled. Special relays
(STL transfer disable) Individual operation mode: SM8040 is always effective. automatically controlled
Zero return operation mode and cycle operation mode: When the stop button is pressed, the by the IST instruction
operation is held until the start button is pressed.
Stepping operation mode: SM8040 is always effective except when the start button is pressed.
When the start button is pressed, SM8040 is not effective and transfer of states is allowed.
Others: The operation is latched when the PLC mode switches from STOP to RUN, and reset when
the start button is pressed. Even in the transfer disabled status, the operation is held for outputs in
the states.
SM8041 This special relay allows transfer from the initial state S2 to the next state.
(Transfer start) Individual operation mode and zero return operation mode: SM8041 is not effective.
Stepping operation mode and cycle operation mode: SM8041 is effective only while the start button
is pressed and held.
Continuous operation mode: The operation is latched when the start button is pressed, and cleared
when the stop button is pressed.
SM8042 SM8042 is activated instantaneously only when the start button is pressed.
(Start pulse)
SM8047 When IST instruction is executed, SM8047 is set to ON.
(Enable STL monitoring) When the SM8047 turns ON, STL monitoring becomes valid, and state relay numbers (S0 to S899)
in the ON status are stored in turn in the ascending order of device number to the special register
SD8040 to SD8047.
Up to eight state relay numbers in the ON status can be monitored.
If either state relay is ON, the special auxiliary relay SM8046 is set to ON.
SM8043 Set this special relay (SM) to ON by a user program when the machine returns to the zero point in Special relays controlled
(Zero return complete) the zero return operation mode. by a sequence program
SM8044 Detect the zero point condition of the machine, and drive this special relay. This signal is effective
(Zero point condition) in every mode.
SM8045 When the mode is switched among individual operation mode, zero return operation mode and
(All output reset disable) automatic mode, all outputs and operation state relays are reset if the machine is not located at the
zero point. If SM8045 has been set to ON in advance, however, only operation state relays are
reset.
Program example
• While the machine is operating, the operation mode can be switched arbitrarily (among stepping operation, cycle operation
and continuous operation) in the automatic mode. When the operation mode is switched between the individual operation
mode, zero return operation mode and automatic mode while the machine is operating, all outputs are reset once to assure
safety, after which the following mode becomes valid. (While SM8045 (All output reset disable) is ON, outputs are not reset
at all.)
SM8044
X4 X2 Y1
Zero point condition
Left limit Upper Unclamping
limit
SM8000
IST X20 S20 S27 Initial state
RUN monitor
8 APPLICATION INSTRUCTION
618 8.17 Initial State
• Programming is not required when the individual operation mode is not provided.
X7 Unclamping command
RST Y1
Moving-up
X5 command Y0 Y2
Moving up
Moving-down
X10 command Y2 Y0
Moving down
Leftward travel
X6 command X2 Y3 Y4
Leftward travel
Rightward travel
X11 command X2 Y4 Y3
Rightward travel
Upper limit
RETSTL
• Programming is not required when the zero return operation mode is not provided. It is necessary to set SM8043 (zero
return complete) to ON before starting the automatic mode.
Y4
Leftward travel
X4
SET S12
Left limit
STL S12
SM400
SET SM8043 Zero return complete
SM8043
RST S12
Make sure to use the state relays S10 to S19
for the zero return operation. In the final state,
RETSTL drive SM8043, and then reset the final state.
8 APPLICATION INSTRUCTION
8.17 Initial State 619
• Automatic mode (stepping operation mode, cycle operation mode or continuous operation mode)
SM400 Y0
Moving down
X1
SET S21
Down limit
STL S21
SM400
SET Y1 Clamping
T0 K10
T0
SET S22
STL S22
SM400 Y2
Moving up
X2
SET S23
Upper limit
STL S23
SM400 Y3
Rightward travel
X3
SET S24
Right limit
STL S24
SM400 Y0
Moving down
X1
SET S25
Down limit
STL S25
S25
RST Y1 Unclamping
T1 K10
T1
SET S26
STL S26
SM400 Y2
Moving up
X2
SET S27
Upper limit
STL S27
SM400 Y4
Leftward travel
X4 S2
Left limit
RETSTL
END
8 APPLICATION INSTRUCTION
620 8.17 Initial State
Operation error
Error code Description
(SD0/SD8067)
1811H The number of times the IST instruction is simultaneously driven exceeds 1.
2820H The device numbers specified in (d1) and (d2) show the following relationship:
(d1) ≥ (d2)
Eight points are not secured from the device specified in (s).
An unavailable device is set in (s).
An unavailable device is set in (d1).
An unavailable device is set in (d2).
8 APPLICATION INSTRUCTION
8.17 Initial State 621
8.18 Drum Sequence
16-bit binary data absolute method
ABSD
This instruction creates many output patterns corresponding to the current value (16-bit binary data) of a counter.
Ladder diagram Structured text
ENO:=ABSD(EN,s1,s2,n,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number storing the data table (with rising and falling 16-bit signed binary ANY16
point data)
(s2) Counter number for monitoring the current value compared with 16-bit signed binary ANY16
the data table
(d) Head bit device number to be output Bit ANY_BOOL
(n) Number of lines in the table and the number of output bit devices 1 to 64 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2) *1
(d) *2
(n)
Processing details
• In this example, outputs are controlled to on or off by one table rotation (0 to 360° using the rotation angle signal of 1°/
pulse).
8 APPLICATION INSTRUCTION
622 8.18 Drum Sequence
• The current value (s2) of the counter is compared with the data table with "n" lines starting from (s1) (which occupies "n"
lines × 2 devices), and consecutive "n" outputs starting from (d) are controlled to on or off during one rotation.
Command
input
ABSD (s1) (s2) (d) (n)
(s2) X1
RST (s2)
K360
X1
(s2)
Rotation angle signal of 1°/pulse
• Write the following data to (s1) to (s1)+2(n)-1 in advance by a transfer instruction: For example, store 16-bit rising point data
in even-numbered devices and 16-bit falling point data in odd-numbered devices.
Rising point Falling point Target output
Data value (example) Data value (example)
(s1) 40 (s1)+1 140 (d)
(s1)+2 100 (s1)+3 200 (d)+1
(s1)+4 160 (s1)+5 60 (d)+2
(s1)+6 240 (s1)+7 280 (d)+3
(s1)+2(n)-2 (s1)+2(n)-1 (d)+n-1
• The following figure shows the output patterns for device points (n) starting from (d) when the command input is set to on.
Each rising point/falling point can be changed by overwriting the data in (s1) to (s1)+2(n)-1.
40 140
(d)
100 200
8
(d)+1
60 160
(d)+2
240 280
(d)+3
0 180 360
Precautions
• When specifying the nibble of a bit device to (s1), specify a multiple of 16 (0, 16, 32, 64 ...) as a device number and always
specify K4 for the number of digits.
• The value of (n) determines the number of target outputs (1 ≤ (n) ≤ 64).
• Even if the command input is set to OFF, the ON/OFF status of outputs does not change.
Operation error
Error code Description
(SD0/SD8067)
2820H The number of device points specified by (s1) or (d) is insufficient.
3405H The value specified by (n) is outside the following range.
1 to 64
8 APPLICATION INSTRUCTION
8.18 Drum Sequence 623
32-bit binary data absolute method
DABSD
This instruction creates many output patterns corresponding to the current value (32-bit binary data) of a counter.
Ladder diagram Structured text
ENO:=DABSD(EN,s1,s2,n,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number storing the data table (with rising and falling 32-bit signed binary ANY32
point data)
(s2) Counter number for monitoring the current value compared with 32-bit signed binary ANY32
the data table
(d) Head bit device number to be output Bit ANY_BOOL
(n) Number of lines in the table and the number of output bit devices 1 to 64 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2) *1
*2
(d)
(n)
Processing details
• In this example, outputs are controlled to on or off by one table rotation (0 to 360° using the rotation angle signal of 1°/
pulse).
• The current value (s2) of the counter is compared with the data table with "n" lines starting from (s1) (which occupies "n"
lines × 4 devices), and consecutive "n" outputs starting from (d) are controlled to on or off during one rotation.
Command
input
DABSD (s1) (s2) (d) (n)
(s2) X1
RST (s2)
K360
X1
(s2)
Rotation angle signal of 1°/pulse
8 APPLICATION INSTRUCTION
624 8.18 Drum Sequence
• Write the following data to (s1), (s1)+1 to (s1)+4(n)-2, and (s1)+4(n)-1 in advance by a transfer instruction: For example,
store 32-bit rising point data in even-numbered devices and 32-bit falling point data in odd-numbered devices.
Rising point Falling point Target output
Data value (example) Data value (example)
(s1)+1, (s1) 40 (s1)+3, (s1)+2 140 (d)
(s1)+5, (s1)+4 100 (s1)+7, (s1)+6 200 (d)+1
(s1)+9, (s1)+8 160 (s1)+11, (s1)+10 60 (d)+2
(s1)+13, (s1)+12 240 (s1)+15, (s1)+14 280 (d)+3
(s1)+4(n)-3, (s1)+4(n)-4 (s1)+4(n)-1, (s1)+4(n)-2 (d)+n-1
• The following figure shows the output patterns for device points (n) starting from (d) when the command input is set to on.
Each rising point/falling point can be changed by overwriting the data in (s1) to (s1)+2(n)-1.
40 140
(d)
100 200
(d)+1
60 160
(d)+2
240 280
(d)+3
0 180 360
Precautions
• The DABSD instruction can specify a high-speed counter. When the high-speed counter is specified, the output pattern
contains response delay caused by the scan cycle with regard to the current value of a counter.
8
• When specifying the nibble of a bit device to (s1), specify a multiple of 16 (0, 16, 32, 64 ...) as a device number and always
specify K8 for the number of digits.
• The value of (n) determines the number of target outputs (1 ≤ (n) ≤ 64).
• Even if the command input is set to OFF, the ON/OFF status of outputs does not change.
Operation error
Error code Description
(SD0/SD8067)
2820H The number of device points specified by (s1) or (d) is insufficient.
3405H The value specified by (n) is outside the following range.
1 to 64
8 APPLICATION INSTRUCTION
8.18 Drum Sequence 625
Relative method
INCD
This instruction creates many output patterns using a pair of counters.
Ladder diagram Structured text
ENO:=INCD(EN,s1,s2,n,d);
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head word device number storing the set value 16-bit signed binary ANY16
(s2) Head counter number for monitoring current value is monitored 16-bit signed binary ANY16
(d) Head bit device number to be output Bit ANY_BOOL
(n) Number of output bit devices 1 to 64 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2) *1
(d) *2
(n)
Processing details
• The current value of a counter is compared with the data table having "n" lines starting from (s1) (which occupies "n" lines ×
1 device). When the value is equivalent to the table data, the current output is reset, and the next output is controlled. In this
way, the ON/OFF status of specified outputs is controlled in turn.
■Operation example
• The following ladder example shows the operation. (s2) occupies two points. In the following timing chart, C0 and C1
correspond to the two points.
X0
INCD D300 C0 M0 K4
SM412 K9999
C0
1 sec clock
8 APPLICATION INSTRUCTION
626 8.18 Drum Sequence
• Suppose that the following data is written in advance by a transfer instruction:
Device storing data Output
Data value (example) Example
(s1) D300=20 (d) M0
(s1)+1 D301=30 (d)+1 M1
(s1)+2 D302=10 (d)+2 M2
(s1)+3 D303=40 (d)+3 M3
(s1)+(n)-1 (d)+(n)-1
• Timing chart
X0
30 40
C0 20 20 20
Current 10
Value
C1 3
Current 2
1 1 1
Value 0 0 0
M0
M1
M2
M3
Precautions
When specifying the nibble of a bit device to (s1), specify a multiple of 16 (0, 16, 32, 64 ...) as a device number.
Operation error
Error code Description
(SD0/SD8067)
2820H The number of device points specified by (s1), (s2), or (d) is insufficient.
3405H The value specified by (n) is outside the following range.
1 to 64
8 APPLICATION INSTRUCTION
8.18 Drum Sequence 627
8.19 Check Code
Check code
CCD(P)
These instructions calculate the horizontal parity value and sum check value in the error check methods used in
communication. There is another check method, called CRC (cyclic redundancy check). For obtaining CRC value, use the
CRC(P) instructions.
Ladder diagram Structured text
ENO:=CCD(EN,s,n,d);
ENO:=CCDP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number of applicable device 16-bit signed binary ANY16
(d) Head device number storing the calculated data 16-bit signed binary ANY16_ARRAY
(Number of elements: 2)
(n) Number of data 1 to 32767 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d) *1
(n)
8 APPLICATION INSTRUCTION
628 8.19 Check Code
Processing details
• These instructions calculate the addition data and horizontal parity value of data stored in (s) to (s)+(n)-1. The addition data
is stored to (d), and the horizontal parity value is stored to (d)+1. The 16-bit mode and 8-bit mode are available for these
instructions. For the operation in each mode, refer to the proceeding pages.
• 16-bit conversion mode (while SM8161 is OFF)
With regard to (n) data points starting from (s), the addition data and horizontal parity data of high-order 8 bits and low-order 8 bits are stored to (d) and
(d)+1 respectively.
SM8161 is shared with the RS2, ASCI(P), HEX(P), and CRC(P) instructions. SM8161 must always be off in the 16-bit mode.
SM8161 is cleared when the CPU module mode is changed from RUN to STOP.
In the following program, conversion is executed as follows:
SM400
SM8161 16-bit conversion mode
X10
CCD D100 D0 K10
D0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1091 in BCD.
D1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 Horizontal parity
8 APPLICATION INSTRUCTION
8.19 Check Code 629
• 8-bit conversion mode (while SM8161 is ON)
With regard to (n) data points starting from (s), the addition data and horizontal parity data of only low-order 8 bits are stored to (d) and (d)+1 respectively.
SM8161 is shared with the RS2, ASCI(P), HEX(P), and CRC(P) instructions. SM8161 must always be on in the 8-bit mode.
SM8161 is cleared when the CPU module mode is changed from RUN to STOP.
In the following program, conversion is executed as follows:
SM400 16 bits
SM8161 8-bit conversion mode
X10
CCD D100 D0 K10 Ignored Low-order 8 bits
Source data
D0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1091 in BCD.
D1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 Horizontal parity
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s) or (d) exceeds the corresponding device range.
3405H The value specified by (n) is outside the following range.
1 to 32767
8 APPLICATION INSTRUCTION
630 8.19 Check Code
8.20 Data Operation Instruction
Searching 16-bit data
SERMM(P)
These instructions search for the same data, maximum value and minimum value in a data table.
Ladder diagram Structured text
ENO:=SERMM(EN,s1,s2,n,d);
ENO:=SERMMP(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number in which same data, maximum value and 16-bit signed binary ANY16
8
minimum value are searched
(s2) Data to be searched for or device number storing data 16-bit signed binary ANY16
(d) Head device number storing number of same data, maximum 16-bit signed binary ANY16_ARRAY
value and minimum value detected by search (Number of elements: 5)
(n) Number of data in which same data, maximum value and 1 to 65535 16-bit unsigned binary ANY16_U
minimum value are searched
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
(n)
Processing details
• These instructions search the same data as the 16-bit binary data of (s2) in (n) data starting from (s1), and store the search
result in (d) to (d)+4.
• When the same data exists, five devices starting from (d) store the number of same data, first position, last position,
maximum value position and minimum value position.
• When the same data does not exist, five devices starting from (d) store the number of same data, first position, last position,
maximum value position and minimum value position. In this case, however, 0 is stored in three devices starting from (d)
(which store the number of same data, first position and last position).
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 631
• The following table shows example of search result table configuration and data. (n=10)
Searched device Searched data Comparison data Data position Search result
(s1) (s1) value (example) (s2) value (example) Maximum Same (d) Minimum
value (d)+4 value (d)+3
(s1) K100 K100 0 (First time)
(s1)+1 K111 1
(s1)+2 K100 2
(s1)+3 K98 3
(s1)+4 K123 4
(s1)+5 K66 5
(s1)+6 K100 6 (Last)
(s1)+7 K95 7
(s1)+8 K210 8
(s1)+9 K88 9
Precautions
• Comparison is executed algebraically. (-10<2)
• When there are two or more maximum or minimum values in the searched data, the last position of the max/min is stored
respectively.
• When these instructions are driven, five devices ((d), (d)+1, (d)+2, (d)+3, and (d)+4) are occupied for storing the search
result (d). Make sure that these devices are not used in other controls for the machine.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s1) or (d) exceeds the corresponding device range.
3405H The value stored in a device specified by (n) is 0.
8 APPLICATION INSTRUCTION
632 8.20 Data Operation Instruction
Searching 32-bit data
DSERMM(P)
These instructions search for the same data, maximum value and minimum value in a data table.
Ladder diagram Structured text
ENO:=DSERMM(EN,s1,s2,n,d);
ENO:=DSERMMP(EN,s1,s2,n,d);
(s1) (s2) (d) (n)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number in which same data, maximum value and 32-bit signed binary ANY32
minimum value are searched
(s2)
(d)
Data to be searched for or device number storing data
Head device number storing number of same data, maximum
32-bit signed binary
32-bit signed binary
ANY32
ANY32_ARRAY
8
value and minimum value detected by search (Number of elements: 5)
(n) Number of data in which same data, maximum value and 1 to 65535 16-bit unsigned binary ANY16_U
minimum value are searched
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
(n)
Processing details
• These instructions search the same data as the 32-bit binary data of (s2)+1 and (s2) in (n) data starting from (s1)+1 and
(s1), and store the search result in (d)+1, (d) to (d)+9, and (d)+8.
• When the same data exists, five 32-bit binary data devices starting from (d)+1 and (d) store the number of same data, first
position, last position, maximum value position and minimum value position.
• When the same data does not exist, five 32-bit binary data devices starting from (d)+1 and (d) store the number of same
data, first position, last position, maximum value position and minimum value position. In this case, however, 0 is stored in
three 32-bit devices starting from (d)+1 and (d) (which store the number of same data, first position and last position).
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 633
• The following table shows example of search result table configuration and data. (n=10)
Searched device Searched data Comparison data Data position Search result
(s1) (s1) value (s2) value Maximum value Same (d) Minimum value
(example) (example) (d)+9, (d)+8 (d)+7, (d)+6
(s1)+1, (s) K100000 K100000 0 (First time)
(s1)+3, (s1)+2 K110100 1
(s1)+5, (s1)+4 K100000 2
(s1)+7, (s1)+6 K98000 3
(s1)+9, (s1)+8 K123000 4
(s1)+11, (s1)+10 K66000 5
(s1)+13, (s1)+12 K100000 6 (Last)
(s1)+15, (s1)+14 K95000 7
(s1)+17, (s1)+16 K910000 8
(s1)+19, (s1)+18 K910000 9
Precautions
• Comparison is executed algebraically. (-10<2)
• When there are two or more maximum or minimum values in the searched data, the last position of the max/min is stored
respectively.
• When these instructions are driven, five devices ([(d)+1,(d)], [(d)+3, (d)+2], [(d)+5, (d)+4], [(d)+7, (d)+6], and [(d)+9, (d)+8])
are occupied for storing the these result (d). Make sure that these devices are not used in other controls for the machine.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s1) or (d) exceeds the corresponding device range.
3405H The value stored in a device specified by (n) is 0.
8 APPLICATION INSTRUCTION
634 8.20 Data Operation Instruction
Bit check of 16-bit data
SUM(P)
These instructions store the total bits of 1 in the binary 16-bit data of the device specified by (s) to the device specified by (d).
Ladder diagram Structured text
ENO:=SUM(EN,s,d);
ENO:=SUMP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number that counts the total bits of 1 16-bit signed binary ANY16
(d) Head device number storing the total bits 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices 8
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions store the total bits of 1 in the binary 16-bit data of the device specified by (s) to the device specified by
(d).
b15 b8b7 b0
(s) 1 1 0 0 1 0 1 1 0 0 1 1 0 0 0 1 The total of 1 is stored in the binary data. (In the example shown on the left, the total is 8.)
b15 b8b7 b0
(d) 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
• When all binary 16-bit data of the device specified by (s) are 0 (off), the zero flag M8020 turns on.
Precautions
While the command input is off, the instruction is not executed. The output of the number of bits in the on status is latched in
the previous status.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 635
Bit check of 32-bit data
DSUM(P)
These instructions store the total bits of 1 in the binary 32-bit data of the device specified by (s) to the device specified by (d).
Ladder diagram Structured text
ENO:=DSUM(EN,s,d);
ENO:=DSUMP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number that counts the total bits of 1 32-bit signed binary ANY32
(d) Head device number storing the total bits 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions store the total bits of 1 in the binary 32-bit data of the device specified by (s) to the device specified by
(d).
(s)+1 (s)
The total of 1 is stored in the binary data. (In the example shown on the left, the
b31 b16 b15 b0 total is 16.)
1 0 0 1 1 1 0 0 1 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0 1 1 1 1 0 1 1 0
b15 b8b7 b0
(d) 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
• When all binary 32-bit data of the device specified by (s) are 0 (off), the zero flag M8020 turns on.
Precautions
While the command input is off, the instruction is not executed. The output of the number of bits in the on status is latched in
the previous status.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
636 8.20 Data Operation Instruction
Bit judgment of 16-bit data
BON(P)
These instructions check whether (n) bit(s) of binary 16-bit data of the device specified by (s) are on or off, and output the
result to the device specified by (d).
Ladder diagram Structured text
ENO:=BON(EN,s,n,d);
ENO:=BONP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Word device number storing the data 16-bit signed binary ANY16
(d) Bit device number to be driven Bit ANY_BOOL
(n) Bit position to be checked 0 to 15 16-bit unsigned binary ANY16_U
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d) *1
(n)
Processing details
• These instructions check whether (n) bit(s) of binary 16-bit data of the device specified by (s) are on or off, and output the
result to the device specified by (d).
• When the result above is on, these instructions turn (d) on. When the result above is off, these instructions turn (d) off.
• When a constant (K) is specified in the device specified by (s), it is automatically converted into binary.
(s)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 637
Operation error
Error code Description
(SD0/SD8067)
3405H The value specified by (n) is outside the following range.
0 to 15
8 APPLICATION INSTRUCTION
638 8.20 Data Operation Instruction
Bit judgment of 32-bit data
DBON(P)
These instructions check whether (n) bit(s) of binary 32-bit data of the device specified by (s) are on or off, and output the
result to the device specified by (d).
Ladder diagram Structured text
ENO:=DBON(EN,s,n,d);
ENO:=DBONP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Word device number storing the data 32-bit signed binary ANY32
(d) Bit device number to be driven Bit ANY_BOOL
(n) Bit position to be checked 0 to 31 16-bit unsigned binary ANY16_U
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d) *1
(n)
Processing details
• These instructions check whether (n) bit(s) of binary 32-bit data of the device specified by (s) are on or off, and output the
result to the device specified by (d).
• When the result above is on, these instructions turn (d) on. When the result above is off, these instructions turn (d) off.
• When a constant (K) is specified in the device specified by (s), it is automatically converted into binary.
(s)+1, (s)
b31 b30 b29 … b17 b16 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1 0 1 … 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 1 1
K31 K30 K29 … K17 K16 K15 K14 K13 K12 K11 K10 K9 K8 K7 K6 K5 K4 K3 K2 K1 K0 (n)
(d)
(n)=5
0 (OFF)
(n)=29
1 (ON)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 639
Operation error
Error code Description
(SD0/SD8067)
3405H The value specified by (n) is outside the following range.
0 to 31
8 APPLICATION INSTRUCTION
640 8.20 Data Operation Instruction
Searching the maximum value of 16-bit data
MAX(P)(_U)
These instructions search the maximum value from the (n) point(s) of 16-bit binary data in the device starting from the one
specified by (s), and store the maximum value in the device specified by (d).
Ladder diagram Structured text*1
ENO:=MAXP(EN,s,n,d); ENO:=MAXP_U(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The MAX and MAX_U instructions are not supported by the ST language and the FBD/LD language. Use MAX of the standard function.
Page 998 MAX(_E), MIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) MAX(P) Head device number where the maximum value is searched 16-bit signed binary ANY16_S
8
MAX(P)_U 16-bit unsigned binary ANY16_U
(d) MAX(P) Head device number for storing the maximum value 16-bit signed binary ANY16_S_ARRAY
(Number of elements: 3)
MAX(P)_U 16-bit unsigned binary ANY16_U_ARRAY
(Number of elements: 3)
(n) Number of data to be searched 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 641
Processing details
• These instructions search the maximum value from the (n) point(s) of 16-bit binary data in the device starting from the one
specified by (s), and store the maximum value in the device specified by (d). These instructions start searching from the
device specified by (s), and store the location from (s) of the first maximum value in (d)+1 and the number of maximum
values in (d)+2.
Operation error
Error code Description
(SD0/SD8067)
2820H The (n) point(s) of data in the device starting from the one specified by (s) exceed the corresponding device range.
The device specified by (d) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
642 8.20 Data Operation Instruction
Searching the maximum value of 32-bit data
DMAX(P)(_U)
These instructions search the maximum value from the (n) point(s) of 32-bit binary data in the device starting from the one
specified by (s), and store the maximum value in the device specified by (d).
Ladder diagram Structured text*1
ENO:=DMAXP(EN,s,n,d); ENO:=DMAXP_U(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The DMAX and DMAX_U instructions are not supported by the ST language and the FBD/LD language. Use MAX of the standard
function.
Page 998 MAX(_E), MIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) DMAX(P) Head device number where the maximum value is searched 32-bit signed binary ANY32_S
8
DMAX(P)_U 32-bit unsigned binary ANY32_U
(d) DMAX(P) Head device number for storing the maximum value 32-bit signed binary ANY32_S_ARRAY
(Number of elements: 4)
DMAX(P)_U 32-bit unsigned binary ANY32_U_ARRAY
(Number of elements: 4)
(n) Number of data to be searched 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 643
Processing details
• These instructions search the maximum value from the (n) point(s) of 32-bit binary data in the device starting from the one
specified by (s), and store the maximum value in the device specified by (d) and (d)+1. These instructions start searching
from the device specified by (s), and store the location from (s) of the first minimum value in (d)+2 and the number of
maximum values in (d)+3.
Operation error
Error code Description
(SD0/SD8067)
2820H The (n) point(s) of data in the device starting from the one specified by (s) exceed the corresponding device range.
The device specified by (d) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
644 8.20 Data Operation Instruction
Searching the minimum value of 16-bit data
MIN(P)(_U)
These instructions search the minimum value from the (n) point(s) of 16-bit binary data in the device starting from the one
specified by (s), and store the minimum value in the device specified by (d).
Ladder diagram Structured text*1
ENO:=MINP(EN,s,n,d); ENO:=MINP_U(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The MIN and MIN_U instructions are not supported by the ST language and the FBD/LD language. Use MIN of the standard function.
Page 998 MAX(_E), MIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) MIN(P) Head device number where the minimum value is searched 16-bit signed binary ANY16_S
8
MIN(P)_U 16-bit unsigned binary ANY16_U
(d) MIN(P) Head device number for storing the minimum value 16-bit signed binary ANY16_S_ARRAY
(Number of elements: 3)
MIN(P)_U 16-bit unsigned binary ANY16_U_ARRAY
(Number of elements: 3)
(n) Number of data to be searched 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 645
Processing details
• These instructions search the minimum value from the (n) point(s) of 16-bit binary data in the device starting from the one
specified by (s), and store the minimum value in the device specified by (d). These instructions start searching from the
device specified by (s), and store the location from (s) of the first minimum value in (d)+1 and the number of minimum
values in (d)+2.
Operation error
Error code Description
(SD0/SD8067)
2820H The (n) point(s) of data in the device starting from the one specified by (s) exceed the corresponding device range.
The device specified by (d) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
646 8.20 Data Operation Instruction
Searching the minimum value of 32-bit data
DMIN(P)(_U)
These instructions search the minimum value from the (n) point(s) of 32-bit binary data in the device starting from the one
specified by (s), and store the minimum value in the device specified by (d).
Ladder diagram Structured text*1
ENO:=DMINP(EN,s,n,d); ENO:=DMINP_U(EN,s,n,d);
FBD/LD*1
EN ENO
s d
*1 The DMIN and DMIN_U instructions are not supported by the ST language and the FBD/LD language. Use MIN of the standard function.
Page 998 MAX(_E), MIN(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) DMIN(P) Head device number where the minimum value is searched 32-bit signed binary ANY32_S
8
DMIN(P)_U 32-bit unsigned binary ANY32_U
(d) DMIN(P) Head device number for storing the minimum value 32-bit signed binary ANY32_S_ARRAY
(Number of elements: 4)
DMIN(P)_U 32-bit unsigned binary ANY32_U_ARRAY
(Number of elements: 4)
(n) Number of data to be searched 0 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions search the minimum value from the (n) point(s) of 32-bit binary data in the device starting from the one
specified by (s), and store the minimum value in the device specified by (d) and (d)+1. These instructions start searching
from the device specified by (s), and store the location from (s) of the first minimum value in (d)+2 and the number of
minimum values in (d)+3.
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 647
Operation error
Error code Description
(SD0/SD8067)
2820H The (n) point(s) of data in the device starting from the one specified by (s) exceed the corresponding device range.
The device specified by (d) exceeds the setting area in the device/label memory.
8 APPLICATION INSTRUCTION
648 8.20 Data Operation Instruction
Sorting 16-bit data
SORTTBL(_U)
These instructions sort data lines in the data table (sorting source) having ((n1)×(n2)) points specified by (s) in the ascending
order based on the group data in the column number (n3), and store the result in the data table (sorting result) having
((n1)×(n2)) points specified by (d).
Ladder diagram Structured text
ENO:=SORTTBL(EN,s,n1,n2,n3,d);
ENO:= SORTTBL_U(EN,s,n1,n2,n3,d);
(s) (n1) (n2) (d) (n3)
FBD/LD
EN ENO
s d
n1
n2
n3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 8
(s) SORTTBL Head device number storing the data table 16-bit signed binary ANY16
SORTTBL_U 16-bit unsigned binary ANY16_U
(n1) Number of data (lines) 1 to 32 16-bit unsigned binary ANY16_U
(n2) Number of group data (columns) 1 to 6 16-bit unsigned binary ANY16_U
(d) SORTTBL Head device number for storing the operation result 16-bit signed binary ANY16
SORTTBL_U 16-bit unsigned binary ANY16_U
(n3) Column number of group data (column) used as the basis of 16-bit unsigned binary ANY16_U
sorting
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n1)
(n2)
(d)
(n3)
Processing details
• These instructions sort data lines in the data table (sorting source) having ((n1)×(n2)) points specified by (s) in the
ascending order based on the group data in the column number (n3), and store the result in the data table (sorting result)
having (n1×n2) points specified by (d).
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 649
• The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4 columns
(n1 = K3, n2 = K4). For the sorting result data table, understand (s) as (d).
Number of groups (n2 = K4)
Column No. 1 Column No. 2 Column No. 3 Column No. 4
Control number Height Weight Age
Number of data (n1) = 3 Line No. 1 (s) (s)+3 (s)+6 (s)+9
Line No. 2 (s)+1 (s)+4 (s)+7 (s)+10
Line No. 3 (s)+2 (s)+5 (s)+8 (s)+11
• When the command input turns on, data sorting is started. Data sorting is completed after (n1) scans, and the instruction
execution complete flag SM8029 is set to on.
• The following table shows an operation example based on the sorting source data below. It is recommended to put a serial
number such as a control number in the first column so that the original line number can be estimated based on the
contents.
Number of groups (n2 = K4)
Column No. 1 Column No. 2 Column No. 3 Column No. 4
Control number Height Weight Age
Number of data (n1) = 5 Line No. 1 (s) (s)+5 (s)+10 (s)+15
1 150 45 20
Line No. 2 (s)+1 (s)+6 (s)+11 (s)+16
2 180 50 40
Line No. 3 (s)+2 (s)+7 (s)+12 (s)+17
3 160 70 30
Line No. 4 (s)+3 (s)+8 (s)+13 (s)+18
4 100 20 8
Line No. 5 (s)+4 (s)+9 (s)+14 (s)+19
5 150 50 45
• Sorting result when the instructions are executed with (n3) = K2 (column No. 2)
8 APPLICATION INSTRUCTION
650 8.20 Data Operation Instruction
• Sorting result when the instructions are executed with (n3) = K3 (column No. 3)
Precautions
• Do not change the contents of operands and data during operation.
• To execute these instructions again, set the command input to off once, then on again.
• These instructions can only be used once in any program.
• When specifying the same device in (s) and (d), the source data is overwritten by the data acquired by sorting. Take special
care so that the contents of (s) are not changed until execution is completed.
Operation error
Error code Description 8
(SD0/SD8067)
1811H These instructions are used more than once.
2820H The device range specified by (s) exceeds the corresponding device range.
The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (n1) is outside the following range.
1 to 32
The value specified by (n2) is outside the following range.
1 to 6
The value specified by (n3) is outside the following range.
1 to (n2)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 651
Sorting 16-bit data 2
SORTTBL2(_U)
These instructions sort data lines in the data table (sorting source) of 16-bit binary data having (n1×n2) points specified by (s)
in the ascending order or descending order based on the group data in the column number (n3), and store the result in the
data table (sorting result) of 16-bit binary data having ((n1)×(n2)) points specified by (d).
Ladder diagram Structured text
ENO:=SORTTBL2(EN,s,n1,n2,n3,d);
ENO:=SORTTBL2_U(EN,s,n1,n2,n3,d);
(s) (n1) (n2) (d) (n3)
FBD/LD
EN ENO
s d
n1
n2
n3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) SORTTBL2 Head device number storing the data table 16-bit signed binary ANY16
SORTTBL2_U 16-bit unsigned binary ANY16_U
(n1) Number of data (lines) 1 to 32 16-bit unsigned binary ANY16_U
(n2) Number of group data (columns) 1 to 6 16-bit unsigned binary ANY16_U
(d) SORTTBL2 Head device number for storing the operation result 16-bit signed binary ANY16
SORTTBL2_U 16-bit unsigned binary ANY16_U
(n3) Column number of group data (column) used as the basis of 16-bit unsigned binary ANY16_U
sorting
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n1)
(n2)
(d)
(n3)
Processing details
• These instructions sort data lines in the data table (sorting source) of 16-bit binary data having (n1×n2) points specified by
(s) in the ascending order or descending order based on the group data in the column number (n3), and store the result in
the data table (sorting result) of 16-bit binary data having ((n1)×(n2)) points specified by (d).
8 APPLICATION INSTRUCTION
652 8.20 Data Operation Instruction
• The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4 columns
(n1 = K3, n2 = K4). For the sorting result data table, understand (s) as (d).
Number of groups (n2 = K4)
Column No. 1 Column No. 2 Column No. 3 Column No. 4
Control number Height Weight Age
Number of data (n1) = 3 Line No. 1 (s) (s)+1 (s)+2 (s)+3
Line No. 2 (s)+4 (s)+5 (s)+6 (s)+7
Line No. 3 (s)+8 (s)+9 (s)+10 (s)+11
• When the command input turns on, data sorting is started. Data sorting is completed after (n1) scans, and the instruction
execution complete flag SM8029 is set to on.
• The following table shows an operation example based on the sorting source data below. It is recommended to put a serial
number such as a control number in the first column so that the original line number can be estimated based on the
contents.
Number of groups (n2 = K4)
Column No. 1 Column No. 2 Column No. 3 Column No. 4
Control number Height Weight Age
Number of data (n1) = 5 Line No. 1 (s) (s)+1 (s)+2 (s)+3
1 150 45 20
Line No. 2 (s)+4
2
(s)+5
180
(s)+6
50
(s)+7
40
8
Line No. 3 (s)+8 (s)+9 (s)+10 (s)+11
3 160 70 30
Line No. 4 (s)+12 (s)+13 (s)+14 (s)+15
4 100 20 8
Line No. 5 (s)+16 (s)+17 (s)+18 (s)+19
5 150 50 45
• Sorting result when the instructions are executed with (n3) = K2 (column No. 2) (in the case of ascending order
SM703=OFF)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 653
• Sorting result when the instructions are executed with (n3) = K3 (column No. 3) (in the case of descending order
SM703=ON)
Precautions
• Do not change the contents of operands and data during operation.
• To execute these instructions again, set the command input to off once, then on again.
• These instructions can be used up to twice in any program.
• When specifying the same device in (s) and (d), the source data is overwritten by the data acquired by sorting. Take special
care so that the contents of (s) are not changed until execution is completed.
• Ensure that the sorted data does not overlap with the source data.
D50 D70
Source Data
D20 D40
Sorted Data
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s) exceeds the corresponding device range.
The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (n1) is outside the following range.
1 to 32
The value specified by (n2) is outside the following range.
1 to 6
The value specified by (n3) is outside the following range.
1 to (n2)
8 APPLICATION INSTRUCTION
654 8.20 Data Operation Instruction
Sorting 32-bit data 2
DSORTTBL2(_U)
These instructions sort data lines in the data table (sorting source) of 32-bit binary data having (n1×n2) points specified by (s)
in the ascending order or descending order based on the group data in the column number (n3), and store the result in the
data table (sorting result) of 32-bit binary data having ((n1)×(n2)) points specified by (d).
Ladder diagram Structured text
ENO:=DSORTTBL2(EN,s,n1,n2,n3,d);
ENO:= DSORTTBL2_U(EN,s,n1,n2,n3,d);
(s) (n1) (n2) (d) (n3)
FBD/LD
EN ENO
s d
n1
n2
n3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label) 8
(s) DSORTTBL2 Head device number storing the data table 32-bit signed binary ANY32
DSORTTBL2_U 32-bit unsigned binary ANY32_U
(n1) Number of data (lines) 1 to 32 16-bit unsigned binary ANY16_U
(n2) Number of group data (columns) 1 to 6 16-bit unsigned binary ANY16_U
(d) DSORTTBL2 Head device number for storing the operation result 32-bit signed binary ANY32
DSORTTBL2_U 32-bit unsigned binary ANY32_U
(n3) Column number of group data (column) used as the basis 16-bit unsigned binary ANY16_U
of sorting
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(n1)
(n2)
(d)
(n3)
Processing details
• These instructions sort data lines in the data table (sorting source) of 32-bit binary data having (n1×n2) points specified by
(s) in the ascending order or descending order based on the group data in the column number (n3), and store the result in
the data table (sorting result) of 32-bit binary data having ((n1)×(n2)) points specified by (d).
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 655
• The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4 columns
(n1 = K3, n2 = K4). For the sorting result data table, understand (s) as (d).
Number of groups (n2 = K4)
Column No. 1 Column No. 2 Column No. 3 Column No. 4
Control number Height Weight Age
Number of data (n1) = 3 Line No. 1 (s)+1, (s) (s)+3, (s)+2 (s)+5, (s)+4 (s)+7, (s)+6
Line No. 2 (s)+9, (s)+8 (s)+11, (s)+10 (s)+13, (s)+12 (s)+15, (s)+14
Line No. 3 (s)+17, (s)+16 (s)+19, (s)+18 (s)+21, (s)+20 (s)+23, (s)+22
• When the command input turns on, data sorting is started. Data sorting is completed after (n1) scans, and the instruction
execution complete flag SM8029 is set to on.
• The following table shows an operation example based on the sorting source data below. It is recommended to put a serial
number such as a control number in the first column so that the original line number can be estimated based on the
contents.
Number of groups (n2 = K4)
Column No. 1 Column No. 2 Column No. 3 Column No. 4
Control number Height Weight Age
Number of data (n1) = 5 Line No. 1 (s)+1, (s) (s)+3, (s)+2 (s)+5, (s)+4 (s)+7, (s)+6
1 150 45 20
Line No. 2 (s)+9, (s)+8 (s)+11, (s)+10 (s)+13, (s)+12 (s)+15, (s)+14
2 180 50 40
Line No. 3 (s)+17, (s)+16 (s)+19, (s)+18 (s)+21, (s)+20 (s)+23, (s)+22
3 160 70 30
Line No. 4 (s)+25, (s)+24 (s)+27, (s)+26 (s)+29, (s)+28 (s)+31, (s)+30
4 100 20 8
Line No. 5 (s)+33, (s)+32 (s)+35, (s)+34 (s)+37, (s)+36 (s)+39, (s)+38
5 150 50 45
• Sorting result when the instructions are executed with (n3) = K2 (column No. 2) (in the case of ascending order
SM703=OFF)
8 APPLICATION INSTRUCTION
656 8.20 Data Operation Instruction
• Sorting result when the instructions are executed with (n3) = K3 (column No. 3) (in the case of descending order
SM703=ON)
Precautions
• Do not change the contents of operands and data during operation.
• To execute these instructions again, set the command input to off once, then on again.
• These instructions can be used up to or twice in any program.
• When specifying the same device in (s) and (d), the source data is overwritten by the data acquired by sorting. Take special
care so that the contents of (s) are not changed until execution is completed.
• Ensure that the sorted data does not overlap with the source data.
D10
Source Data
D30 D10
Source Data
D30 8
D2 D22 D20 D40
Sorted Data Sorted Data
D50 D70
Source Data
D20 D40
Sorted Data
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s) exceeds the corresponding device range.
The device range specified by (d) exceeds the corresponding device range.
3405H The value specified by (n1) is outside the following range.
1 to 32
The value specified by (n2) is outside the following range.
1 to 6
The value specified by (n3) is outside the following range.
1 to (n2)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 657
Adding 16-bit data
WSUM(P)(_U)
These instructions add the (n) point(s) of 16-bit binary data in the device starting from the one specified by (s), and store the
result in the device specified by (d).
Ladder diagram Structured text
ENO:=WSUM(EN,s,n,d); ENO:=WSUM_U(EN,s,n,d);
ENO:=WSUMP(EN,s,n,d); ENO:=WSUMP_U(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) WSUM(P) Head device number where the addition target data are 16-bit signed binary ANY16_S
stored
WSUM(P)_U 16-bit unsigned binary ANY16_U
(d) WSUM(P) Head device number storing sum 32-bit signed binary ANY32_S
WSUM(P)_U 32-bit unsigned binary ANY32_U
(n) Number of data 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions add the (n) point(s) of 16-bit binary data in the device starting from the one specified by (s), and store the
result in the device specified by (d).
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
The (n) point(s) of data in the device starting from (s) exceed the corresponding device range.
3405H The data stored in a device specified by (n) is 0.
8 APPLICATION INSTRUCTION
658 8.20 Data Operation Instruction
Adding 32-bit data
DWSUM(P)(_U)
These instructions add the (n) point(s) of 32-bit binary data in the device starting from the one specified by (s), and store the
result in the device specified by (d).
Ladder diagram Structured text
ENO:=DWSUM(EN,s,n,d); ENO:=DWSUM_U(EN,s,n,d);
ENO:=DWSUMP(EN,s,n,d); ENO:=DWSUMP_U(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) DWSUM(P) Head device number where the addition target data are 32-bit signed binary ANY32_S
stored
DWSUM(P)_U 32-bit unsigned binary ANY32_U
(d) DWSUM(P) Head device number storing sum 64-bit signed binary ANY32_ARRAY
8
DWSUM(P)_U 64-bit unsigned binary
(n) Number of data 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions add the (n) point(s) of 32-bit binary data in the device starting from the one specified by (s), and store the
result in the device specified by (d).
Precautions
In the 32-bit operation, the acquired sum is 64-bit data. The FX5 CPU module cannot handle 64-bit data. When the sum is
within the numeric range of 32-bit data (K-2147483648 to K2147483647), however, the FX5 CPU module can handle the low-
order 32 bits of 32-bit data as the sum while ignoring the high-order 32 bits.
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 659
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
The (n) point(s) of data in the device starting from (s) exceed the corresponding device range.
3405H The data stored in a device specified by (n) is 0.
8 APPLICATION INSTRUCTION
660 8.20 Data Operation Instruction
Calculating the mean value of 16-bit data
MEAN(P)(_U)
These instructions calculate the mean value of the (n) point(s) of 16-bit data units starting from the one specified by (s), and
store the operation result in (d).
Ladder diagram Structured text
ENO:=MEAN(EN,s,n,d); ENO:=MEAN_U(EN,s,n,d);
ENO:=MEANP(EN,s,n,d); ENO:=MEANP_U(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) MEAN(P) Head device number where the mean value target data are 16-bit signed binary ANY16_S
stored
MEAN(P)_U 16-bit unsigned binary ANY16_U
(d) MEAN(P) Head device number storing mean value 16-bit signed binary ANY16_S
8
MEAN(P)_U 16-bit unsigned binary ANY16_U
(n) Number of data or the device number storing the number of 1 to 65535 16-bit unsigned binary ANY16
data
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions calculate the mean value of the (n) point(s) of 16-bit data starting from the one specified by (s), and store
the operation result in a device specified by (d).
(s)
(s)+1 (d)
(1)
(s)+2 (n)
(s)+(n-1)
(1): Mean
Precautions
When a device number is exceeded, (n) is handled as a smaller value in the possible range.
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 661
Operation error
Error code Description
(SD0/SD8067)
3405H The value stored in a device specified by (n) is 0.
8 APPLICATION INSTRUCTION
662 8.20 Data Operation Instruction
Calculating the mean value of 32-bit data
DMEAN(P)(_U)
These instructions calculate the mean value of the (n) point(s) of 32-bit data units starting from the one specified by (s), and
store the operation result in (d).
Ladder diagram Structured text
ENO:=DMEAN(EN,s,n,d); ENO:=DMEAN_U(EN,s,n,d);
ENO:=DMEANP(EN,s,n,d); ENO:=DMEANP_U(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) DMEAN(P) Head device number where the mean value target data are 32-bit signed binary ANY32_S
stored
DMEAN(P)_U 32-bit unsigned binary ANY32_U
(d) DMEAN(P) Head device number storing mean value 32-bit signed binary ANY32_S
8
DMEAN(P)_U 32-bit unsigned binary ANY32_U
(n) Number of data or the device number storing the number of 1 to 65535 16-bit unsigned binary ANY16
data
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions calculate the mean value of the (n) point(s) of 32-bit data starting from the one specified by (s), and store
the operation result in a device specified by (d).
(s)+1, (s)
(d)+1, (d)
(s)+3, (s)+2 (1)
(n)
(s)+(2n-1), (s)+(2n-2)
(1): Mean
Precautions
When a device number is exceeded, (n) is handled as a smaller value in the possible range.
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 663
Operation error
Error code Description
(SD0/SD8067)
3405H The value stored in a device specified by (n) is 0.
8 APPLICATION INSTRUCTION
664 8.20 Data Operation Instruction
Calculating the square root of 16-bit data
SQRT(P)
These instructions calculate the square root of binary 16-bit data specified by (s1), and store the operation result in (d).
Ladder diagram Structured text*1
ENO:=SQRTP(EN,s,d);
(s) (d)
FBD/LD*1
EN ENO
s d
*1 The SQRT instruction is not supported by the ST language and the FBD/LD language. Use SQRT of the standard function.
Page 960 SQRT(_E)
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Device where the data whose square root is operated is 16-bit signed binary ANY16
calculated
(d) Device for storing the calculated square root 16-bit signed binary ANY16
EN Execution condition Bit BOOL
8
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions calculate the square root of binary 16-bit data specified by (s1), and store the operation result in (d).
(s) (d)
Precautions
• The obtained square root is an integer because the decimal point is ignored. When the calculated decimal value is ignored,
SM8021 (borrow flag) turns on.
• When the operation result is true 0, SM8020 (zero flag) turns on.
Operation error
Error code Description
(SD0/SD8067)
3405H In (s), a negative value is specified.
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 665
Calculating the square root of 32-bit data
DSQRT(P)
These instructions calculate the square root of binary 32-bit data specified by (s1), and store the operation result in (d).
Ladder diagram Structured text
ENO:=DSQRT(EN,s,d);
ENO:=DSQRTP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Device where the data whose square root is operated is 32-bit signed binary ANY32
calculated
(d) Device for storing the calculated square root 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions calculate the square root of binary 32-bit data specified by (s1), and store the operation result in (d).
Precautions
• The obtained square root is an integer because the decimal point is ignored. When the calculated decimal value is ignored,
SM8021 (borrow flag) turns on.
• When the operation result is true 0, SM8020 (zero flag) turns on.
Operation error
Error code Description
(SD0/SD8067)
3405H In (s), a negative value is specified.
8 APPLICATION INSTRUCTION
666 8.20 Data Operation Instruction
CRC calculation
CRC(P)
These instructions calculate the CRC (cyclic redundancy check) value which is an error check method used in
communication. In addition to CRC value, parity check and sum check are available. For obtaining the horizontal parity value
and sum check value, the CCD(P) instruction is available. For the generation of CRC value (CRC-16), these instructions use
"X16 + X15 + X2 + 1" in a polynomial.
Ladder diagram Structured text
ENO:=CRC(EN,s,n,d);
ENO:=CRCP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number storing data for which the CRC value is
generated
16-bit signed binary ANY16 8
(d) Device number storing the generated CRC value 16-bit signed binary ANY16
(n) Number of 8-bit (1-byte) data for which the CRC value is 1 to 32767 16-bit unsigned binary ANY16_U
generated or the device number storing the number of data
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
• These instructions generate CRC value for (n) 8-bit data (unit: byte) starting from a device specified in (s), and store to (d).
The 16-bit conversion mode and 8-bit conversion mode are available for these instructions. For the operation in each
mode, refer to the proceeding pages.
• 16-bit conversion mode (while SM8161 is OFF)
In this mode, the operation is executed for high-order 8 bits (1 byte) and low-order 8 bits (1 byte) of a device specified in (s). The operation result is stored
to one 16-bit device specified in (d).
In the following program, conversion is executed as follows:
SM400
SM8161 16-bit conversion mode
Command
input
CRC (s) (d) (n)
8 APPLICATION INSTRUCTION
8.20 Data Operation Instruction 667
Example) (s) = D100, (d) = D0, (n) = 6
Device Contents of target data
8 bits 16 bits
Device storing data (s) Low-order byte Low-order bits of D100 01H 0301H
for which the CRC
High-order byte High-order bits of D100 03H
value is generated
(s)+1 Low-order byte Low-order bits of D101 03H 0203H
High-order byte High-order bits of D101 02H
(s)+2 Low-order byte Low-order bits of D102 00H 1400H
High-order byte High-order bits of D102 14H
(s)+(n)/2-1 Low-order byte
High-order byte
Device storing the (d) Low-order byte Low-order bits of D0 E4H 41E4H
generated CRC value High-order byte High-order bits of D0 41H
SM400
SM8161 8-bit conversion mode
Command
input
CRC (s) (d) (n)
Precautions
• In these instructions, "X16+X15+X2+1" is used in a polynomial for generating the CRC value (CRC-16). There are many
other standard polynomials for generating the CRC value. Note that the CRC value completely differs if an adopted
polynomial is different. Major polynomials for generating the CRC value are shown below.
Name Polynomial
CRC-12 X12 + X11 + X3 + X2 + X + 1
CRC-16 X16 + X15 + X2 + 1
CRC-32 X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 + X8 + X7 + X5 + X4 + X2 + X + 1
CRC-CCITT X16 + X12 + X5 + 1
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
668 8.20 Data Operation Instruction
8.21 Indirect Address Read Instruction
Reading the indirect address
ADRSET(P)
These instructions store the indirect address of the device specified by (s) to the device specified by (d).
The addresses stored in the device specified by (d)+0 and (d)+1 are used by the program to execute the indirect address of
the device.
Ladder diagram Structured text
ENO:=ADRSET(EN,s,d);
ENO:=ADRSETP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand
(s)
Description
Device number for reading the indirect address
Range
Data type
Device name
Data type (label)
ANY_ELEMENTARY
8
(d) Device number for storing the indirect address of the device 32-bit signed binary ANY32
specified by (s)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(d)
8 APPLICATION INSTRUCTION
8.21 Indirect Address Read Instruction 669
Processing details
• These instructions store the indirect address of the device specified by (s) to the device specified by (d). The addresses
stored in the device specified by (d)+0 and (d)+1 are used by the program to execute the indirect address of the device.
Device area
D0
D1
(2)
D100 Address of
D101 W100 W100 1234
• The nibble of a bit device, and the bit of a word device cannot be specified in (s).
Precautions
• In the indirect specification, the device address used in sequence program is specified with a word device of 2 words (2-
word devices). Use the indirect specification as an index when index register is insufficient.
[When the index register is used] [When the indirect specification is used]
• In the indirect specification, the device which specify the address of the specified device is specified by "@+(word device
number)". For example, when "@D100" is specified, and the content of D101 and D100 becomes the device address.
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
670 8.21 Indirect Address Read Instruction
8.22 Clock Instruction
Reading clock data
TRD(P)
These instructions read the clock data from the built-in real time clock in the CPU module.
Ladder diagram Structured text
ENO:=TRD(EN,d);
ENO:=TRDP(EN,d);
(d)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Head device number where the read clock data is stored 16-bit signed binary ANY16_ARRAY
(Number of elements: 7)
EN Execution condition Bit BOOL 8
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
Processing details
• These instructions read the clock data (SD210 to SD216) from the built-in real time clock in the CPU module to the device
numbers (d) to (d)+6 in the following format.
Device Item Clock data Device Item
Special SD210 Year 1980 to 2079 (year, four digits) → (d) Year
registers
SD211 Month 1 to 12 → (d)+1 Month
SD212 Day 1 to 31 → (d)+2 Day
SD213 Hour data 0 to 23 → (d)+3 Hour data
SD214 Minute data 0 to 59 → (d)+4 Minute data
SD215 Second data 0 to 59 → (d)+5 Second data
SD216 Day-of-the-week data 0 (Sunday) to 6 (Saturday) → (d)+6 Day-of-the-week data
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 671
• The table below shows the related devices. The clock data stored in these special registers is updated during the END
processing.
Device Name Description
Binary code
SD210 Binary clock data (year) The year data in the clock data is stored as a four-digit binary code.
SD211 Binary clock data (month) The month data in the clock data is stored as a binary code.
SD212 Binary clock data (day) The day data in the clock data is stored as a binary code.
SD213 Binary clock data (hour) The hour data in the clock data is stored as a binary code.
SD214 Binary clock data (minute) The minute data in the clock data is stored as a binary code.
SD215 Binary clock data (second) The second data in the clock data is stored as a binary code.
SD216 Binary clock data (day of the week) The day-of-a-week data in the clock data (0: Sunday, 1: Monday, ..., 6: Saturday) is stored as a binary code.
Binary code (FX3 compatible area)
SD8013 Binary clock data (second) The second data in the clock data is stored as a binary code.
SD8014 Binary clock data (minute) The minute data in the clock data is stored as a binary code.
SD8015 Binary clock data (hour) The hour data in the clock data is stored as a binary code.
SD8016 Binary clock data (day) The day data in the clock data is stored as a binary code.
SD8017 Binary clock data (month) The month data in the clock data is stored as a binary code.
SD8018 Binary clock data (year) The year data in the clock data is stored as a four-digit binary code.
SD8019 Binary clock data (day of the week) The day-of-a-week data in the clock data (0: Sunday, 1: Monday, ..., 6: Saturday) is stored as a binary code.
Precautions
• These instructions occupy seven points of device starting from device number specified by (d). Make sure that these
devices are not used by other machine controls.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (d) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
672 8.22 Clock Instruction
Writing clock data
TWR(P)
This instruction writes the clock data to the built-in CPU module real time clock.
Ladder diagram Structured text
ENO:=TWR(EN,s);
ENO:=TWRP(EN,s);
(s)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number where the clock write source data is stored 16-bit signed binary ANY16_ARRAY
(Number of elements: 7)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices 8
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
Processing details
• These instructions write the clock data stored in device numbers (s) to (s)+6 to the clock data area (SD210 to SD216 and
SD8013 to SD8019) of the built-in real time clock in the CPU module.
Time setting data Special registers
Device Item Clock data Device Item
(s) Year 1980 to 2079 (year, four digits) → SD210, SD8018 Year
(s)+1 Month 1 to 12 → SD211, SD8017 Month
(s)+2 Day 1 to 31 → SD212, SD8016 Day
(s)+3 Hour data 0 to 23 → SD213, SD8015 Hour data
(s)+4 Minute data 0 to 59 → SD214, SD8014 Minute data
(s)+5 Second data 0 to 59 → SD215, SD8013 Second data
(s)+6 Day-of-the-week data 0 (Sunday) to 6 (Saturday) → SD216, SD8019 Day-of-the-week data
• Executing these instructions immediately changes the real time clock data. Therefore, transfer the clock data of a few
minutes ahead the current time to the clock data area (s) to (s)+6 in advance. Execute the instruction when the actual time
matches the clock data time.
• When using these instructions to set the clock data (i.e., performing time adjustment), control of special relay SM8015
(clock stop/adjustment) is not required.
• If incorrect values (i.e., values out of range) are set to the write source area, the clock data will not be updated. In this case,
correct the clock data in the write source area and execute the instruction.
• Day of the week (SD216 and SD8019) is automatically corrected.
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 673
• The table below shows the related devices.
Device Name Description
SM8019 Real time clock error This special data register turns on when the clock data value in the special register is exceeding the setting
range.
Binary code
SD210 Binary clock data (year) The year data in the clock data is stored as a four-digit binary code.
SD211 Binary clock data (month) The month data in the clock data is stored as a binary code.
SD212 Binary clock data (day) The day data in the clock data is stored as a binary code.
SD213 Binary clock data (hour) The hour data in the clock data is stored as a binary code.
SD214 Binary clock data (minute) The minute data in the clock data is stored as a binary code.
SD215 Binary clock data (second) The second data in the clock data is stored as a binary code.
SD216 Binary clock data (day of the week) The day-of-a-week data in the clock data (0: Sunday, 1: Monday, ..., 6: Saturday) is stored as a binary code.
Binary code (FX3 compatible area)
SD8013 Binary clock data (second) The second data in the clock data is stored as a binary code.
SD8014 Binary clock data (minute) The minute data in the clock data is stored as a binary code.
SD8015 Binary clock data (hour) The hour data in the clock data is stored as a binary code.
SD8016 Binary clock data (day) The day data in the clock data is stored as a binary code.
SD8017 Binary clock data (month) The month data in the clock data is stored as a binary code.
SD8018 Binary clock data (year) The year data in the clock data is stored as a four-digit binary code.
SD8019 Binary clock data (day of the week) The day-of-a-week data in the clock data (0: Sunday, 1: Monday, ..., 6: Saturday) is stored as a binary code.
Precautions
• These instructions occupy seven points of device starting from device number specified by (s). Make sure that these
devices are not used by other machine controls.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s) exceeds the corresponding device range.
8 APPLICATION INSTRUCTION
674 8.22 Clock Instruction
Adding clock data
TADD(P)
These instructions add the time data stored in the device number specified by (s2) and later to the clock data stored in the
device number specified by (s1) and later, and store the result to the device number specified by (d) and later.
Ladder diagram Structured text
ENO:=TADD(EN,s1,s2,d);
ENO:=TADDP(EN,s1,s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number where the clock data to be added is stored. 16-bit signed binary ANY16_ARRAY
(Number of elements: 3)
(s2) Head device number where the adding time value (or clock data
value) is stored.
16-bit signed binary ANY16_ARRAY
(Number of elements: 3) 8
(d) Head device number where the resultant clock data (or time 16-bit signed binary ANY16_ARRAY
value) is stored. (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions add the time data stored in the device numbers starting from (s2) to the clock data stored in the device
numbers starting from (s1), and store the result to the device numbers starting from (d).
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 675
Ex.
When adding 7:48:10 to 6:32:40
• If the sum of two values exceeds 24:00:00, the carry flag turns on, and the result will be the sum minus 24:00:00. For
example, if a time value of 20:20:20 is added to another time value of 14:30:30, the sum is 34:40:50. However, the actual
addition result will be 10:40:50.
Precautions
• These instructions occupy three points for each of three devices starting from device number specified by (s1), (s2), and (d)
respectively. Make sure that these devices are not used by other machine controls.
• When using the time value (hour, minute, second) of the built-in real time clock in the CPU module for the operation, use
the TRD(P) operation to read the special register values first. Then specify the word devices where the read values are
stored to each operand.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s1), (s2), and (d) exceeds the corresponding device range.
3405H Any of values specified by (s1) and (s2) is outside the following range.
0 to 23
Any of values specified by (s1)+1, (s2)+1, (s1)+2, and (s2)+2 is outside the following range.
0 to 59
8 APPLICATION INSTRUCTION
676 8.22 Clock Instruction
Subtracting clock data
TSUB(P)
These instructions subtract the time data stored in the device numbers starting from (s2) from the clock data stored in the
device numbers starting from (s1), and store the result to the device numbers starting from (d).
Ladder diagram Structured text
ENO:=TSUB(EN, s1, s2,d);
ENO:=TSUBP(EN, s1, s2,d);
(s1) (s2) (d)
FBD/LD
EN ENO
s1 d
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number where the clock data that is subtracted is stored 16-bit signed binary ANY16_ARRAY
(Number of elements: 3)
(s2) Head device number where the subtracting time value (or clock data 16-bit signed binary ANY16_ARRAY
value) is stored (Number of elements: 3) 8
(d) Head device number where the resultant clock data (or time value) is 16-bit signed binary ANY16_ARRAY
stored (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d)
Processing details
• These instructions subtract the time data stored in the device numbers starting from (s2) from the clock data stored in the
device numbers starting from (s1), and store the result to the device numbers starting from (d).
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 677
Ex.
When subtracting 3:50:10 from 10:40:20
• If the remainder is a negative time value, the borrow flag turns on. The actual result will be the remainder plus 24:00:00. For
example, if a time value of 10:42:12 is subtracted from another time value of 4:50:32, the remainder is -6:08:20. However,
the actual subtraction result will be 18:08:20.
Precautions
• These instructions occupy three points for each of three devices starting from device number specified by (s1), (s2), and (d)
respectively. Make sure that these devices are not used by other machine controls.
• When using the time value (hour, minute, second) of the built-in real time clock in the CPU module for the operation, use
the TRD(P) operation to read the special register values first. Then specify the word devices where the read values are
stored to each operand.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified by (s1), (s2), and (d) exceeds the corresponding device range.
3405H Any of values specified by (s1) and (s2) is outside the following range.
0 to 23
Any of values specified by (s1)+1, (s2)+1, (s1)+2, and (s2)+2 is outside the following range.
0 to 59
8 APPLICATION INSTRUCTION
678 8.22 Clock Instruction
Converting time data from hour/minute/second to seconds in 16
bits
HTOS(P)
These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and store
the converted data in the device numbers starting from (d) as 16-bit binary.
Ladder diagram Structured text
ENO:=HTOS(EN,s,d);
ENO:=HTOSP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number where the clock data before conversion is 16-bit signed binary ANY16_ARRAY
stored (Number of elements: 3)
(d) Head device number where the clock data after conversion is
stored
16-bit signed binary ANY16 8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and
store the converted data in the device numbers starting from (d).
(d)
(s) hour (0 to 9)
(s)+1 minute (0 to 59) second
(s)+2 second (0 to 59)
Ex.
When specifying 4 hours 29 minutes 31 seconds in (s)
(d)
(s) 4
(s)+1 29 16171
(s)+2 31
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 679
Operation error
Error code Description
(SD0/SD8067)
2820H Any of the device area ranges specified in (s) and (d) exceed the corresponding device range.
3403H The result is outside the following range.
0 to 32767
3405H A value specified by (s) is outside the following range.
0 to 9
Any of values specified by (s)+1 and (s)+2 is outside the following range.
0 to 59
8 APPLICATION INSTRUCTION
680 8.22 Clock Instruction
Converting time data from hour/minute/second to seconds in 32
bits
DHTOS(P)
These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and store
the converted data in the device numbers starting from (d) as 32-bit binary.
Ladder diagram Structured text
ENO:=DHTOS(EN,s,d);
ENO:=DHTOSP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number where the clock data before conversion is 16-bit signed binary ANY16_ARRAY
stored (Number of elements: 3)
(d) Head device number where the clock data after conversion is
stored
32-bit signed binary ANY32 8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and
store the converted data in the device numbers starting from (d).
(d)+1 (d)
(s) hour (0 to 32767)
(s)+1 minute (0 to 59) second
(s)+2 second (0 to 59)
Ex.
When specifying 35 hours 10 minutes 58 seconds in (s)
(d)+1 (d)
(s) 35
(s)+1 10 126658
(s)+2 58
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 681
Operation error
Error code Description
(SD0/SD8067)
2820H Any of the device area ranges specified in (s) and (d) exceed the corresponding device range.
3405H A value specified by (s) is outside the following range.
0 to 32767
Any of values specified by (s)+1 and (s)+2 is outside the following range.
0 to 59
8 APPLICATION INSTRUCTION
682 8.22 Clock Instruction
Converting time data from seconds to hour/minute/second in 16
bits
STOH(P)
These instructions convert the 16-bit time value in seconds stored in the device numbers starting from (s) to the time value in
the HHMMDD format, and store the converted data in the device numbers starting from (d).
Ladder diagram Structured text
ENO:=STOH(EN,s,d);
ENO:=STOHP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number where the clock data before conversion is 16-bit signed binary ANY16
stored
(d) Head device number where the clock data after conversion is
stored
16-bit signed binary ANY16_ARRAY
(Number of elements: 3)
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the time value in seconds stored in the device numbers starting from (s) to the time value in
HHMMDD format, and store the converted data in the device numbers starting from (d).
(s)
(d) hour (0 to 9)
second (0 to 32767) (d)+1 minute (0 to 59)
(d)+2 second (0 to 59)
Ex.
When specifying 29011 seconds in (s)
(s)
(d) 8
29011 (d)+1 3
(d)+2 31
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 683
Operation error
Error code Description
(SD0/SD8067)
2820H The specified device area exceeds the corresponding device range.
3405H The value specified by (s) is outside the range.
8 APPLICATION INSTRUCTION
684 8.22 Clock Instruction
Converting time data from seconds to hour/minute/second in 32
bits
DSTOH(P)
These instructions convert the 32-bit time value in seconds stored in the device numbers starting from (s) to the time value in
the HHMMDD format, and store the converted data in the device numbers starting from (d).
Ladder diagram Structured text
ENO:=DSTOH(EN,s,d);
ENO:=DSTOHP(EN,s,d);
(s) (d)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number where the clock data before conversion is 32-bit signed binary ANY32
stored
(d) Head device number where the clock data after conversion is
stored
16-bit signed binary ANY16_ARRAY
(Number of elements: 3)
8
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
Processing details
• These instructions convert the time value in seconds stored in the device numbers starting from (s) to the time value in
HHMMDD format, and store the converted data in the device numbers starting from (d).
(s)+1 (s)
(d) hour (0 to 32767)
second (0 to 117964799) (d)+1 minute (0 to 59)
(d)+2 second (0 to 59)
Ex.
When specifying 45325 seconds in (s)
(s)+1 (s)
(d) 12
45325 (d)+1 35
(d)+2 25
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 685
Operation error
Error code Description
(SD0/SD8067)
2820H The specified device area exceeds the corresponding device range.
3405H The value specified by (s) is outside the range.
8 APPLICATION INSTRUCTION
686 8.22 Clock Instruction
Comparing date data
ORDT
FBD/LD
s1 s1 s1
s2 s2 s2 8
s3 s3 s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number where the comparison data is stored 16-bit signed binary ANY_DT
(s2) Head device number where the comparison data is stored 16-bit signed binary ANY_DT
(s3) Comparison target setting value or the number of comparison 0001H to 0007H, 16-bit signed binary ANY16
target data 8001H to 8007H
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 687
Processing details
• These instructions compare the date data in the devices specified by (s1) and (s2), or compare the date data in the device
specified by (s1) with the current date. Set the comparison target by (s3).
• Comparing two specified date data
These instructions compare the date data in the device specified by (s1) with the date data in the device specified by (s2) in accordance with the
conditions set by (s3). (Devices are used as a normally open contact.)
• When 0 is set to the 0 to 2 bits, the date data are not compared. When 1 is set, the entire date data (year, month, and day)
are compared.
• When 0 is set to the 15 bit, the data in the device specified by (s1) and the date data in the device specified by (s2) are
compared. When 1 is set, the data in the device specified by (s1) is compared with the current date. The date data in the
device specified by (s2) is ignored.
• The following table lists processing details of each bit.
(s3) value when (s3) value when Comparison Contents of processing
comparing two comparing the target
specified date data specified date data
with the current date
0001H 8001H Day Only data in the device specified by (s1)+2 is compared.
0002H 8002H Month Only data in the device specified by (s1)+1 is compared.
0003H 8003H Month, day Data in the device areas specified by (s1)+2 and (s1)+2 are compared.
0004H 8004H Year Only data in the device specified by (s1) is compared.
0005H 8005H Year, day Data in the device areas specified by (s1) and (s1)+2 are compared.
0006H 8006H Year, month Data in the device areas specified by (s1) and (s1)+1 are compared.
0007H 8007H Year, month, day The entire date data in the device areas specified by (s1), (s1)+1, and (s1)+2
are compared.
Other than 0001H to 0007H, 8001H to 8007H None The entire date data in the device areas specified by (s1), (s1)+1, and (s1)+2
are not compared. (The operation result will be non-continuity.)
8 APPLICATION INSTRUCTION
688 8.22 Clock Instruction
• If the comparison target data in the device are not recognized as date data, SM709 turns on after the instruction is executed
and the operation result will be non-continuity. Even if the data are not recognized as date data, SM709 does not turn on if
the data are within the setting range. If the device areas specified by (s1) to (s1)+2 or (s2) to (s2)+2 exceed the
corresponding device range, SM709 turns on after the instruction is executed and the operation result will be non-continuity
as well. Once SM709 turns on, the on state is held until the CPU module is powered off or reset. Turn off SM 709 as
needed.
• The following table lists the comparison operation results of each instruction.
Instruction symbol Condition Result Instruction symbol Condition Result
DT= (s1)=(s2) Conductive state DT= (s1)(s2) Non-conductive state
DT<> (s1)(s2) DT<> (s1)=(s2)
DT> (s1)>(s2) DT> (s1)≤(s2)
DT<= (s1)≤(s2) DT<= (s1)>(s2)
DT< (s1)<(s2) DT< (s1)≥(s2)
DT>= (s1)≥(s2) DT>= (s1)<(s2)
Ex.
The date data A, B, and C are compared.
A B C
• Even though the specified date does not exist, the comparison operation is performed in accordance with the conditions in
the following table as long as the date data are within the valid range.
• Date A: 2006/02/30 (Even though the date does not exist, this date can be set.)
• Date B: 2007/03/29
• Date A: 2008/02/31 (Even though the date does not exist, this date can be set.)
: Continuity, : Non-continuity
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 689
Comparing time data
ORTM
FBD/LD
s1 s1 s1
s2 s2 s2
s3 s3 s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Head device number where the comparison data is stored 16-bit signed binary ANY_TM
(s2) Head device number where the comparison data is stored 16-bit signed binary ANY_TM
(s3) Comparison target setting value or the number of comparison 0001H to 0007H, 16-bit signed binary ANY16
target data 8001H to 8007H
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
8 APPLICATION INSTRUCTION
690 8.22 Clock Instruction
Processing details
• These instructions compare the time data in the devices specified by (s1) and (s2), or compare the time data in the device
specified by (s1) with the current time. Set the comparison target by (s3).
• Comparing two specified time data
These instructions compare the time data in the device specified by (s1) with the time data in the device specified by (s2) in accordance with the
conditions set by (s3). (Devices are used as a normally open contact.)
• When 0 is set to the 0 to 2 bits, the time data (hour, minute, and second) are not compared. When 1 is set, the entire time
data (hour, minute, and second) are compared.
• When 0 is set to the 15 bit, the data in the device specified by (s1) and the time data in the device specified by (s2) are
compared. When 1 is set, the data in the device specified by (s1) is compared with the current time. The time data in the
device specified by (s2) is ignored.
• The following table lists processing details of each bit.
(s3) value when (s3) value when Comparison Contents of processing
comparing two comparing the target
specified time data specified time data
with the current time
0001H 8001H Second data Only data in the device specified by (s1)+2 is compared.
0002H 8002H Minute data Only data in the device specified by (s1)+1 is compared.
0003H 8003H Minute and Data in the device areas specified by (s1)+2 and (s1)+2 are compared.
second data
0004H 8004H Hour data Only data in the device specified by (s1) is compared.
0005H 8005H Hour and second Data in the device areas specified by (s1) and (s1)+2 are compared.
data
0006H 8006H Hour and minute Data in the device areas specified by (s1) and (s1)+1 are compared.
data
0007H 8007H Hour, minute, and The entire time data in the device areas specified by (s1), (s1)+1, and (s1)+2
second data are compared.
Other than 0001H to 0007H, 8001H to 8007H None The entire time data in the device areas specified by (s1), (s1)+1, and (s1)+2
are not compared. (The operation result will be non-continuity.)
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 691
• If the comparison target data in the device are not recognized as time data, SM709 turns on after the instruction is executed
and the operation result will be non-continuity. If the device areas specified by (s1) to (s1)+2 or (s2) to (s2)+2 exceed the
corresponding device range, SM709 turns on after the instruction is executed and the operation result will be non-continuity
as well. Once SM709 turns on, the on state is held until the CPU module is powered off or reset. Turn off SM709 as
needed.
• The following table lists the comparison operation results of each instruction.
Instruction symbol Condition Result Instruction symbol Condition Result
TM= (s1)=(s2) Conductive state TM= (s1)(s2) Non-conductive state
TM<> (s1)(s2) TM<> (s1)=(s2)
TM> (s1)>(s2) TM> (s1)≤(s2)
TM<= (s1)≤(s2) TM<= (s1)>(s2)
TM< (s1)<(s2) TM< (s1)≥(s2)
TM>= (s1)≥(s2) TM>= (s1)<(s2)
Ex.
The time data A, B, and C are compared.
A B C
Operation error
There is no operation error.
8 APPLICATION INSTRUCTION
692 8.22 Clock Instruction
Comparing clock data
TCMP(P)
These instructions compare the time specified by (s1), (s2), and (s3) with the time data specified by (s4), and turn on/off the
bit device specified by (d) depending on the size match.
Ladder diagram Structured text
ENO:=TCMP(EN,s1,s2,s3,s4,d);
ENO:=TCMPP(EN,s1,s2,s3,s4,d);
(s1) (s2) (s3) (s4) (d)
FBD/LD
EN ENO
s1 d
s2
s3
s4
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Specify the "hour" of the time comparison 0 to 23 16-bit signed binary ANY16 8
(s2) Specify the "minute" of the time comparison 0 to 59 16-bit signed binary ANY16
(s3) Specify the "second" of the time comparison 0 to 59 16-bit signed binary ANY16
(s4) Specify the time data (hour, minute, and second) 16-bit signed binary ANY16_ARRAY
(Number of elements: 3)
(d) Specify the Bit device that turns on/off depending on the Bit ANYBIT_ARRAY
comparison result (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(s4)
(d)
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 693
Processing details
• These instructions compare the time specified by (s1), (s2), and (s3) with the time data specified by (s4), and turn on/off the
bit device specified by (d) depending on the size match.
(s1) hour (0 to 23) (s4) hour (0 to 23)
(d) = ON
(s2) minute (0 to 59) (s4)+1 minute (0 to 59)
(s1) hour (0 to 23) (s4) hour (0 to 23)
(d) +2 = ON
(s2) minute (0 to 59) (s4)+1 minute (0 to 59)
• (d), (d)+1, and (d)+2 hold the state before the command contact is turned off even if, the TCMP instruction is not executed
by switching on → off the command contact.
Precautions
• Three devices are occupied by (s4) and (d). Make sure that these devices are not used by other machine controls.
• Specify each operand of the word device after reading the value of the special register used in the TRD(P) instruction when
the time (hour, minute, second) of the clock data of the built-in real time clock in the CPU module is used.
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified exceeds the corresponding device range.
3405H The value specified by (s1) and (s4) is outside the following range.
0 to 23
The value specified by (s2), (s3), (s4)+1, and (s4)+2 is outside the following range.
0 to 59
8 APPLICATION INSTRUCTION
694 8.22 Clock Instruction
Comparing clock data zones
TZCP(P)
This instruction compares two comparison time (comparison time zone) specified by (s1) and (s2) with the time data specified
by (s3), and turns on or off the specified bit devices (d) according to the comparison results.
Ladder diagram Structured text
ENO:=TZCP(EN,s1,s2,s3,d);
ENO:=TZCPP(EN,s1,s2,s3,d);
(s1) (s2) (s3) (d)
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Specify the lower limit of time comparison (hour, minute, and 16-bit signed binary ANY16_ARRAY
(s2)
second).
Specify the upper limit of time comparison (hour, minute, and 16-bit signed binary
(Number of elements: 3)
ANY16_ARRAY
8
second). (Number of elements: 3)
(s3) Specify the time data (hour, minute, and second). 16-bit signed binary ANY16_ARRAY
(Number of elements: 3)
(d) Specify the Bit device that turns on/off depending on the Bit ANYBIT_ARRAY
comparison result (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
(d)
8 APPLICATION INSTRUCTION
8.22 Clock Instruction 695
Processing details
• This instruction compares two comparison time (comparison time zone) specified by (s1) and (s2) with the time data
specified by (s3), and turns on or off the specified bit devices (d) according to the comparison results.
(s1)
(s1)+1
hour
minute
(0 to 23)
(0 to 59)
(s3)
(s3)+1
hour
minute
(0 to 23)
(0 to 59)
(d) = ON
(s1)
(s1)+1
hour
minute
(0 to 23)
(0 to 59)
(s3)
(s3)+1
hour
minute
(0 to 23)
(0 to 59)
(s2)
(s2)+1
hour
minute
(0 to 23)
(0 to 59)
(d) +1 = ON
(s3)
(s3)+1
hour
minute
(0 to 23)
(0 to 59)
(s2)
(s2)+1
hour
minute
(0 to 23)
(0 to 59)
(d) +2 = ON
• Even if the command contact turns off from on and the TZCP instruction is not executed, (d), (d)+1, and (d)+2 hold the
status before the command contact turned off.
Precautions
• Three devices are occupied by (s1), (s2), (s3), and (d). Make sure that these devices are not used by other machine
controls.
• When the time (hour, minute, second) of the clock data of the real time clock built in the CPU module is used, read the
values of special registers by the TRD instruction, and then specify those word devices as the operands.
• Make (s1) ≤ (s2).
Operation error
Error code Description
(SD0/SD8067)
2820H The device range specified exceeds the corresponding device range.
3405H The value specified by (s1), (s2), and (s3) is outside the following range.
0 to 23
The value specified by (s1)+1, (s2)+1, (s3)+1, (s1)+2, (s2)+2, and (s3)+2 is outside the following range.
0 to 59
8 APPLICATION INSTRUCTION
696 8.22 Clock Instruction
8.23 Timing Check Instruction
Generating timing pulses
DUTY
This instruction sets user timing clock output destinations (SM420 to SM424 and SM8330 to SM8334) specified by (d) to on
for the number of scans specified by (n1) and to off for the number of scans specified by (n2).
Ladder diagram Structured text
ENO:=DUTY(EN,n1,n2,d);
FBD/LD
EN ENO
n1 d
n2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(n1) Number of scans to be turned on 0 to 32767 16-bit unsigned binary ANY16
8
(n2) Number of scans to be turned off 0 to 32767 16-bit unsigned binary ANY16
(d) Special relay of the timing clock output destination (SM420 to SM424, Bit ANYBIT_BOOL
SM8330 to SM8334)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(n1)
(n2)
(d) *1
Processing details
• This instruction sets user timing clock output destinations (SM420 to SM424 and SM8330 to SM8334) specified by (d) to on
for the number of scans specified by (n1) and to off for the number of scans specified by (n2).
ON
• Specify SM420 to SM424 (SM8330 to SM8334) in the special relay of the timing clock output destination specified by (d).
• In SM420 to SM424 (SM8330 to SM8334), when one device is turned on, another device is also turned on at the same
time.
8 APPLICATION INSTRUCTION
8.23 Timing Check Instruction 697
• The counted number of scans is stored among SD8330 to SD8334 in accordance with the special relay of the timing clock
output destination specified by (d).
• The counted number of scans stored among SD8330 to SD8334 is reset when the counted value reaches "(n1)+(n2)" or
when the command input (instruction) is set to on.
Special relay (d) for outputting the timing clock Scan counting device
SM420(SM8330) SD8330
SM421(SM8331) SD8331
SM422(SM8332) SD8332
SM423(SM8333) SD8333
SM424(SM8334) SD8334
• When the command input is set to ON, the operation is started. The special relay of the timing clock output destination is
set to ON or OFF by the END instruction. Even if the command input is set to OFF, the operation is not stopped. In the
STOP mode, the operation is stopped. When the power to the CPU module is turned OFF, the operation is stopped.
• When (n1) and (n2) are set to "0", the status is as shown below:
Status of (n1) and (n2) ON/OFF status of (d)
(n1)=0, (n2)≥0 (d)= Fixed to OFF
(n1)>0, (n2)=0 (d)= Fixed to ON
Precautions
• The DUTY instruction can be used up to 5 times (points). It is not permitted, however, to use the same timing clock output
destination device for two or more DUTY instructions.
Operation error
Error code Description
(SD0/SD8067)
2820H The device specified by (d) is out of the range from SM420 to SM424 (SM8330 to SM8334).
3405H The value specified by (n1), (n2) is other than 0 to 32767.
8 APPLICATION INSTRUCTION
698 8.23 Timing Check Instruction
Hour meter
HOURM
This instruction measures the on time of the input contact in units of hour.
Ladder diagram Structured text
ENO:=HOURM(EN,s,d1,d2);
FBD/LD
EN ENO
s d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Time after which the alarm (d2) is set to on (unit: hour) 16-bit signed binary ANY16
(d1) Device for storing the measured current value (latched (battery 16-bit signed binary ANY16_ARRAY
backed) type data register) (Number of elements: 2)
(d2)
EN
Device to be turned on when timeout occurs (alarm output)
Execution condition
Bit
Bit
ANY_BOOL
BOOL
8
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d1)
(d2)
Processing details
• This instruction measures the period of time for which the input contact is on in units of hour, and turns on the device
specified by (d2) when the accumulated ON time exceeds the time (16-bit binary data) specified in (s).
• In (s), specify the period of time until the device specified by (d2) is turned on in units of hour.
• The measured current value in units of hour is stored in (d1).
• The measured current value of less than one hour (in units of second) is stored in (d1)+1.
• (d2) is set to on when the current value in (d1) exceeds the time specified by (s).
• Specify a latched (battery backed) type data register as (d1) so that the current value data can be continuously used even
after the power to CPU module turns off. If a general data type register is used, the current value data is cleared when the
power to the CPU module is turned OFF or when the controller mode switches from STOP to RUN.
• Even after the alarm output specified by (d2) turns ON, the measurement is continued.
• When the current value reaches the maximum value of 16-bit data, the measurement is stopped. For continuing the
measurement, clear the current value stored in (d1) to (d1)+1.
Precautions
• Two devices are occupied by (d1). Make sure that these devices are not used by other machine controls.
8 APPLICATION INSTRUCTION
8.23 Timing Check Instruction 699
Operation error
Error code Description
(SD0/SD8067)
2820H The device areas specified by (d1) exceed the corresponding device range.
3405H The value of (s) is negative.
8 APPLICATION INSTRUCTION
700 8.23 Timing Check Instruction
DHOURM
This instruction measures the on time of the input contact in units of hour.
Ladder diagram Structured text
ENO:=DHOURM(EN,s,d1,d2);
FBD/LD
EN ENO
s d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Time after which the alarm (d2) is set to on (unit: hour) 32-bit signed binary ANY32
(d1) Device for storing the measured current value (latched (battery 32-bit signed binary ANY32_ARRAY
backed) type data register) (Number of elements: 2)
(d2) Device to be turned on when timeout occurs (alarm output) Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
8
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d1)
(d2)
Processing details
• This instruction measures the period of time for which the input contact is on in units of hour, and turns on the device
specified by (d2) when the accumulated ON time exceeds the time (32-bit binary data) specified in (s).
• In (s)+1 and (s), specify the period of time until the device specified by (d2) is turned on in units of hour.
• The measured current value in units of hour is stored in (d1)+1 and (d1). ((d1)+1: highest-order, (d1): lowest-order)
• The measured current value of less than one hour (in units of second) is stored in (d1)+2.
• (d2) is set to on when the current value in (d1)+1 and (d1) exceeds the time specified by (s).
• Specify a latched (battery backed) type data register as (d1) so that the current value data can be continuously used even
after the power to CPU module turns off. If a general data type register is used, the current value data is cleared when the
power to the CPU module is turned OFF or when the controller mode switches from STOP to RUN.
• Even after the alarm output specified by (d2) turns ON, the measurement is continued.
• When the current value reaches the maximum value of 32-bit data, the measurement is stopped. For continuing the
measurement, clear the current value stored in (d1) to (d1)+2.
Precautions
• Three devices are occupied by (d1). Make sure that these devices are not used by other machine controls.
8 APPLICATION INSTRUCTION
8.23 Timing Check Instruction 701
Operation error
Error code Description
(SD0/SD8067)
2820H The device areas specified by (d1) exceed the corresponding device range.
3405H The value of (s) is negative.
8 APPLICATION INSTRUCTION
702 8.23 Timing Check Instruction
8.24 Module Access Instruction
I/O refresh
REF(P)/RFS(P)
These instructions refresh the (n) points of devices starting from the device specified by (s), and receive an external input or
generate an output.
The REF(P) instructions can also be used as RFS(P).
Ladder diagram Structured text
ENO:=REF(EN,s,n);
ENO:=REFP(EN,s,n);
(s) (n)
ENO:=RFS(EN,s,n);
ENO:=RFSP(EN,s,n);
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
8
(s) Head device number to be refreshed Bit ANY_BOOL
(n) Number of devices to be refreshed 0 to 65535 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(n)
Processing details
• This function refreshes only the corresponding devices in the middle of a scan and receives an external input or generates
an output.
• Since the input receptions and external outputs are performed at one time only after the END instruction is executed in the
program, a pulse signal cannot be output externally in the middle of a scan. The execution of the I/O refresh instruction
forcibly refreshes the corresponding input (X) or output (Y) in the middle of program execution, and then a pulse signal can
be output externally in the middle of a scan.
8 APPLICATION INSTRUCTION
8.24 Module Access Instruction 703
• To refresh an input (X) or an output (Y) in 1 point units, use the direct access input (DX) or the direct access output (DY).
Ex.
When a program using the RFS instruction is changed to a program using direct access input/output
Command
REF X0 K1 (1)
X0 Y20
Command
REF Y20 K1 (2)
DX0 DY20
Operation error
Error code Description
(SD0/SD8067)
2820H The (n) points of device range starting from the device specified by (s) exceed the range of proximal I/O.
8 APPLICATION INSTRUCTION
704 8.24 Module Access Instruction
Reading 1-word/2-word data from another module
FROM(P), DFROM(P)
• FROM(P)
These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by
(U/H), and store the data to the device specified by (d) and later (d).
• DFROM(P)
These instructions read the (n) × 2 words of data from the buffer memory specified by (s) intelligent function module specified
by (U/H), and store the data to the device specified by (d) and later.
Ladder diagram Structured text
ENO:=FROM(EN,UnHn,s,n,d);
ENO:=FROMP(EN,UnHn,s,n,d);
(U/H) (s) (d) (n)
ENO:=DFROM(EN,UnHn,s,n,d);
ENO:=DFROMP(EN,UnHn,s,n,d);
FBD/LD
EN ENO
UnHn d
Setting data
8
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U/H) Unit number H1 to H10 16-bit unsigned binary ANY16
(s) Start address of the buffer memory where the read-target data is 0 to 65535 16-bit unsigned binary ANY16
stored
(d) FROM(P) Head device number for storing the read data 16-bit signed binary ANY16
DFROM(P) 32-bit signed binary ANY32
(n) Number of read data 1 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U/H displays as UnHn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U/H)
(s)
(d) *1 *1
(n)
8 APPLICATION INSTRUCTION
8.24 Module Access Instruction 705
Processing details
■FROM(P)
• These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by
(U/H), and store the data to the device specified by (d) and later.
Buffer memory CPU module
(s) (d)
(n) words (n) points
■DFROM(P)
• These instructions read the (n) × 2 words of data from the buffer memory specified by (s) in intelligent function module
specified by (U/H), and store the data to the device specified by (d) and later.
Buffer memory CPU module
(s) (d)
Precautions
• For the nibble of a bit device specified by (d), specify K1 to K4 in the FROM(P) instruction and K1 to K8 in the DFROM(P)
instruction.
• When a number greater than 65535 is specified as the buffer memory specified by (s), use the FROMD(P) instruction or
use U\G in the MOV(P) instruction. The following shows the program to transfer the buffer memory #70000 in the
intelligent function module No. 1 to D0.
SM400
MOV U1\G70000 D0
Transfer Transfer
source destination
Module No. 1
buffer memory #70000
Operation error
Error code Description
(SD0/SD8067)
2441H Updating procedure with the unit was not properly completed during the execution of the instruction.
2801H The unit number specified by (U/H) does not exist.
2823H The buffer memory number specified by (s) exceeds the buffer memory area.
The buffer memory number specified by (s) + the number of transfer points specified by (n) exceeds the buffer memory area.
2820H The device number specified by (d) + the number of read data specified by (n) exceeds the corresponding device range.
3056H Timeout occurred while communicating with the connected units during the execution of the instruction.
3060H Signal error is detected while accessing the connected units during the execution of the instruction.
3580H An instruction that cannot be used in an interrupt program is used.
8 APPLICATION INSTRUCTION
706 8.24 Module Access Instruction
Common items among the FROM(P), DFROM(P), TO(P), and DTO(P) (details)
• Use the module number to specify which Intelligent function module the instruction works for. The setting range is from H1
to H10 (K1 to K16).
• A module number is automatically assigned to each intelligent function module connected to a CPU module. The module
number is assigned in the way "No. 1 → No. 2 → No. 3 ..." starting from the equipment nearest the CPU module.
• 16-bit RAM memories are built in an intelligent function module, and they are called buffer memories. The contents of buffer
memories vary depending on the purpose of control of each Intelligent function module, and the setting range is from K0 to
K65535.
• The number of read data is specified by (n), and the setting range is from K1 to K65535.
Specified device Specified BFM
D100 BFM#5
D101 #6
D102 #7
D103 #8
D104 #9
n=5
• If this instruction is executed in an interrupt program with the priority 1, operation error (3580H) occurs. This instruction
operates in an interrupt program with the priority 2 or 3. 8
• If this instruction is executed to an FX3 intelligent function module within an interrupt program, operation error (3580H)
occurs.
8 APPLICATION INSTRUCTION
8.24 Module Access Instruction 707
Writing 1-word/2-word data to another module
TO(P), DTO(P)
• TO(P)
These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
• DTO(P)
These instructions write the (n) × 2 points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
Ladder diagram Structured text
ENO:=TO(EN,UnHn,s1,s2,n);
ENO:=TOP(EN,UnHn,s1,s2,n);
(U/H) (s1) (s2) (n)
ENO:=DTO(EN,UnHn,s1,s2,n);
ENO:=DTOP(EN,UnHn,s1,s2,n);
FBD/LD
EN ENO
UnHn
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U/H)*1 Unit number H1 to H10 16-bit unsigned binary ANY16
(s1) Start address of the buffer memory for writing the data 0 to 65535 16-bit unsigned binary ANY16
(s2) TO(P) Write data, or head device number which stores the write data 16-bit signed binary ANY16
DTO(P) 32-bit signed binary ANY32
(n) Number of write data 1 to 65535 16-bit unsigned binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U/H displays as UnHn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U/H)
(s1)
(s2) *1 *1
(n)
8 APPLICATION INSTRUCTION
708 8.24 Module Access Instruction
Processing details
■TO(P)
• These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
CPU module Buffer memory
(s2) (s1)
(n) points (n) words
• When a constant is specified in (s2), (n) words of the same data (the value specified by (s2)) is written starting from the
specified buffer memory address.
CPU module Buffer memory
(s2) 0
5
(s1)
5
5
(n) words (The same data is written.)
5
8
■DTO(P)
• These instructions write the (n) × 2 points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
CPU module Buffer memory
(s2) (s1)
• When a constant is specified in (s2), (n) x 2 words of the same data (the value specified by (s2)) is written starting from the
specified buffer memory address.
CPU module Buffer memory
(s2) (s1)
70000 70000
70000
(n)2 words (The same data is written.)
70000
8 APPLICATION INSTRUCTION
8.24 Module Access Instruction 709
Precautions
• For the nibble of a bit device specified by (s2), specify K1 to K4 in the TO(P) instruction and K1 to K8 in the DTO(P)
instruction.
• When a number greater than 65535 is specified as the buffer memory specified by (s1), use the TOD(P) instruction or use
U\G in the MOV(P) instruction.
Operation error
Error code Description
(SD0/SD8067)
2441H Updating procedure with the unit was not properly completed during the execution of the instruction.
2801H The unit number specified by (U/H) does not exist.
2823H The buffer memory number specified by (s1) exceeds the buffer memory area.
The buffer memory number specified by (s1) + the number of transfer points specified by (n) exceeds the buffer memory
area.
2820H The device number specified by (s2) + the number of write data specified by (n) exceeds the corresponding device range.
3056H Timeout occurred while communicating with the connected units during the execution of the instruction.
3060H Signal error is detected while accessing the connected units during the execution of the instruction.
3580H An instruction that cannot be used in an interrupt program is used.
8 APPLICATION INSTRUCTION
710 8.24 Module Access Instruction
Reading 1-word/2-word data from another module
FROMD(P), DFROMD(P)
• FROMD(P)
These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by
(U/H), and store the data to the device specified by (d) and later.
• DFROMD(P)
These instructions read the (n) × 2 words of data from the buffer memory specified by (s) in intelligent function module
specified by (U/H), and store the data to the device specified by (d) and later.
Ladder diagram Structured text
ENO:=FROMD(EN,UnHn,s,n,d);
ENO:=FROMDP(EN,UnHn,s,n,d);
(U/H) (s) (d) (n)
ENO:=DFROMD(EN,UnHn,s,n,d);
ENO:=DFROMDP(EN,UnHn,s,n,d);
FBD/LD
EN ENO
UnHn d
Setting data
8
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U/H) Unit number H1 to H10 16-bit unsigned binary ANY16
(s) Start address of the buffer memory where the read-target data 0 to 4294967295 32-bit unsigned binary ANY32
is stored
(d) FROMD(P) Head device number for storing the read data 16-bit signed binary ANY16
DFROMD(P) 32-bit signed binary ANY32
(n) Number of read data 1 to 65535 32-bit unsigned binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U/H displays as UnHn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U/H)
(s)
(d) *1 *1
(n)
8 APPLICATION INSTRUCTION
8.24 Module Access Instruction 711
Processing details
■FROMD(P)
• These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by
(U/H), and store the data to the device specified by (d) and later.
Buffer memory CPU module
(s) (d)
(n) words (n) points
■DFROMD(P)
• These instructions read the (n) × 2 words of data from the buffer memory specified by (s) in intelligent function module
specified by (U/H), and store the data to the device specified by (d) and later.
Buffer memory CPU module
(s) (d)
Precautions
• For the nibble of a bit device specified by (d), specify K1 to K4 in the FROMD(P) instruction and K1 to K8 in the
DFROMD(P) instruction.
Operation error
Error code Description
(SD0/SD8067)
2441H Updating procedure with the unit was not properly completed during the execution of the instruction.
2801H The unit number specified by (U/H) does not exist.
2823H The buffer memory number specified by (s) exceeds the buffer memory area.
The buffer memory number specified by (s) + the number of transfer points specified by (n) exceeds the buffer memory area.
2820H The device number specified by (d) + the number of read data specified by (n) exceeds the corresponding device range.
3056H Timeout occurred while communicating with the connected units during the execution of the instruction.
3060H Signal error is detected while accessing the connected units during the execution of the instruction.
3580H An instruction that cannot be used in an interrupt program is used.
8 APPLICATION INSTRUCTION
712 8.24 Module Access Instruction
Common items among the FROMD(P), DFROMD(P), TOD(P), and DTOD(P) (details)
• Use the module number to specify which intelligent function module the instruction works for. The setting range is from H1
to H10 (K1 to K16).
• A module number is automatically assigned to each intelligent function module connected to a CPU module. The module
number is assigned in the way "No. 1 → No. 2 → No. 3 ..." starting from the equipment nearest the CPU module.
• 16-bit RAM memories are built in an intelligent function module, and they are called buffer memories. The contents of buffer
memories vary depending on the purpose of control of each intelligent function module, and the setting range is from K0 to
K4294967295.
• The number of read data is specified by (n), and the setting range is from K1 to K65535.
Specified device Specified BFM
D100 BFM#5
D101 #6
D102 #7
D103 #8
D104 #9
n=5
• If this instruction is executed in an interrupt program with the priority 1, operation error (3580H) occurs. This instruction
operates in an interrupt program with the priority 2 or 3. 8
• If this instruction is executed to an FX3 intelligent function module within an interrupt program, operation error (3580H)
occurs.
8 APPLICATION INSTRUCTION
8.24 Module Access Instruction 713
Writing 1-word/2-word data to another module (32-bit
specification)
TOD(P), DTOD(P)
• TOD(P)
These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
• DTOD(P)
These instructions write the (n) × 2 points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
Ladder diagram Structured text
ENO:=TOD(EN,UnHn,s1,s2,n);
ENO:=TODP(EN,UnHn,s1,s2,n);
(U/H) (s1) (s2) (n)
ENO:=DTOD(EN,UnHn,s1,s2,n);
ENO:=DTODP(EN,UnHn,s1,s2,n);
FBD/LD
EN ENO
UnHn
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U/H) Unit number H1 to H10 16-bit unsigned binary ANY16
(s1) Start address of the buffer memory for writing the data 0 to 4294967295 32-bit unsigned binary ANY32
(s2) TOD(P) Write data, or head device number which stores the write data 16-bit signed binary ANY16
DTOD(P) 32-bit signed binary ANY32
(n) Number of write data 1 to 65535 32-bit unsigned binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U/H displays as UnHn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U/H)
(s1)
*1 *1
(s2)
(n)
8 APPLICATION INSTRUCTION
714 8.24 Module Access Instruction
Processing details
■TOD(P)
• These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
CPU module Buffer memory
(s2) (s1)
(n) points (n) words
• When a constant is specified in (s2), (n) words of the same data (the value specified by (s2)) is written starting from the
specified buffer memory address.
CPU module Buffer memory
(s2) 0
5
(s1)
5
5
(n) words (The same data is written.)
8
5
■DTOD(P)
• These instructions write the (n) × 2 points of data in the device starting from the one specified by (s2) to the buffer memory
address specified by (s1) in intelligent function module specified by (U/H).
CPU module Buffer memory
(s2) (s1)
• When a constant is specified in (s2), (n) × 2 words of the same data (the value specified by (s2)) is written starting from the
specified buffer memory address.
CPU module Buffer memory
(s2) (s1)
70000 70000
70000
(n)2 words (The same data is written.)
70000
8 APPLICATION INSTRUCTION
8.24 Module Access Instruction 715
Precautions
• For the nibble of a bit device specified by (s2), specify K1 to K4 in the TOD(P) instruction and K1 to K8 in the DTOD(P)
instruction.
Operation error
Error code Description
(SD0/SD8067)
2441H Updating procedure with the unit was not properly completed during the execution of the instruction.
2801H The unit number specified by (U/H) does not exist.
2823H The buffer memory number specified by (s1) exceeds the buffer memory area.
The buffer memory number specified by (s1) + the number of transfer points specified by (n) exceeds the buffer memory area.
2820H The device number specified by (s2) + the number of write data specified by (n) exceeds the corresponding device range.
3056H Timeout occurred while communicating with the connected units during the execution of the instruction.
3060H Signal error is detected while accessing the connected units during the execution of the instruction.
3580H An instruction that cannot be used in an interrupt program is used.
8 APPLICATION INSTRUCTION
716 8.24 Module Access Instruction
8.25 Logging Instructions
Setting trigger logging
LOGTRG
This instruction generates a trigger condition for the specified logging setting number in trigger logging.
Ladder diagram Structured text
ENO:=LOGTRG(EN,s);
(s)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Logging setting number 1 to 4 16-bit signed binary ANY16
EN
ENO
Execution condition
Execution result
Bit
Bit
BOOL
BOOL
8
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
Processing details
• This instruction generates a trigger for trigger logging with the logging setting number specified by (s).
• Specify a value 1 to 4 in (s).
• The LOGTRG instruction turns on the special relay (logging trigger) with the logging setting number in the device specified
by (s) and executes trigger logging for the specified number of records.
• The instruction is enabled when "When trigger instruction executed" is selected in the "Trigger condition".
• Even if the LOGTRG instruction is executed, no processing is performed in the following cases.
• A logging setting number in which an item other than "When trigger instruction executed" is selected in the "Trigger condition" is specified.
• A logging setting number with no setting is specified.
• A logging setting number specifying the execution of continuous logging is specified.
• Another LOGTRG instruction is executed without executing the LOGTRGR instruction after a LOGTRG instruction was executed once.
Operation error
Error code Description
(SD0/SD8067)
3405H The value set in (s) is other than the following.
1≤(s)≤4
8 APPLICATION INSTRUCTION
8.25 Logging Instructions 717
Resetting trigger logging
LOGTRGR
This instruction resets the trigger condition of the specified logging setting number.
Ladder diagram Structured text
ENO:=LOGTRGR(EN,s);
(s)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Logging setting number 1 to 4 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
Processing details
• This instruction resets the LOGTRG instruction of the logging setting number specified by (s). The instruction disables the
LOGTRG instruction of the specified trigger logging setting number.
• The LOGTRGR instruction turns off the special relay (logging completion, logging trigger, and after logging trigger) with the
logging setting number in the device specified by (s).
Precautions
When the LOGTRGR instruction is executed after the LOGTRG instruction is executed in the same scan, the LOGTRG
instruction becomes invalid.
Operation error
Error code Description
(SD0/8067)
3405H The value set in (s) is other than the following.
1≤(s)≤4
8 APPLICATION INSTRUCTION
718 8.25 Logging Instructions
9 STEP LADDER INSTRUCTIONS
9
9.1 Starts/Ends Step Ladder
STL, RETSTL
STL: This instruction starts step ladder.
RETSTL: This instruction ends step ladder.
Ladder diagram Structured text
Not supported.
STL (d)
(1)
RETSTL
FBD/LD
Not supported.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) The step relay number which assigns the State 0 to 4096 Bit ANY_BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
Processing details
• In programs using step ladder instructions, a step relay S is assigned to each process based on machine operations, and
sequences of input condition and output control are programmed as circuits connected to contacts (STL contacts) of state
relays.
• In a step ladder program, a step relay S is regarded as one control process, and a sequence of input conditions and output
controls are programmed in a state relay. Because the preceding process is stopped when the program execution proceeds
to the next process, a machine can be controlled using simple sequences for each process.
• The step relay number specified by STL instruction is assigned to the State. The start and completion of the State use SET
instruction, RST instruction, and ZRST instruction.
• Program a step ladder program starting from the initial state relay in the order of state relay ON status transfer. Make sure
to put the RETSTL instruction at the end of a step ladder program. The RETSTL instruction is omissible anywhere other
than the last Step Ladder.
STL S0
X0 Process of S0
SET S20
start
STL S20
Y23 Moving
Y21 forward Process of S20
X1
SET S21
STL S21
Y21 Moving
Y23 Process of S21
backward
RETSTL
END
• A step ladder program is expressed as a relay ladder, but it can be created according to the machine control flow using
state relays. A state relay consists of a drive coil and contact (STL contact) in the same way as other relays. Use SET or
OUT instructions to drive a coil, and use STL instructions for a contact.
• The table below shows operations of internal circuits connected to the state relays,
Internal circuit diagram operation
Execution in the contact ON status When a state relay turns ON, a connected circuit (internal circuit) is activated with a STL contact.
Execution in the contact OFF status When a condition (transfer condition) provided between state relays is satisfied, the next state relay turns ON, and the
(for one operation cycle) state relay which was been ON before hand turns OFF (transfer operation). In the state relay ON status transfer
process, both state relays are ON for one operation cycle.
In the next operation cycle after the ON status is transferred to the next state relay, the former state relay is reset to
OFF. A drive instruction connected to the bus line of the reset state relay is executed in the contact OFF status for one
operation cycle regardless of the actual contact status before the drive instruction.
When the transfer state relay is used in a contact instruction, however, the contact image is executed in the OFF
status immediately after the transfer condition is satisfied.
Non-execution An instruction is not executed in the contact OFF status after the operation cycle where the instruction was executed
in the contact OFF status (jump status).
• The figure below shows the timing chart of the state relay (internal circuit) activation status.
Execution in the
contact ON status
Execution in the contact OFF status
in one operation cycle
Execution Non-execution
(jump status)
• Each state relay has three functions, driving a load, specifying a transfer destination and specifying a transfer condition.
Such as the following program, driving a load and then transition processing. In a state relay without any load, the drive
processing is not required.
STL S20
Y10
Drive processing
X10
Y11
X11
X0 X1
STL S21 Transfer processing
SM400 *1 *2 SM400
Y30 Y30
Process of S31
SM400 *1 SM400
SET Y31 When X1 turns ON, S32 SET Y31
Y31 programmed in the
turns ON and S31 is SET instruction remains
X1 *3 automatically reset. X1 ON even if S31 is reset.
SET S32 SET S32
*4
STL S32 STL S32
SM400 *1 *2 SM400
*5 Y30 Y30
Process of S32 Activated
Y32 Y32
X2 *3 X2
S33 S33
When the step relay is latched, the ON/OFF status is backed up by nonvolatile memory against power failure.
Use this type of state relay if the operation should be restarted from the last point before power failure. These
relays hold the operation status also at the time of RUN to STOP. If it RUN(s) again, the operation will be
resumed from the State before STOP.
■Related devices
Device Name Remarks
SM8040 STL transfer disable When SM8040 is set to ON, transfer of the ON status is disabled among all state relays.
SM8046 STL state ON When the step relay turns on, SM8046 turns on automatically.
SM8047 Enable STL monitoring When SM8047 is turned on, it stores in SD8040 to SD8047 sequentially from the young number of
the step relay which operates in the step relay.
SD8040 to SD8047 ON step relay numbers The turned-on step relay number is stored in SD8040 to SD8047 (Max. 8 points) sequentially from
the smaller number.
Precautions
When the step relay is not latched, step relay clears at power supply ON→OFF or RUN→STOP. If the State is valid and power
supply ON→OFF or PLC RUN→STOP, operation can not be restarted from the last point before power-supply ON→OFF or
RUN→STOP.
Operation error
There is no operation error.
SP.SOCOPEN
This instruction opens a connection.
Ladder diagram Structured text
ENO:=SP_SOCOPEN(EN,U0,s1,s2,d);
FBD/LD
EN ENO
U0 d
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(s1) Connection number 1 to 8 16-bit unsigned binary ANY16
(s2) Head device number for storing the control data Refer to Control data Word ANY16_ARRAY
(Page 723) (Number of elements:
10)
(d) Head device number which turns ON when the execution of Bit ANYBIT_ARRAY
the instruction is completed and remains ON for 1 scan. (Number of elements: 2)
If the instruction is completed with an error, (d)+1 is also
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d) *1
0000H: 10
The open processing is performed with the settings configured using
"External Device Configuration" of the engineering tool.
8000H:
The open processing is performed with the set values of the control
data (s2)+2 to (s2)+9.
(s2)+1 Completion status The status at the completion of the instruction is stored. System
0000H: Completed successfully
Other than 0000H: Completed with an error (error code)
For error codes, refer to MELSEC iQ-F FX5 User's Manual
(Ethernet Communication).
(s2)+2 Application setting area b15b14 b13 to b11 b10 b9 b8 b7 to b0 As shown on the left User
(s2)+2 [4] 0 [3] [2][1] 0
*1 User: Data to be set before the execution of the instruction. System: The CPU module stores the execution result of the instruction.
*2 When Unpassive open is selected, the target device IP address and target device port number are ignored.
*3 Of the host station port numbers, 1 to 1023 (0001H to 03FFH) are generally reserved port numbers and 61440 to 65534 (F000H to
FFFEH) are used by other communication functions. Thus, using 1024 to 5548 and 5570 to 61439 (0400H to 15ACH and 15C2H to
EFFFH) as the port numbers is recommended. Do not specify 5549 to 5569 (15ADH to 15C1H) since they are used by the system.
SP.SOCOPEN instruction
ON
OFF
Completion device (d)+0
ON When failed
OFF
Completion device (d)+1 1 scan when
Connection
normally completed
open
• The connection in which no protocol is set with the parameter can be opened and used. In this case, specify 8000H in
(s2)+0 and the contents of the open processing in (s2)+2 to (s2)+9.
For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication).
Operation error
Error code Description
(SD0/SD8067)
3405H The connection number specified by (s1) is other than 1 to 8.
2820H The device number specified by (s2) or (d) is outside the range of the number of device points.
2822H Device that cannot be specified is specified.
3582H When an instruction which cannot be used in interruption routine program is used.
SP.SOCCLOSE
This instruction closes a connection.
Ladder diagram Structured text 10
ENO:=SP_SOCCLOSE(EN,U0,s1,s2,d);
FBD/LD
EN ENO
U0 d
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(s1) Connection number 1 to 8 16-bit unsigned binary ANY16
(s2) Head device number for storing the control data Refer to Control data Word ANY16_ARRAY
(Page 725) (Number of elements: 2)
(d) Head device number which turns on when the execution of Bit ANYBIT_ARRAY
the instruction is completed and remains on for 1 scan. (Number of elements: 2)
If the instruction is completed with an error, (d)+1 is also
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d) *1
■Control data
Device Item Description Setting range Set by*1
(s2)+0 System area
(s2)+1 Completion status The status at the completion of the instruction is stored. System
0000H: Completed successfully
Other than 0000H: Completed with an error (error code)
For error codes, refer to MELSEC iQ-F FX5 User's Manual
(Ethernet Communication).
*1 System: The CPU module stores the execution result of the instruction.
SP.SOCCLOSE instruction
ON
OFF
Completion device (d)+0
ON When failed
OFF
Completion device (d)+1 1 scan when normally
Connection
completed
closed
For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication).
Operation error
Error code Description
(SD0/SD8067)
3405H The connection number specified by (s1) is other than 1 to 8.
2820H The device number specified by (s2) or (d) is outside the range of the number of device points.
2822H Device that cannot be specified is specified.
3582H When an instruction which cannot be used in interruption routine program is used.
Do not execute the SP.SOCCLOSE instruction when Passive open is selected. Since the open completion
signal and open request signal of the corresponding connection turn OFF and close processing is executed,
the communication is disabled.
SP.SOCRCV
10
This instruction reads the receive data. (Reading during END processing)
Ladder diagram Structured text
ENO:=SP_SOCRCV(EN,U0,s1,s2,d1,d2);
FBD/LD
EN ENO
U0 d1
s1 d2
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(s1) Connection number 1 to 8 16-bit unsigned binary ANY16
(s2) Head device number for specifying the control data Refer to Control data Word ANY16_ARRAY
(Page 728) (Number of elements: 2)
(d1) Head device number for storing the receive data Word ANY16
(d2) Head device number which turns ON when the execution of Bit ANYBIT_ARRAY
the instruction is completed and remains ON for 1 scan. (Number of elements: 2)
If the instruction is completed with an error, (d2)+1 is also
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d1)
*1
(d2)
*1 System: The CPU module stores the execution result of the instruction.
• When the SP.SOCRCV instruction is executed, reading data from the socket communication receive data
area is executed with the END processing. Thus, executing the SP.SOCRCV instruction extends the scan
time.
• When the data of odd-number of bytes is received, invalid data is stored in the higher byte of the device
where the last receive data is stored.
Processing details
In the END processing after the execution of the SP.SOCRCV instruction, the receive data of the connection specified by (s1)
is read from the socket communication receive data area.
CPU module
Receive data
(d1)+0 length
Socket communications
(d1)+1 Receive data receive data storage area
The completion of the SP.SOCRCV instruction can be checked using the completion devices (d2)+0 and (d2)+1.
• Completion device (d2)+0: Turns ON during the END processing for the scan in which the SP.SOCRCV instruction is
completed, and turns OFF during the next END processing.
• Completion device (d2)+1: Turns ON or OFF depending on the status when the SP.SOCRCV instruction is completed.
Status Description
When completed normally The device does not change (remains OFF).
When completed with an error The device turns ON during the END processing for the scan in which the SP.SOCRCV instruction is completed, and turns
OFF during the next END processing.
ON
Open completion signal OFF
(SD10680.n)
END processing END processing END processing
Sequence program
10
ON
Receive state signal OFF
(SD10682.n) Execute SP.SOCRCV instruction
SP.SOCRCV instruction
1 scan
ON
Completion device (d2)+0 OFF
When failed
ON
Completion device (d2)+1 OFF
Data
reading
Data processing
ACK
reception (Only TCP)
For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication).
Operation error
Error code Description
(SD0/SD8067)
3405H The connection number specified by (s1) is other than 1 to 8.
2820H The size of the receive data exceeds the size of the receive data storage device.
The device number specified by (s2), (d1), or (d2) is outside the range of the number of device points.
2822H Device that cannot be specified is specified.
3582H When an instruction which cannot be used in interruption routine program is used.
SP.SOCSND
This instruction sends data.
Ladder diagram Structured text
ENO:=SP_SOCSND(EN,U0,s1,s2,s3,d);
FBD/LD
EN ENO
U0 d
s1
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(s1) Connection number 1 to 8 16-bit unsigned binary ANY16
(s2) Head device number for specifying the control data Refer to Control data Word ANY16_ARRAY
(Page 731) (Number of elements: 2)
(s3) Head device number for storing the send data Word ANY16
(d) Head device number which turns ON when the execution of Bit ANYBIT_ARRAY
the instruction is completed and remains on for 1 scan. (Number of elements: 2)
If the instruction is completed with an error, (d)+1 is also
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(s3)
(d) *1
*1 User: Data to be set before the execution of the instruction. System: The CPU module stores the execution result of the instruction.
When TCP is used, specify send data length that is smaller than the maximum window size of the target
device (Receive data buffer of TCP). Data whose size exceeds the maximum window size of the target device
cannot be sent.
Processing details
This instruction send the data set by (s3) to the target device of the connection specified by (s1).
CPU module
The completion of the SP.SOCSND instruction can be checked using the completion devices (d)+0 and (d)+1.
• Completion device (d)+0: Turns ON during the END processing for the scan in which the SP.SOCSND instruction is
completed, and turns OFF during the next END processing.
• Completion device (d)+1: Turns ON or OFF depending on the status when the SP.SOCSND instruction is completed.
Status Description
When completed normally The device does not change (remains OFF).
When completed with an error The device turns ON during the END processing for the scan in which the SP.SOCSND instruction is completed, and turns
OFF during the next END processing.
Data send
processing
Data
transmission
(send) *1 *1 Even after completion device
turns ON, data transmission
may continue.
For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication).
Operation error
Error code Description
(SD0/SD8067)
3405H The connection number specified by (s1) is other than 1 to 8.
2820H The device number specified by (s2), (s3), or (d) is outside the range of the number of device points.
2822H Device that cannot be specified is specified.
3582H When an instruction which cannot be used in interruption routine program is used.
SP.SOCCINF
This instruction reads the connection information.
Ladder diagram Structured text 10
ENO:=SP_SOCCINF(EN,U0,s1,s2,d);
FBD/LD
EN ENO
U0 d
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(s1) Connection number 1 to 8 16-bit unsigned binary ANY16
(s2) Head device number for storing the control data Refer to Control data Word ANY16_ARRAY
(Page 734) (Number of elements: 2)
(d) Head device number for storing the connection information Word ANY16_ARRAY
(Number of elements: 5)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (DY)
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d)
*1 System: The CPU module stores the execution result of the instruction.
*2 When the instruction is executed for a connection that is not open, 0H is returned.
*3 Of the host station port numbers, 1 to 1023 (0001H to 03FFH) are generally reserved port numbers and 61440 to 65534 (F000H to
FFFEH) are used by other communication functions. Thus, using 1024 to 5548 and 5570 to 61439 (0400H to 15ACH and 15C2H to
EFFFH) as the port numbers is recommended. Do not specify 5549 to 5569 (15ADH to 15C1H) since they are used by the system.
Processing details
This instruction reads the connection information of the connection specified by (s1).
For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication).
Operation error
Error code Description
(SD0/SD8067)
3405H The connection number specified by (s1) is other than 1 to 8.
2820H The device number specified by (s2) or (d) is outside the range of the number of device points.
2822H Device that cannot be specified is specified.
S(P).SOCRDATA
This instruction reads the data in the socket communication receive data area.
Ladder diagram Structured text 10
ENO:=S_SOCRDATA(EN,U0,s1,s2,n,d);
ENO:=SP_SOCRDATA(EN,U0,s1,s2,n,d);
(U) (s1) (s2) (d) (n)
FBD/LD
EN ENO
U0 d
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(s1) Connection number 1 to 8 16-bit unsigned binary ANY16
(s2) Head device number for storing the control data Refer to Control data Word ANY16_ARRAY
(Page 735) (Number of elements: 2)
(d) Head device number for storing the read data Word ANY16
(n) Number of the read data (1 to 1024 words) 1 to 1024 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d)
(n)
■Control data
Device Item Description Setting range Set by*1
(s2)+0 System area
(s2)+1 Completion status The status at the completion of the instruction is stored. System
0000H: Completed successfully
Other than 0000H: Completed with an error (error code)
For error codes, refer to MELSEC iQ-F FX5 User's Manual
(Ethernet Communication).
*1 System: The CPU module stores the execution result of the instruction.
• When (n) is 1, the receive data length can be read. By doing this, the device for storing the receive data can
be changed when the SP.SOCRCV instruction is executed.
For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication).
Precautions
• Even when the S(P).SOCRDATA instructions are executed, the socket communication receive data area is not cleared and
the receiving status signal does not change. Therefore, the next receive data is not stored in the socket communication
receive data area.
• To update receive data, use the SP.SOCRCV instruction to read the receive data.
Operation error
Error code Description
(SD0/SD8067)
3405H The connection number specified by (s1) is other than 1 to 8.
2820H The device number specified by (s2), (d), or (n) is outside the range of the number of device points.
2822H Device that cannot be specified is specified.
SP.ECPRTCL
10
This instruction executes the communication protocol registered using the engineering tool.
Ladder diagram Structured text
ENO:=SP_ECPRTCL(EN,U0,s1,s2,s3,d);
FBD/LD
EN ENO
U0 d
s1
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(s1) Connection number 1 to 8 16-bit unsigned binary ANY16
(s2) Number of protocols to be executed continuously 1 to 8 16-bit unsigned binary ANY16
(s3) Head device number for storing the control data Refer to Control data Word ANY16_ARRAY
(Page 737) (Number of elements: 18)
(d) Head device number which turns ON when the execution of Bit ANYBIT_ARRAY
the instruction is completed and remains on for 1 scan. (Number of elements: 2)
If the instruction is completed with an error, (d)+1 is also
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(s3)
(d) *1
■Control data
Device Item Description Setting range Set by*1
(s3)+0 Resulting number of The number of protocols executed by the SP.ECPRTCL instruction is stored. 0, 1 to 8 System
executed protocols Any protocol where an error occurred is also included in the execution number. If
the setting of setting data or control data contains an error, "0" is stored.
*1 System: The CPU module stores the execution result of the instruction.
SP.ECPRTCL instruction
ON
OFF
Completion device (d)+0
ON When failed
OFF
Completion device (d)+1 When normally
Executing a
completed
protocol(s)
1 scan
For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication).
Precautions
• If an error occurs in the mth protocol while multiple protocols are being executed, the instruction does not execute the
"m+1"th protocol and after and is completed with an error.
• The connections for which the SP.ECPRTCL instruction can be executed are only those for which "Communication
protocol" is specified for the communication means.
• If a cancel request is received during execution of the mth protocol while multiple protocols are executed continuously, the
following is stored in (s3).
Device Item Description
(s3)+0 Resulting number of executed The executed protocol number.
protocols
(s3)+1 Completion status The error codes.
(s3)+10 Collation match The receive packet number successful in collation match for the already executed protocol.
Receive packet number 1
(s3)+m+8 Collation match
Receive packet number m-1
• If same instructions are executed for the same connection, the subsequent instruction is ignored and is not executed until
the preceding instruction is completed.
• The SP.ECPRTCL instruction itself does not open/close a connection and therefore the SP.SOCOPEN/SP.SOCCLOSE
instructions need to be used to open/close the connection.
Refer to the Page 722 SP.SOCOPEN and Page 725 SP.SOCCLOSE
SP.SLMPSND
10
This instruction sends SLMP messages to an SLMP-compatible device.
Ladder diagram Structured text
ENO:=SP_SLMPSND(EN,Un,s1,s2,d1,d2);
FBD/LD
EN ENO
Un d1
s1 d2
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Dummy String ANYSTRING_SINGLE
(s1) Head device where control data is stored Page 742 Control data Word ANY16_ARRAY
(Number of elements: 19)
(s2) Head device where request frame is stored Page 743 Request frame Word ANY16_ARRAY*2
(d1) Head device for storing response frame Page 743 Response Word ANY16_ARRAY*2
frame
(d2) Head device that turns on for one scan upon completion of Bit ANYBIT_ARRAY
the instruction (Number of elements: 2)
When the instruction completes with an error, (d2)+1 also
turns on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d1)
(d2) *1
*1 If (s1)+0 is set to "0: Without arrival check", receive data is not set. Set 0 in (s1)+0 in the following cases:
⋅ When a command that does not return a response message is used
⋅ When a response message is not referred to
*2 When “0” or “255” is specified to the fourth octet of the IP address of the target device, a send error occurs and the SP.SLMPSND
instruction is completed with an error.
In addition, the error code (C1CDH (SP.SLMPSND instruction message send error)) is stored in the completion status.
• When data of the error completion type (the 7th bit of (s1)+0) is set to "1" and "0", the operations are shown below.
Error completion type Completion status Clock setting flag Clock data IP address of error
(The 7th bit of (s1)+0) (s1)+1 (s1)+12 (s1)+13 to 16 detected device
(s1)+17, 18
0: Do not set the data at completion with an Normal completion 0: Invalid 0 (Clear) 0 (Clear)
error
Error completion 0: Invalid 0 (Clear) 0 (Clear)
1: Set the data at completion with an error Normal completion 0: Invalid 0 (Clear) 0 (Clear)
Error completion 1: Valid Set the information at Set the information at
completion with an error. completion with an error.
■Request frame
Device Item Description Setting range Set by
(s2)+0 Request data length Specify the data length from the monitoring timer to the request data. (In units of 1 to 2000 User
bytes)
(s2)+1 Monitoring timer This timer sets the waiting time for the target device that received a request message 0 to 65535 User
to wait for response to processing request issued to the request destination. (Unit:
Increments of 250 ms)
• 0: Infinite wait
• 1 to 65535: 1 to 65535 × 250 ms
(s1)+2 to Request data The request data of the SLMP message is stored. User
(s1)+n
■Response frame
Device Item Description Setting range Set by
(d1)+0 Response data length The data length from the end code to the response data is stored. (In units of bytes) 2 to 2000 System
(d1)+1 End code The result of command processing is stored. In normal end, 0 is stored. In abnormal System
end, an error code set by the target device is stored.*1
(d1)+2 to Response data Execution results for the request data are set. *2 System
(d1)+n (Some commands do not return response data.)
*1 For the set error code and the corresponding error description, check the specifications of the target device.
*2 For details of the response data, refer to the MELSEC iQ-F FX5 User's Manual (SLMP).
Header Subheader Request Request Request Request Request data Monitoring timer Request data Footer
destination destination destination
destination length
network station No. multidrop
No. module I/O No. station No.
(s1)+3 to (s1)+5 (s1)+6 (s1)+7 (s1)+8 (s1)+9 (s2)+0 (s2)+1 (s2)+2 to (s2)+n
●Response data
(When completed)
Header Subheader Request Request Request Request Response data End code Response data Footer
destination destination destination
destination length
network station No. multidrop
No. module I/O No. station No.
Response data End code Network No. Station No. Request Request Command Subcommand Footer
(responding (responding destination
length station) station) destination
multidrop
module I/O No. station No.
(d1)+0 (d1)+1
Error information
Stored in (d1)
• The SP.SLMPSND instruction communicates using UDP. Set the target device to use UDP.
• The SP.SLMPSND instruction communicates in binary code. Match the setting of the target device also with the binary
code.
• The execution status and the completion status of the SP.SLMPSND instruction can be checked with the completion device
(d2) and the completion status indication device (d2)+1.
• Completion device (d2)+0 : This device turns on during END processing of the scan where the SP.SLMPSND instruction completes, and turns off during the
next END processing.
• Completion status indication device (d2)+1 : This device turns on or off depending on the completion status of the SP.SLMPSND instruction.
Status Description
When completed successfully The device remains off.
When completed with an error The device turns on during the END processing of the scan where the SP.SLMPSND instruction completes, and
turns off during the next END processing.
Precautions
Specify the arrival monitoring time ((S1)+11) of the control data and monitoring timer ((S2)+1) of the request frame so that the
arrival monitoring time≥monitoring timer.
Request
CPU module Target device
destination
(1)
(2)
(s1)+11 (s2)+1
(3)
(4)
The SP.SLMPSND instruction is successfully completed even if the target device returns an abnormal
response. When the SP.SLMPSND instruction is completed successfully, whether the response is normal or
abnormal can be identified by the end code of the response frame. When an abnormal response is returned,
check the manual of the SLMP-compatible device being used and take corrective action.
Operation error
Error code Description
(SD0/SD8067)
3405H The value set to (s1)+2 as own station channel is out of the range, 1 to 9.
The value set to (s2)+0 as the request data length is out of the range, 1 to 2000.
Upon completion with an error, the completion status indication device (d2)+1 is turned on and an error code is stored in the
completion status (s1)+1. For the error code stored in the completion status (s1)+1, refer to the following.
MELSEC iQ-F FX5 User's Manual (Ethernet Communication)
PID
This instruction executes PID control which changes the output value according to the input variation.
Ladder diagram Structured text
ENO:=PID(EN,s1,s2,s3,d);
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Device number storing the target value (SV) -32768 to +32767 16-bit signed binary ANY16*1
(s2) Device number storing the measured value (PV) -32768 to +32767 16-bit signed binary ANY16*1
(s3) Device number storing a parameter 1 to 32767 16-bit signed binary ANY16*1
(d) Device number storing the output value (MV) -32768 to +32767 16-bit signed binary ANY16*1
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 When setting using a label, use the global label assigned to the device.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
*1
(s3)
(d) *1
Processing details
When the target value (s1), measured value (s2), and parameters (s3) to (s3)+6 are set and a program is executed, the
operation result (MV) is stored to the output value (d) at every sampling time (s3). For details, refer to the MELSEC iQ-F
FX5 User's Manual (Application).
SM402
RST D***
Initial pulse
(1)
(1): Latched data register number specified to (d)
16 POSITIONING INSTRUCTION
749
12 NETWORK COMMON INSTRUCTION
Target networks and target station types
Each link dedicated instruction allows access to a station on a network other than the own station network.
The following table lists the target stations of each instruction.
Instruction symbol Target station (another station)
Target network Target station type
GP.READ • Ethernet • QCPU
GP.SREAD • CC-Link IE Controller Network • LCPU
• CC-Link IE Field Network • QSCPU
• MELSECNET/H • QnACPU
• MELSECNET/10 • FX5CPU
• Intelligent device station
GP.WRITE • Ethernet • QCPU
GP.SWRITE • CC-Link IE Controller Network • LCPU
• CC-Link IE Field Network • QnACPU
• MELSECNET/H • FX5CPU
• MELSECNET/10 • Intelligent device station
GP.SEND • Ethernet • QCPU
GP.RECV • CC-Link IE Controller Network • LCPU
• CC-Link IE Field Network • QnACPU
• MELSECNET/H • FX5CPU
• MELSECNET/10 • Interface board for personal computer*1
*1 These instructions can access the following personal computer interface boards having the SEND/RECV functions.
CC-Link IE Field Network interface board, CC-Link IE Controller Network interface board, MELSECNET/H interface board, and
MELSECNET/10 interface board
GP.READ
This instruction reads data from a device in another station programmable controller. (In units of words)
Ladder diagram Structured text
ENO:=GP_READ(EN,Un,s1,s2,d1,d2);
FBD/LD
EN ENO
Un d1
s1 d2
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s1) Own station head device where control data is stored Refer to Page 753 Control Device name ANY16
data.
(s2) Target station head device where the data to be read is Character string*2 ANYSTRING_SINGL
stored E*2
(d1) Own station head device for storing the read data*3 Device name ANY16
(d2) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
(d2)+1 also turns on when the instruction completes with 2)
an error.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 For the specifications of the string data to be specified, refer to the following.
(Page 751 Specifications of character string data specified by link dedicated instructions)
*3 The continuous area specified by the read data length (s1)+9 is required.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d1)
(d2) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
*1 If completion status ((s1)+1) is "Channel in use (dedicated instruction) (error codes: D25AH and D25BH)", data is not stored.
Processing details
• The instruction reads data by the specified number of words ((s1)+9) from the target station head device (s2) into the own
station head device (after (d1)). Specify the target stations in control data ((s1)+4) and ((s1)+5). Upon completion of reading
the device data specified by (s2), the completion device specified by (d2) turns on.
• For the target stations that can be specified, refer to the following.
Page 750 Target networks and target station types
[Own station] [Target station]
(d1) (s2)
READ
Ch1
Ch2
• When executing multiple link dedicated instructions concurrently, be careful not to overlap the channels of the link
dedicated instructions. Multiple link dedicated instructions specifying the same channel cannot be used concurrently.
• The execution of the GP.READ instruction and whether it has been completed normally or completed with an error can be
checked with the completion device (d2) or completion status indication device (d2)+1.
Device Operation
Completion device (d2) The device turns on during the END processing for the scan in which the GP.READ instruction is completed,
and turns off during the next END processing.
Completion status indication device (d2)+1 The device turns on or off depending on the completion status of the GP.READ instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
GP.READ instruction is completed, and turns off during the next END processing.
READ
ON
Start contact OFF OFF
CPU module on ON
Completion device
the own station (d2) OFF OFF
Completion status 1 scan
indication device
(d2)+1 OFF
FX5-CCLIEF Channel 1
Network
module
READ
ON
FX5-CCLIEF Channel 1
Target station
error
Operation error
Error code Description
((s1)+1)
D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE).
GP.SREAD
This instruction reads data from a device in another station programmable controller. (In units of words)
After the data reading is completed by the GP.SREAD instruction, the device of the other station is turned on. The other
station can recognize that data has been read by the GP.SREAD instruction.
Ladder diagram Structured text
ENO:=GP_SREAD(EN,Un,s1,s2,d1,d2,d3);
FBD/LD
EN ENO
Un d1
s1 d2
s2
d3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s1) Own station head device where control data is stored Refer to Page 757 Device name ANY16
Control data.
(s2) Target station head device where the data to be read is Character string*2 ANYSTRING_SINGLE*2
stored
(d1) Own station head device for storing the read data*3 Device name ANY16
(d2) Own station device to be turned on for one scan when Bit ANYBIT_ARRAY
the instruction completes. (Number of elements: 2)
(d2)+1 also turns on when the instruction completes with
an error.
(d3) Target station device to be turned on for one scan when Character string*2 ANYSTRING_SINGLE*2
the instruction completes (The target station can
recognize that data has been read from another station.)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 For the specifications of the string data to be specified, refer to the following.
(Page 751 Specifications of character string data specified by link dedicated instructions)
*3 The continuous area specified by the read data length (s1)+9 is required.
*1 S cannot be used.
*2 T, ST, and C cannot be used. 12
■Control data
Device Item Description Setting range Set by
(s1)+0 Error completion type 0000H User
b15 … b8 b7 b6 … b0 0080H
0 (1) 0
*1 If completion status ((s1)+1) is "Channel in use (dedicated instruction) (error codes: D25AH and D25BH)", data is not stored.
The number of resends (s1)+7 must be set every time the instruction is executed.
Processing details
• The instruction reads data by the specified number of words ((s1)+9) from the target station head device (s2) into the own
station word device (after (d1)). Specify the target stations in control data ((s1)+4) and ((s1)+5). Upon completion of reading
the device data specified by (s2), the completion device specified by (d2) turns on. Upon completion of reading
the device data specified by (s2), the completion device specified by (d2) turns on. In target station, upon completion of
sending the device data specified by (s2), the device specified by (d3) turns on.
• For the target stations that can be specified, refer to the following.
Page 750 Target networks and target station types
[Own station] [Target station]
(d1) (s2)
SREAD
Ch1
Ch2
• When executing multiple link dedicated instructions concurrently, be careful not to overlap the channels of the link
dedicated instructions. Multiple link dedicated instructions specifying the same channel cannot be used concurrently.
• The execution of the GP.SREAD instruction and whether it has been completed normally or completed with an error can be
checked with the completion device (d2) or completion status indication device (d2)+1.
Device Operation
Completion device (d2) The device turns on during the END processing for the scan in which the GP.SREAD instruction is
completed, and turns off during the next END processing.
Completion status indication device (d2)+1 The device turns on or off depending on the completion status of the GP.SREAD instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
GP.SREAD instruction is completed, and turns off during the next END processing.
SREAD
ON
Start contact OFF OFF
CPU module on ON
Completion device
the own station (d2) OFF OFF
Completion status 1 scan
indication device
(d2)+1 OFF
FX5-CCLIEF Channel 1
Network
module
SREAD
ON
FX5-CCLIEF Channel 1
Target station
error
Operation error
Error code Description
((s1)+1)
D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE).
GP.WRITE
This instruction writes data to the device in another station programmable controller. (In units of words)
Ladder diagram Structured text
ENO:=GP_WRITE(EN,Un,s1,s2,d1,d2);
FBD/LD
EN ENO
Un d2
s1
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s1) Own station head device where control data is stored Refer to Page 761 Control Device name ANY16
data.
(s2) Own station head device where the data to be written is Device name ANY16
stored
(d1) Target station head device where data is to be written*2 Character string*3 ANYSTRING_SINGL
E*3
(d2) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
(d2)+1 also turns on when the instruction completes with 2)
an error.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 The continuous area specified by the write data length (s1)+9 is required.
*3 For the specifications of the string data to be specified, refer to the following.
(Page 751 Specifications of character string data specified by link dedicated instructions)
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d1)
(d2) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
Request Target
source station
12
Completed
When the target station is in another network: Completed when data has arrived the
relay station of the own network.
Completed
Request Relay Target
source station station
Completed
Target
station
*1 If completion status ((s1)+1) is "Channel in use (dedicated instruction) (error codes: D25AH and D25BH)", data is not stored.
(s2) (d1)
WRITE
Ch1
Ch2
• When executing multiple link dedicated instructions concurrently, be careful not to overlap the channels of the link
dedicated instructions. Multiple link dedicated instructions specifying the same channel cannot be used concurrently.
• The execution of the GP.WRITE instruction and whether it has been completed normally or completed with an error can be
checked with the completion device (d2) or completion status indication device (d2)+1.
Device Operation
Completion device (d2) The device turns on during the END processing for the scan in which the GP.WRITE instruction is
completed, and turns off during the next END processing.
Completion status indication device (d2)+1 The device turns on or off depending on the completion status of the GP.WRITE instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
GP.WRITE instruction is completed, and turns off during the next END processing.
WRITE
ON
Start contact OFF OFF
CPU module on
Completion device ON
the own station (d2) OFF OFF
Completion status 1 scan
indication device
(d2)+1 OFF
FX5-CCLIEF Channel 1
Network
module
WRITE
ON
Completion device ON
CPU module on
(d2) OFF OFF
the own station
Completion status ON
indication device
OFF OFF
(d2)+1
1 scan
Write data storage
device (s2) 3000
Completion status
Error code
(s1)+1
FX5-CCLIEF Channel 1
Target station
error
• Write processing is performed only once on the rising edge when the write command turns on.
Operation error
Error code Description
((s1)+1)
D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE).
GP.SWRITE
This instruction writes data to the device in another station programmable controller. (In units of words)
After the data writing is completed by the GP.SWRITE instruction, the device of the other station is turned on. The other
station can recognize that data has been written by the GP.SWRITE instruction.
Ladder diagram Structured text
ENO:=GP_SWRITE(EN,Un,s1,s2,d1,d2,d3);
EN ENO
Un d2
s1
s2
d1
d3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s1) Own station head device where control data is stored Refer to Page 766 Control Device name ANY16
data.
(s2) Own station head device where the data to be written is Device name ANY16
stored
(d1) Target station head device where data is to be written*2 Character string*3 ANYSTRING_SINGL
E*3
(d2) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
(d2)+1 also turns on when the instruction completes with 2)
an error.
(d3) Target station device to be turned on for one scan when Character string*3 ANYSTRING_SINGL
the instruction completes (enabling the target station to E*3
recognize that data has been written from another station)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 The continuous area specified by the write data length (s1)+9 is required.
*3 For the specifications of the string data to be specified, refer to the following.
(Page 751 Specifications of character string data specified by link dedicated instructions)
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
*1 S cannot be used.
*2 T, ST, and C cannot be used.
■Control data
Device Item Description Setting range Set by
(s1)+0 Execution/error 0000H User
b15 … b8 b7 … b0
completion type 0001H
0 (2) 0 (1) 0080H
(1) Execution type (bit 0) 0081H
• 0: No arrival acknowledgment
When the target station is in the own network: Completed when data has been sent
from the own station.
Request Target
source station
Completed
When the target station is in another network: Completed when data has arrived the
relay station of the own network.
Completed
Request Relay Target
source station station
Completed
Target
station
*1 If completion status ((s1)+1) is "Channel in use (dedicated instruction) (error codes: D25AH and D25BH)", data is not stored.
Processing details
• The instruction writes data by the specified number of words ((s1)+9) from the own station head device (s2) into the target
station word devices. Specify the target stations in control data ((s1)+4) and ((s1)+5). Upon completion of writing device
data to target station, the completion device specified by (d2) turns on. In the other station, upon completion of writing the
device data specified by (s2), the device specified by (d3) turns on.
• For the target stations that can be specified, refer to the following.
Page 750 Target networks and target station types
(s2) (d1)
SWRITE
Ch1
Ch2
• When executing multiple link dedicated instructions concurrently, be careful not to overlap the channels of the link
dedicated instructions. Multiple link dedicated instructions specifying the same channel cannot be used concurrently.
• The execution of the GP.SWRITE instruction and whether it has been completed normally or completed with an error can
be checked with the completion device (d2) or completion status indication device (d2)+1.
Device Operation
Completion device (d2) The device turns on during the END processing for the scan in which the GP.SWRITE instruction is
completed, and turns off during the next END processing.
Completion status indication device (d2)+1 The device turns on or off depending on the completion status of the GP.SWRITE instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
GP.SWRITE instruction is completed, and turns off during the next END processing.
SWRITE
ON
Start contact OFF OFF
CPU module on
Completion device ON
the own station (d2) OFF OFF
Completion status 1 scan
indication device
(d2)+1 OFF
FX5-CCLIEF Channel 1
Network
module
SWRITE
ON
Completion device ON
CPU module on
(d2) OFF OFF
the own station
Completion status ON
indication device
OFF OFF
(d2)+1
1 scan
Write data storage
device (s2) 3000
Completion status
Error code
(s1)+1
FX5-CCLIEF Channel 1
Target station
error
• Write processing is performed only once on the rising edge when the write command turns on.
GP.SEND
This instruction sends data to another station programmable controller.
Ladder diagram Structured text
ENO:=GP_SEND(EN,Un,s1,s2,d);
FBD/LD
12
EN ENO
Un d
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s1) Own station head device where control data is stored Refer to Page 772 Control Device name ANY16
data.
(s2) Own station head device where sending data is stored*2 Device name ANY16
(d) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 The continuous area specified by the send data length (s1)+9 is required.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(d) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
Request Target
source station
Completed
When the target station is in another network: Completed when data has arrived the
relay station of the own network.
Completed
Request Relay Target
source station station
Completed
Target
station
*1 If completion status ((s1)+1) is "Channel in use (dedicated instruction) (error codes: D25AH to D25BH)", data is not stored.
No. 1
• When multiple network modules are mounted in the target station, specify the network number and station
number of the network module that receives a request from the own station.
(Example: In the following figure, specify station No. 1 of network No. 1. (Station No. 5 of network No. 2.
cannot be specified.))
(Target station)
St. 3 St. 2
(Own station)
• The number of resends (s1)+7 must be set every time the instruction is executed.
(s2)
RECV
Ch1 12
SEND
Ch1
Ch2 Chn
• Data can be sent not only to the stations connected to the own station network but also to stations connected to the
specified network number of MELSECNET/H, MELSECNET/10, or Ethernet.
• When executing multiple link dedicated instructions concurrently, be careful not to overlap the channels of the link
dedicated instructions. Multiple link dedicated instructions specifying the same channel cannot be used concurrently.
• The execution of the GP.SEND instruction and whether it has been completed normally or completed with an error can be
checked with the completion device (d) or completion status indication device (d)+1.
Device Operation
Completion device (d) The device turns on during the END processing for the scan in which the GP.SEND instruction is completed,
and turns off during the next END processing.
Completion status indication device (d)+1 The device turns on or off depending on the completion status of the GP.SEND instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
GP.SEND instruction is completed, and turns off during the next END processing.
ON
Start contact OFF OFF
CPU module on
the own station Completion device ON
(d) OFF OFF
Completion status 1 scan
indication device
OFF
(d)+1
Send data storage
device (s2) 3000
FX5-CCLIEF Channel 1
Data
transmission Storage
notification
Network
module Channel 2
RECV
RECV execution ON
request area OFF OFF
CPU module on ON
Completion device
the target station
(d2) OFF OFF
SEND
ON
Completion device ON
CPU module on
(d) OFF OFF
the own station
Completion status ON
indication device
OFF OFF
(d)+1
1 scan
Send data storage
device (s2) 3000 12
Completion status
Error code
(s1)+1
FX5-CCLIEF Channel 1
Transmission
error Resending data
(Number of resends: 2)
• Send processing is performed only once on the rising edge when the send command turns on.
Operation error
Error code Description
((s1)+1)
D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE).
GP.RECV
This instruction reads data received from another station programmable controller. (For the main routine program)
Ladder diagram Structured text
ENO:=GP_RECV(EN,Un,s,d1,d2);
FBD/LD
EN ENO
Un d1
s d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s) Own station head device where control data is stored Refer to Page 779 Control Device name ANY16
data.
(d1) Own station head device for storing the receive data*2 Device name ANY16
(d2) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
(d2)+1 also turns on when the instruction completes with 2)
an error.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 The continuous area (a maximum of 960 words) specified by the receive data length (s)+9 is required.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s)
(d1)
(d2) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
*1 If completion status ((s1)+1) is "Channel in use (dedicated instruction) (error codes: D25AH to D25BH)", data is not stored.
(d1)
Ch1
SEND
RECV
Ch1
Ch2 Chn
• The data received from the sending station is stored in the own station channel specified by the sending station and the
corresponding bit in the GP.RECV instruction execution request area corresponding to each channel is set to on. When the
corresponding bit in the GP.RECV instruction execution request area is set to on, the received data is read from the receive
data storage channel. The following table lists the GP.RECV instruction execution request areas.
Name of GP.RECV instruction execution request area Device number/address of corresponding bit
GP.RECV execution request flag Channel 1 SB0030
GP.RECV execution request flag Channel 2 SB0031
• When executing multiple link dedicated instructions concurrently, be careful not to overlap the channels of the link
dedicated instructions. Multiple link dedicated instructions specifying the same channel cannot be used concurrently.
• The execution of the GP.RECV instruction and whether it has been completed normally or completed with an error can be
checked with the completion device (d2) or completion status indication device (d2)+1.
Device Operation
Completion device (d2) The device turns on during the END processing for the scan in which the GP.RECV instruction is completed,
and turns off during the next END processing.
Completion status indication device (d2)+1 The device turns on or off depending on the completion status of the GP.RECV instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
GP.RECV instruction is completed, and turns off during the next END processing.
Intelligent Channel 2
device station
RECV execution ON
CPU module on
request area OFF
12
Completion device ON
the own station
(d2) OFF OFF
Completion status ON
indication device OFF OFF
(d2)+1
1 scan
Completion status
Error code
(s)+1
• Read processing is performed only once on the rising edge when the read command turns on.
Operation error
Error code Description
((s)+1)
D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE).
G(P).CCPASET
Set the parameters to the FX5-CCLIEF.
Ladder diagram Structured text
ENO:=G_CCPASET(EN,Un,s1,s2,s3,s4,d);
ENO:=GP_CCPASET(EN,Un,s1,s2,s3,s4,d);
(U) (s1) (s2) (s3) (s4) (d)
FBD/LD
EN ENO
Un d
s1
s2
s3
s4
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)9 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s1) Own station head device where control data is stored Refer to Page 783 Control Device name ANY16
data.
(s2) Dummy device*2 Device name ANY16
(s3) Dummy device*2 Device name ANY16
(s4) Dummy device*2 Device name ANY16
(d) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 Since the operands (s2) to (s4) are not used for the FX5-CCLIEF, specify dummy devices.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s1)
(s2)
(s3)
(s4)
*1 *2
(d)
*1 S cannot be used.
*2 T, ST, and C cannot be used.
Processing details 13
• Set the parameters to the FX5-CCLIEF.
[Own station]
CCPASET
Setting
parameters
• The execution of the G(P).CCPASET instruction and whether it has been completed normally or completed with an error
can be checked with the completion device (d) or completion status indication device (d)+1.
Device Operation
Completion device (d) The device turns on during the END processing for the scan in which the G(P).CCPASET instruction is
completed, and turns off during the next END processing.
Completion status indication device (d)+1 The device turns on or off depending on the completion status of the G(P).CCPASET instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
G(P).CCPASET instruction is completed, and turns off during the next END processing.
CCPASET
ON
CPU module on
Start contact OFF OFF
the own station
Completion device ON
(d) OFF OFF
Completion status 1 scan
indication device
(d)+1 OFF
CCPASET
ON
Operation error
Error code Description
((s1)+0)
D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE).
G(P).UINI
This instruction sets the station number to the intelligent device station (own station) whose station number has not yet been
set.
Ladder diagram Structured text
ENO:=G_UINI(EN,Un,s,d);
ENO:=GP_UINI(EN,Un,s,d);
(U) (s) (d)
FBD/LD
EN ENO
13
Un d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s) Own station head device where control data is stored Refer to Page 785 Control Device name ANY16
data.
(d) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s)
(d) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
■Control data
Device Item Description Setting range Set by
(s)+0 Not used System
(s)+1 Completion status The instruction completion status is stored. System
• 0: Normal
• Other than 0: Error (error code)
(s)+2 Change target 0001H (fixed) 0001H User
specification
(s)+3 Station number of own Specifies the station number to be set. 1 to 120 User
station
(s)+4 to Not used System
(s)+9
UINI
Setting a station
number
• The execution of the G(P).UINI instruction and whether it has been completed normally or completed with an error can be
checked with the completion device (d) or completion status indication device (d)+1.
Device Operation
Completion device (d) The device turns on during the END processing for the scan in which the G(P).UINI instruction is completed,
and turns off during the next END processing.
Completion status indication device (d)+1 The device turns on or off depending on the completion status of the G(P).UINI instruction.
When completed normally: The device does not change (remains off).
When completed with an error: The device turns on during the END processing for the scan in which the
G(P).UINI instruction is completed, and turns off during the next END processing.
• The following figure shows the operation at completion of the G(P).UINI instruction.
■When completed normally
UINI
ON
Start contact OFF OFF
CPU module on
Completion device ON
the own station
(d) OFF OFF
UINI
ON
Operation error
Error code Description
((s)+1)
D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE).
13
DHSCS
This instruction compares the value counted by a high-speed counter with a specified value, and immediately sets a bit device
if the two values are equivalent to each other. The high-speed pulse input/output module is not supported.
Ladder diagram Structured text*1
ENO:=DHSCS(EN,s1,s2,d);
ENO:=DHSCS_I(EN,s1,s2,Pn);
(s1) (s2) (d)
FBD/LD*1
DHSCS DHSCS_I
EN ENO EN ENO
s1 d s1
s2 s2
Pn
*1 When the interrupt pointer (I) is specified in operand (d) by ST language and the FBD/LD language, use the DHSCS_I instruction.
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data to be compared with the current value of a high-speed -2147483648 to 32-bit signed binary ANY32
counter or word device number storing the data to be compared +2147483647
(s2) Channel number of a high-speed counter K1 to 8 32-bit signed binary ANY32
(d) DHSCS Bit device number to be set to ON when the compared two values Bit ANY_BOOL
DHSCS_I are equivalent to each other POINTER
*1
*1 In the case of the ST language and the FBD/LD language, d displays as Pn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (I)
F, B, SB, S SD, SW, R
(s1)
(s2) *1
(d) *2
*1 Enable the FX3 compatible function, and specify a device between LC35 and 55 that is designated as an FX3 compatible high-speed
counter. For FX3 compatible function, refer to MELSEC iQ-F FX5 User's Manual (Application).
*2 I16 to I23 can be used.
Use DHSCS if the output should be given when the counting result becomes equivalent to the comparison
value regardless of the scan time of the CPU module.
When the number of instructions that can be simultaneously used is exceeded, use a general-purpose
comparison instruction.
If using the high-speed comparison match interrupt, the corresponding interrupt programs can be executed by setting the
interrupt pointers (I16 to I23) to (d) as shown below.
M0
El
14
M1
HIOEN K0 H1 H0 (1)
A SM400
DHSCS K1000 K1 I16 (2)
Y10
M2
I16 I16
B
IRET
END
Precautions
The value specified in (s2) should only be the channel of high-speed counter number (1 to 8) set by the parameter.
• An operation error occurs in the following cases.
• When a channel which is not set by the parameter or a value other than K1 to 8 is specified
• When an LC device number which is not set by the parameter is specified
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Application).
Operation error
Error code Description
(SD0/SD8067)
3405H A channel number LC device, or device (I) number outside the range is specified.
3582H The DHSCS instruction is executed in an interrupt program
3600H A channel number for which the channel setting is not set is specified in the operand for channel number specification of the high-speed
counter.
3780H The DHSCS, DHSCR, and DHSZ instructions are used exceeding the maximum limit of the number of these instructions.
DHSCR
This instruction compares the value counted by a high-speed counter with a specified value, and immediately resets a bit
device if the two values are equivalent to each other, or resets the high speed counter. The high-speed pulse input/output
module is not supported.
Ladder diagram Structured text
ENO:=DHSCR(EN,s1,s2,d);
FBD/LD
EN ENO
s1
s2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data to be compared with the current value of a high-speed -2147483648 to 32-bit signed binary ANY32
counter or word device number storing the data to be compared +2147483647
(s2) Channel number of a high-speed counter K1 to 8 32-bit signed binary ANY32
(d) Bit device number to be reset (set to OFF) when both values Bit/32-bit signed ANY_ELEMENTARY
become equivalent to each other, or channel number of self-reset binary
high speed counter
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
*1
(s2)
(d)
*1 Enable the FX3 compatible function, and specify a device between LC35 and 55 that is designated as an FX3 compatible high-speed
counter. For FX3 compatible function, refer to MELSEC iQ-F FX5 User's Manual (Application).
Processing details
• When the current value of a high-speed counter of the channel specified in (s2) becomes the comparison value (s1) (for
example, when the current value changes from "199" to "200" or from "201" to "200" if the comparison value is K200), the
bit device (d) is reset to OFF regardless of the scan time. For details, refer to MELSEC iQ-F FX5 User's Manual
(Application).
Command
input
DHSCR (s1) (s2) (d) (s1) = (s2) (d)
Precautions
The value specified in (s2) should only be the channel of high-speed counter number (1 to 8) set by the parameter.
• An operation error occurs in the following cases.
• When a channel which is not set by the parameter or a value other than K1 to 8 is specified
• When an LC device number which is not set by the parameter is specified
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Application).
Operation error
Error code Description
(SD0/SD8067)
3405H A channel number outside the range or the LC device is specified.
3582H The DHSCR instruction is executed in an interrupt program. 14
3600H A channel number for which the channel setting is not set is specified in the operand in channel number specification of the high-speed
counter.
3780H The DHSCS, DHSCR, and DHSZ instructions are used exceeding the maximum limit of the in number of these instructions.
DHSZ
This instruction compares the current value of a high-speed counter with two values (one zone), and outputs the comparison
result (refresh). The high-speed pulse input/output module is not supported.
Ladder diagram Structured text
ENO:=DHSZ(EN,s1,s2,s3,d);
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Data to be compared with the current value of a high-speed -2147483648 to 32-bit signed binary ANY32
counter or word device number storing data to be compared +2147483647
(comparison value 1)
(s2) Data to be compared with the current value of a high-speed -2147483648 to 32-bit signed binary ANY32
counter or word device number storing data to be compared +2147483647
(comparison value 2)
(s3) Channel number of a high-speed counter K1 to 8 32-bit signed binary ANY32
(d) Head bit device number to which the comparison result is output Bit ANYBIT_ARRAY
based on the comparison value 1 and the comparison value 2 (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3) *1
(d)
*1 Enable the FX3 compatible function, and specify a device between LC35 and 55 that is designated as an FX3 compatible high-speed
counter. For FX3 compatible function, refer to MELSEC iQ-F FX5 User's Manual (Application).
Processing details
• The current value of a high-speed counter specified in (s3) is compared with two comparison points (comparison value 1
and comparison value 2). Based on the zone comparison result, "smaller than the lower comparison value", "inside the
comparison zone" or "larger than the upper comparison value", one among (d), (d)+1 and (d)+2 is set to ON regardless of
the scan time. For details, refer to MELSEC iQ-F FX5 User's Manual (Application).
Command
input
DHSZ (s1) (s2) (s3) (d) (s1) (s3) (d)
(s1) (s3) (s2) (d) +1
(s3) (s2) (d) +2
Comparison pattern Current value of CH1 (s3) Change of output contact (Y)
Y0 Y1 Y2
(s1) > (s3) 1000>(s3) ON OFF OFF
999→1000 ON→OFF OFF→ON OFF
1000→999 OFF→ON ON→OFF OFF
(s1) ≤ (s3) ≤ (s2) 999→1000 ON→OFF OFF→ON OFF
1000→999 OFF→ON ON→OFF OFF
1000 ≤ (s3) ≤ 2000 OFF ON OFF
2000→2001
2001→2000
OFF
OFF
ON→OFF
OFF→ON
OFF→ON
ON→OFF
14
(s3) > (s2) 2000→2001 OFF ON→OFF OFF→ON
2001→2000 OFF OFF→ON ON→OFF
(s3) > 2000 OFF OFF ON
It is used when the output should be given when the counting result becomes equivalent to the comparison
value regardless of the scan time of the CPU module.
When the number of instructions that can be simultaneously used is exceeded, use a general-purpose
comparison instruction.
Precautions
An operation error occurs in the following cases.
• When a channel which is not set to (s3) by the parameter or a value other than K1 to 8 is specified
• When an LC device number which is not set by the parameter is specified
Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
When designating a Y device, do not set a device that crosses over a module or a device No. that is a multiple of 16
Example: Designating Y36 or Y37 when using FX5U-64M.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Application).
Operation error
Error code Description
(SD0/SD8067)
2820H The number of devices is insufficient.
3405H A channel number or LC device outside the range is specified.
The comparison value 1 is greater than the comparison value 2.
3582H The DHSZ instruction is executed in an interrupt program.
3600H A channel number for which the channel setting is not set is specified in the operand for channel number specification of the high-speed
counter.
3780H The DHSCS, DHSCR, and DHSZ instructions are used exceeding the maximum limit of the number of these instructions.
HIOEN(P)
These instructions control the start and stop operations of a high-speed I/O function.
Ladder diagram Structured text
ENO:=HIOEN(EN,s1,s2,s3);
ENO:=HIOENP(EN,s1,s2,s3);
(s1) (s2) (s3)
FBD/LD
EN ENO
s1
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Function number to be started or stopped Refer to Function 16-bit signed binary ANY16
number (Page
794)
(s2) Set the bit of the channel number where the function is started. -32768 to +32767 16-bit signed binary ANY16
(s3) Set the bit of the channel number where the function is stopped. -32768 to +32767 16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
Processing details
Specify the number of the function to be started or stopped in (s1), the bit of the channel to be started in (s2), and the bit of the
channel to be stopped in (s3).
The following table shows the function numbers which can be specified in (s1).
■Function number
Function Function name
number
K0 High-speed counter
K10*1 Pulse density/rotation speed measurement
K20*1 High-speed comparison table (CPU module)
K21*1 High-speed comparison table (first high-speed pulse input/output module)
K22*1 High-speed comparison table (second high-speed pulse input/output module)
K23*1 High-speed comparison table (third high-speed pulse input/output module)
K24*1 High-speed comparison table (fourth high-speed pulse input/output module)
K30*1*2 Multi-output high-speed comparison table
K40 Pulse width measurement
*1 When high-speed counter (function number: K0) is stopped during function operation, the function continues to operate, but nothing will
be processed.
*2 When multi-output high-speed comparison table (function number: K30) is stopped, high-speed counter of the same ch is also stopped.
The following table shows the values which can be specified in (s2) and (s3) for each function number.
• Function number K0
The counting start and stop of a high-speed counter can be controlled for each channel of high-speed counter.
CH1 to CH8 are for the CPU module, and CH9 to CH16 are for the high-speed pulse input/output module.
Bit position
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
CH16 CH15 CH14 CH13 CH12 CH11 CH10 CH9 CH8 CH7 CH6 CH5 CH4 CH3 CH2 CH1
Ex.
To start CH3, set 04H in (s2). To stop it, set 04H in (s3).
To start CH1, CH4, and CH5, set 19H in (s2). To stop them, set 19H in (s3).
To start CH1 and CH4 and to stop CH5, set 09H in (s2) and set 10H in (s3).
• Function number K10 14
The measuring start and stop of the pulse density (rotation speed measurement) can be controlled for each channel of the
high-speed counter.
Bit position
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
CH8 CH7 CH6 CH5 CH4 CH3 CH2 CH1
Operation error
Error code Description
(SD0/SD8067)
1810H A channel number which is used in another instruction is specified.
2801H The channel number of a module that does not exist is specified.
3056H Timeout occurred while communicating with the target modules during execution of the instruction.
3060H Signal error was detected while accessing the target modules during execution of the instruction.
3405H An invalid function number is specified in (s).
3580H An instruction that cannot be used in an interrupt program is used.
3600H A channel number which is not selected in the parameter setting is executed.
3781H Ring length ≤ preset value is specified and executed in channel for which ring length is set and preset input is enabled.
DHIOEN(P)
These instructions control the start and stop operations of a high-speed I/O function.
Ladder diagram Structured text
ENO:=DHIOEN(EN,s1,s2,s3);
ENO:=DHIOENP(EN,s1,s2,s3);
(s1) (s2) (s3)
FBD/LD
EN ENO
s1
s2
s3
Setting data 14
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Function number to be started or stopped Refer to Function 16-bit signed binary ANY16
number (Page
797)
(s2) Set the bit of the channel number where the function is started. -2147483648 to 32-bit signed binary ANY32
+2147483647
(s3) Set the bit of the channel number where the function is stopped. -2147483648 to 32-bit signed binary ANY32
+2147483647
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(s3)
Processing details
Specify the number of the function to be started or stopped in (s1), the bit of the channel to be started in (s2), and the bit of the
channel to be stopped in (s3).
The following table shows the function numbers which can be specified in (s1).
■Function number
Function Function name
number
K0 High-speed counter
K10*1 Pulse density/rotation speed measurement
K20*1 High-speed comparison table (CPU module)
K21 High-speed comparison table (first high-speed pulse input/output module)
K22 High-speed comparison table (second high-speed pulse input/output module)
K23 High-speed comparison table (third high-speed pulse input/output module)
K24 High-speed comparison table (fourth high-speed pulse input/output module)
*1 When high-speed counter (function number: K0) is stopped during function operation, the function continues to operate, but nothing will
be processed.
*2 When multi-output high-speed comparison table (function number: K30) is stopped, high-speed counter of the same ch is also stopped.
The following table shows the values which can be specified in (s2) and (s3) for each function number.
• Function number K0
The counting start and stop of a high-speed counter can be controlled for each channel of the high-speed counter.
CH1 to CH8 are for the CPU module, and CH9 to CH16 are for the high-speed pulse input/output module.
Bit position
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
CH16 CH15 CH14 CH13 CH12 CH11 CH10 CH9 CH8 CH7 CH6 CH5 CH4 CH3 CH2 CH1
Ex.
To start CH3, set 04H in (s2). To stop it, set 04H in (s3).
To start CH1, CH4, and CH5, set 19H in (s2). To stop them, set 19H in (s3).
To start CH1 and CH4 and to stop CH5, set 09H in (s2) and set 10H in (s3).
• Function number K10
The measuring start and stop of the pulse density (rotation speed measurement) can be controlled for each channel of the
high-speed counter.
Bit position
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
CH8 CH7 CH6 CH5 CH4 CH3 CH2 CH1
Operation error
Error code Description
(SD0/SD8067)
1810H A channel number which is used in another instruction is specified.
2801H The channel number of a module that does not exist is specified.
3056H Timeout occurred while communicating with the target modules during execution of the instruction.
3060H Signal error was detected while accessing the target modules during execution of the instruction.
3405H An invalid function number is specified in (s).
3580H An instruction that cannot be used in an interrupt program is used.
3600H A channel number which is not selected in the parameter setting is executed.
3781H Ring length ≤ preset value is specified and executed in channel for which ring length is set and preset input is enabled.
HCMOV(P)
These instructions read and write (updates) special register for high-speed counter, pulse width measurement, PWM, and
positioning.
Ladder diagram Structured text
ENO:=HCMOV(EN,s,n,d);
ENO:=HCMOVP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Transfer source device number Bit/16-bit signed binary ANY_ELEMENTARY
(d) Transfer destination device number Bit/16-bit signed binary ANY_ELEMENTARY
(n) Specification to clear the device value of the transfer source after the transfer K0, K1 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
These instructions transfer the data in the device specified by (s) to the device specified by (d). At this time, if the value of (n)
is K0, the value of (s) is not cleared. If the value of (n) is K1, the value of (s) is cleared to "0" after the transfer. The value is
cleared only for the SD8099 special device supporting high-speed transfer.
Precautions
• When it is necessary to execute comparison and outputting as soon as the current value of a high-speed counter changes,
use the high-speed comparison table, multi-output high-speed comparison table, or one of the DHSCS, DHSCR, and DHSZ
instructions.
• If 32-bit binary data special device which supports the high-speed transfer (such as the current value of a high-speed
counter) is read using the HCMOV instruction, the operation is the same as that when the MOV instruction is used.
• Do not overwrite the current value of a high-speed counter using the HCMOV instruction while executing the pulse density
(rotation speed measurement) or the SPD instruction.
• If (s) is SD8099, and the (n) value is K1, SD8099 is cleared at the timing the instruction is executed (after the SD8099
current value is transferred). Do not clear the SD8099 current value with an application instruction such as a MOV
instruction, which is affected by the scan.
14
The HCMOV instruction is mainly used to read the current value of the high-speed counter/pulse width
measurement and change the current address (in the user units) or the current address (in the pulse unit) of
positioning.
Operation error
Error code Description
(SD0/SD8067)
2801H The channel number of a module that does not exist is specified.
2821H Operands that execute transmission between an SM supporting high-speed transfer and an SD supporting high-speed transfer is
designated.
3056H Timeout occurred while communicating with the target modules during execution of the instruction.
3060H Signal error was detected while accessing the target modules during execution of the instruction.
3405H A value outside the data range is set in (n).
3580H An instruction that cannot be used in an interrupt program is used.
DHCMOV(P)
These instructions read and write (updates) special register for high-speed counter, pulse width measurement, PWM, and
positioning.
Ladder diagram Structured text
ENO:=DHCMOV(EN,s,n,d);
ENO:=DHCMOVP(EN,s,n,d);
(s) (d) (n)
FBD/LD
EN ENO
s d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Transfer source device number Bit/32-bit signed ANY_ELEMENTARY
binary
(d) Transfer source device number Bit/32-bit signed ANY_ELEMENTARY
binary
(n) Specification to clear the device value of the transfer source after the transfer K0, K1 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d)
(n)
Processing details
These instructions transfer the data in the device specified by (s) to the device specified by (d). At this time, if the value of (n)
is K0, the value of (s) is not cleared. If the value of (n) is K1, the value of (s) is cleared to "0" after the transfer. The value is
cleared only for SD devices for the current value of high-speed counters or LC devices used as a high-speed counter when
using the FX3 compatible high-speed counter.
Precautions
• When it is necessary to execute comparison and outputting as soon as the current value of a high-speed counter changes,
use the high-speed comparison table, multi-output high-speed comparison table, or one of the DHSCS, DHSCR, and DHSZ
instructions.
• Do not overwrite the current value of a high-speed counter using the DHCMOV instruction while executing the pulse density
(rotation speed measurement) or the DSPD instruction.
• Transfer is not possible between an SM supporting high-speed transfer and an SD supporting high-speed transfer.
• When the device supporting high-speed transfer is set as the transfer source (s) by the DHCMOV instruction while the high-
speed I/O function is stopped, the previous value before stop is read out. However, if the function is not executed even
once, the initial value is read out.
Ex.
When SD5303, SD5302 (PWM pulse width) is set as the transfer source (s), the operation is executed as follows. 14
When the PWM function is not executed "0" is read out. (This is not the value of the parameter that is set by GX Works3.)
When the PWM function was executed but it is currently stopped The value when the PWM function was stopped is read out.
When the PWM function is executed The latest value that is currently operating is read out.
• When a high-speed counter SD device (current value, maximum value, minimum value) is read out individually, only the
read SD device will be updated. Thus, there may be cases when the high-speed counter's SD device does not satisfy the
relation of minimum value ≤ current value ≤ maximum value temporarily. Refer to the MELSEC iQ-F FX5 User's Manual
(Application) for details on the timing that the high-speed counter's SD device is updated.
The DHCMOV instruction is mainly used to read the current value of the high-speed counter/pulse width
measurement and change the current address (in the user units) or the current address (in the pulse unit) of
positioning.
Operation error
Error code Description
(SD0/SD8067)
2801H The channel number of a module that does not exist is specified.
2821H Operands that execute transmission between an SM supporting high-speed transfer and an SD supporting high-speed transfer is
designated.
3056H Timeout occurred while communicating with the target modules during execution of the instruction.
3060H Signal error was detected while accessing the target modules during execution of the instruction.
3405H A value outside the data range is set in (n).
3580H An instruction that cannot be used in an interrupt program is used.
RS2
This instruction sends or receives data by non-protocol communication via serial ports of RS-232C or RS-485.
Ladder diagram Structured text
ENO:=RS2(EN,s,n1,n2,n3,d);
FBD/LD
EN ENO
s d
n1
n2
n3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device storing send data 16-bit signed binary/ ANY16
character string
(n1) Number of bytes of data to be sent 0 to 4096 16-bit unsigned binary ANY16_U
(d) Head device storing receive data 16-bit signed binary/ ANY16
character string
(n2) Number of bytes to be received 0 to 4096 16-bit unsigned binary ANY16_U
(n3) Communication channel K1 to 4 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
(n1)
(d) *1
(n2)
(n3)
Processing details
This instruction sends or receives data by non-protocol communication via the built-in RS-485 port or the optional RS-232C or
RS-485 serial ports installed in the CPU module. This instruction specifies the head device storing the sent data from the CPU
module, the number of data bytes, the head device storing the received data, and the maximum number of bytes that can be
received. For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
Operation error
Error code Description
(SD0/SD8067)
3405H Data outside the allowable range was input.
2820H The device specified by (s) and (d) exceeds the corresponding device range.
1810H Channel number which is used in another instruction is specified.
3600H Channel number specified by (n3) is not set by parameters.
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
15
IVCK
This instruction reads the operation status of an inverter to the CPU module.
Ladder diagram Structured text
ENO:=IVCK(EN,s1,s2,n,d1,d2);
FBD/LD
EN ENO
s1 d1
s2 d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Inverter station number K0 to 31 16-bit signed binary ANY16
*1
(s2) Inverter instruction codes 16-bit signed binary ANY16
(d1) Device number storing the read value 16-bit signed binary ANY16
(n) Communication channel K1 to 4 16-bit unsigned binary ANY16_U
(d2) Head bit device to which the execution status of the instruction is output Bit ANYBIT_ARRAY
(Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Refer to MELSEC iQ-F FX5 User's Manual (Serial Communication) or respective inverter manual.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
(d1)
(n)
(d2) *1
Processing details
The operation status corresponding to the instruction code specified in (s2) of an inverter connected to the communication
channel (n) whose station number is specified in (s1) is read and transferred to (d1). For details, refer to MELSEC iQ-F
FX5 User's Manual (Serial Communication). (For the instruction codes, refer to the each inverter manual.)
Precautions
Three devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
15
IVDR
This instruction writes a control value necessary for inverter operation to a CPU module using the computer link operation
function of the inverter.
Ladder diagram Structured text
ENO:=IVDR(EN,s1,s2,s3,n,d);
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Inverter station number K0 to 31 16-bit signed binary ANY16
*1
(s2) Inverter instruction codes 16-bit signed binary ANY16
(s3) Set value to be written to the inverter parameter or device number storing the 16-bit signed binary ANY16
data to be set
(n) Communication channel K1 to 4 16-bit unsigned binary ANY16_U
(d) Head bit device to which the execution status of the instruction is output Bit ANYBIT_ARRAY
(Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Refer to MELSEC iQ-F FX5 User's Manual (Serial Communication) or respective inverter manual.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
(s3)
(n)
(d) *1
Processing details
The control value specified in (s3) is written to the instruction code specified in (s2) of an inverter connected to the
communication channel (n) whose station number is specified in (s1). For details, refer to MELSEC iQ-F FX5 User's
Manual (Serial Communication). (For the instruction codes, refer to the each inverter manual.)
Precautions
Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
15
IVRD
This instruction reads a parameter of an inverter to the CPU module.
Ladder diagram Structured text
ENO:=IVRD(EN,s1,s2,n,d1,d2);
FBD/LD
EN ENO
s1 d1
s2 d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Inverter station number K0 to 31 16-bit signed binary ANY16
(s2) Inverter parameter number *1 16-bit signed binary ANY16
(d1) Device number storing the read value 16-bit signed binary ANY16
(n) Communication channel K1 to 4 16-bit unsigned binary ANY16_U
(d2) Head bit device to which the execution status of the instruction is output Bit ANYBIT_ARRAY
(Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Refer to MELSEC iQ-F FX5 User's Manual (Serial Communication) or respective inverter manual.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
(d1)
(n)
(d2) *1
Processing details
The value of the parameter (s2) is read from an inverter connected to the communication channel (n) whose station number is
(s1), and output to (d1). For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). (For the
parameter numbers, refer to the each inverter manual.)
Precautions
Three devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
15
IVWR
This instruction writes a parameter of an inverter from the CPU module.
Ladder diagram Structured text
ENO:=IVWR(EN,s1,s2,s3,n,d);
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Inverter station number K0 to 31 16-bit signed binary ANY16
(s2) Inverter parameter number *1 16-bit signed binary ANY16
(s3) Set value to be written to the inverter parameter or device number storing the 16-bit signed binary ANY16
data to be set
(n) Communication channel K1 to 4 16-bit unsigned binary ANY16_U
(d) Head bit device to which the execution status of the instruction is output Bit ANYBIT_ARRAY
(Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Refer to MELSEC iQ-F FX5 User's Manual (Serial Communication) or respective inverter manual.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
(s3)
(n)
(d) *1
Processing details
A value specified in (s3) is written to a parameter (s2) in an inverter connected to the communication channel (n) whose
station number is (s1). For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). (For the parameter
numbers, refer to the each inverter manual.)
Precautions
Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
15
IVBWR
This instruction writes parameters of an inverter from the CPU module in a batch.
Ladder diagram Structured text
ENO:=IVBWR(EN,s1,s2,s3,n,d);
FBD/LD
EN ENO
s1 d
s2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Inverter station number K0 to 31 16-bit signed binary ANY16
(s2) Number of parameters in an inverter to be written at one time *1 16-bit signed binary ANY16
(s3) Head device of a parameter table to be written to an inverter 16-bit signed binary ANY16
(n) Communication channel K1 to 4 16-bit unsigned binary ANY16_U
(d) Head bit device to which the execution status of the instruction is output Bit ANYBIT_ARRAY
(Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Refer to MELSEC iQ-F FX5 User's Manual (Serial Communication) or respective inverter manual.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
(s3)
(n)
(d) *1
Processing details
A data table specified in (s2) and (s3) is written to an inverter connected to the communication channel (n) whose station
number is (s1) in batch. For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). (For the
parameter numbers, refer to the each inverter manual.)
Precautions
Three devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
15
IVMC
This instruction writes 2 types of settings (operation command and set frequency) to the inverter, and reads 2 types of data
(inverter status monitor, output frequency, etc.) from the inverter at the same time.
Ladder diagram Structured text
ENO:=IVMC(EN,s1,s2,s3,n,d1,d2);
FBD/LD
EN ENO
s1 d1
s2 d2
s3
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Inverter station number K0 to 31 16-bit signed binary ANY16
*1
(s2) Multiple instructions for inverter: Send/receive data type specification 16-bit signed binary ANY16
(s3) Head device which stores data to be written to the inverter 16-bit signed binary ANY16_ARRAY
(Number of elements: 2)
(d1) Head device which stores values to be read from the inverter 16-bit signed binary ANY16_ARRAY
(Number of elements: 2)
(n) Communication channel K1 to 4 16-bit unsigned binary ANY16_U
(d2) Head bit device to which the execution status of the instruction is output Bit ANYBIT_ARRAY
(Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1
(s3)
(d1)
(n)
(d2) *1
Processing details
This instruction executes multiple commands of an inverter connected to the communication channel (n) whose station
number is specified in (s1). Specify the send/receive data type using (s2), the head device which stores data to be written to
the inverter using (s3), and the head device which stores values to be read from the inverter using (d1). For details, refer to
MELSEC iQ-F FX5 User's Manual (Serial Communication).
Operation error
Error code Description
(SD0/SD8067)
1810H Channel number specified by (d) is used by another instruction.
2820H The specified device exceeds the range of the corresponding device.
3405H The value specified by (s1) is other than any of K0 to 31.
The value specified by (n) is other than any of K1 to 4.
3600H Channel number specified by (d) is not set by parameters.
15
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
ADPRW
This instruction allows the MODBUS Master to communicate (read/write data) with the Slaves.
Ladder diagram Structured text
ENO:=ADPRW(EN,s1,s2,s3,s4,s5d1,d2);
FBD/LD
EN ENO
s1 d2
s2
s3
s4
s5d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Slave node address 0 to 20H 16-bit signed binary ANY16
(s2) Function code 01H to 06H, 0FH, 10H 16-bit signed binary ANY16
(s3) Function parameters depending on the function code 0 to FFFFH 16-bit signed binary ANY16
(s4) Function parameters depending on the function code 1 to 2000 16-bit signed binary ANY16
(s5)/(d1) Function parameters depending on the function code Bit/16-bit signed binary ANY_ELEMENTARY
(d2) Head bit device number to which the execution status of Bit ANYBIT_ARRAY
the communication is output (Number of elements: 3)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
*1
(s2)
(s3) *1
(s4) *1
*1
(s5)/(d1)
(d2) *1
Processing details
• Function code (s2) is operated on Slave node address (s1) according to Parameters (s3), (s4), and (s5)/(d1). Use 0 as the
Slave Node Address for Broadcast commands. For details, refer to MELSEC iQ-F FX5 User's Manual (MODBUS
Communication).
• The communication execution status (d2) is output according to the status of the ADPRW instruction such as
communicating/completed normally/completed with an error.
Operation error
Error code Description
(SD0/SD8067)
1810H Channel used by the instruction is used by other instruction.
3600H Invalid parameter setup.
2822H Device that cannot be used by this instruction is specified.
3405H Data outside the allowable range was input.
2820H The specified device exceeds the range of the corresponding device.
For communication errors, refer to MELSEC iQ-F FX5 User's Manual (MODBUS Communication).
15
S(P).CPRTCL
This instruction executes the communication protocol registered using the engineering tool.
Ladder diagram Structured text
ENO:=S_CPRTCL(EN,U0,s,n1,n2,d);
ENO:=SP_CPRTCL(EN,U0,s,n1,n2,d);
(U) (n1) (n2) (s) (d)
FBD/LD
EN ENO
U0 d
n1
n2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U)*1 Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE
(n1) Communication channel 1 to 4 16-bit unsigned binary ANY16_U
(n2) Number of protocols to be executed continuously 1 to 8 16-bit unsigned binary ANY16_U
(s) Head device number for storing the control data Refer to Control data Word ANY16_ARRAY
(Page 821) (Number of elements: 18)
(d) Head device number which turns ON when the execution of Bit ANYBIT_ARRAY
the instruction is completed and remains on for 1 scan. (Number of elements: 2)
If the instruction is completed with an error, (d)+1 is also
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as U0.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U)
(n1)
(n2)
(s)
(d) *1
Processing details
This instruction executes the protocol registered using the engineering tool. Using CH specified by (n1), the instruction
executes the protocol in accordance with the control data stored in the device specified by (s) and later. The instruction
continuously executes as many protocols as specified by (n2) (a maximum of 8 protocols) at one time.
The number of executed protocols is stored in the device specified by (s)+1.
The completion of the S(P).CPRTCL instruction can be checked using the completion devices (d)+0 and (d)+1.
• Completion device (d)+0: Turns ON during the END processing for the scan in which the S(P).CPRTCL instruction is
completed, and turns OFF during the next END processing.
• Completion device (d)+1: Turns ON or OFF depending on the status when the S(P).CPRTCL instruction is completed.
Status Description
When completed normally The device does not change (remains OFF).
When completed with an error The device turns ON during the END processing for the scan in which the S(P).CPRTCL instruction is completed, and
turns OFF during the next END processing.
S(P).CPRTCL instruction
ON
OFF
Completion device (d)+0
ON When failed
OFF
Completion device (d)+1 When normally
Executing a
completed
protocol(s)
1 scan
For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
Precautions
• If an error occurs in the mth protocol while multiple protocols are being executed, the instruction does not execute the
"m+1"th protocol and after and is completed with an error.
• The communication CH for which the S(P).CPRTCL instruction can be executed are only those for which "Predefined
protocol support function" is specified for the communication protocol.
• If a cancel request is received during execution of the mth protocol while multiple protocols are executed continuously, the
following is stored in (s).
Device Item Description
(s)+0 Completion status The error codes.
(s)+1 Resulting number of executed The executed protocol number.
protocols
(s)+10 Collation match The receive packet number successful in collation match for the already executed protocol.
Receive packet number 1
(s)+m+8 Collation match
Receive packet number m-1
• If same instructions are executed for the same CH, the subsequent instruction is ignored and is not executed until the
preceding instruction is completed.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication).
15
Instruction correspondence table for CPU module built-in positioning and high-speed
pulse input/output module
The table for instructions corresponding to the CPU module and the high-speed pulse input/output module are shown below.
: Supported, : Not supported
Instruction CPU module High-speed pulse input/
output module
DSZR [For the FX3 compatible operand specification]
DSZR [For the FX5 operand specification]
DDSZR
DVIT [For the FX3 compatible operand specification]
DVIT [For the FX5 operand specification]
DDVIT [For the FX3 compatible operand specification]
DDVIT [For the FX5 operand specification]
TBL [For the FX3 compatible operand specification]
TBL [For the FX5 operand specification]
DRVTBL
DRVMUL
DABS
PLSV [For the FX3 compatible operand specification]
PLSV [For the FX5 operand specification]
DPLSV [For the FX3 compatible operand specification]
DPLSV [For the FX5 operand specification]
DRVI [For the FX3 compatible operand specification]
DRVI [For the FX5 operand specification]
DDRVI [For the FX3 compatible operand specification]
DDRVI [For the FX5 operand specification]
DRVA [For the FX3 compatible operand specification]
DRVA [For the FX5 operand specification]
DDRVA [For the FX3 compatible operand specification]
DDRVA [For the FX5 operand specification]
16 POSITIONING INSTRUCTION
824 16.1 Dedicated Instruction (Positioning Function)
Zero return(OPR) with 16-bit data DOG search
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Bit device number to which the near-point dog signal is input Bit ANY_ELEMENTARY
(BOOL)
(s2) Bit device number to which the zero-phase signal is input Bit ANY_ELEMENTARY
(BOOL) 16
(d1) Bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1) *1
(s2) *1*2
(d1) *3
(d2) *4
*1 When using X, always specify a device that has been set by parameter.
*2 Specify the device set with a parameter or same as the one set in (s1).
*3 Only Y can be used.
*4 When the output mode is CW/CCW, specify the CCW axis. When the output mode is PULSE/SIGN and using Y, only the SIGN output or
general-purpose output of the self-axis can be specified.
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 825
Processing details
This instruction executes mechanical zero return. The values of special devices are applied as the zero return speed and
creep speed. With the forward limit or reverse limit, zero return with the dog search function can be executed.
• For (s1), specify the near-point dog signal input device number. When an X device is specified, the near-point dog signal
functions follow the logic set by parameter. When other than X device is specified, the device functions follow the positive
logic.
• For (s2), specify the zero-phase signal input device number. When an X device is specified, the zero-phase signal functions
follow the logic set by parameter. When other than X device is specified, the device functions follow the positive logic.
• For (d1), specify the device from which pulses are output. Only the output devices (Y) having positioning parameters can
be specified.
• For (d2), specify the bit device from which the rotation direction signal is output. Only the device specified with a parameter
or general-purpose outputs can be specified. When the output devices (Y) is executed by another function (PWM,
positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
826 16.1 Dedicated Instruction (Positioning Function)
DSZR [For the FX5 operand specification]
This instruction executes mechanical zero return.
Ladder diagram Structured text
ENO:=DSZR(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Zero return speed 1 to 65535 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(s2) Creep speed 1 to 65535 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(d2) Bit device number of the zero return complete flag or abnormal end flag Bit
(WORD)
ANY_BOOL
16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
Processing details
This instruction executes mechanical zero return. The near-point dog signal and zero-phase signal function follow the device
set with parameters. With the forward limit or reverse limit, zero return with the dog search function can be executed.
• For (s1), specify the zero return speed in the user units. (The speed must be 200 Kpps or lower in frequency.)
• For (s2), specify the creep speed in the user units. Set the creep speed equal to or slower than the zero return speed set in
(s1). (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number for which zero return is performed.
• For (d2), specify the bit device of the zero return complete flag or abnormal end flag.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 827
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
828 16.1 Dedicated Instruction (Positioning Function)
Zero return(OPR) with 32-bit data DOG search
DDSZR
This instruction executes mechanical zero return.
Ladder diagram Structured text
ENO:=DDSZR(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Zero return speed 1 to 2147483647 32-bit signed binary ANY32
(s2) Creep speed 1 to 2147483647 32-bit signed binary ANY32
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY16
16
(d2) Bit device number of the zero return complete flag or abnormal end flag Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
Processing details
This instruction executes mechanical zero return. The near-point dog signal and zero-phase signal function follow the device
set with parameters. With the forward limit or reverse limit, zero return with the dog search function can be executed.
• For (s1), specify the zero return speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (s2), specify the creep speed in user units. Set the creep speed equal to or slower than the zero return speed set in
(s1). (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number for which zero return is performed.
• For (d2), specify the bit device of the zero return complete flag or abnormal end flag.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 829
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
830 16.1 Dedicated Instruction (Positioning Function)
16-bit data interrupt positioning
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address after an interrupt input -32768 to +32767 16-bit signed binary ANY16
(s2) Command speed 1 to 65535 16-bit unsigned binary ANY16
16
(d1) Bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1) *1
(d2) *2 *3
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 831
Processing details
This instruction executes interrupt 1-speed constant quantity feed.
• For (s1), specify the transfer distance that is output after an interrupt, in user units. (The distance must be within the range
of -2147483647 to +2147483647 number of pulses.)
• For (s2), specify the speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the output devices (Y) having positioning parameters can
be specified.
• For (d2), specify the device from which the rotation direction signal is output. Only the device specified with a parameter or
general-purpose outputs can be specified. When the output devices (Y) is executed by another function (PWM, positioning
PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
832 16.1 Dedicated Instruction (Positioning Function)
DVIT [For the FX5 operand specification]
This instruction executes interrupt 1-speed constant quantity feed.
Ladder diagram Structured text
ENO:=DVIT(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address after an interrupt input -32768 to +32767 16-bit signed binary ANY16
(s2) Command speed 1 to 65535 16-bit unsigned binary ANY16
(d1) Specify the axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d2) Bit device number of the positioning complete flag or abnormal end flag Bit ANY_BOOL
EN Execution condition Bit BOOL 16
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
Processing details
This instruction executes interrupt 1-speed constant quantity feed.
• For (s1), specify the transfer distance that is output after an interrupt, in user units. (The distance must be within the range
of -2147483647 to +2147483647 number of pulses.)
• For (s2), specify the speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DVIT instruction.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 833
32-bit data interrupt positioning
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address after an interrupt input -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Command speed 1 to 2147483647 32-bit signed binary ANY32
(d1) Bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1) *1
(d2) *2 *3
16 POSITIONING INSTRUCTION
834 16.1 Dedicated Instruction (Positioning Function)
Processing details
This instruction executes interrupt 1-speed constant quantity feed.
• For (s1), specify the transfer distance that is output after an interrupt, in user units. (The distance must be within the range
of -2147483647 to +2147483647 in the number of pulses.)
• For (s2), specify the speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the output devices (Y) having positioning parameters can
be specified.
• For (d2), specify the device from which the rotation direction signal is output. Only the device specified with a parameter or
general-purpose outputs can be specified. When the output devices (Y) is executed by another function (PWM, positioning
PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 835
DDVIT [For the FX5 operand specification]
This instruction executes interrupt 1-speed constant quantity feed.
Ladder diagram Structured text
ENO:=DDVIT(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address after an interrupt input -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Command speed 1 to 2147483647 32-bit signed binary ANY32
(d1) Specify the axis number from which pulses are to be output K1 to 12*1 16-bit unsigned ANY_ELEMENTARY
binary (WORD)
(d2) Bit device number of the positioning complete flag or Bit ANY_BOOL
abnormal end flag
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
Processing details
This instruction executes interrupt 1-speed constant quantity feed.
• For (s1), specify the transfer distance that is output after an interrupt, in user units. (The distance must be within the range
of -2147483647 to +2147483647 number of pulses.)
• For (s2), specify the speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DDVIT instruction.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
836 16.1 Dedicated Instruction (Positioning Function)
Positioning by one table operation
(d) (n)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(n) Table number to be executed 1 to 100*1 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
16
ENO Execution result Bit BOOL
*1 If the table data is not stored to devices, the table number range is 1 to 32.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d) *1
(n)
Processing details
This instruction operates one table of the positioning table that is set with parameters in the engineering tool.
• For (d), specify the device from which pulses are output. Only the output devices (Y) having positioning parameters can be
specified.
• For (n), specify the table number to be executed according to the output specified in (d).
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 837
TBL [For the FX5 operand specification]
This instruction executes one specified table operation from the instructions set in the data table using the engineering tool
etc. The high-speed pulse input/output module is not supported.
Ladder diagram Structured text
ENO:=TBL(EN,n,d);
(d) (n)
FBD/LD
EN ENO
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d) Axis number from which pulses are to be output K1 to 4 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(n) Table number to be executed 1 to 100*1 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 If the table data is not stored to devices, the table number range is 1 to 32.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d)
(n)
Processing details
This instruction operates one table of the positioning table that is set with parameters in the engineering tool.
• For (d), specify the axis number from which pulses are output.
• For (n), specify the table number to be executed according to the output specified in (d).
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
838 16.1 Dedicated Instruction (Positioning Function)
Positioning by multiple table operation
DRVTBL
This instruction executes positioning operation set in multiple data tables with the engineering tool in continuous operation or
stepping operation. To execute such operation, this instruction needs to be executed only once.
Ladder diagram Structured text
ENO:=DRVTBL(EN,n1,n2,n3,d1,d2);
FBD/LD
EN ENO
n1 d2
n2
n3
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY16 16
(n1) Start table number to be executed 1 to 100*2 16-bit unsigned binary ANY16_U
(n2) Last table number to be executed 1 to 100*2 16-bit unsigned binary ANY16_U
(n3) Table execution method K0, K1 16-bit unsigned binary ANY16_U
(d2) Bit device number of the positioning complete flag or abnormal end flag Bit ANYBIT_ARRAY
(Number of elements: 2)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
*2 If the table data is not stored to devices in the CPU module, the table number range is 1 to 32.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(d1)
(n1)
(n2)
(n3)
(d2) *1
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 839
Processing details
This instruction executes positioning operation set in multiple data tables with the engineering tool in the continuous operation
or stepping operation. To execute such operation, this instruction needs to be executed only once.
• For (d1), specify the axis number from which pulses are output.
• For (n1), specify the start table to be executed according to the output specified in (d1).
• For (n2), specify the last table. When (n1) and (n2) are the same, only one table is executed. The table operation keeps
executing until the last table or a table that is not set with parameters is executed.
• For (n3), specify the table execution method. (K0 = Stepping operation, K1 = Continuous operation)
• For (d2), specify the bit device of the normal complete flag or abnormal end flag.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
840 16.1 Dedicated Instruction (Positioning Function)
Multiple axes concurrent drive positioning
DRVMUL
This instruction executes tables of multiple axes of one module simultaneously.
Ladder diagram Structured text
ENO:=DRVMUL(EN,n1,n2,n3,n4,n5,d);
FBD/LD
EN ENO
n1 d
n2
n3
n4
n5
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(n1) Start axis number K1, K5, K7, K9,
K11*1
16-bit unsigned binary ANY16_U
16
(n2) Table number of the axis 1 K0 to 100*2 16-bit unsigned binary ANY16_U
(n3) Table number of the axis 2 K0 to 100*2 16-bit unsigned binary ANY16_U
(n4) Table number of the axis 3 K0 to 100*2 16-bit unsigned binary ANY16_U
*2
(n5) Table number of the axis 4 K0 to 100 16-bit unsigned binary ANY16_U
(d) Bit device number of the positioning complete flag or abnormal end flag Bit ANYBIT_ARRAY
(Number of elements: 8)
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 (axis 1) for the CPU module, and K5, K7, K9, or K11 (axis 5, axis 7, axis 9, or axis 11) for the high-speed pulse input/output
module.
*2 If the table data is not stored to devices in the CPU module, the table number range is 1 to 32.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(n1)
(n2)
(n3)
(n4)
(n5)
*1
(d)
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 841
Processing details
This instruction executes tables of multiple axes of one module simultaneously.
• For (n1), specify the head axis number for which pulses are output.
Designation number Axis numbers to be used
K1 Execute axis 1 to axis 4 (CPU module) simultaneously.
K5 Execute axis 5, axis 6 (high-speed pulse input/output module first module) simultaneously.
K7 Execute axis 7, axis 8 (high-speed pulse input/output module second module) simultaneously.
K9 Execute axis 9, axis 10 (high-speed pulse input/output module third module) simultaneously.
K11 Execute axis 11, axis 12 (high-speed pulse input/output module fourth module) simultaneously.
• For (n2), specify the table number that is executed with the axis (n1). When not executing the axis (n1), specify K0.
• For (n3), specify the table number that is executed with the axis (n1)+1. When not executing the axis (n1)+1, specify K0.
• For (n4), specify the table number that is executed with the axis (n1)+2. If axis (n1) + 2 is not executed or the axis number
of the high-speed pulse input/output module is specified to (n1), specify K0.
• For (n5), specify the table number that is executed with the axis (n1)+3. If axis (n1) + 3 is not executed or the axis number
of the high-speed pulse input/output module is specified to (n1), specify K0.
• For (d), specify the device of the instruction execution complete flag for each axis. Eight devices are occupied from (d), and
function as follows.
Device Description
(d) Instruction execution complete flag for the axis (n1)
(d)+1 Instruction execution abnormal end flag for the axis (n1)
(d)+2 Instruction execution complete flag for the axis (n1)+1
(d)+3 Instruction execution abnormal end flag for the axis (n1)+1
(d)+4 Instruction execution complete flag for the axis (n1)+2
(d)+5 Instruction execution abnormal end flag for the axis (n1)+2
(d)+6 Instruction execution complete flag for the axis (n1)+3
(d)+7 Instruction execution abnormal end flag for the axis (n1)+3
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Eight devices are occupied from the device specified in (d). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
842 16.1 Dedicated Instruction (Positioning Function)
32-bit data ABS current value read
DABS
This instruction reads the absolute position (ABS) data when a servo amplifier (equipped with the absolute position detection
function) is connected. The data is converted into pulse when read.
Ladder diagram Structured text
ENO:=DABS(EN,s,d1,d2);
FBD/LD
EN ENO
s d1
d2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Head device number that inputs the output signal for absolute position Bit ANYBIT_ARRAY
(ABS) data from the servo amplifier (Number of elements: 3)
(d1) Head device number that outputs the absolute position (ABS) data Bit ANYBIT_ARRAY
control signal to the servo amplifier (Number of elements: 3) 16
(d2) Absolute position (ABS) data (32-bit value) 32-bit signed binary ANY32
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s) *1
*1
(d1)
(d2)
Processing details
This instruction reads the absolute position (ABS) data when a servo amplifier (equipped with the absolute position detection
function) is connected. The data is converted into pulse when being read.
• For (s), specify the head device number that inputs the output signal for absolute position (ABS) data from the servo
amplifier.
• For (d1), specify the head device number that outputs the absolute position (ABS) data control signal to the servo amplifier.
Be sure to use transistor outputs for the CPU module outputs.
• For (d2), specify the device that stores the absolute position (ABS) data read from the servo amplifier.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 843
Precautions
Three devices are occupied from the device specified in (s) and (d1). Make sure that these devices are not used in other
controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
844 16.1 Dedicated Instruction (Positioning Function)
16-bit data variable speed pulse
FBD/LD
EN ENO
s d2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed -32768 to +32767 16-bit signed binary ANY16
(d1) Bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d1) *1
(d2) *2 *3
Processing details
This instruction outputs variable speed pulses with an assigned rotation direction output.
• For (s), specify the command speed to be output. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the output devices (Y) having positioning parameters can
be specified.
• For (d2), specify the device from which the rotation direction signal is output. Only the device specified with the parameter
or general-purpose outputs can be specified. When the output devices (Y) is executed by another function (PWM,
positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 845
PLSV [For the FX5 operand specification]
This instruction outputs variable speed pulses with an assigned rotation direction output.
Ladder diagram Structured text
ENO:=PLSV(EN,s,d1,d2);
FBD/LD
EN ENO
s d2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed -32768 to +32767 16-bit signed binary ANY16
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d2) Bit device number of the positioning complete flag or abnormal end flag Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d1)
(d2) *1
Processing details
This instruction outputs variable speed pulses with an assigned rotation direction output.
• For (s), specify the command speed to be output. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the abnormal end flag for the PLSV instruction. (This device does not have the normal
complete status, and only has the abnormal end status ((d2)+1).
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
846 16.1 Dedicated Instruction (Positioning Function)
32-bit data variable speed pulse
FBD/LD
EN ENO
s d2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed -2147483648 to +2147483647 32-bit signed binary ANY32
(d1) Bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d1) *1
(d2) *2 *3
Processing details
This instruction outputs variable speed pulses with an assigned rotation direction output.
• For (s), specify the command speed to be output. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the output devices (Y) having positioning parameters can
be specified.
• For (d2), specify the device from which the rotation direction signal is output. Only the device specified with the parameter
or general-purpose outputs can be specified. When the output devices (Y) is executed by another function (PWM,
positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 847
DPLSV [For the FX5 operand specification]
This instruction outputs variable speed pulses with an assigned rotation direction output.
Ladder diagram Structured text
ENO:=DPLSV(EN,s,d1,d2);
FBD/LD
EN ENO
s d2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s) Command speed -2147483648 to +2147483647 32-bit signed binary ANY32
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d2) Bit device number of the positioning complete flag or Bit ANY_BOOL
abnormal end flag
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s)
(d1)
(d2) *1
Processing details
This instruction outputs variable speed pulses with an assigned rotation direction output.
• For (s), specify the command speed to be output. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the abnormal end flag for the DPLSV instruction. (This device does not have the normal
complete status, and only has the abnormal end status ((d2)+1).
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
848 16.1 Dedicated Instruction (Positioning Function)
16-bit data relative positioning
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -32768 to +32767 16-bit signed binary ANY16
(s2) Command speed 1 to 65535 16-bit unsigned binary ANY16
16
(d1) Output bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1) *1
(d2) *2 *3
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 849
Processing details
This instruction executes one-speed positioning by incremental drive. Specify the positioning address in the incremental
system, in which the transfer direction and transfer distance from the current position (relative address) are specified for
positioning.
• For (s1), specify the relative positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the Y devices having positioning parameters can be
specified.
• For (d2), specify the bit device from which the rotation direction signal is output. Only the device specified with the
parameter or general-purpose outputs can be specified. When the output devices (Y) is executed by another function
(PWM, positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
850 16.1 Dedicated Instruction (Positioning Function)
DRVI [For the FX5 operand specification]
This instruction executes one-speed positioning by incremental drive.
Ladder diagram Structured text
ENO:=DRVI(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -32768 to +32767 16-bit signed binary ANY16
(s2) Command speed 1 to 65535 16-bit unsigned binary ANY16
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d2) Bit device number of the positioning complete flag or abnormal end flag Bit ANY_BOOL
EN Execution condition Bit BOOL 16
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 851
Processing details
This instruction executes one-speed positioning by incremental drive. Specify the positioning address in the incremental
system, in which the transfer direction and transfer distance from the current position (relative address) are specified for
positioning.
• For (s1), specify the relative positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DRVI instruction.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
852 16.1 Dedicated Instruction (Positioning Function)
32-bit data relative positioning
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Command speed 1 to 2147483647 32-bit signed binary ANY32 16
(d1) Output bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1) *1
(d2) *2 *3
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 853
Processing details
This instruction executes one-speed positioning by incremental drive. Specify the positioning address in the incremental
system, in which the transfer direction and transfer distance from the current position (relative address) are specified for
positioning.
• For (s1), specify the relative positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the Y devices having positioning parameters can be
specified.
• For (d2), specify the device from which the rotation direction signal is output. Only the device specified with the parameter
or general-purpose outputs can be specified. When the output devices (Y) is executed by another function (PWM,
positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
854 16.1 Dedicated Instruction (Positioning Function)
DDRVI [For the FX5 operand specification]
This instruction executes one-speed positioning by incremental drive.
Ladder diagram Structured text
ENO:=DDRVI(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Command speed 1 to 2147483647 32-bit signed binary ANY32
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d2) Bit device number of the positioning complete flag or Bit ANY_BOOL
abnormal end flag 16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
Processing details
This instruction executes one-speed positioning by incremental drive. Specify the positioning address in the incremental
system, in which the transfer direction and transfer distance from the current position (relative address) are specified for
positioning.
• For (s1), specify the relative positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DDRVI instruction.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 855
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
856 16.1 Dedicated Instruction (Positioning Function)
16-bit data absolute positioning
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -32768 to +32767 16-bit signed binary ANY16
(s2) Command speed 1 to 65535 16-bit unsigned binary ANY16 16
(d1) Output bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY (BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1) *1
(d2) *2 *3
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 857
Processing details
This instruction executes one-speed positioning by absolute drive. Specify the positioning address in the absolute system, in
which the transfer distance from the origin (absolute address) is specified for positioning.
• For (s1), specify the absolute positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the Y devices having positioning parameters can be
specified.
• For (d2), specify the bit device from which the rotation direction signal is output. Only the device specified with the
parameter or general-purpose outputs can be specified. When the output devices (Y) is executed by another function
(PWM, positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
858 16.1 Dedicated Instruction (Positioning Function)
DRVA [For the FX5 operand specification]
This instruction executes one-speed positioning by absolute drive.
Ladder diagram Structured text
ENO:=DRVA(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -32768 to +32767 16-bit signed binary ANY16
(s2) Command speed 1 to 65535 16-bit unsigned binary ANY16
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d2) Bit device number of the positioning complete flag or abnormal end flag Bit ANY_BOOL
EN Execution condition Bit BOOL 16
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
Processing details
This instruction executes one-speed positioning by absolute drive. Specify the positioning address in the absolute system, in
which the transfer distance from the origin (absolute address) is specified for positioning.
• For (s1), specify the absolute positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DRVA instruction.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 859
32-bit data absolute positioning
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Command speed 1 to 2147483647 32-bit signed binary ANY32
(d1) Output bit device number (Y) from which pulses are output 0 to 3 Bit ANY_ELEMENTARY
(BOOL)
(d2) Bit device number from which the rotation direction is output Bit ANY_BOOL
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1) *1
(d2) *2 *3
16 POSITIONING INSTRUCTION
860 16.1 Dedicated Instruction (Positioning Function)
Processing details
This instruction executes one-speed positioning by absolute drive. Specify the positioning address in the absolute system, in
which the transfer distance from the origin (absolute address) is specified for positioning.
• For (s1), specify the absolute positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the device from which pulses are output. Only the Y devices having positioning parameters can be
specified.
• For (d2), specify the bit device from which the rotation direction signal is output. Only the device specified with the
parameter or general-purpose outputs can be specified. When the output devices (Y) is executed by another function
(PWM, positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error.
For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control -
CPU module built-in, High-speed pulse input/output module).
16
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 861
DDRVA [For the FX5 operand specification]
This instruction executes one-speed positioning by absolute drive.
Ladder diagram Structured text
ENO:=DDRVA(EN,s1,s2,d1,d2);
FBD/LD
EN ENO
s1 d2
s2
d1
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(s1) Positioning address -2147483648 to +2147483647 32-bit signed binary ANY32
(s2) Command speed 1 to 2147483647 32-bit signed binary ANY32
(d1) Axis number from which pulses are to be output K1 to 12*1 16-bit unsigned binary ANY_ELEMENTARY
(WORD)
(d2) Bit device number of the positioning complete flag or Bit ANY_BOOL
abnormal end flag
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 Specify K1 to K4 (axis 1 to 4) for the CPU module, and K5 to K12 (axis 5 to 12) for the high-speed pulse input/output module.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(s1)
(s2)
(d1)
(d2) *1
Processing details
This instruction executes one-speed positioning by absolute drive. Specify the positioning address in the absolute system, in
which the transfer distance from the origin (absolute address) is specified for positioning.
• For (s1), specify the absolute positioning address in user units. (The address must be within the range of -2147483647 to
+2147483647 number of pulses.)
• For (s2), specify the command speed in user units. (The speed must be 200 Kpps or lower in frequency.)
• For (d1), specify the axis number from which pulses are output.
• For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DDRVA instruction.
For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module
built-in, High-speed pulse input/output module).
16 POSITIONING INSTRUCTION
862 16.1 Dedicated Instruction (Positioning Function)
Precautions
Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls.
For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed
pulse input/output module).
16
16 POSITIONING INSTRUCTION
16.1 Dedicated Instruction (Positioning Function) 863
16.2 Positioning Module
Restoring the absolute position
G.ABRST
These instructions restore the absolute position of the specified axis.
Ladder diagram Structured text
ENO:=G_ABRST1(EN,Un,s,d);
ENO:=G_ABRST2(EN,Un,s,d);
(U) (s) (d)
FBD/LD
EN ENO
Un d
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
*1
(U) Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s) Device where the control data is stored Refer to Page 865 Device name ANY16_ARRAY*2
Control data. (Number of elements:
8)
(d) Device which turns on when the execution of the instruction is Bit ANYBIT_ARRAY
completed and remains on for 1 scan. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 When specifying setting data by using a label, define an array to secure enough operation area and specify an element of the array
label.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s)
(d) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
16 POSITIONING INSTRUCTION
864 16.2 Positioning Module
■Control data
Device Item Description Setting range Set by
(s)+0 System area
(s)+1 Completion status The instruction completion status is stored. System
• 0: Normal
• Other than 0: Error (error code)
(s)+2 Signal received from Write the signal status, below, input from the servo amplifier to the CPU module or I/ 0, 1 User
the servo amplifier O module.
• b0: ABS data bit 0
• b1: ABS data bit 1
• b2: Send data ready flag
(s)+3 Signal to be sent to the Performs the operation with this instruction by using the "Signal received from the System
servo amplifier servo amplifier" in (s)+2. The ON/ OFF state of the following data, output to the
servo amplifier, is stored.
• b0: Servo ON
• b1: ABS transfer mode
• b2: ABS request flag
(s)+4 Status Status of communication with the servo amplifier 0 User/
• 0: Communication complete (set by the user at start of communication) System
• Other than 0: Now communicating (stored by the system)
(s)+5 to System area
(s)+7
Processing details
• The positioning data of the following axis is read from the servo amplifier supporting the absolute position and the value
with the unit converted is stored in the "Current feed value" and "Machine feed value" areas in the positioning module. For
the absolute position detection system, restore the absolute position once when it is powered on or the CPU module is
reset. 16
Instruction symbol Target axis
G.ABRST1 Axis 1
G.ABRST2 Axis 2
Control data
Input module Current feed value
(s)+0
Servo amplifier (s)+1
(s)+2
Output module (s)+3 Machine feed value
(s)+4
(s)+5
Current value data
(s)+7
G.ABRST
• Whether the execution of the G.ABRST instruction has been completed normally or with an error can be checked with the
completion device (d) or completion status indication device (d)+1.
Device Description
Completion device (d) This device turns on during the END processing of the scan where the G.ABRST instruction completed, and
turns off during the next END processing.
Completion status indication device (d)+1 This device turns on or off depending on the completion status of the G.ABRST instruction.
When completed normally: Unchanged from off.
When completed with an error: Turns on during the END processing of the scan where the G.ABRST
instruction completed, and turns off during the next END processing.
16 POSITIONING INSTRUCTION
16.2 Positioning Module 865
• The following figure shows the operation at completion of the G.ABRST instruction.
ON
Completion device(d) OFF OFF
1 scan
• Completion of absolute position restoration can be checked with the (s)+4 status.
• The G.ABRST instruction performs absolute position restoration by following procedure.
Precautions
• If the absolute position detection system has been constructed, absolute position restoration must be performed once after
the power is turned on or reset. The servo does not turn on until the absolute position restoration completes.
• Absolute position restoration must be performed while the [Cd.190] PLC READY signal is off. While [Cd.190] PLC READY
signal is ON, if the G.ABRST instruction is executed, "Dedicated instruction error (Error code: 1870H)" occurs in the
positioning module and absolute position restoration cannot be executed.
• The absolute position can be restored (the G.ABRST instruction can be executed) while a servo amplifier is operable.
Note that when the absolute position is restored, the Servo on signal may turn off (servo off) for the period of the scan time
plus approximately 60 ms and the motor may move. To restore the absolute position during the servo off state, install an
electromagnetic brake separately so that signals are output to the electromagnetic brake while the G.ABRST instruction
is being executed.
• The following instructions cannot be executed simultaneously to a single axis. For different axes, any of the following can
be executed concurrently with a G.ABRST instruction.
• Positioning start instruction (GP.PSTRT)
• Absolute position restoration instruction (G.ABRST)
• Teaching instruction (GP.TEACH)
• If this instruction is executed in an interrupt program with the priority 1, operation error (3580H) occurs. This instruction
operates in an interrupt program with the priority 2 or 3.
Operation error
Error code Description
((s)+1)
1860H A value other than 0 was set in "Status" of (s)+4 (at start of communication with the servo amplifier).
1861H "Status" of (s)+4 was changed during absolute position restoration (i.e. during communication with the servo amplifier).
1865H An instruction was specified for an undefined axis.
16 POSITIONING INSTRUCTION
866 16.2 Positioning Module
Starting the positioning
GP.PSTRT
This instruction starts positioning of the specified axis.
Ladder diagram Structured text
ENO:=GP_PSTRT1(EN,Un,s,d);
ENO:=GP_PSTRT2(EN,Un,s,d);
(U) (s) (d)
FBD/LD
EN ENO
Un d
Setting data
■Description, range, data type
Operand Description Range Data type Data type (label)
(U)*1 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
Refer to Page 868 ANY16_ARRAY*2
(s) Own station head device where control data is stored
Control data.
Device name
(Number of elements: 16
3)
(d) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 When specifying setting data by using a label, define an array to secure enough operation area and specify an element of the array
label.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s)
(d) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
16 POSITIONING INSTRUCTION
16.2 Positioning Module 867
■Control data
Device Item Description Setting range Set by
(s)+0 System area
(s)+1 Completion status The instruction completion status is stored. System
• 0: Normal
• Other than 0: Error (error code)
(s)+2 Start number Specifies the number of the following data that is started with the GP.PSTRT 1 to 600 User
instruction. 7000 to 7004
• Positioning data number: 1 to 600 9001 to 9004
• Block start: 7000 to 7004
• Machine OPR: 9001
• Fast OPR: 9002
• Present value change: 9003
• Multiple axes concurrent start: 9004
Processing details
• The positioning is started for the specified axes below.
Instruction symbol Target axis
GP.PSTRT1 Axis 1
GP.PSTRT2 Axis 2
• Block start, origin return start, present value change start, and multiple axes concurrent start are available by specifying one
of 7000 to 7004 or 9001 to 9004 with "Start number" in (s)+2.
• Whether the GP.PSTRT instruction has been completed normally or with an error can be checked with the completion
device (d) or completion status indication device (d)+1.
Device Description
Completion device (d) This device turns on during the END processing of the scan where the GP.PSTRT instruction completed, and
turns off during the next END processing.
Completion status indication device (d)+1 This device turns on or off depending on the completion status of the GP.PSTRT instruction.
When completed normally: Unchanged from off.
When completed with an error: Turns on during the END processing of the scan where the GP.PSTRT
instruction completed, and turns off during the next END processing.
• The following figure shows the operation at completion of the GP.PSTRT instruction.
ON
Completion device(d) OFF OFF
1 scan
• For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module).
16 POSITIONING INSTRUCTION
868 16.2 Positioning Module
Precautions
• If the positioning is started by using the GP.PSTRT instruction, the [Cd.184] Positioning start signal will not turn on. In this
case, although the start completion signals ([Md.31] Status: b14) turn on, the ON time is short; the program may fail to
detect the ON state. For this reason, start completion cannot be checked using the start completion signals ([Md.31] Status:
b14). Check the positioning control status with the start command of the GP.PSTRT instruction or the [Md.141] BUSY
signal.
• If the positioning is started by using the GP.PSTRT instruction, and then the stop command is input before the positioning
completes, the completion device (d) turns on for one scan and the execution of the GP.PSTRT instruction completes.
• The following instructions cannot be executed simultaneously to a single axis. For different axes, any of the following can
be executed concurrently with a GP.PSTRT instruction.
• Positioning start instruction (GP.PSTRT)
• Absolute position restoration instruction (G.ABRST)
• Teaching instruction (GP.TEACH)
• The GP.PSTRT instruction can be executed when the READY signal ([Md.140] module status: b0) is ON. While the
READY signal ([Md.140] module status: b0) is OFF, if the GP.PSTRT instruction is executed, "PLC READY OFF start
(Error code: 19A1H)" error occurs and positioning cannot be started. Turn the "[Cd.190] PLC READY signal" ON, and turn
the READY signal ([Md.140] module status: b0) ON before executing the GP.PSTRT instruction.
• If multiple axes concurrent start is executed using the GP.PSTRT instruction, the completion device (d) turns on when the
positioning completes for the axis where the GP.PSTRT instruction has been executed (e.g. Axis 1 for GP.PSTRT1).
• If the GP.PSTRT instruction is used, the starting time will delay 0 to 0.88ms relative to the [Cd.184] Positioning start
signal.
• If this instruction is executed in an interrupt program with the priority 1, operation error (3580H) occurs. This instruction
operates in an interrupt program with the priority 2 or 3.
16
Operation error
Error code Description
((s)+1)
1862H A value other than 1 to 600, 7000 to 7004, or 9001 to 9004 was set in "Starting number" of (s)+2.
1865H An instruction was specified for an undefined axis.
19A1H Start positioning when the "[Cd.190] PLC READY signal" is OFF.
16 POSITIONING INSTRUCTION
16.2 Positioning Module 869
Teaching
GP.TEACH
This instruction teaches the specified axis.
Ladder diagram Structured text
ENO:=GP_TEACH1(EN,Un,s,d);
ENO:=GP_TEACH2(EN,Un,s,d);
(U) (s) (d)
FBD/LD
EN ENO
Un d
Setting data
■Description, range, data type
Operand Description Range Data type Data type (label)
(U)*1 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s) Own station head device where control data is stored Refer to Page 871 Device name ANY16_ARRAY*2
Control data. (Number of elements:
4)
(d) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 When specifying setting data by using a label, define an array to secure enough operation area and specify an element of the array
label.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K,H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s)
(d) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
16 POSITIONING INSTRUCTION
870 16.2 Positioning Module
■Control data
Device Item Description Setting range Set by
(s)+0 System area
(s)+1 Completion status The instruction completion status is stored. System
• 0: Normal
• Other than 0: Error (error code)
(s)+2 Teaching data selection Selects the address to which to write the current feed value (positioning or arc 0, 1 User
address).
• 0: Writes the current feed value to the positioning address.
• 1: Writes the current feed value to the arc address.
(s)+3 Positioning data Sets the positioning data number at which to perform the teaching. 1 to 600 User
number
Processing details
• The data of "[Md.20] Current feed value" of one of the following target axes is set in the positioning or arc address. The
positioning data other than the positioning or arc address must be set using the engineering tool or program.
Instruction symbol Target axis
GP.TEACH1 Axis 1
GP.TEACH2 Axis 2
• The following figure shows the operation at completion of the GP.TEACH instruction.
ON
Completion device(d) OFF OFF
1 scan
• For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module).
16 POSITIONING INSTRUCTION
16.2 Positioning Module 871
Precautions
• The following instructions cannot be executed simultaneously to a single axis. For different axes, any of the following can
be executed concurrently with a GP.TEACH instruction.
• Positioning start instruction (GP.PSTRT)
• Absolute position restoration instruction (G.ABRST)
• Teaching instruction (GP.TEACH)
• The GP.TEACH instruction is executed when "[Md.141] BUSY signal" is off. While "[Md.141] BUSY signal" is ON, if the
GP.TEACH instruction is executed, "Teaching during BUSY (Warning code: 0903H)" warning occurs in the positioning
module and teaching cannot be executed. Before executing the instruction, check that the "[Md.141] BUSY signal" of the
corresponding axis is off.
• If this instruction is executed in an interrupt program with the priority 1, operation error (3580H) occurs. This instruction
operates in an interrupt program with the priority 2 or 3.
Operation error
Error code Description
((s)+1)
1863H A value other than 0 or 1 was set in "Teaching data selection" of (s)+2.
1864H A value other than 1 to 600 was set in "Positioning data number" of (s)+3.
1865H An instruction was specified for an undefined axis.
16 POSITIONING INSTRUCTION
872 16.2 Positioning Module
Backing up Module Data (Writing Data to the Flash ROM)
GP.PFWRT
This instruction writes the module extension parameter (the positioning data and block start data) in the buffer memory to the
module extension parameter file.
Ladder diagram Structured text
ENO:=GP_PFWRT(EN,Un,s,d);
FBD/LD
EN ENO
Un d
Setting data
■Description, range, data type
Operand Description Range Data type Data type (label)
(U)*1 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s) Own station head device where control data is stored Refer to Page 873
Control data.
Device name ANY16_ARRAY*2
(Number of elements:
16
2)
(d) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 When specifying setting data by using a label, define an array to secure enough operation area and specify an element of the array
label.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K,H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s)
(d) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
■Control data
Device Item Description Setting range Set by
(s)+0 System area
(s)+1 Completion status The instruction completion status is stored. System
• 0: Normal
• Other than 0: Error (error code)
16 POSITIONING INSTRUCTION
16.2 Positioning Module 873
Processing details
• The buffer memory module extension parameters are written to the module extension parameter file.
• Whether the GP.PFWRT instruction has been completed normally or with an error can be checked with the completion
device (d) or completion status indication device (d)+1.
Device Description
Completion device (d) This device turns on during the END processing of the scan where the GP.PFWRT instruction completed, and
turns off during the next END processing.
Completion status indication device (d)+1 This device turns on or off depending on the completion status of the GP.PFWRT instruction.
When completed normally: Unchanged from off.
When completed with an error: Turns on during the END processing of the scan where the GP.PFWRT
instruction completed, and turns off during the next END processing.
• The following figure shows the operation at completion of the GP.PFWRT instruction.
ON
Completion device(d) OFF OFF
1 scan
• For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module).
Precautions
• While the module extension parameters are being written by using the GP.PFWRT instruction, do not power off the system
or reset the CPU module. If the power is turned off or the CPU module is reset while the module extension parameters are
being written, data is not normally written and normal positioning start is disabled. If normal positioning start is disabled,
restart the system as follows.
Method Description
Restart using the engineering tool Write the positioning and block start data to the positioning module from the "Write to programmable controller" of
the engineering tool.
Restart using the program After initializing parameters by using the GP.PINIT instruction, set the module extension parameters in the buffer
memory of the positioning module. Thereafter, execute the GP.PFWRT instruction.
• Data write to the flash ROM of the positioning module can be repeated a maximum of one hundred thousand times. Any
attempt to write data to the flash memory beyond this count results in failure, and the flash ROM write error (error code:
1931H) occurs.
• After the power is turned on or the CPU module is reset once, module backup (including the number of times initialization is
executed) can be repeated a maximum of 25 times if the program is used. Any attempt to write data to the flash ROM
memory beyond 25 times results in a flash ROM write count error at error code 1080H. If this error occurs, reset the
positioning module error with "[Cd.5] axis error reset", by turning the power OFF to ON, or by resetting the CPU module.
• The GP.PFWRT instruction can be executed when the READY signal ([Md.140] module status: b0) is OFF. While the
READY signal ([Md.140] module status: b0) is ON, if the GP.PFWRT instruction is executed, "Writing during PLC READY
ON (Warning code: 0905H) warning occurs in the positioning module and the module backup cannot be executed. Turn the
"[Cd.190] PLC READY signal" OFF, and turn the READY signal ([Md.140] module status: b0) OFF before executing the
GP.PFWRT instruction.
• If this instruction is executed in an interrupt program with the priority 1, operation error (3580H) occurs. This instruction
operates in an interrupt program with the priority 2 or 3.
16 POSITIONING INSTRUCTION
874 16.2 Positioning Module
Operation error
Error code Description
((s)+1)
1080H Flash ROM write count error
1931H Flash ROM write error
16
16 POSITIONING INSTRUCTION
16.2 Positioning Module 875
Initializing the Module
GP.PINIT
This instruction resets the module parameter and module extension parameter (the positioning data and block start data) in
the buffer memory, and the module extension parameter file setting values to the factory default settings (initial values).
Ladder diagram Structured text
ENO:=GP_PINIT(EN,Un,s,d);
FBD/LD
EN ENO
Un d
Setting data
■Description, range, data type
Operand Description Range Data type Data type (label)
(U)*1 Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16
(s) Own station head device where control data is stored Refer to Page 876 Device name ANY16_ARRAY*2
Control data. (Number of elements:
2)
(d) Own station device to be turned on for one scan when the Bit ANYBIT_ARRAY
instruction completes. (Number of elements:
If the instruction is completed with an error, (d)+1 is also 2)
turned on.
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U displays as Un.
*2 When specifying setting data by using a label, define an array to secure enough operation area and specify an element of the array
label.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K,H E $ (U)
F, B, SB, S SD, SW, R
(U)
(s)
(d) *1 *2
*1 S cannot be used.
*2 T, ST, and C cannot be used.
■Control data
Device Item Description Setting range Set by
(s)+0 System area
(s)+1 Completion status The instruction completion status is stored. System
• 0: Normal
• Other than 0: Error (error code)
16 POSITIONING INSTRUCTION
876 16.2 Positioning Module
Processing details
• These instructions reset the module parameters and module extension parameters in the buffer memory of the positioning
module, and the settings in the module extension parameter file to the factory default settings (initial values).
• The setting data initialized include the parameters, positioning data (No. 1 to 600), and block start data (No. 7000 to 7004).
• Whether the GP.PINIT instruction has been completed normally or with an error can be checked with the completion device
(d) or completion status indication device (d)+1.
Device Description
Completion device (d) This device turns on during the END processing of the scan where the GP.PINIT instruction completed, and turns
off during the next END processing.
Completion status indication device (d)+1 This device turns on or off depending on the completion status of the GP.PINIT instruction.
When completed normally: Unchanged from off.
When completed with an error: Turns on during the END processing of the scan where the GP.PFWRT
instruction completed, and turns off during the next END processing.
• The following figure shows the operation at completion of the GP.PINIT instruction.
ON
Completion device(d) OFF OFF
1 scan 16
• For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module).
Precautions
• The GP.PINIT instruction can be executed when the READY signal ([Md.140] module status: b0) is OFF. While the READY
signal ([Md.140] module status: b0) is ON, if the GP.PINIT instruction is executed, "Writing during PLC READY ON
(Warning code: 0905H) warning occurs in the positioning module and the initializing the module cannot be executed. Turn
the "[Cd.190] PLC READY signal" OFF, and turn the READY signal ([Md.140] module status: b0) OFF before executing the
GP.PINIT instruction.
• Data write to the flash ROM of the positioning module can be repeated a maximum of one hundred thousand times. Any
attempt to write data to the flash memory beyond this count results in failure, and the flash ROM write error (error code:
1931H) occurs.
• After the power is turned on or the CPU module is reset once, module backup (including the number of times initialization is
executed) can be repeated a maximum of 25 times if the program is used. Any attempt to write data to the flash ROM
memory beyond 25 times results in a flash ROM write count error at error code 1080H. If this error occurs, reset the
positioning module error with "[Cd.5] axis error reset", by turning the power OFF to ON, or by resetting the CPU module.
• If this instruction is executed in an interrupt program with the priority 1, operation error (3580H) occurs. This instruction
operates in an interrupt program with the priority 2 or 3.
Operation error
Error code Description
((s)+1)
1080H Flash ROM write count error
1931H Flash ROM write error
16 POSITIONING INSTRUCTION
16.2 Positioning Module 877
17 DIVIDED DATA READ/WRITE FROM/TO BFM
INSTRUCTION
17.1 Divided BFM Read
RBFM
This instruction reads data from continuous buffer memory areas in an FX3 intelligent function module
Ladder diagram Structured text
ENO:=RBFM(EN,UnHn,s,n1,n2,d);
FBD/LD
EN ENO
UnHn d
n1
n2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U/H)*1 Module number K1 to 16 16-bit unsigned binary ANY16_U
(s) Head buffer memory number 0 to 32767 16-bit unsigned binary ANY16_U
(d) Head device number storing data to be read from buffer memory 16-bit signed binary ANY16
(n1) Number of all buffer memory areas to be read 1 to 32768 16-bit unsigned binary ANY16_U
(n2) Not used 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U/H displays as UnHn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U/H)
(s)
(d)
(n1)
(n2)
• When this instruction is finished normally, instruction execution complete flag (SM8029) turns on. When this instruction is
finished abnormally, instruction execution abnormal end flag (SM8329) turns on.
• When this instruction or the WBFM instruction is executed in the same scan, instruction non-execution flag (SM8328) is set
to on, and execution of such an instruction is paused. When execution of the other target instruction is complete, the
paused instruction resumes.
■Related devices
Device Name Description
SM8029 Instruction execution complete Turns ON when an instruction is finished normally.
SM8328 Instruction non-execution Turns ON when the RBFM instruction or WBFM instruction in another step is executed for
the same module number.
SM8329 Instruction execution abnormal end Turns ON when an instruction is finished abnormally.
Precautions
• Do not stop the instruction while it is being executed. If driving is stopped, the buffer memory reading processing is
suspended, but the data that is already read is stored in (d) onwards. Stop the instruction after execution completes as in
the following program.
Command
input
SET M
M
RBFM (U/H) (s) (d) (n1) (n2)
SM8029
RST M
Instruction execution complete flag
• When indexing is executed, the contents of index registers at the beginning of execution are used. Even if the contents of
index registers are changed after the instruction, such changes do not affect the process of the instruction.
• The contents of (n1) points starting from (d) update (change) every scan while this instruction is executed. Use the data
after the instruction is completed.
• Do not update (change) the contents of (n1) buffer memory areas starting from the buffer memory (s) while this instruction
is executed. If the contents are updated, the intended data may not be read.
• This instruction cannot be used in FX5 intelligent function modules.
• This instruction cannot be used while a interrupt routine program is being executed.
A module number is automatically assigned to each intelligent function module connected to the CPU module. The module
number is assigned as No.1 → No.2 → No.3… starting from the equipment nearest the CPU module.
• Buffer memory number
The intelligent function module incorporates a RAM memory. The RAM memory is called buffer memory. Buffer memory
numbers range from #0 to #32767 and their contents vary depending on the function of the extension equipment. (Setting
range: K0 to K32767)
For the contents of buffer memory areas, refer to manuals of intelligent function modules.
FBD/LD
EN ENO
UnHn
s1
s2
n1
n2
Setting data
■Descriptions, ranges, and data types
Operand Description Range Data type Data type (label)
(U/H)*1 Module number K1 to 16 16-bit unsigned binary ANY16_U
(s1) Head buffer memory number 0 to 32767 16-bit unsigned binary ANY16_U
(s2) Head device number storing data to be written to buffer memory 16-bit signed binary ANY16
(n1) Number of all buffer memory areas to be written 1 to 32768 16-bit unsigned binary ANY16_U
(n2) Not used 16-bit unsigned binary ANY16_U
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
*1 In the case of the ST language and the FBD/LD language, U/H displays as UnHn.
■Applicable devices
Operand Bit Word Double word Indirect Constant Others
X, Y, M, L, SM, T, ST, C, D, W, U\G Z LC LZ specification K, H E $
F, B, SB, S SD, SW, R
(U/H)
(s1)
(s2)
(n1)
(n2)
• When this instruction is finished normally, instruction execution complete flag (SM8029) turns on. When this instruction is
finished abnormally, instruction execution abnormal end flag (SM8329) turns on.
• When this instruction or the RBFM instruction is executed in the same scan, instruction non-execution flag (SM8328) is set
to on, and execution of such an instruction is paused. When execution of the other target instruction is complete, the
paused instruction resumes.
■Related devices
Device Name Description
SM8029 Instruction execution complete Turns ON when an instruction is finished normally.
SM8328 Instruction non-execution Turns ON when the RBFM instruction or WBFM instruction in another step is executed for
the same module number.
SM8329 Instruction execution abnormal end Turns ON when an instruction is finished abnormally.
Precautions
• Do not stop the instruction while it is being executed. If driving is stopped, the buffer memory write processing is
suspended, but the data that is already written is stored in (m2) onwards.
• When indexing is executed, the contents of index registers at the beginning of execution are used. Even if the contents of
index registers are changed after the instruction, such changes do not affect the process of the instruction.
• Do not update (change) the contents of (n1) points starting from (s2) while this instruction is executed. If the contents are
updated, the intended data may not be written to the buffer memory areas.
• This instruction cannot be used in FX5 intelligent function modules.
• This instruction cannot be used while a interrupt routine program is being executed.
Operation error
Error code Description
(SD0/SD8067)
2441H Communication procedure with module is not completed correctly when this instruction is executed.
2801H Module with the module number specified by (U/H) does not exist, or the specified module is not supported.
2823H The number of transfer points specified by (n1) and the buffer memory number specified by (s1) is beyond the buffer memory range.
2820H The number of transfer points specified by (n1) and the device number specified by (s2) is beyond the specified device range.
3580H An instruction that cannot be used in an interrupt program is used.
23 SELECTION FUNCTIONS
24 COMPARISON FUNCTIONS
883
18 TYPE CONVERSION FUNCTIONS
18.1 Converting BOOL to WORD
BOOL_TO_WORD(_E)
These functions convert BOOL type data to WORD type data.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=BOOL_TO_WORD(s);
[With EN/ENO]
s d EN ENO d:=BOOL_TO_WORD_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BOOL_TO_WORD(_E)) Output Output variable WORD
Processing details
■Operation processing
• These functions convert the BOOL type data input to (s) to WORD type data and output from (d).
• When the input value is "FALSE", these functions output 0H as the WORD type data value.
• When the input value is "TRUE", these functions output 1H as the WORD type data value.
(s) (d)
FALSE 0H
TRUE 1H
BOOL WORD
• A value input to (s) is the BOOL type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
BOOL_TO_DWORD(_E)
These functions convert BOOL type data to DWORD type data.
18
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=BOOL_TO_DWORD(s);
[With EN/ENO]
s d EN ENO d:=BOOL_TO_DWORD_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BOOL_TO_DWORD(_E)) Output Output variable DWORD
Processing details
■Operation processing
• These functions convert the BOOL type data input to (s) to DWORD type data and output from (d).
• When the input value is "FALSE", these functions output 0H as the DWORD type data value.
• When the input value is "TRUE", these functions output 1H as the DWORD type data value.
(s) (d)
FALSE 0H
TRUE 1H
BOOL DWORD
• A value input to (s) is the BOOL type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
BOOL_TO_INT(_E)
These functions convert BOOL type data to INT type data.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=BOOL_TO_INT(s);
[With EN/ENO]
s d EN ENO d:=BOOL_TO_INT_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BOOL_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the BOOL type data input to (s) to INT type data and output from (d).
• When the input value is "FALSE", these functions output 0 as the INT type data value.
• When the input value is "TRUE", these functions output 1 as the INT type data value.
(s) (d)
FALSE 0
TRUE 1
BOOL INT
• A value input to (s) is the BOOL type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
BOOL_TO_DINT(_E)
These functions convert BOOL type data to DINT type data.
18
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=BOOL_TO_DINT(s);
[With EN/ENO]
s d EN ENO d:=BOOL_TO_DINT_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BOOL_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the BOOL type data input to (s) to DINT type data and output from (d).
• When the input value is "FALSE", these functions output 0 as the DINT type data value.
• When the input value is "TRUE", these functions output 1 as the DINT type data value.
(s) (d)
FALSE 0
TRUE 1
BOOL DINT
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
BOOL_TO_TIME(_E)
These functions convert BOOL type data to TIME type data.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=BOOL_TO_TIME(s);
[With EN/ENO]
s d EN ENO d:=BOOL_TO_TIME_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BOOL_TO_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions convert the BOOL type data input to (s) to TIME type data and output from (d).
• When the input value is "FALSE", these functions output 0 as the TIME type data value.
• When the input value is "TRUE", these functions output 1 as the TIME type data value.
(s) (d)
FALSE 0
TRUE T#1ms
BOOL TIME
• A value input to (s) is the BOOL type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
BOOL_TO_STRING(_E)
These functions convert BOOL type data to STRING type data.
18
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=BOOL_TO_STRING(s);
[With EN/ENO]
s d EN ENO d:=BOOL_TO_STRING_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BOOL_TO_STRING(_E)) Output Output variable STRING
Processing details
■Operation processing
• These functions convert the BOOL type data input to (s) to STRING type data and output from (d).
• When the input value is "FALSE", these functions output 0 as the STRING type data value.
• When the input value is "TRUE", these functions output 1 as the STRING type data value.
(s) (d)
FALSE "0"
TRUE "1"
BOOL STRING
• A value input to (s) is the BOOL type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
WORD_TO_BOOL(_E)
These functions convert WORD type data to BOOL type data.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=WORD_TO_BOOL(s);
[With EN/ENO]
s d EN ENO d:=WORD_TO_BOOL_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable WORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(WORD_TO_BOOL(_E)) Output Output variable BOOL
Processing details
■Operation processing
• These functions convert the WORD type data input to (s) to BOOL type data and output from (d).
• When the input value is 0H, these functions output "FALSE".
• When the input value is any value other than 0H, these functions output "TRUE".
(s) (d)
0H FALSE
1567H TRUE
WORD BOOL
• A value input to (s) is the WORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
WORD_TO_DWORD(_E)
These functions convert WORD type data to DWORD type data.
18
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=WORD_TO_DWORD(s);
[With EN/ENO]
s d EN ENO d:=WORD_TO_DWORD_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable WORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(WORD_TO_DWORD(_E)) Output Output variable DWORD
Processing details
■Operation processing
• These functions convert the WORD type data input to (s) to DWORD type data and output from (d).
• Each of high-order 16 bits becomes "0" after data conversion.
(s) (d)
5678H 00005678H
WORD DWORD
• A value input to (s) is the WORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
WORD_TO_INT(_E)
These functions convert WORD type data to INT type data.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=WORD_TO_INT(s);
[With EN/ENO]
s d EN ENO d:=WORD_TO_INT_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable WORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(WORD_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the WORD type data input to (s) to INT type data and output from (d).
(s) (d)
5678H 22136
WORD INT
• A value input to (s) is the WORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable WORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(WORD_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the WORD type data input to (s) to DINT type data and output from (d).
• Each of high-order 16 bits becomes "0" after data conversion.
(s) (d)
5678H 22136
WORD DINT
5678H 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
22136 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
0
• A value input to (s) is the WORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable WORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(WORD_TO_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions convert the WORD type data input to (s) to TIME type data and output from (d).
(s) (d)
0H T#0ms
1234H T#1s234ms
WORD TIME
• A value input to (s) is the WORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
2. Function with EN/ENO
The following table lists the execution conditions and operation results.
Execution condition Operation result
EN ENO (d)
TRUE (Executes operation) TRUE Operation output value
FALSE (Stops operation) FALSE*1 Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DWORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DWORD_TO_BOOL(_E)) Output Output variable BOOL
Processing details
■Operation processing
• These functions convert the DWORD type data input to (s) to BOOL type data and output from (d).
• When the input value is 0H, these functions output "FALSE".
• When the input value is any value other than 0H, these functions output "TRUE".
(s) (d)
0H FALSE
12345678H TRUE
DWORD BOOL
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DWORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DWORD_TO_WORD(_E)) Output Output variable WORD
Processing details
■Operation processing
• These functions convert the DWORD type data input to (s) to WORD type data and output from (d).
• The information stored in high-order 16 bits of an input value is discarded. (Refer to (1) in the figure below.)
(s) (d)
12345678H 5678H
DWORD WORD
1 2 3 4 5 6 7 8
12345678H 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
5678H 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
(1)
• A value input to (s) is the DWORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
When DWORD_TO_WORD(_E) is executed, the information stored in high-order 16 bits of the DWORD type
data value input from (s) is discarded.
18
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DWORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DWORD_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the DWORD type data input to (s) to INT type data and output from (d).
• The information stored in high-order 16 bits of an input value is discarded. (Refer to (1) in the figure below.)
(s) (d)
BC614EH 24910
DWORD INT
BC614EH 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
24910 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
(1)
• A value input to (s) is the DWORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
When DWORD_TO_INT(_E) is executed, the information stored in high-order 16 bits of the DWORD type
data value input from (s) is discarded.
18
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DWORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DWORD_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the DWORD type data input to (s) to DINT type data and output from (d).
(s) (d)
BC614EH 12345678
DWORD DINT
• A value input to (s) is the DWORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DWORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DWORD_TO_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions convert the DWORD type data input to (s) to TIME type data and output from (d).
(s) (d)
0H T#0ms
1234567H T#20m34s567ms
DWORD TIME
• A value input to (s) is the DWORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_BOOL(_E)) Output Output variable BOOL
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to BOOL type data and output from (d).
• When the input value is 0, these functions output "FALSE".
• When the input value is any value other than 0, these functions output "TRUE".
(s) (d)
0 FALSE
1567 TRUE
INT BOOL
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_WORD(_E)) Output Output variable WORD
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to WORD type data and output from (d).
(s) (d)
22136 5678H
INT WORD
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_DWORD(_E)) Output Output variable DWORD
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to DWORD type data and output from (d).
• Each of high-order 16 bits becomes "0" after data conversion.
(s) (d)
-325 0000FEBBH
INT DWORD
-325 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1
0000FEBBH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1
0
• A value input to (s) is the INT type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to DINT type data and output from (d).
(s) (d)
1234 1234
INT DINT
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_BCD(_E)) Output Output variable WORD
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to BCD type data and output from (d).
(s) (d)
9999 9999H
INT BCD
3276816384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
9999 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
(1) BCD
8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 1
9999H 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
• A value input to (s) is the INT type data value and within the range from 0 to 9999.
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
18
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_REAL(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to REAL type data and output from (d).
(s) (d)
1234 1234.0
INT REAL
• A value input to (s) is the INT type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to TIME type data and output from (d).
(s) (d)
1234 T#1s234ms
INT TIME
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_STRING(_E)) Output Output variable STRING(6)
Processing details
■Operation processing
• These functions convert the INT type data input to (s) to STRING type data and output from (d).
(d)
High-order byte Low-order byte
ASCII code for ten-thousands place Sign data +0
(s)
ASCII code for hundreds place ASCII code for thousands place +1
ASCII code for ones place ASCII code for tens place +2
INT 00H +3
(1)
(1): "00H" is stored when "SM701" (output character number selector) is off.
Ex.
When "-123" is input
(d)
High-order byte Low-order byte
20H (SP) 2DH (-) +0
(s)
31H (1) 20H (SP) +1
-123
33H (3) 32H (2) +2
INT 00H +3
• 00H is stored at the end (4th word) of the character string when SM701 (output character number selector signal) is off.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "0000H" does not exist.
3405H The character string specified by (s) has more than 16383 characters.
3406H The whole specified character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_BOOL(_E)) Output Output variable BOOL
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to BOOL type data and output from (d).
• When the input value is 0, these functions output "FALSE".
• When the input value is any value other than 0, these functions output "TRUE".
(s) (d)
0 FALSE
12345678 TRUE
DINT BOOL
• A value input to (s) is the DINT type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_WORD(_E)) Output Output variable WORD
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to WORD type data and output from (d).
• The information stored in high-order 16 bits of an input value is discarded. (Refer to (1) in the figure below.)
(s) (d)
12345678 614EH
DINT WORD
12345678 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
614EH 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
(1)
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
When DINT_TO_WORD(_E) is executed, the information stored in high-order 16 bits of the DINT type data
value input from (s) is discarded.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_DWORD(_E)) Output Output variable DWORD
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to DWORD type data and output from (d).
(s) (d)
12345678 BC614EH
DINT DWORD
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to INT type data and output from (d).
(s) (d)
1234 1234
DINT INT
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3401H The 32-bit signed binary data in the device specified by (s) is out of the valid range (-32768 to 32767).
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_BCD(_E)) Output Output variable ANY_BIT
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to BCD type data and output from (d).
(s) (d)
99999999 99999999H
DINT BCD
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215
214
213
212
211
210
29
28
27
26
25
24
23
22
21
20
99999999 0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
(1) BCD
×107
×106
×105
×104
×103
×102
×101
×100
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
99999999H 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
(1): Make sure to set them to "0".
• A value input to (s) is the DINT type data value. When (d) is WORD, the input value is within the range from 0 to 9999.
When (d) is DWORD, the input value is within the range from 0 to 99999999.
• WORD or DWORD can be specified to (d). BOOL cannot be specified.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• When (d) is WORD
Error code Description
(SD0/SD8067)
3401H The 32-bit signed binary data in the device specified by (s) is out of the valid range (-32768 to 32767).
Data in the device specified by (s) is out of the valid range (0 to 9999).
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_REAL(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to REAL type data and output from (d).
(s) (d)
16543521 16543521.0
DINT REAL
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to TIME type data and output from (d).
(s) (d)
1234 T#1s234ms
DINT TIME
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_STRING(_E)) Output Output variable STRING(11)
Processing details
■Operation processing
• These functions convert the DINT type data input to (s) to STRING type data and output from (d).
(d)
High-order byte Low-order byte
ASCII code for billions place Sign data +0
(s)
ASCII code for ten-millions place ASCII code for hundred-millions place +1
ASCII code for hundred-thousands place ASCII code for millions place +2
DINT ASCII code for thousands place ASCII code for ten-thousands place +3
ASCII code for tens place ASCII code for hundreds place +4
00H ASCII code for ones place +5
(1)
(1): "00H" is stored when "SM701" (output character number selector) is off.
Ex.
When "-123456" is input
(d)
High-order byte Low-order byte
20H (SP) 2DH (-) +0
(s)
20H (SP) 20H (SP) +1
-123456
31H (1) 20H (SP) +2
DINT 33H (3) 32H (2) +3
35H (5) 34H (4) +4
00H 36H (6) +5
• 00H is stored at the end (high-order byte of the 6th word) of the character string when SM701 (output character number
selector signal) is off.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable WORD
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BCD_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the BCD type data input to (s) to INT type data and output from (d).
(s) (d)
9999H 9999
BCD INT
8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 1
9999H 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
(1)
(1): Always becomes "0".
• A value input to (s) is the WORD type data value and within the range from 0H to 9999H (from 0 to 9 for each digit).
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY_BIT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BCD_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the BCD type data input to (s) to DINT type data and output from (d).
• When WORD is specified to (s)
(s) (d)
9999H 9999
WORD DINT
×103
×102
×101
×100
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
9999H 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
DINT
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215
214
213
212
211
210
29
28
27
26
25
24
23
22
21
20
9999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
(1)
(1): Always becomes "0".
• When DWORD is specified to (s)
(s) (d)
99999999H 99999999
DWORD DINT
×107
×106
×105
×104
×103
×102
×101
×100
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
99999999H 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
DINT
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215
214
213
212
211
210
29
28
27
26
25
24
23
22
21
20
99999999 0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
(1)
(1): Always becomes "0".
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• When (s) is WORD
Error code Description
(SD0/SD8067)
3401H A value other than 0 to 9 exists in each digit of (s).
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(REAL_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the REAL type data input to (s) to INT type data and output from (d).
(s) (d)
1234.0 1234
REAL INT
• A value input to (s) is the REAL type data value and within the range from -32768 to 32767.
• After conversion, the first digit after the decimal point of the REAL type data value is rounded off.
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(REAL_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the REAL type data input to (s) to DINT type data and output from (d).
(s) (d)
16543521.0 16543521
REAL DINT
• A value input to (s) is the REAL type data value and within the range from -2147483648 to 2147483647.
• After conversion, the first digit after the decimal point of the REAL type data value is rounded off.
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(REAL_TO_STRING(_E)) Output Output variable STRING(13)
Processing details
■Operation processing
• These functions convert the REAL type data input to (s) to STRING type (exponent format) data and output from (d).
(d)
High-order byte Low-order byte
(s)
REAL 20H (SP) Sign data (integer part) +0
ASCII code for 2nd decimal place ASCII code for 1st decimal place +2
. E
ASCII code for 4th decimal place ASCII code for 3rd decimal place +3
Sign Sign
(integer part) (exponent part) ASCII code for 5th decimal place
45H (E) +4
Added
automatically ASCII code for tens place of exponent part Sign data (exponent part) +5
(d)
(1)
(2) (3) (4)
(s)
-12.3456 - 1 . 2 3 4 5 6 E + 0 1
REAL
(5) (6) (7)
(1): Total number of digits (13 digits)
(2): Integer part (1 digit)
(3): Decimal part (5 digits)
(4): Exponent part (2 digits)
(5): "20H (SP)" is stored.
(6): "2EH (.)" is stored.
(7): "45H (E)" is stored.
(d)
(1)
(s) 7
-12.345678 - 1 . 2 3 4 5 6 7 8 E + 0 1
(d)
(s) (1)
-12.34 - 1 . 2 3 4 0 0 E + 0 1
REAL (3)
(2)
(1): Total number of digits (13 digits)
(2): Number of digits of decimal part (5)
(3): "30H (0)" is stored.
• In "Sign data (exponent part)", "2BH (+)" is stored when the input value is positive, and "2DH (-)" is stored when the input value is negative.
• "30H (0)" is stored in the tens place of the exponent part when the exponent part consists of 1 digit.
(d)
(1)
(s) (2)
-12.3456 - 1 . 2 3 4 5 6 E + 0 1
REAL (3)
(1): Total number of digits (13 digits)
(2): Number of digits of exponent part (2)
(3): "30H (0)" is stored.
• "00H" is automatically stored at the end (7th word) of the character string.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3402H (s) is not located within the following range
• 0, 2-126≤|specified device value|<2128
• (s) is -0, denormalized number, NaN (not a number), or ±∞.
3406H The whole converted character string cannot be stored in the devices from the device specified by (d) to the last device of the target
device.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(TIME_TO_BOOL(_E)) Output Output variable BOOL
Processing details
■Operation processing
• These functions convert the TIME type data input to (s) to BOOL type data and output from (d).
(s) (d)
T#0ms FALSE
T#20m34s567ms TRUE
TIME BOOL
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
2. Function with EN/ENO
The following table lists the execution conditions and operation results.
Execution condition Operation result
EN ENO (d)
TRUE (Executes operation) TRUE Operation output value
FALSE (Stops operation) FALSE*1 Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(TIME_TO_WORD(_E)) Output Output variable WORD
Processing details
■Operation processing
• These functions convert the TIME type data input to (s) to WORD type data and output from (d).
(s) (d)
T#1s234ms 1234H
TIME WORD
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(TIME_TO_DWORD(_E)) Output Output variable DWORD
Processing details
■Operation processing
• These functions convert the TIME type data input to (s) to DWORD type data and output from (d).
(s) (d)
T#20m34s567ms 1234567H
TIME DWORD
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(TIME_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the TIME type data input to (s) to INT type data and output from (d).
(s) (d)
T#1s234ms 1234
TIME INT
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(TIME_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the TIME type data input to (s) to DINT type data and output from (d).
(s) (d)
T#20m34s567ms 1234567
TIME DINT
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(TIME_TO_STRING(_E)) Output Output variable STRING(11)
Processing details
■Operation processing
• These functions convert the TIME type data input to (s) to STRING type data and output from (d).
(s) (d)
T#20m34s567ms " 1234567"
TIME STRING
(s) (d)
T#-20m34s567ms "- 1234567"
TIME STRING
• A value input to (s) is the TIME type data value.
• 00H is stored at the end of the character string when SM701 (output character number selector signal) is off.
• The following shows the operation result to be stored in the output.
• As the 1st character, "20H" (space) is stored if the binary data is positive, and "2DH" (-) is stored if the data is negative.
• "20H" (space) is stored on the left side of the effective digits.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(1)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(STRING_TO_BOOL(_E)) Output Output variable BOOL
Processing details
■Operation processing
• These functions convert the STRING type (in the decimal format or exponent format) data input to (s) to BOOL type data
and output from (d).
(s) (d)
'0' FALSE
'1' TRUE
STRING BOOL
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(6)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(STRING_TO_INT(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions convert the STRING type data input to (s) to INT type data and output from (d).
(s)
High-order byte Low-order byte
+0 ASCII code for ten-thousands place Sign data (d)
+1 ASCII code for hundreds place ASCII code for thousands place
+2 ASCII code for ones place ASCII code for tens place
+3 00H (Indicates the end of the character string.) INT
• A value input to (s) is the STRING type data value and within the following range.
• Within the range of "30H" to "39H", "20H", "2DH", and "00H" in ASCII code
• Within the range of "-32768" to "32767" as the STRING type data value
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(11)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(STRING_TO_DINT(_E)) Output Output variable DINT
Processing details
■Operation processing
• These functions convert the STRING type data input to (s) to DINT type data and output from (d).
(s)
High-order byte Low-order byte
+0 ASCII code for billions place Sign data
(d)
+1 ASCII code for ten-millions place ASCII code for hundred-millions place
+2 ASCII code for hundred-thousands place ASCII code for millions place
+3 ASCII code for thousands place ASCII code for ten-thousands place DINT
+4 ASCII code for tens place ASCII code for hundreds place
+5 00H (Indicates the end of the character string.) ASCII code for ones place
• A value input to (s) is the STRING type data value and within the following range.
• Within the range of "30H" to "39H", "20H", "2DH", and "00H" in ASCII code
• Within the range of "-2147483648" to "2147483647" as the STRING type data value
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(24)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(STRING_TO_REAL(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions convert the STRING type (in the decimal format or exponent format) data input to (s) to REAL type data
and output from (d).
(s)
High-order byte Low-order byte
+0 ASCII code for 1st character Sign data
+1 ASCII code for 3rd character ASCII code for 2nd character
+2 ASCII code for 5th character ASCII code for 4th character (d)
+3 ASCII code for 7th character ASCII code for 6th character
+4 ASCII code for 9th character ASCII code for 8th character
REAL
+5 ASCII code for 11th character ASCII code for 10th character
• The conversion source STRING type data can be in the decimal format or exponent format.
• Decimal point format
(s)
High-order byte Low-order byte
+0 31H (1) 2DH (-)
+1 33H (3) 2EH (.)
+2 30H (0) 35H (5) (d)
+3 34H (4) 33H (3) -1.35034
+4 00H
REAL
- 1 . 3 5 0 3 4
- 1 . 3 5 0 3 4 1 2 0 2 3 -1.35034
REAL
• Exponent format
- 1 . 3 5 0 3 4 1 2 E - 1 0 -1.35034E-10
REAL
• When 2BH (+) is specified as the sign in the floating point format or when the sign is omitted, a character string is converted
into a positive value. It is handled as negative value during conversion when the sign is set to 2DH (-).
• String data in the exponent format is handled as positive value during conversion when the sign of the exponent part is set
to 2BH (+) or when the sign is omitted. When 2DH (-) is specified as the sign, a character string is converted into a negative
value.
• When 20H (space) or 30H (0) exists between numbers except the first 0 in STRING type data, 20H or 30H is ignored during
conversion.
• Decimal point format
- 0 1 . 3 5 0 3 4 -1.35034
REAL
• Exponent format
- 0 1 . 3 5 0 3 4 E - 1 0 -1.35034E-10
REAL
• When 30H (0) exists between a number and "E" in STRING type data (exponent format), 30H is ignored during conversion.
- 1 . 3 5 0 3 4 E - 0 2 -1.35034E-2
REAL
• When 20H (space) is contained in character string, 20H is ignored during conversion.
• Up to 24 characters can be input as STRING type data. 20H (space) and 30H (0) in a character string are counted as one
character respectively.
• A value input to (s) is the STRING type data value and within the following range.
• Within the range of "30H" to "39H", "45H", "2BH", "2DH", "2EH", "20H" and "00H" in ASCII code
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
2820H 00H does not exist in the corresponding device range starting from (s)
3401H Invalid data which cannot be converted to (s) are set.
• Any character other than "30(0)" to "39(9)" exists in the integer part or decimal part.
• 2EH (.) exists in two or more positions in the specified character string.
• Any character other than 45H (E), 65(e), 2B(+) , or 2D(-) exists in the specified exponent part.
• Two or more exponent parts of 45H (E) or 65(e) exist in the specified character string.
• Three or more digits of numerical values in the exponent parts are described in the specified character string.
• Two or more signs of exponent parts of 2B(+) or 2D(-) exist in the specified character string.
• Two or more signs of 2B(+) or 2D(-) exist in the integral part for the decimal point format and exist in the mantissa part for the exponent
format in the specified character string.
• The number of characters after (s) is 0 or more than 24
3403H (d) exceeds the following range. (An overflow has occurred.)
|(d)|<2128
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(11)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(STRING_TO_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions convert the STRING type data input to (s) to TIME type data and output from (d).
(s) (d)
'00000000' T#0ms
'01234567' T#20m34s567ms
STRING TIME
• A value input to (s) is the STRING type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3401H Values for each place of the ASCII code for input are other than "30H" to "39H", "20H", and "00H".
Value of the ASCII code for input are outside the following range.
-2147483648 to 4147483647
n s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(BitArr) Input (Variables are available for element specification.) Input variable BOOL array element
n Only a constant 4, 8, 12 or 16 can be specified. Input variable INT
ENO Output status (TRUE: Normal , FALSE: Abnormal) Output variable BOOL
d(BITARR_TO_INT(_E)) Output Output variable ANY16
Processing details
■Operation processing
• These functions convert the data for bits specified by (n) starting from the bit array element input to (s) to ANY 16 type data
and output from (d).
• "0" is set to output bits beyond the specified number of bits.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(BitArr) Input (Variables are available for element specification.) Input variable BOOL array element
n Only a constant 4, 8, 12, 16, 20, 24, 28 or 32 can be specified. Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(BITARR_TO_DINT(_E)) Output Output variable ANY32
Processing details
■Operation processing
• These functions convert the data for bits specified by (n) starting from the bit array element input to (s) to ANY 32 type data
and output from (d).
• "0" is set to output bits beyond the specified number of bits.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s Input Input variable ANY16
n Only a constant 4, 8, 12 or 16 can be specified. Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INT_TO_BITARR(_E)) Output (Variables are available for element specification.) Output variable BOOL array element
Processing details
■Operation processing
• These functions output low-order (n) bits of ANY 16 type data specified to (s).
• Output bits beyond the specified number of bits are not changed.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s Input Input variable ANY32
n Only a constant 4, 8, 12, 16, 20, 24, 28 or 32 can be specified. Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DINT_TO_BITARR(_E)) Output (Variables are available for element specification.) Output variable BOOL array element
Processing details
■Operation processing
• These functions output low-order (n) bits of ANY 32 type data specified to (s) to (d).
• Output bits beyond the specified number of bits are not changed.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(BitArrIn) Input Input variable BOOL array element
n Only a constant 4, 8, 12, 16, 20, 24, 28 or 32 can be specified. Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(CPY_BITARR(_E)) Output Output variable BOOL array element
Processing details
■Operation processing
• These functions output (n) bits of a bit array specified to (s) to (d).
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s Input Input variable ANY16
n Only a constant 0 to 15 can be specified. Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(GET_BIT_OF_INT(_E)) Output Output variable BOOL
Processing details
■Operation processing
• These functions output (n)th bit of (s).
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s Input Input variable BOOL
n Only a constant 0 to 15 can be specified. Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SET_BIT_OF_INT(_E)) Output Output variable ANY16
Processing details
■Operation processing
• These functions write the BOOL value specified by (s) in the (n)th bit of (d).
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n1 s d
n2 n1
n2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s Input Input variable ANY16
n1 Bit specification of input variable (Only a constant 0 to 15 can be Input variable INT
specified.)
n2 Bit specification of output variable (Only a constant 0 to 15 can be Input variable INT
specified.)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(CPY_BIT_OF_INT(_E)) Output Output variable ANY16
Processing details
■Operation processing
• These function copy the value of the (n1)th bit of the word specified by (s) to the (n2)th bit of (d).
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
s Input Input variable ANY
d(GET_BOOL_ADDR / GET_INT_ADDR / GET_WORD_ADDR) Output Output variable BOOL/INT/WORD
Processing details
■Operation processing
• These functions output the input data variable as the output variable type according to the following table.
General function Input data type Output data type
GET_BOOL_ADDR BOOL BOOL
ARRAY OF BOOL
GET_INT_ADDR INT INT
DINT
GET_WORD_ADDR WORD
WORD
REAL
TIME
STRING
ARRAY OF INT
ARRAY OF DINT
ARRAY OF WORD
ARRAY OF DWORD
ARRAY OF REAL
ARRAY OF TIME
■Operation result
The operation processing is executed. The operation output value is output from (d).
Operation error
There is no operation error.
ABS(_E)
These functions output the absolute value of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=ABS(s);
[With EN/ENO]
s d EN ENO d:=ABS_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ABS(_E)) Output Output variable ANY_NUM
Processing details
■Operation processing
• These functions output the absolute value of the INT, DINT, or REAL type data input to (s) in the same data type as (s) from
(d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=|A|
• A value input to (s) is the INT, DINT, or REAL type data value.
• When -32768 is input while the data type of (s) is INT, -32768 is output from (d).
• When -2147483648 is input while the data type of (s) is DINT, -2147483648 is output from (d). (An operation error does not
occur. "ABS_E" outputs "TRUE" from output variable ENO.)
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
19
SQRT(_E)
These functions output the square root of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=SQRT(s);
[With EN/ENO]
s d EN ENO d:=SQRT_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SQRT(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions output the square root of the REAL type data input to (s) from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B= A
• A value input to (s) is the REAL type data value and within the positive value range.
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3405H A negative value is input.
LN(_E)
These functions output the natural logarithm operation result of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=LN(s);
[With EN/ENO] 19
s d EN ENO d:=LN_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(LN(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the logarithm whose base is "e" of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=logeA
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3405H A negative value is input.
The data after conversion is other than -3.40282+38 to -1.17549-38, 0, or 1.17549-38 to 3.40282+38.
LOG(_E)
These functions output the operation result of the common logarithm (the logarithm whose base is 10) of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=LOG(s);
[With EN/ENO]
s d EN ENO d:=LOG_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output condition (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(LOG(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the logarithm whose base is "10" of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=log10A
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
EXP(_E)
These functions output the exponential operation result of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=EXP(s);
[With EN/ENO]
s d EN ENO d:=EXP_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(EXP(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the exponent of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=eA
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3403H The data after conversion is not -3.40282+38 to -1.17549-38, or 1.17549-38 to 3.40282+38.
SIN(_E)
These functions output the sine of the angle of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=SIN(s);
[With EN/ENO] 19
s d EN ENO d:=SIN_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SIN(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the sine of the angle of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=SIN A
• A value (angle) input to (s) is the REAL type data value. Input a value in radians (angle×π/180).
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3402H A negative value is input.
COS(_E)
These functions output the cosine of the angle of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=COS(s);
[With EN/ENO]
s d EN ENO d:=COS_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(COS(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the cosine of the angle of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=COS A
• A value (angle) input to (s) is the REAL type data value. Input a value in radians (angle×π/180).
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3402H A negative value is input.
TAN(_E)
These functions output the tangent of the angle of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=TAN(s);
[With EN/ENO] 19
s d EN ENO d:=TAN_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(TAN(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the tangent of the angle data of the REAL type data (angle) input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=TAN A
• Even when the input value is π/2 radian or (3/2) π radian, no error occurs because an operation error occurs in a radian
value.
• A value (angle) input to (s) is the REAL type data value. Input a value in radians (angle×π/180).
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3402H A negative value is input.
ASIN(_E)
These functions output the arc sine value of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=ASIN(s);
[With EN/ENO]
s d EN ENO d:=ASIN_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ASIN(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the arc sine of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=SIN-1 A
• A value input to (s) is the REAL type data value and within the following range.
ASIN(_E): -1.0 to 1.0
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3402H A negative value is input.
3405H A value input by these functions is other than -1.0 to 1.0.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ACOS(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the arc cosine of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=COS-1 A
• A value input to (s) is the REAL type data value and within the following range.
ACOS(_E): -1.0 to 1.0
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3402H A negative value is input.
3405H A value input by these functions is other than -1.0 to 1.0.
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable REAL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ATAN(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions calculate the arc tangent value of the REAL type data input to (s), and output from (d).
• These functions are expressed as follows when the input value is "A" and the output operation result is "B".
B=TAN-1 A
• A value input to (s) is the REAL type data value and within the following range.
ATAN(_E): ±1.17549-38 to ±3.40282+38
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3402H -0 is input.
ADD(_E)
These functions output the sum of input values ((s1) + (s2) + ... + (s28)).
Ladder diagram, FBD/LD*1 Structured text*1
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=ADD(s1,s2);
[With EN/ENO] 20
s1 d EN ENO d:=ADD_E(EN,ENO,s1,s2);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) to s28(IN28) Input Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ADD(_E)) Output Output variable ANY_NUM
Processing details
■Operation processing
• These functions add the INT, DINT, or REAL type data ((s1) + (s2) + ... + (s28)) input to (s1) to (s28), and output from (d) in
the same data type as (s).
Ex.
Data type is the INT type
(s1) (s2) (d)
1234 5678 6912
• A value input to (s1) to (s28) is the INT, DINT, or REAL type data value.
• If an underflow and an overflow occur in the operation result, the result will be output as follows from (d).
Data type is INT Data type is DINT Data type is REAL
• Even if underflow or overflow occurs in the • Even if underflow or overflow occurs in the An operation error occurs and an undefined value
operation result, it is not regarded as an operation result, it is not regarded as an is output.
operation error. "ADD_E" outputs "TRUE" from operation error. "ADD_E" outputs "TRUE" from
ENO. ENO.
[Example 1] [Example 1]
32767+2=1 2147483647+2=1
(7FFFH)+(0002H)=0001H (7FFFFFFFH)+(0002H)=(00000001H)
The most significant bit becomes 0, and the carry The most significant bit becomes 1, and the carry
flags (SM716 and SM8022) turn on. flags (SM716 and SM8022) turn on.
[Example 2] [Example 2]
-32768+(-2)=-1 -2147483648+(-2)=-1
(8000H)+(FFFEH)=(FFFFH) (80000000H)+(FFFEH)=(7FFFFFFFH)
The most significant bit becomes 1, and the borrow The most significant bit becomes 1, and the borrow
flag (SM8021) turns on. flag (SM8021) turns on.
• When the operation result is 0, the zero flag (SM8020) turns on.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s1) to (s28) are REAL
Error code Description
(SD0/SD8067)
3402H The data specified by (s1) to (s28) is -0, denormalized number, NaN (not a number), or ±∞.
3403H (d) exceeds the following range. (An overflow has occurred.)
|(d)|<2128
MUL(_E)
These functions output the product input values ((s1)×(s2)× ... ×(s28)).
Ladder diagram, FBD/LD*1 Structured text*1
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=MUL(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=MUL_E(EN,ENO,s1,s2);
s2 s1 d
s2 20
*1 The input variable "s" can be changed in the range of 2 to 28.
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) to s28(IN28) Input Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(MUL(_E)) Output Output variable ANY_NUM
Processing details
■Operation processing
• These functions multiply the INT, DINT, or REAL type data input to (s1) to (s28) ((s1)×(s2)× ...×(s28)), and output the
operation result from (d) in the same data type as (s).
Ex.
Data type is INT
• When the operation result is 0, the zero flag (SM8020) turns on.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
When the operation result exceeds the data type range, convert the data type of an input value then perform
the operation.
Operation error
• (s1) to (s28) are REAL
Error code Description
(SD0/SD8067)
3402H The data specified by (s1) to (s28) is -0, denormalized number, NaN (not a number), or ±∞.
3403H (d) exceeds the following range. (An overflow has occurred.)
|(d)|<2128
SUB(_E)
These functions output the difference of input values ((s1) - (s2)).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=SUB(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=SUB_E(EN,ENO,s1,s2);
s2 s1 d
s2 20
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1), s2(IN2) Input Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SUB(_E)) Output Output variable ANY_NUM
Processing details
■Operation processing
• These functions subtract the INT, DINT, or REAL type data input to (s1) and (s2) ((s1)-(s2)), and output the operation result
from (d) in the same data type as (s).
Ex.
Data type is INT
(s1) (s2) (d)
12345 - 6789 5556
• When the operation result is 0, the zero flag (SM8020) turns on.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s1) and (s2) are REAL
Error code Description
(SD0/SD8067)
3402H The data specified by (s1) is -0, denormalized number, NaN (not a number), or ±∞.
The data specified by (s2) is -0, denormalized number, NaN (not a number), or ±∞.
3403H (d) exceeds the following range. (An overflow has occurred.)
|(d)|<2128
DIV(_E)
These functions output the quotient of input values ((s1) ÷ (s2)).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=DIV(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=DIV_E(EN,ENO,s1,s2);
s2 s1 d
s2 20
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) Dividend Input variable ANY_NUM
s2(IN2) Divisor Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DIV(_E)) Output Output variable ANY_NUM
Processing details
■Operation processing
• These functions divide the INT, DINT, or REAL type data input to (s1) and (s2) ((s1) ÷ (s2)), and output the operation result
from (d) in the same data type as (s).
Ex.
Data type is INT
(d)
(s1) (s2) (Quotient) (Remainder)
5 2 2 1
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s1) and (s2) are INT
Error code Description
(SD0/SD8067)
3400H The value (divisor) specified by (s2) is 0.
MOD(_E)
These functions output the remainder of input values ((s1) ÷ (s2)).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=MOD(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=MOD_E(EN,ENO,s1,s2);
s2 s1 d
s2 20
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) Dividend Input variable ANY_INT
s2(IN2) Divisor Input variable ANY_INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(MOD(_E)) Output Output variable ANY_INT
Processing details
■Operation processing
• These functions divide the INT or DINT type data input to (s1) and (s2) ((s1) ÷ (s2)), and output the remainder from (d) in
the same data type as (s).
Ex.
Data type is INT
(d)
(s1) (s2) (Quotient) (Remainder)
5 2 2 1
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
EXPT(_E)
These functions output the exponentiation of an input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=EXPT(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=EXPT_E(EN,ENO,s1,s2);
s2 s1 d
s2 20
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) Cardinal number Input variable REAL
s2(IN2) Exponent Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(EXPT(_E)) Output Output variable REAL
Processing details
■Operation processing
• These functions raise the REAL type data input to (s1) by INT, DINT, or REAL specified by (s2), and output the operation
result from (d).
(s2)
(s1) 2 (d)
4.0 16.0
INT
REAL REAL
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
MOVE(_E)
These functions output the assignment of input values.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=MOVE(s);
[With EN/ENO]
s d EN ENO d:=MOVE_E(EN,ENO,s);
s d
20
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(MOVE(_E)) Output Output variable ANY
Processing details
■Operation processing
• These functions assign the value of variable specified to (s) to the variable specified to (d).
• BOOL, INT, DINT, WORD, DWORD, REAL, STRING, TIME, structure, or array type can be specified for (s) and (d). Specify
the same data type for (s) and (d).
(s) (d)
12 12
INT INT
(s) (d)
2147483647 2147483647
DINT DINT
(s) (d)
65535 65535
WORD WORD
(s) (d)
4294967295 4294967295
DWORD DWORD
(s) (d)
3.402823+38 3.402823+38
REAL REAL
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "00H" does not exist.
3405H The character string specified by (s) has more than 16383 characters.
3406H The whole specified character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
SHL(_E)
These functions shift an input value leftward by (n) bits and output the result.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=SHL(s,n);
[With EN/ENO]
s d EN ENO d:=SHL_E(EN,ENO,s,n);
n s d
n 21
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY_BIT
n(N) Number of shift bits Input variable ANY_BIT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SHL(_E)) Output Output variable ANY_BIT
Processing details
■Operation processing
• These functions shift the WORD or DWORD type data input to (s) left by (n) bits and output the result in the same data type
as (s) from (d).
• The number input in (n) is used as the number of left-shift bits.
Ex.
When the data type of (s) is WORD and 8 is input in (n)
270FH F00H
IN (WORD) WORD
270FH 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
F00H 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
SHR(_E)
These functions shift an input value rightward by (n) bits and output the result.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=SHR(s,n);
[With EN/ENO]
s d EN ENO d:=SHR_E(EN,ENO,s,n);
n s d
Setting data
21
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY_BIT
n(N) Number of shift bits Input variable ANY_BIT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SHR(_E)) Output Output variable ANY_BIT
Processing details
■Operation processing
• These functions shift the WORD or DWORD type data input to (s) right by (n) bits and output the result in the same data
type as (s) from (d).
• The number input in (n) is used as the number of right-shift bits.
Ex.
When the data type of (s) is WORD and 8 is input in (n)
270FH 27H
IN (WORD) WORD
270FH 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
27H 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
ROL(_E)
These functions rotate an input value leftward by (n) bits and output the result.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=ROL(s,n);
[With EN/ENO]
s d EN ENO d:=ROL_E(EN,ENO,s,n);
n s d
Setting data
21
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY_BIT
n(N) Number of shift bits Input variable ANY_BIT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ROL(_E)) Output Output variable ANY_BIT
Processing details
■Operation processing
• These functions rotate the WORD or DWORD type data input to (s) left by (n) bits and output the result in the same data
type as (s) from (d).
• The number input in (n) is used as the number of left-rotation bits.
WORD, DWORD
n-bit rotation
Ex.
When the data type of (s) is WORD and 3 is input in (n) (The bits are rotated left by 3 bits.)
270FH 3879H
IN (WORD) WORD
1) 2)
270FH 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
3879H 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 1
Data of 2) Data of 1)
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
ROR(_E)
These functions rotate an input value rightward by (n) bits and output the result.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=ROR(s,n);
[With EN/ENO]
s d EN ENO d:=ROR_E(EN,ENO,s,n);
n s d
Setting data
21
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY_BIT
n(N) Number of shift bits Input variable ANY_BIT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ROR(_E)) Output Output variable ANY_BIT
Processing details
■Operation processing
• These functions rotate the WORD or DWORD type data input to (s) right by (n) bits and output the result in the same data
type as (s) from (d).
• The number input in (n) is used as the number of right-rotation bits.
WORD, DWORD
n-bit rotation
Ex.
When the data type of (s) is WORD and 3 is input in (n) (The bits are rotated right by 3 bits.)
270FH E4E1H
IN (WORD) WORD
2) 1)
270FH 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
E4E1H 1 1 1 0 0 1 0 0 1 1 1 0 0 0 0 1
Data of 1) Data of 2)
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) to s28(IN28) Input Input variable ANY_BIT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(AND(_E) / OR(_E) / XOR(_E)) Output Output variable ANY_BIT
Processing details
■Operation processing
1. AND(_E)
• These functions perform the logical AND on the BOOL, WORD, or DWORD type data input in (s1) to (s28) bit by bit, and
output the operation result from (d) in the same data type as (s).
Ex.
When the data type is WORD
(s1) 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
AND
(s2) 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
(d) 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0
Ex.
When the data type is WORD
(s1) 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1
OR
(s2) 0 0 0 0 0 0 1 0 0 0 1 1 0 1 0 0
Logical Word OR
(d) 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1
3. XOR(_E)
• These functions perform the exclusive logical OR on the BOOL, WORD, or DWORD type data input in (s1) to (s28) bit by
bit, and output the operation result from (d) in the same data type as (s).
Ex.
When the data type is WORD
(s1) 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
XOR
(s2) 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0
Logical Exclusive OR
(d) 1 0 1 1 0 0 0 1 0 1 0 1 1 0 1 0
• When three or more variables (s) exist, XOR is performed between (s1) and (s2) first, and XOR is successively performed
between the result and (s3). When the expression includes (s4), XOR is performed between the result of XOR with (s3) and
(s4). In this manner, XOR is repeated by the number of variables (s) in the order with (s5), (s6), and so on.
Ex.
When the data type is BOOL
(1) (2) (3)
(s1) FALSE TRUE FALSE TRUE
XOR XOR XOR XOR
(s2) TRUE (s3) TRUE (s4) TRUE (s5) TRUE (4)
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
NOT(_E)
These functions output the logical negation of input values.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=NOT(s);
[With EN/ENO]
s d EN ENO d:=NOT_E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable ANY_BIT 22
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(NOT(_E)) Output Output variable ANY_BIT
Processing details
■Operation processing
• These functions calculate the logical negation for each bit of the BOOL, WORD, or DWORD type data input in (s), and
output the operation result from (d) in the same data type as (s).
Ex.
When the data type is WORD
(s) 0 1 1 0 1 0 1 1 0 0 0 0 1 1 1 1
NOT
(d) 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0
• A value input to (s) is the BOOL, WORD, or DWORD type data value.
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
SEL(_E)
These functions output a selected input value.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=SEL(s1,s2,s3);
[With EN/ENO]
s1 d EN ENO d:=SEL_E(EN,ENO,s1,s2,s3);
s2 s1 d
s3 s2
s3
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(G) Output condition (TRUE: Output s3, FALSE: Output s2) Input variable BOOL
s2(IN0) Input Input variable ANY
s3(IN1)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SEL(_E)) Output Output variable ANY
Processing details
■Operation processing
• These functions output a value input to (s2) and (s3) according to a value input to (s1) in the same data type as (s2) and
(s3) from (d).
• When FALSE(=0) is input to (s1), these functions output an input value of (s2) from (d).
• When TRUE(=1) is input to (s1), these functions output an input value of (s3) from (d).
Ex.
The data type of (s2) and (s3) is the INT type ((s2) and (s3) of an argument correspond to the bit value of (s1) (0 or 1).)
23 SELECTION FUNCTIONS
996 23.1 Selection
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s2) and (s3) are the STRING type
Error code Description
(SD0/SD8067)
23
2820H "00H" is not set to a label specified by (s2) or devices from the device number to end device number of corresponding device.
"00H" is not set to a label specified by (s3) or devices from the device number to the end device number of corresponding device.
3406H The specified character string cannot be stored in a label specified by (d) or devices from the device number to the end device number of
corresponding device.
23 SELECTION FUNCTIONS
23.1 Selection 997
23.2 Selecting Maximum/Minimum Value
MAX(_E), MIN(_E)
• MAX(_E): These functions output the maximum value of an input value.
• MIN(_E): These functions output the minimum value of an input value.
Ladder diagram, FBD/LD*1 Structured text*1
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=MAX(s1,s2);
d:=MIN(s1,s2);
s1 d EN ENO [With EN/ENO]
d:=MAX_E(EN,ENO,s1,s2);
s2 s1 d
d:=MIN_E(EN,ENO,s1,s2);
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) to s28(IN28) Input Input variable ANY_SIMPLE
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(MAX(_E) / MIN(_E)) Output Output variable ANY_SIMPLE
Processing details
■Operation processing
• MAX(_E)
These functions output the maximum value of the BOOL, INT, DINT, WORD, DWORD, DWORD, REAL, STRING, or TIME type data input to (s1) to (s28) in
the same data type as (s) from (d).
Ex.
Data type is INT
(s1) to (s28)
1234 MAX (d)
INT _IN1 OUT 5678
5678 _IN2 INT
INT
• MIN(_E)
These functions output the minimum value of the BOOL, INT, DINT, WORD, DWORD, DWORD, REAL, STRING, or TIME type data input to (s1) to (s28) in
the same data type as (s) from (d).
Ex.
Data type is INT
(s1) to (s28)
1234 MIN (d)
INT _IN1 OUT 5678
5678 _IN2 INT
INT
• A data value of the BOOL, INT, DINT, WORD, DWORD, REAL, STRING, or TIME type can be input to (s1) to (s28).
• The number of pins for (s) can be changed in the range of 2 to 28.
23 SELECTION FUNCTIONS
998 23.2 Selecting Maximum/Minimum Value
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s1) to (s28) are STRING
Error code Description
(SD0/SD8067)
23
2820H In the corresponding device range of the device specified by (s1) to (s28) and later, "00H" does not exist.
3405H The character string specified by (s1) to (s28) has more than 16383 characters.
3406H The whole specified character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
23 SELECTION FUNCTIONS
23.2 Selecting Maximum/Minimum Value 999
23.3 Limit Control
LIMIT(_E)
These functions output an input value controlled with the upper and lower limits.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=LIMIT(s1,s2,s3);
[With EN/ENO]
s1 d EN ENO d:=LIMIT_E(EN,ENO,s1,s2,s3);
s2 s1 d
s3 s2
s3
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(MIN) Lower limit value (minimum output threshold value) Input variable ANY_SIMPLE
s2(IN) Input value to be controlled with the upper and lower limits Input variable ANY_SIMPLE
s3(MX) Upper limit value (maximum output threshold value) Input variable ANY_SIMPLE
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(LIMIT(_E)) Output Output variable ANY_SIMPLE
Processing details
■Operation processing
• These functions output an input value according to the BOOL, INT, DINT, WORD, DWORD, REAL, STRING, or TIME type
data input to (s1), (s2), and (s3) in the same data type as (s1), (s2), and (s3) from (d).
• When the input value of (s2) is larger than the one of (s3), these functions output the input value of (s3) from (d).
• When the input value of (s2) is smaller than the one of (s1), these functions output the input value of (s1) from (d).
• When the input value of (s1) ≤ the input value of (s2) ≤ the input value of (s3), these functions output the input value of (s2) from (d).
Ex.
Data type is INT
(d)
• A data value of the BOOL, INT, DINT, WORD, DWORD, REAL, STRING, or TIME type can be input to (s1), (s2), and (s3).
(The input value of (s1) must be smaller than the one of (s3).)
23 SELECTION FUNCTIONS
1000 23.3 Limit Control
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s1), (s2), and (s3) are INT or WORD
Error code Description
(SD0/SD8067)
23
3405H The lower limit value specified by (s1) is greater than the upper limit value specified by (s2).
23 SELECTION FUNCTIONS
23.3 Limit Control 1001
23.4 Multiplexer
MUX(_E)
These functions output one of multiple input values.
Ladder diagram, FBD/LD*1 Structured text*1
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=MUX(n,s1,s2);
[With EN/ENO]
n d EN ENO d:=MUX_E(EN,ENO,n,s1,s2);
s1 n d
s2 s1
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
n(K) Output value selection Input variable INT
s1(IN0) to s28(IN27) Input Input variable ANY
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(MUX(_E)) Output Output variable ANY
Processing details
■Operation processing
• These functions output one of values input to (s1) to (s28) according to the input value of (n) in the same data type as (s)
from (d).
• When 0 is input to (n), these functions output a value input to (s1) from (d).
• When (n)-1 is input to (n), these functions output a value input to (sn) from (d).
Ex.
Data type is INT
n 0 (d)
MUX
INT _K OUT 1234
1234 _IN0 INT
(s1) to (s28) _IN1
INT
5678
INT
• When a value input to (n) is outside the pin number range for (s), these functions output an indefinite value from (d). (An
operation error does not occur. "MUX_E" outputs "FALSE" from ENO).
• A value input to (n) is the INT type data value and within the range from 0 to 27. (The value must be in the pin number
range for (s).)
• A data value of the BOOL, INT, DINT, WORD, DWORD, REAL, STRING, TIME, structure, or array type can be input to (s).
23 SELECTION FUNCTIONS
1002 23.4 Multiplexer
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s1) to (s28) are STRING
Error code Description
(SD0/SD8067)
23
2820H In the corresponding device range of the device specified by (s1) to (s28) and later, "00H" does not exist.
3405H The character string specified by (s1) to (s28) has more than 16383 characters.
3406H The whole specified character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
23 SELECTION FUNCTIONS
23.4 Multiplexer 1003
24 COMPARISON FUNCTIONS
24.1 Compare
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) to s28(IN28) Input Input variable ANY_SIMPLE
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(GT(_E) / GE(_E) / EQ(_E) / LE(_E) / LT(_E)) Output (TRUE: True value, FALSE: False value) Output variable BOOL
Processing details
■Operation processing
• These functions perform a comparison operation of input values of (s) and output operation results from (d) in the BOOL
type.
• GT(_E): These functions compare [(s1)>(s2)]&[(s2)>(s3)]&⋅⋅⋅&[(s)(n-1)>(s)(n)].
• When all the operation results are (s)(n-1)>(s)(n), these functions output TRUE.
• When any of the operation results is (s)(n-1)≤(s)(n), these functions output FALSE.
• GE(_E): These functions compare [(s1)≥(s2)]&[(s2)≥(s3)]&⋅⋅⋅&[(s)(n-1)≥(s)(n)].
• When all the operation results are (s)(n-1)≥(s)(n), these functions output TRUE.
• When any of the operation result is (s)(n-1)<(s)(n), these functions output FALSE.
• EQ(_E): These functions compare [(s1)=(s2)]&[(s2)=(s3)]&⋅⋅⋅&[(s)(n-1)=(s)(n)].
• When all the operation results are (s)(n-1)=(s)(n), these functions output TRUE.
• When any of the operation results is (s)(n-1)(s)(n), these functions output FALSE.
• LE(_E): These functions compare [(s1)≤(s2)]&[(s2)≤(s3)]&⋅⋅⋅&[(s)(n-1)≤(s)(n)].
• When all the operation results are (s)(n-1)≤(s)(n), these functions output TRUE.
• When any of the operation result is (s)(n-1)>(s)(n), these functions output FALSE.
• LT(_E): These functions compare [(s1)<(s2)]&[(s2)<(s3)]&⋅⋅⋅&[(s)(n-1)<(s)(n)].
• When all the operation results are (s)(n-1)<(s)(n), these functions output TRUE.
• When any of the operation results is (s)(n-1)≥(s)(n), these functions output FALSE.
• A data value of the INT, DINT, REAL, BOOL, WORD, DWORD, TIME, or STRING type can be input to (s).
24 COMPARISON FUNCTIONS
1004 24.1 Compare
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
• (s1) to (s28) are the STRING type
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s1) to (s28) and later, "00H" does not exist.
3405H The character string specified by (s1) to (s28) has more than 16383 characters.
3406H The whole specified character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range. 24
24 COMPARISON FUNCTIONS
24.1 Compare 1005
24.2 Compare
NE(_E)
These functions output the data comparison result of input values.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]*1
d:=NE(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=NE_E(EN,ENO,s1,s2);
s2 s1 d
s2
*1 Supported by engineering tool version "1.035M" and later. In earlier versions, write in operator form. (MELSEC iQ-F FX5
Programming Manual (Program Design))
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1), s2(IN2) Input Input variable ANY_SIMPLE
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(NE(_E)) Output (TRUE: True value, FALSE: False value) Output variable BOOL
Processing details
■Operation processing
• These functions perform a comparison operation of input values of (s) and output operation results from (d) in the BOOL
type.
• NE(_E): These functions compare [(s1)(s2)].
• When (s1)(s2), these functions output TRUE.
• These functions output FALSE when (s1)=(s2).
• A data value of the INT, DINT, REAL, BOOL, WORD, DWORD, TIME, or STRING type can be input to (s).
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
24 COMPARISON FUNCTIONS
1006 24.2 Compare
Operation error
• (s1) and (s2) are the STRING type
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "00H" does not exist.
3405H The character string specified by (s) has more than 16383 characters.
3406H The whole specified character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
24
24 COMPARISON FUNCTIONS
24.2 Compare 1007
25 CHARACTER STRING FUNCTIONS
25.1 Character String Length Detection
LEN(_E)
These functions detect the length of an input character string and output the result.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=LEN(s);
[With EN/ENO]
s d EN ENO d:=LEN _E(EN,ENO,s);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(255)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(LEN(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions detect the length of a character string input to (s) and output the result from (d).
High-order byte Low-order byte
+0 ASCII code for 2nd character ASCII code for 1st character
+1 ASCII code for 4th character ASCII code for 3rd character
+2 ASCII code for 6th character ASCII code for 5th character Character string length
INT
+n 00H (Indicates the end of the character string.) ASCII code for (n)th character
• A value input to (s) is the STRING type data value and within the range from 0 to 255 byte(s).
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
LEFT(_E), RIGHT(_E)
• LEFT(_E): These functions output specified number of characters from the left of input character string data.
• RIGHT(_E): These functions output specified number of characters from the right of input character string data.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=LEFT(s,n);
d:=RIGHT(s,n);
s d EN ENO [With EN/ENO]
d:=LEFT_E(EN,ENO,s,n);
n s d
d:=RIGHT_E(EN,ENO,s,n);
n
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(255)
n(L) Specification of number of characters to be extracted Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(LEFT(_E) / RIGHT(_E)) Output Output variable STRING(255)
Processing details
■Operation processing
• LEFT(_E)
These functions output the data for the specified number of characters from the left of a character string input to (s) from (d).
The value input to (n) specifies the number of characters to be extracted.
Ex.
When the value input to (n) is 7
"ABCDEF12345" "ABCDEF1"
Ex.
When the value input to (n) is 5
"ABCDEF12345" "12345"
• A value input to (s) is the STRING type data value and within the range from 0 to 255 byte(s).
• A value input to (n) is the INT type data value and within the range from 0 to 255. (However, the value must be within the
number of characters of the character string to be input to (s).)
■Operation result
1. Function without EN/ENO
The operation processing is executed. The operation output value is output from (d).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
n1 s d
n2 n1
n2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(255)
n1(L) Specification of number of characters to be extracted Input variable INT
n2(P) Specification of head character position of a character string to be Input variable INT
extracted
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(MID(_E)) Output Output variable STRING(255)
Processing details
■Operation processing
• These functions output the data for the specified number of characters from an arbitrary position of a character string input
to (s).
• The value input to (n1) specifies the number of characters to be extracted.
• The value input to (n2) specifies the number of the head character position of a character string to be extracted.
Ex.
When the value input to (n1) and (n2) is 5
(s) (d)
"ABCDEF12345" "EF123"
(1): Head character position of a character string to be extracted n2: 5th character
(2): Number of characters to be extracted n1: 5
• A value input to (s) is the STRING type data value and within the range from 0 to 255 byte(s).
• A value input to (n1) is the INT type data value and within the range from 0 to 255. (However, the value must be within the
number of characters of the character string to be input to (s).)
• A value input to (n2) is the INT type data value and within the range from 1 to 255. (However, the value must be within the
number of characters of the character string to be input to (s).)
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s) and later, "00H" does not exist.
3405H The character string specified by (s) has more than 16383 characters.
Data outside the allowable range was set to (n1) and (n2).
• The value stored in a device specified in (n1) and (n2) is 0 or less.
• The value stored in a device specified in (n2) is any value other than an effective value (-1, 0, 1, or more).
• The value stored in a device specified in (n1) exceeds the number of characters of (s).
• The total of the values stored in devices specified in (n1) and (n2) exceeds the number of characters of (s).
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) to s28(IN28) Input Input variable STRING(255)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(CONCAT(_E)) Output Output variable STRING(255)
Processing details
■Operation processing
• These functions concatenate the character string input to the input variables (s2) to (s28) after the one input to (s1) and
output the result from (d).
• When character strings are concatenated, 00H indicating an end of the character string specified by (s1) is ignored and the
character string specified by (s2) to (s28) is concatenated.
• When the concatenated character string exceeds 255 bytes, these functions output a character string within 255 bytes.
High-order byte Low-order byte High-order byte Low-order byte High-order byte Low-order byte
byte
+0 42H (B) 41H (A) +0 32H (2) 31H (1) +0 42H (B) 41H (A)
+1 44H (D) 43H (C) +1 34H (4) 33H (3) +1 44H (D) 43H (C)
+2 00H 45H (E) +2 36H (6) 35H (5) +2 31H (1) 45H (E)
+3 00H +3 33H (3) 32H (2)
+4 35H (5) 34H (4)
+5 00H 36H (6)
• A value input to the input variables (s1) and (s2) to (s28) is the STRING type data value and within the range from 0 to 255
byte(s).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s1) to (s28) and later, "00H" does not exist.
3406H The whole concatenated character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
s2 s1 d
n s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1), s2(IN2) Input Input variable STRING(255)
n(P) Specification of head character position of a character string to be Input variable INT
inserted
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(INSERT(_E)) Output Output variable STRING(255)
Processing details
■Operation processing
• These functions insert the character string input to (s2) at the (n)th character from the start of the character string input to
(s1) (head position of the insertion) and output from (d).
• After the character string specified by (s2) is inserted to the one specified by (s1), 00H indicating an end of the character
string specified by (s2) is ignored.
• When the inserted character string exceeds 255 bytes, these functions output a character string within 255 bytes.
Ex.
When the value input to (n) is 4
(s1) (d)
"ABCDE" "ABC123456DE"
• A value input to (s1) and (s2) is the STRING type data value and within the range from 0 to 255 byte(s).
• A value input to (n) is the INT type data value and within the range from 1 to 255. (However, the value must be within the
number of characters of the character string to be input to (s1).)
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
2820H In the corresponding device range of the device specified by (s1) to (s28) and later, "00H" does not exist.
3406H The whole concatenated character string cannot be stored in the devices from the device specified by (d) to the last device in the
corresponding device range.
n1 s d
n2 n1
n2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Input Input variable STRING(255)
n1(L) Specification of number of characters to be deleted Input variable INT
n2(P) Specification of head character position of a character string to be Input variable INT
deleted
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DELETE(_E)) Output Output variable STRING(255)
Processing details
■Operation processing
• These functions delete the data for the specified number of characters from an arbitrary position of a character string input
to (s) and output the remaining character strings from (d).
• The value input to (n1) specifies the number of characters to be deleted.
• The value input to (n2) specifies the number of the head character position of a character string to be deleted.
Ex.
When the value input to (n1) and (n2) is 5
(s) (d)
"ABCDEF12345" "ABCD45"
• A value input to (s) is the STRING type data value and within the range from 0 to 255 byte(s).
• A value input to (n1) is the INT type data value and within the range from 0 to 255. (However, the value must be within the
number of characters of the character string to be input to (s).)
• A value input to (n2) is the INT type data value and within the range from 1 to 255. (However, the value must be within the
number of characters of the character string to be input to (s).)
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
2820H "00H" is not set to devices from the device number specified by (s) to the end device number of corresponding device.
3405H The character strings specified by (s) have more than 255 characters.
The device value specified by (n1) is out of the valid range (0 to 255).
The device value specified by (n2) is out of the valid range (1 to 255).
(n1) exceeds the number of characters of a character string specified by (s).
(n2) exceeds the number of characters of a character string specified by (s).
3406H The whole deleted character string cannot be stored in the devices from the device specified by (d) to the last device of the target device.
s2 s1 d
n1 s2
n2 n1
n2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1), s2(IN2) Input Input variable STRING(255)
n1(L) Specification of number of characters to be replaced Input variable INT
n2(P) Specification of head character position of a character string to be Input variable INT
replaced
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(REPLACE(_E)) Output Output variable STRING(255)
Processing details
■Operation processing
• These functions replace the data for the specified number of characters from an arbitrary position of a character string input
to (s1) with a character string input to (s2) and output from (d).
• The value input to (n1) specifies the number of characters to be replaced.
Ex.
When the value input to (n1) and (n2) is 5
(s1) (d)
"ABCDEFGH123" "ABCD1234523"
(s2)
"123456" (2)
• A value input to (s1) and (s2) is the STRING type data value and within the range from 0 to 255 byte(s).
• A value input to (n1) is the INT type data value and within the range from 0 to 255. (However, the value must be within the
number of characters of the character string to be input to (s1).)
• A value input to (n2) is the INT type data value and within the range from 1 to 255. (However, the value must be within the
number of characters of the character string to be input to (s1).)
■Operation result
1. Function without EN/ENO
The following table lists the operation results.
Operation result (d)
No operation error occurred Operation output value
An operation error occurred Indefinite value
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
FIND(_E)
These functions search for a character string and output the result.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=FIND(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=FIND_E(EN,ENO,s1,s2);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1), s2(IN2) Input Input variable STRING(255)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(FIND(_E)) Output Output variable INT
Processing details
■Operation processing
• These functions search for a character string input to (s2) from the start of the character string input to (s1) and output the
result from (d).
• This function outputs the head character position of the searched character string detected first as the search result.
• If a character string specified by (s2) cannot be searched from the one specified by (s1), these functions output "0".
IN1 (d)
"ABCD1234567" 5
Search of
IN2 character string
"1234"
• A value input to (s1) and (s2) is the STRING type data value and within the range from 0 to 255 byte(s).
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
ADD_TIME(_E)
These functions output the sum of input values (TIME data) ((s1) + (s2)).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=ADD_TIME(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=ADD_TIME_E(EN,ENO,s1,s2);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1), s2(IN2) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(ADD_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions add the TIME type data input to (s1) and (s2) ((s1) + (s2)), and output the operation result from (d) as TIME
type data.
Ex.
When a value input to (s1) and (s2) is T#1d2h33m44s55ms (1 day 2 hours 33 minutes 44 seconds 55 milliseconds) and
T#2ms (2 milliseconds)
(s1) (s2) (d)
T#1d2h33m44s55ms T#2ms T#1d2h33m44s57ms
Ex.
Overflow
Ex.
Underflow
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
SUB_TIME(_E)
These functions output the difference of input values (TIME data) ((s1) - (s2)).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=SUB_TIME(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=SUB_TIME_E(EN,ENO,s1,s2);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1), s2(IN2) Input Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(SUB_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions subtract the TIME type data input to (s1) and (s2) ((s1) - (s2)), and output the operation result from (d) as
TIME type data.
Ex.
When a value input to (s1) and (s2) is T#1d2h33m44s55ms (1 day 2 hours 33 minutes 44 seconds 55 milliseconds) and
T#2ms (2 milliseconds)
• A value input to (s1) and (s2) is the TIME type data value.
• Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error. The data is output from
(d) as follows: "SUB_TIME_E" outputs "TRUE" from the output variable ENO.
Ex.
Overflow
Ex.
Underflow
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
MUL_TIME(_E)
These functions output the multiplication of input values (TIME) ((s1) × (s2)).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=MUL_TIME(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=MUL_TIME_E(EN,ENO,s1,s2);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) Input Input variable TIME
s2(IN2) Input Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(MUL_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions multiply the TIME type data input to (s1) and (s2) ((s1) × (s2)), and output the operation result from (d) as
TIME type data.
Ex.
When a value input to (s1) and (s2) is T#1d2h33m44s55ms (1 day 2 hours 33 minutes 44 seconds 55 milliseconds) and 2
(s1) (s2) (d)
T#1d2h33m44s55ms 2 T#2d5h7m28s110ms
Ex.
Overflow
T#24d20h31m23s647ms 2 T#-2ms
(7FFFFFFFH) (00000002H) (FFFFFFFEH)
The most significant bit becomes 1, and a negative time is output.
Ex.
Underflow
T#-24d20h31m23s648ms 2 T#0ms
(80000000H) (00000002H) (00000000H)
The most significant bit becomes 0, and a positive time is output.
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
There is no operation error.
DIV_TIME(_E)
These functions output the quotient of input values (TIME data) ((s1) ÷ (s2)).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=DIV_TIME(s1,s2);
[With EN/ENO]
s1 d EN ENO d:=DIV_TIME_E(EN,ENO,s1,s2);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(IN1) Input Input variable TIME
s2(IN2) Input Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(DIV_TIME(_E)) Output Output variable TIME
Processing details
■Operation processing
• These functions divide the TIME type data input to (s1) and (s2) ((s1) ÷ (s2)), and output the operation result from (d) as
TIME type data. The remainder is ignored.
Ex.
When a value input to (s1) and (s2) is T#1d2h33m44s55ms (1 day 2 hours 33 minutes 44 seconds 55 milliseconds) and 2
*1 When FALSE is output from ENO, data output from (d) is undefined. In that case, modify a program so that the data output from (d) is
not used.
Operation error
Error code Description
(SD0/SD8067)
3400H A value input to (s2) is 0. (Zero division)
1033
27 BISTABLE FUNCTION BLOCKS
27.1 Bistable Function Blocks (Set Priority)
SR(_E)
These function blocks judge two input values and output 1 (TRUE) or 0 (FALSE).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
SR_1(S1:=s1,R:=s2,Q1:=d);
[With EN/ENO]
s1 d EN ENO SR_E_1(EN:=EN,ENO:=ENO S1:=s1,R:=s2,Q1:=d);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(S1) Set instruction Input variable BOOL
s2(R) Reset instruction Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(Q1) Output Output variable BOOL
Processing details
■Operation processing
• When (s1) turns ON, (d) is set. If (s2) is turned ON when (s1) is OFF, (d) is reset.
• If (s2) is turned ON when (s1) is ON, (d) is not reset.
■Operation result
1. Function block without EN/ENO
The operation processing is executed. The operation output value is output from (d).
• Timing chart
ON ON ON ON ON ON
ON ON ON ON ON
(s2) OFF
ON ON ON ON ON ON
(1) (2)
(1): When (s1) is on, (d) is on.
(2): When (s1) is off and (s2) is on, (d) is off.
• Timing chart
ON ON ON ON ON 27
EN
ON ON ON ON ON ON
ON ON
(s2) OFF
ENO
ON ON ON
(1) (2)
(1): When EN and (s1) are on, (d) is on.
(2): When EN, (s1), and (s2) are on, (d) is off.
Operation error
There is no operation error.
RS(_E)
These function blocks judge two input values and output 1 (TRUE) or 0 (FALSE).
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
RS_1(S:=s1,R1:=s2,Q1:=d);
[With EN/ENO]
s1 d EN ENO RS_E_1(EN:=EN, ENO:=ENO, S:=s1,R1:=s2,Q1:=d);
s2 s1 d
s2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(S) Set instruction Input variable BOOL
s2(R1) Reset instruction Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(Q1) Output Output variable BOOL
Processing details
■Operation processing
• When (s1) turns ON, (d) is set. When (s2) is turned ON, (d) is reset.
• If (s1) is turned ON when (s2) is ON, (d) is not set.
■Operation result
1. Function block without EN/ENO
The operation processing is executed. The operation output value is output from (d).
• Timing chart
ON ON ON ON ON ON
(s1) OFF
ON ON ON ON ON ON ON
ON ON ON ON ON ON
(1) (2)
(1): When (s1) is on and (s2) is off, (d) turns on.
(2): When (s2) is on, (d) turns off.
• Timing chart
EN
ON ON ON ON ON
27
ON ON
(s1) OFF
ON ON
ENO
ON ON
(1) (2)
(1): When EN and (s1) are on and (s2) is off, (d) turns on.
(2): When EN and (s2) are on, (d) turns off.
Operation error
There is no operation error.
R_TRIG(_E)
These functions detect the rising edge of a signal, and output a pulse signal.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
R_TRIG_1(CLK:=s,Q:=d);
[With EN/ENO]
s d EN ENO R_TRIG_E_1(EN:=EN, ENO:=ENO CLK:=s,Q:=d);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(CLK) Rising edge detector input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(Q) Output Output variable BOOL
Processing details
■Operation processing
When (s) turns ON, (d) is turned ON only for one scan.
■Operation result
1. Function block without EN/ENO
The operation processing is executed. The operation output value is output from (d).
• Timing chart
ON ON ON ON ON ON
(s) OFF
ON ON ON ON ON ON
(1) (2)
(1): On the rising edge of (s), (d) turns on.
(2): At the next scan, (d) turns off.
• Timing chart
ON ON ON ON
EN
ON ON ON ON
(s) OFF 28
ENO OFF
ON ON ON ON
Operation error
There is no operation error.
F_TRIG(_E)
These function blocks detect the falling edge of a signal, and output a pulse signal.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
F_TRIG_1(CLK:=s,Q:=d);
[With EN/ENO]
s d EN ENO F_TRIG_E_1(EN:=EN, ENO:=ENO CLK:=s,Q:=d);
s d
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(CLK) Falling edge detector input Input variable BOOL
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d(Q) Output Output variable BOOL
Processing details
■Operation processing
When (s) turns OFF, (d) is turned ON only for one scan.
■Operation result
1. Function block without EN/ENO
The operation processing is executed. The operation output value is output from (d).
• Timing chart
ON ON ON ON ON ON
ON ON ON ON ON ON
(1) (2)
(1): On the falling edge of (s), (d) turns on.
(2): At the next scan, (d) turns off.
• Timing chart
ON ON ON ON ON
EN OFF
ON ON ON ON ON ON
ENO OFF
ON ON ON
Operation error
There is no operation error.
CTU(_E)
These function blocks count up the number of times of rising of a signal.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
CTU_1(CU:=s1,R:=s2,PV:=n,Q:=d1,CV:=d2);
[With EN/ENO]
s1 d1 EN ENO CTU_E_1(EN:=EN, ENO:=ENO CU:=s1,R:=s2,PV:=n,Q:=d1,CV:=d2);
s2 d2 s1 d1
n s2 d2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(CU) Count signal input Input variable BOOL
s2(R) Count value reset Input variable BOOL
n(PV) Count maximum value Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d1(Q) Count end Output variable BOOL
d2(CV) Count value Output variable INT
Processing details
■Operation processing
1. Count up
• These function blocks count up (add "1" to) the value of (d2) when (s1) turns ON from OFF.
• When the value of (d2) reaches the value of (n) of the counter, (d1) turns ON and the function blocks stop counting up.
• Set the maximum value of the counter for (n). When (s2) is turned ON, (d1) turns OFF and (d2) is set to 0.
ON ON ON ON ON ON ON ON
ON
ON
(d2) 0 1 2 3 0 1 2
29
(1) (2)
(1): When (s1) is on, (d2) counts up.
(2): When (s2) is on, (d2) is cleared to 0.
• Timing chart
When 3 is specified in n
ON ON ON ON ON ON ON ON
ON
ON ON ON ON ON
ENO OFF
ON
(d2) 0 1 2 3 0 1
(1) (2)
(1): When EN and (s1) are on, (d2) turns on.
(2): When (s2) is on, (d2) is cleared to 0.
Operation error
There is no operation error.
CTD(_E)
These function blocks count down the number of times of rising of a signal.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
CTD_1(CD:=s1,LD:=s2,PV:=n,Q:=d1,CV:=d2);
[With EN/ENO]
s1 d1 EN ENO CTD_E_1(EN:=EN, ENO:=ENO CD:=s1,LD:=s2,PV:=n,Q:=d1,CV:=d2);
s2 d2 s1 d1
n s2 d2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(CD) Count signal input Input variable BOOL
s2(LD) Count value set Input variable BOOL
n(PV) Count start value Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d1(Q) Count end Output variable BOOL
d2(CV) Count value Output variable INT
Processing details
■Operation processing
1. Count down
• These function blocks count down (subtract "-1" from) the value of (d2) when (s1) turns ON from OFF.
• When the value of (d2) is 0, (d1) turns ON and the function blocks stop counting down.
• Set the count start value for (n). When (s2) is turned ON, (d1) turns OFF and (n) is set for (d2).
ON ON ON ON ON ON ON ON
(s1) OFF OFF OFF OFF OFF OFF OFF OFF OFF
ON ON
ON ON
(d2) 0 3 2 1 0 3 2 1
29
(1) (2)
(1): When (s2) is on, (d2) is initialized.
(2): On the rising edge of (s1), (d2) counts down.
• Timing chart
When 3 is specified in n
ON ON ON ON ON ON ON ON
EN OFF
ON ON ON ON ON ON ON ON
(s1) OFF OFF OFF OFF OFF OFF OFF OFF OFF
ON ON
ENO OFF
ON ON
(d2) 0 3 2 1 0 -1 -2 -3
(1) (2)
(1): When EN and (s2) are on, (d2) is initialized.
(2): When EN is on at the rising edge of (s1), (d2) counts down.
Operation error
There is no operation error.
CTUD(_E)
These functions count up/down the number of times of rising of a signal.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
CTUD_1(CU:=s1,CD:=s2,R:=s3,LD:=s4,PV:=n,QU:=d1,QD:=d2,CV:=d3);
[With EN/ENO]
s1 d1 EN ENO CTUD_E_1(EN:=EN,ENO:=ENO,CU:=s1,CD:=s2,R:=s3,LD:=s4,PV:=n,QU:=
d1,QD:=d2,CV:=d3);
s2 d2 s1 d1
s3 d3 s2 d2
s4 s3 d3
n s4
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s1(CU) Count up signal input Input variable BOOL
s2(CD) Count down signal input Input variable BOOL
s3(R) Count value reset Input variable BOOL
s4(LD) Count value set Input variable BOOL
n(PV) Count maximum value/start value Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d1(QU) Count up end Output variable BOOL
d2(QD) Count down end Output variable BOOL
d3(CV) Current count value Output variable INT
Processing details
■Operation processing
1. Count up
• These function blocks count up (add "1" to) the value of (d3) when (s1) turns ON from OFF.
• When the value of (d3) reaches the value of (n), (d1) turns ON and the function blocks stop counting up.
• Set the maximum value of the counter for (n). When (s3) is turned ON, (d1) turns OFF and (d3) is set to 0.
2. Count down
• These function blocks count down (subtract "-1" from) the value of (d3) when (s2) turns ON from OFF.
• When the value of (d3) is 0, (d2) turns ON and the function blocks stop counting down.
• Set the counter start value for (n). When (s4) is turned ON, (d2) turns OFF and (n) is set for (d3).
4. Others
• When (s1) and (s2) are simultaneously turned ON from OFF, (s1) is prioritized and the function blocks count up (add "1" to)
the value of (d3).
• When (s3) and (s4) are simultaneously turned ON, (s3) is prioritized and the value of (d3) is set to 0.
ON ON ON ON ON ON
ON ON ON ON ON ON
ON
ON
29
(d1) OFF
OFF
(d2)
(d3) 0 1 2 0 1 2 3 2 3 2 1 0
• Timing chart
When 3 is specified in n
ON ON ON ON ON
EN OFF
ON ON ON ON ON ON
ON ON ON ON ON ON
ON ON
ON ON
ON ON ON ON ON
ENO OFF
ON
(d1) OFF
OFF
(d2)
(d3) 0 1 2 0 1 0 3 2 1
Operation error
There is no operation error.
COUNTER_FB_M
When the execution condition is established, this function block starts counting up.
Ladder diagram, FBD/LD Structured text
COUNTER_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2);
s1 d1
s2 d2
s3
Setting data
■Descriptions, types, and data types 29
Argument Description Type Data type
s1(Coil) Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s2(Preset) Counter set value Input variable INT
s3(ValueIn) Counter initial value Input variable INT
d1(ValueOut) Counter current value Output variable ANY16
d2(Status) Output Output variable BOOL
Processing details
■Operation processing
• The counter starts counting when detecting the rising edge (from OFF to ON) of (s1). It does not start counting if (s1)
remains ON. The counting is started from the value of (s3). When the count value reaches the value of (s2), (d2) turns ON.
The current count value is stored in (d1).
• A value in the range of 0 to 32767 can be specified for (s2).
• A value in the range of -32768 to 32767 can be specified for (s3). However, when a negative value is specified, the initial
value is set to 0.
• To reset the current value of the counter (d1), reset (s1) of FB directly.
Ex.
When the label name is TIMER_CONT_FB_M_1
[Ladder]
RST
M0 EN ENO
d TIMER_CONT_FB_M_1.Coll
[ST]
RST(M0,TIMER_CONT_FB_M_1.Coil)
[Ladder example]
COUNTER_FB_M
M0 Coll
10 Preset ValueOut D10
1 ValueIn Status M10
[Timing chart]
ON
M0 OFF
D10 1 2 3 10
ON
M10 OFF
TP(_E), TP_10(_E)
These function blocks keep on a signal for specified duration.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
TP_1(IN:=s,PT:=n,Q:=d1,ET:=d2);
TP_10_1(IN:=s,PT:=n,Q:=d1,ET:=d2);
s d1 EN ENO [With EN/ENO]
TP_E_1(EN:=EN,ENO:=ENO,IN:=s,PT:=n,Q:=d1,ET:=d2);
n d2 s d1
TP_10_E_1(EN:=EN,ENO:=ENO,IN:=s,PT:=n,Q:=d1,ET:=d2);
n d2
Setting data
30
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s(IN) Output start Input variable BOOL
n(PT) Output time setting value Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d1(Q) Output Output variable BOOL
d2(ET) Elapsed time Output variable TIME
Processing details
■Operation processing
1. Output
• When (s) turns on, (d1) turns on for the time specified by (n). The elapsed time from when (d1) is turned on is set for (d2).
• The timer device is used for counting the elapsed time.
2. End of output
• (d1) turns off when the elapsed time reaches the set value.
• If (s) is off after (d1) is turned off, the elapsed time is reset.
• Even if (s) is turned off when (d1) is on, (d1) is not turned off.
• Timing chart
When T#5s (5 seconds) is specified in n
ON ON ON
(s) OFF OFF
ON ON
(d2) 0 0 1 2 3 4 5 0 0 1 2 3 4
• Timing chart
When T#5s (5 seconds) is specified in n
ON ON ON ON ON
EN OFF
ON
ENO OFF
ON ON
(d2) 0 0 1 2 3 4 5 0 1 2 3
Operation error
Error code Description
(SD0/SD8067)
3401H The set value of the output time exceeds the effective range.
TON(_E), TON_10(_E)
These function blocks turn on a signal after a specified time.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
TON_1(IN:=s,PT:=n,Q:=d1,ET:=d2);
TON_10_1(IN:=s,PT:=n,Q:=d1,ET:=d2);
s d1 EN ENO [With EN/ENO]
TON_E_1(EN:=EN,ENO:=ENO,IN:=s,PT:=n,Q:=d1,ET:=d2);
n d2 s d1
TON_10_E_1(EN:=EN,ENO:=ENO,IN:=s,PT:=n,Q:=d1,ET:=d2);
n d2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL 30
s(IN) Time measurement Input variable BOOL
n(PT) Delay time setting value Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d1(Q) Output Output variable BOOL
d2(ET) Elapsed time Output variable TIME
Processing details
■Operation processing
1. Output
• When (s) turns on, (d1) is turned on after the time specified by (n). The delay elapsed time from when (d1) is turned on is
set for (d2).
• When (s) is turned off, (d1) is turned off and the delay elapsed time is reset.
• The timer device is used for counting the elapsed time.
• Timing chart
When T#5s (5 seconds) is specified in n
ON ON
ON
(d2) 0 0 1 2 3 4 5 0 0 1 2 3 0
• Timing chart
When T#5s (5 seconds) is specified in n
ON ON ON ON ON
EN OFF
ON ON
ENO
ON
(d2) 0 0 1 2 3 4 5 0
Operation error
Error code Description
(SD0/SD8067)
3401H The set value of the output time exceeds the effective range.
TOF(_E), TOF_10(_E)
These function blocks turn off a signal after a specified time.
Ladder diagram, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
TOF_1(IN:=s,PT:=n,Q:=d1,ET:=d2);
TOF_10_1(IN:=s,PT:=n,Q:=d1,ET:=d2);
s d1 EN ENO [With EN/ENO]
TOF_E_1(EN:=EN,ENO:=ENO,IN:=s,PT:=n,Q:=d1,ET:=d2);
n d2 s d1
TOF_10_E_1(EN:=EN,ENO:=ENO,IN:=s,PT:=n,Q:=d1,ET:=d2);
n d2
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL 30
s(IN) Time measurement Input variable BOOL
n(PT) Delay time setting value Input variable TIME
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d1(Q) Output Output variable BOOL
d2(ET) Elapsed time Output variable TIME
Processing details
■Operation processing
1. Output
• When (s) turns on, (d1) is turned on.
• When (s) turns off from on, (d1) is turned off after the time specified by (n). The elapsed time until (d1) is turned off is set for
(d2).
• The timer device is used for counting the elapsed time.
• Timing chart
When T#5s (5 seconds) is specified in n
ON ON ON
ON ON
(d2) 0 0 1 2 3 4 5 0 0 1 2 3 4 0 0 1
• Timing chart
When T#5s (5 seconds) is specified in n
ON ON ON ON ON
ON ON ON
ON ON ON ON ON
ON
(d1) OFF
(d2) 0 0 1 2 3 4 0 0 1 0
(1) (2)
(1): When EN is on and (s) is off, the time measurement of (d2) starts.
(2): When EN and (s) are on, (d2) is reset.
Operation error
Error code Description
(SD0/SD8067)
3401H The set value of the output time exceeds the effective range.
TIMER__M
When the execution condition is established, these function blocks start the timer count to the set time.
Ladder diagram, FBD/LD Structured text
TIMER_1_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2);
TIMER_10_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2);
s1 d1 TIMER_100_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2);
TIMER_CONT_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2);
s2 d2
TIMER_CONTHS_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=
s3 d2);
Setting data
■Descriptions, types, and data types
Argument Description Type Data type
30
s1(Coil) Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s2(Preset) Timer set value Input variable INT
s3(ValueIn) Timer initial value Input variable INT
d1(ValueOut) Timer current value Output variable ANY16
d2(Status) Output Output variable BOOL
Processing details
■TIMER_1_FB_M
• When the execution condition of (s1) turns on, counting the current value starts. The timer starts counting from "(s3) × 1
ms". When it counts up to "(s2) × 1 ms", (d2) turns on. The current measurement value is output into (d1).
• When the execution condition of (s1) turns off, the current value is reset to (s3) and (d2) turns off.
• A value in the range of 0 to 32767 can be specified for (s2).
• A value in the range of -32768 to 32767 can be specified for (s3). However, when a negative value is specified, the initial
value is set to 0.
Ex.
[Ladder example]
TIMER_1_FB_M
M0 Coll
10 Preset ValueOut D10
1 ValueIn Status M10
[Timing chart]
ON
M0 OFF 10
D10 1
9 ms
M10 OFF
Ex.
[Ladder example]
TIMER_10_FB_M
M0 Coll
10 Preset ValueOut D10
1 ValueIn Status M10
[Timing chart]
ON
M0 OFF 10
D10 1
90 ms
M10 OFF
■TIMER_100_FB_M
• When the execution condition of (s1) turns on, counting the current value starts. The timer starts counting from "(s3) × 100
ms". When it counts up to "(s2) × 100 ms", (d2) turns on. The current measurement value is output into (d1).
• When the execution condition of (s1) turns off, the current value is reset to (s3) and (d2) turns off.
• A value in the range of 0 to 32767 can be specified for (s2).
• A value in the range of -32768 to 32767 can be specified for (s3). However, when a negative value is specified, the initial
value is set to 0.
Ex.
[Ladder example]
TIMER_100_FB_M
M0 Coll
10 Preset ValueOut D10
1 ValueIn Status M10
[Timing chart]
ON
M0 OFF 10
D10 1
90 ms
M10 OFF
Ex.
For label name TIMER_CONT_FB_M_1
[Ladder program]
M0 EN
RST
ENO
30
d TIMER_CONT_FB_M_1.Coll
[ST]
RST(M0,TIMER_CONT_FB_M_1.Coil)
[Ladder example]
TIMER_CNT_FB_M
X0 Coll
200 Preset ValueOut D10
0 ValueIn Status M10
[Timing chart]
ON
ON
M10 OFF
Operation error
There is no error.
APPX
1060 Appendix 1 Reference data: Main Instruction Execution Time
Appendix 2 Number of Instruction Steps
The number of instruction steps are shown below.
The number of steps may increase depending on the contents of the source and destination (such as specification of BFM or
character string), bit specification of word device, nibble specification of bit devices, indexing etc.
Instruction name Number of minimum steps
LD 2
LDI 2
AND 2
ANI 2
OR 2
ORI 2
LDP 4
LDF 4
ANDP 4
ANDF 4
ORP 4
ORF 4
LDPI 4
LDFI 4
ANDPI 4
ANDFI 4
ORPI 4
ORFI 4
ANB 1
ORB 1
MPS 1
MRD 1 A
MPP 1
INV 1
MEP 3
MEF 3
OUT 2
OUT T/ST 5
OUTH T/ ST 5
OUTHS T/ST 5
OUT C 5
OUT LC 5
OUT F 3
SET 2
RST 2
SET F 3
RST F 3
ANS 7
ANR 1
ANRP 1
PLS 3
PLF 3
FF 3
ALT 3
ALTP 3
SFT 3
SFTP 3
APPX
Appendix 2 Number of Instruction Steps 1061
Instruction name Number of minimum steps
SFR 4
SFRP 4
SFL 4
SFLP 4
BSFR 4
BSFRP 4
BSFL 4
BSFLP 4
DSFR 4
DSFRP 4
DSFL 4
DSFLP 4
SFTR 6
SFTRP 6
SFTL 6
SFTLP 6
WSFR 6
WSFRP 6
WSFL 6
WSFLP 6
MC 5
MCR 3
FEND 1
END 1
STOP 1
LD= 4
LD<> 4
LD> 4
LD<= 4
LD< 4
LD>= 4
AND= 4
AND<> 4
AND> 4
AND<= 4
AND< 4
AND>= 4
OR= 4
OR<> 4
OR> 4
OR<= 4
OR< 4
OR>= 4
LD=_U 4
LD<>_U 4
LD>_U 4
LD<=_U 4
LD<_U 4
LD>=_U 4
AND=_U 4
AND<>_U 4
AND>_U 4
AND<=_U 4
APPX
1062 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
AND<_U 4
AND>=_U 4
OR=_U 4
OR<>_U 4
OR>_U 4
OR<=_U 4
OR<_U 4
OR>=_U 4
LDD= 4
LDD<> 4
LDD> 4
LDD<= 4
LDD< 4
LDD>= 4
ANDD= 4
ANDD<> 4
ANDD> 4
ANDD<= 4
ANDD< 4
ANDD>= 4
ORD= 4
ORD<> 4
ORD> 4
ORD<= 4
ORD< 4
ORD>= 4
LDD=_U
LDD<>_U
4
4
A
LDD>_U 4
LDD<=_U 4
LDD<_U 4
LDD>=_U 4
ANDD=_U 4
ANDD<>_U 4
ANDD>_U 4
ANDD<=_U 4
ANDD<_U 4
ANDD>=_U 4
ORD=_U 4
ORD<>_U 4
ORD>_U 4
ORD<=_U 4
ORD<_U 4
ORD>=_U 4
CMP 5
CMPP 5
CMP_U 5
CMPP_U 5
DCMP 5
DCMPP 5
DCMP_U 5
DCMPP_U 5
ZCP 6
APPX
Appendix 2 Number of Instruction Steps 1063
Instruction name Number of minimum steps
ZCPP 6
ZCP_U 6
ZCPP_U 6
DZCP 6
DZCPP 6
DZCP_U 6
DZCPP_U 6
BKCMP= 6
BKCMP<> 6
BKCMP> 6
BKCMP<= 6
BKCMP< 6
BKCMP>= 6
BKCMP=P 6
BKCMP<>P 6
BKCMP>P 6
BKCMP<=P 6
BKCMP<P 6
BKCMP>=P 6
BKCMP=_U 6
BKCMP<>_U 6
BKCMP>_U 6
BKCMP<=_U 6
BKCMP<_U 6
BKCMP>=_U 6
BKCMP=P_U 6
BKCMP<>P_U 6
BKCMP>P_U 6
BKCMP<=P_U 6
BKCMP<P_U 6
BKCMP>=P_U 6
DBKCMP= 6
DBKCMP<> 6
DBKCMP> 6
DBKCMP<= 6
DBKCMP< 6
DBKCMP>= 6
DBKCMP=P 6
DBKCMP<>P 6
DBKCMP>P 6
DBKCMP<=P 6
DBKCMP<P 6
DBKCMP>=P 6
DBKCMP=_U 6
DBKCMP<>_U 6
DBKCMP>_U 6
DBKCMP<=_U 6
DBKCMP<_U 6
DBKCMP>=_U 6
DBKCMP=P_U 6
DBKCMP<>P_U 6
DBKCMP>P_U 6
DBKCMP<=P_U 6
APPX
1064 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
DBKCMP<P_U 6
DBKCMP>=P_U 6
+ (s) (d) 5
+P (s) (d) 5
+ (s1) (s2) (d) 5
+P (s1) (s2) (d) 5
+_U (s) (d) 5
+P_U (s) (d) 5
+_U (s1) (s2) (d) 5
+P_U (s1) (s2) (d) 5
ADD 5
ADDP 5
ADD_U 5
ADDP_U 5
- (s) (d) 5
-P (s) (d) 5
- (s1) (s2) (d) 5
-P (s1) (s2) (d) 5
-_U (s) (d) 5
-P_U (s) (d) 5
-_U (s1) (s2) (d) 5
-P_U (s1) (s2) (d) 5
SUB 5
SUBP 5
SUB_U 5
SUBP_U 5
D+ (s) (d)
D+P (s) (d)
5
5
A
D+ (s1) (s2) (d) 5
D+P (s1) (s2) (d) 5
D+_U (s) (d) 5
D+P_U (s) (d) 5
D+_U (s1) (s2) (d) 5
D+P_U (s1) (s2) (d) 5
DADD 5
DADDP 5
DADD_U 5
DADDP_U 5
D- (s) (d) 5
D-P (s) (d) 5
D- (s1) (s2) (d) 5
D-P (s1) (s2) (d) 5
D-_U (s) (d) 5
D-P_U (s) (d) 5
D-_U (s1) (s2) (d) 5
D-P_U (s1) (s2) (d) 5
DSUB 5
DSUBP 5
DSUB_U 5
DSUBP_U 5
* 7
*P 7
*_U 7
APPX
Appendix 2 Number of Instruction Steps 1065
Instruction name Number of minimum steps
*P_U 7
MUL 7
MULP 7
MUL_U 7
MULP_U 7
/ 7
/P 7
/_U 7
/P_U 7
DIV 7
DIVP 7
DIV_U 7
DIVP_U 7
D* 7
D*P 7
D*_U 7
D*P_U 7
DMUL 7
DMULP 7
DMUL_U 7
DMULP_U 7
D/ 7
D/P 7
D/_U 7
D/P_U 7
DDIV 7
DDIVP 7
DDIV_U 7
DDIVP_U 7
B+ (s) (d) 4
B+P (s) (d) 4
B+ (s1) (s2) (d) 5
B+P (s1) (s2) (d) 5
B- (s) (d) 4
B-P (s) (d) 4
B- (s1) (s2) (d) 5
B-P (s1) (s2) (d) 5
DB+ (s) (d) 4
DB+P (s) (d) 4
DB+ (s1) (s2) (d) 5
DB+P (s1) (s2) (d) 5
DB- (s) (d) 4
DB-P (s) (d) 4
DB- (s1) (s2) (d) 5
DB-P (s1) (s2) (d) 5
B* 7
B*P 7
B/ 7
B/P 7
DB* 7
DB*P 7
DB/ 7
DB/P 7
APPX
1066 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
BK+ 6
BK+P 6
BK+_U 6
BK+P_U 6
BK- 6
BK-P 6
BK-_U 6
BK-P_U 6
DBK+ 6
DBK+P 6
DBK+_U 6
DBK+P_U 6
DBK- 6
DBK-P 6
DBK-_U 6
DBK-P_U 6
INC 3
INCP 3
INC_U 3
INCP_U 3
DEC 3
DECP 3
DEC_U 3
DECP_U 3
DINC 3
DINCP 3
DINC_U
DINCP_U
3
3
A
DDEC 3
DDECP 3
DDEC_U 3
DDECP_U 3
WAND (s) (d) 5
WANDP (s) (d) 5
WAND (s1) (s2) (d) 5
WANDP (s1) (s2) (d) 5
DAND (s) (d) 5
DANDP (s) (d) 5
DAND (s1) (s2) (d) 5
DANDP (s1) (s2) (d) 5
BKAND 6
BKANDP 6
WOR (s) (d) 5
WORP (s) (d) 5
WOR (s1) (s2) (d) 5
WORP (s1) (s2) (d) 5
DOR (s) (d) 5
DORP (s) (d) 5
DOR (s1) (s2) (d) 5
DORP (s1) (s2) (d) 5
BKOR 6
BKORP 6
WXOR (s) (d) 5
APPX
Appendix 2 Number of Instruction Steps 1067
Instruction name Number of minimum steps
WXORP (s) (d) 5
WXOR (s1) (s2) (d) 5
WXORP (s1) (s2) (d) 5
DXOR (s) (d) 5
DXORP (s) (d) 5
DXOR (s1) (s2) (d) 5
DXORP (s1) (s2) (d) 5
BKXOR 6
BKXORP 6
WXNR (s) (d) 5
WXNRP (s) (d) 5
WXNR (s1) (s2) (d) 5
WXNRP (s1) (s2) (d) 5
DXNR (s) (d) 5
DXNRP (s) (d) 5
DXNR (s1) (s2) (d) 5
DXNRP (s1) (s2) (d) 5
BKXNR 6
BKXNRP 6
BSET 4
BSETP 4
BRST 4
BRSTP 4
TEST 5
TESTP 5
DTEST 5
DTESTP 5
BKRST 4
BKRSTP 4
ZRST 4
ZRSTP 4
BCD 4
BCDP 4
DBCD 4
DBCDP 4
BIN 4
BINP 4
DBIN 4
DBINP 4
FLT2INT 4
FLT2INTP 4
FLT2UINT 4
FLT2UINTP 4
FLT2DINT 4
FLT2DINTP 4
FLT2UDINT 4
FLT2UDINTP 4
INT2UINT 4
INT2UINTP 4
INT2DINT 4
INT2DINTP 4
INT2UDINT 4
INT2UDINTP 4
APPX
1068 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
UINT2INT 4
UINT2INTP 4
UINT2DINT 4
UINT2DINTP 4
UINT2UDINT 4
UINT2UDINTP 4
DINT2INT 4
DINT2INTP 4
DINT2UINT 4
DINT2UINTP 4
DINT2UDINT 4
DINT2UDINTP 4
UDINT2INT 4
UDINT2INTP 4
UDINT2UINT 4
UDINT2UINTP 4
UDINT2DINT 4
UDINT2DINTP 4
GRY 4
GRYP 4
GRY_U 4
GRYP_U 4
DGRY 4
DGRYP 4
DGRY_U 4
DGRYP_U 4
GBIN
GBINP
4
4
A
GBIN_U 4
GBINP_U 4
DGBIN 4
DGBINP 4
DGBIN_U 4
DGBINP_U 4
DABIN 4
DABINP 4
DABIN_U 4
DABINP_U 4
DDABIN 4
DDABINP 4
DDABIN_U 4
DDABINP_U 4
HEXA 5
HEXAP 5
VAL 5
VALP 5
VAL_U 5
VALP_U 5
DVAL 5
DVALP 5
DVAL_U 5
DVALP_U 5
NEG 3
APPX
Appendix 2 Number of Instruction Steps 1069
Instruction name Number of minimum steps
NEGP 3
DNEG 3
DNEGP 3
DECO 5
DECOP 5
ENCO 5
ENCOP 5
SEGD 4
SEGDP 4
SEGL 5
DIS 5
DISP 5
UNI 5
UNIP 5
NDIS 5
NDISP 5
NUNI 5
NUNIP 5
WTOB 5
WTOBP 5
BTOW 5
BTOWP 5
DSW 6
MOV 4
MOVP 4
DMOV 4
DMOVP 4
CML 4
CMLP 4
DCML 4
DCMLP 4
SMOV 7
SMOVP 7
CMLB 4
CMLBP 4
BMOV 5
BMOVP 5
FMOV 5
FMOVP 5
DFMOV 5
DFMOVP 5
XCH 4
XCHP 4
DXCH 4
DXCHP 4
SWAP 3
SWAPP 3
DSWAP 3
DSWAPP 3
MOVB 4
MOVBP 4
PRUN 5
PRUNP 5
APPX
1070 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
DPRUN 5
DPRUNP 5
BLKMOVB 5
BLKMOVBP 5
ROR 4
RORP 4
RCR 4
RCRP 4
DROR 4
DRORP 4
DRCR 4
DRCRP 4
ROL 4
ROLP 4
RCL 4
RCLP 4
DROL 4
DROLP 4
DRCL 4
DRCLP 4
CJ 3
CJP 3
GOEND 1
DI 1
DI (s) 3
EI 1
IMASK
SIMASK
3
5
A
IRET 1
WDT 1
WDTP 1
FOR 3
NEXT 1
BREAK 5
BREAKP 5
CALL 3
CALLP 3
RET 1
SRET 1
XCALL 3
SFRD 5
SFRDP 5
POP 5
POPP 5
SFWR 5
SFWRP 5
FINS 5
FINSP 5
FDEL 5
FDELP 5
LD$= 4
LD$<> 4
LD$> 4
APPX
Appendix 2 Number of Instruction Steps 1071
Instruction name Number of minimum steps
LD$<= 4
LD$< 4
LD$>= 4
AND$= 4
AND$<> 4
AND$> 4
AND$<= 4
AND$< 4
AND$>= 4
OR$= 4
OR$<> 4
OR$> 4
OR$<= 4
OR$< 4
OR$>= 4
$+ (s) (d) 4
$+P (s) (d) 4
$+ (s1) (s2) (d) 5
$+P (s1) (s2) (d) 5
$MOV 4
$MOVP 4
BINDA 4
BINDAP 4
BINDA_U 4
BINDAP_U 4
DBINDA 4
DBINDAP 4
DBINDA_U 4
DBINDAP_U 4
ASCI 5
ASCIP 5
STR 5
STRP 5
STR_U 5
STRP_U 5
DSTR 5
DSTRP 5
DSTR_U 5
DSTRP_U 5
ESTR 5
ESTRP 5
DESTR 5
DESTRP 5
LEN 4
LENP 4
RIGHT 5
RIGHTP 5
LEFT 5
LEFTP 5
MIDR 5
MIDRP 5
MIDW 5
MIDWP 5
APPX
1072 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
INSTR 6
INSTRP 6
STRINS 5
STRINSP 5
STRDEL 5
STRDELP 5
LDE= 4
LDE<> 4
LDE> 4
LDE<= 4
LDE< 4
LDE>= 4
ANDE= 4
ANDE<> 4
ANDE> 4
ANDE<= 4
ANDE< 4
ANDE>= 4
ORE= 4
ORE<> 4
ORE> 4
ORE<= 4
ORE< 4
ORE>= 4
DECMP 5
DECMPP 5
DEZCP
DEZCPP
6
6
A
E+ (s) (d) 4
E+P (s) (d) 4
E+ (s1) (s2) (d) 5
E+P (s1) (s2) (d) 5
DEADD 5
DEADDP 5
E- (s) (d) 4
E-P (s) (d) 4
E- (s1) (s2) (d) 5
E-P (s1) (s2) (d) 5
DESUB 5
DESUBP 5
E* 5
E*P 5
DEMUL 5
DEMULP 5
E/ 5
E/P 5
DEDIV 5
DEDIVP 5
INT2FLT 4
INT2FLTP 4
UINT2FLT 4
UINT2FLTP 4
DINT2FLT 4
APPX
Appendix 2 Number of Instruction Steps 1073
Instruction name Number of minimum steps
DINT2FLTP 4
UDINT2FLT 4
UDINT2FLTP 4
EVAL 4
EVALP 4
DEVAL 4
DEVALP 4
DEBCD 4
DEBCDP 4
DEBIN 4
DEBINP 4
ENEG 3
ENEGP 3
DENEG 3
DENEGP 3
EMOV 4
EMOVP 4
DEMOV 4
DEMOVP 4
SIN 4
SINP 4
DSIN 4
DSINP 4
COS 4
COSP 4
DCOS 4
DCOSP 4
TAN 4
TANP 4
DTAN 4
DTANP 4
ASIN 4
ASINP 4
DASIN 4
DASINP 4
ACOS 4
ACOSP 4
DACOS 4
DACOSP 4
ATAN 4
ATANP 4
DATAN 4
DATANP 4
RAD 4
RADP 4
DRAD 4
DRADP 4
DEG 4
DEGP 4
DDEG 4
DDEGP 4
DESQR 4
DESQRP 4
APPX
1074 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
ESQRT 4
ESQRTP 4
EXP 4
EXPP 4
DEXP 4
DEXPP 4
LOG 4
LOGP 4
DLOGE 4
DLOGEP 4
POW 5
POWP 5
LOG10 4
LOG10P 4
DLOG10 4
DLOG10P 4
EMAX 5
EMAXP 5
EMIN 5
EMINP 5
RND 3
RNDP 3
ZPUSH (d) 3
ZPUSHP (d) 3
ZPUSH (s) (d) 4
ZPUSHP (s) (d) 4
ZPOP (d)
ZPOPP (d)
3
3
A
ZPOP (s) (d) 4
ZPOPP (s) (d) 4
LIMIT 6
LIMITP 6
LIMIT_U 6
LIMITP_U 6
DLIMIT 6
DLIMITP 6
DLIMIT_U 6
DLIMITP_U 6
BAND 6
BANDP 6
BAND_U 6
BANDP_U 6
DBAND 6
DBANDP 6
DBAND_U 6
DBANDP_U 6
ZONE 6
ZONEP 6
ZONE_U 6
ZONEP_U 6
DZONE 6
DZONEP 6
DZONE_U 6
APPX
Appendix 2 Number of Instruction Steps 1075
Instruction name Number of minimum steps
DZONEP_U 6
SCL 5
SCLP 5
SCL_U 5
SCLP_U 5
DSCL 5
DSCLP 5
DSCL_U 5
DSCLP_U 5
SCL2 5
SCL2P 5
SCL2_U 5
SCL2P_U 5
DSCL2 5
DSCL2P 5
DSCL2_U 5
DSCL2P_U 5
TTMR 4
STMR 7
UDCNTF 5
ROTC 6
RAMPF 6
SPD 5
DSPD 5
PLSY 5
DPLSY 5
PWM 5
DPWM 5
MTR 6
IST 7
ABSD 9
DABSD 9
INCD 9
CCD 5
CCDP 5
SERMM 6
SERMMP 6
DSERMM 6
DSERMMP 6
SUM 4
SUMP 4
DSUM 4
DSUMP 4
BON 5
BONP 5
DBON 5
DBONP 5
MAX 5
MAXP 5
MAX_U 5
MAXP_U 5
DMAX 5
DMAXP 5
APPX
1076 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
DMAX_U 5
DMAXP_U 5
MIN 5
MINP 5
MIN_U 5
MINP_U 5
DMIN 5
DMINP 5
DMIN_U 5
DMINP_U 5
SORTTBL 7
SORTTBL_U 7
SORTTBL2 7
SORTTBL2_U 7
DSORTTBL2 7
DSORTTBL2_U 7
WSUM 7
WSUMP 7
WSUM_U 7
WSUMP_U 7
DWSUM 7
DWSUMP 7
DWSUM_U 7
DWSUMP_U 7
MEAN 5
MEANP 5
MEAN_U
MEANP_U
5
5
A
DMEAN 5
DMEANP 5
DMEAN_U 5
DMEANP_U 5
SQRT 4
SQRTP 4
DSQRT 4
DSQRTP 4
CRC 5
CRCP 5
ADRSET 4
ADRSETP 4
TRD 3
TRDP 3
TWR 3
TWRP 3
TADD 5
TADDP 5
TSUB 5
TSUBP 5
HTOS 4
HTOSP 4
DHTOS 4
DHTOSP 4
STOH 4
APPX
Appendix 2 Number of Instruction Steps 1077
Instruction name Number of minimum steps
STOHP 4
DSTOH 4
DSTOHP 4
LDDT= 5
LDDT<> 5
LDDT> 5
LDDT<= 5
LDDT< 5
LDDT>= 5
ANDDT= 5
ANDDT<> 5
ANDDT> 5
ANDDT<= 5
ANDDT< 5
ANDDT>= 5
ORDT= 5
ORDT<> 5
ORDT> 5
ORDT<= 5
ORDT< 5
ORDT>= 5
LDTM= 5
LDTM<> 5
LDTM> 5
LDTM<= 5
LDTM< 5
LDTM>= 5
ANDTM= 5
ANDTM<> 5
ANDTM> 5
ANDTM<= 5
ANDTM< 5
ANDTM>= 5
ORTM= 5
ORTM<> 5
ORTM> 5
ORTM<= 5
ORTM< 5
ORTM>= 5
TCMP 7
TCMPP 7
TZCP 6
TZCPP 6
DUTY 5
HOURM 5
DHOURM 5
REF 4
REFP 4
RFS 4
RFSP 4
FROM 6
FROMP 6
DFROM 6
APPX
1078 Appendix 2 Number of Instruction Steps
Instruction name Number of minimum steps
DFROMP 6
TO 6
TOP 6
DTO 6
DTOP 6
FROMD 6
FROMDP 6
DFROMD 6
DFROMDP 6
TOD 6
TODP 6
DTOD 6
DTODP 6
LOGTRG 3
LOGTRGR 3
STL 3
RETSTL 1
SP.SOCOPEN 10
SP.SOCCLOSE 10
SP.SOCRCV 12
SP.SOCSND 12
SP.SOCCINF 10
S.SOCRDATA 12
SP.SOCRDATA 12
SP.ECPRTCL 7
SP.SLMPSND 13
PID
GP.READ
6
19
A
GP.SREAD 23
GP.WRITE 20
GP.SWRITE 23
GP.SEND 16
GP.RECV 16
G.CCPASET 22
GP.CCPASET 22
G.UINI 14
GP.UINI 14
DHSCS 5
DHSCR 5
DHSZ 6
HIOEN 5
HIOENP 5
DHIOEN 5
DHIOENP 5
HCMOV 5
HCMOVP 5
DHCMOV 5
DHCMOVP 5
RS2 7
IVCK 7
IVDR 7
IVRD 7
IVWR 7
APPX
Appendix 2 Number of Instruction Steps 1079
Instruction name Number of minimum steps
IVBWR 7
IVMC 13
ADPRW 13
S.CPRTCL 7
SP.CPRTCL 7
DSZR 6
DDSZR 6
DVIT 6
DDVIT 6
TBL 4
DRVTBL 7
DRVMUL 13
DABS 5
PLSV 5
DPLSV 5
DRVI 6
DDRVI 6
DRVA 6
DDRVA 6
G.ABRST 15
GP.PSTRT 15
GP.TEACH 15
GP.PFWRT 15
GP.PINIT 15
RBFM 7
WBFM 7
APPX
1080 Appendix 2 Number of Instruction Steps
Appendix 3 Added and Changed Functions
The functions added or changed with the CPU module and engineering tool, and the supported CPU modules' firmware
version and engineering tool software version are given below.
• The firmware version can be confirmed with module diagnosis (CPU diagnosis). Refer to the User's Manual (Hardware) for
the CPU module in use for details on diagnosing the module (CPU diagnosis).
• Refer to the GX Works3 Operating Manual for details on the software version.
Add/Change Function Supported CPU module Supported engineering Reference
firmware version tool software version
The RS2 instruction is supported. "1.014" and above "1.005F" and above Page 804 RS2
The SEGD(P) instruction is supported. "1.014" and above "1.007H" and above Page 329 SEGD(P)
The SEGL instruction is supported. "1.014" and above "1.007H" and above Page 331 SEGL
The DSW instruction is supported. "1.014" and above "1.007H" and above Page 345 DSW
The UDCNTF instruction is supported. "1.014" and above "1.007H" and above Page 565 UDCNTF
The MTR instruction is supported. "1.014" and above "1.007H" and above Page 609 MTR
The IST instruction is supported. "1.014" and above "1.007H" and above Page 612 IST
The Step ladder is supported. "1.014" and above "1.007H" and above Page 719 STL, RETSTL
The predefined protocol support function is "1.014" and above "1.007H" and above Page 737 SP.ECPRTCL
supported. Page 820 S(P).CPRTCL
The PID instruction is supported. "1.014" and above "1.007H" and above Page 746 PID
The ESQRT(P) instruction is supported. "1.015" and above "1.015R" and above Page 516 DESQR(P)/ESQRT(P)
The number of settable high-speed comparison "1.015" and above*1 "1.015R" and above Page 794 HIOEN(P)
tables was changed from maximum 4 to 32. Page 797 DHIOEN(P)
The number of high-speed comparisons was "1.015" and above*1 "1.015R" and above Page 794 HIOEN(P)
changed from 4 to 32. Page 797 DHIOEN(P)
The high-speed pulse input/output module is "1.030" and above "1.025B" and above Page 597 PWM
supported. Page 603 DPWM
Page 794 HIOEN(P)
Page 797 DHIOEN(P)
Page 800 HCMOV(P) A
Page 802 DHCMOV(P)
Page 824 POSITIONING INSTRUCTION
The CC-Link IE field network intelligent device "1.030" and above "1.025B" and above Page 750 NETWORK COMMON
station is supported. INSTRUCTION
Page 782 CC-LINK IE FIELD NETWORK
INSTRUCTION
The logging instruction is supported "1.040" and above "1.030G" and above Page 717 LOGTRG
Page 718 LOGTRGR
The SLMP frame send instruction is supported "1.040" and above "1.030G" and above Page 741 SP.SLMPSND
The positioning module instruction is supported "1.050" and above "1.035M" and above Page 864 G.ABRST
Page 867 GP.PSTRT
Page 870 GP.TEACH
Page 873 GP.PFWRT
Page 876 GP.PINIT
APPX
Appendix 3 Added and Changed Functions 1081
INSTRUCTION INDEX
1082
BK-(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 DABS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .843
BK+(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 236 DABSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .624
BKAND(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 DACOS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .508
BKCMP<(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . 177 DADD(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .197
BKCMP<=(P)(_U) . . . . . . . . . . . . . . . . . . . . . . 177 DAND(P) . . . . . . . . . . . . . . . . . . . . . . . . . 251,252
BKCMP<>(P)(_U) . . . . . . . . . . . . . . . . . . . . . . 177 DASIN(P). . . . . . . . . . . . . . . . . . . . . . . . . . . . .506
BKCMP=(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . 177 DATAN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .510
BKCMP>(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . 177 DB-(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 227,228
BKCMP>=(P)(_U) . . . . . . . . . . . . . . . . . . . . . . 177 DB*(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232
BKCMP_EQ(P)(_U). . . . . . . . . . . . . . . . . . . . . 177 DB/(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
BKCMP_GE(P)(_U). . . . . . . . . . . . . . . . . . . . . 177 DB+(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 225,226
BKCMP_GT(P)(_U) . . . . . . . . . . . . . . . . . . . . . 177 DBAND(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . .543
BKCMP_LE(P)(_U) . . . . . . . . . . . . . . . . . . . . . 177 DBCD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284
BKCMP_LT(P)(_U) . . . . . . . . . . . . . . . . . . . . . 177 DBDIVISION(P) . . . . . . . . . . . . . . . . . . . . . . . .234
BKCMP_NE(P)(_U) . . . . . . . . . . . . . . . . . . . . . 177 DBIN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288
BKMINUS(P)(_U) . . . . . . . . . . . . . . . . . . . . . . 238 DBINDA(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . .427
BKOR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 DBK-(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .243
BKPLUS(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . 236 DBK+(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .240
BKRST(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 DBKCMP<(P)(_U) . . . . . . . . . . . . . . . . . . . . . .179
BKXNR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 DBKCMP<=(P)(_U) . . . . . . . . . . . . . . . . . . . . .179
BKXOR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 DBKCMP<>(P)(_U) . . . . . . . . . . . . . . . . . . . . .179
BLKMOVB(P) . . . . . . . . . . . . . . . . . . . . . . . . . 369 DBKCMP=(P)(_U) . . . . . . . . . . . . . . . . . . . . . .179
BMINUS(P) . . . . . . . . . . . . . . . . . . . . . . . 223,224 DBKCMP>(P)(_U) . . . . . . . . . . . . . . . . . . . . . .179
BMOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 DBKCMP>=(P)(_U) . . . . . . . . . . . . . . . . . . . . .179
BMULTI(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 DBKCMP_EQ(P)(_U) . . . . . . . . . . . . . . . . . . . .179
BON(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 DBKCMP_GE(P)(_U) . . . . . . . . . . . . . . . . . . . .179
BOOL_TO_DINT(_E) . . . . . . . . . . . . . . . . . . . 887 DBKCMP_GT(P)(_U) . . . . . . . . . . . . . . . . . . . .179
BOOL_TO_DWORD(_E) . . . . . . . . . . . . . . . . . 885 DBKCMP_LE(P)(_U). . . . . . . . . . . . . . . . . . . . .179
BOOL_TO_INT(_E) . . . . . . . . . . . . . . . . . . . . . 886 DBKCMP_LT(P)(_U) . . . . . . . . . . . . . . . . . . . . .179
BOOL_TO_STRING(_E) . . . . . . . . . . . . . . . . . 889 DBKCMP_NE(P)(_U) . . . . . . . . . . . . . . . . . . . .179
BOOL_TO_TIME(_E) . . . . . . . . . . . . . . . . . . . 888 DBKMINUS(P)(_U) . . . . . . . . . . . . . . . . . . . . . .243
BOOL_TO_WORD(_E) . . . . . . . . . . . . . . . . . . 884 DBKPLUS(P)(_U) . . . . . . . . . . . . . . . . . . . . . . .240
BPLUS(P) . . . . . . . . . . . . . . . . . . . . . . . . 221,222 DBMINUS(P) . . . . . . . . . . . . . . . . . . . . . . 227,228
BREAK(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 DBMULTI(P) . . . . . . . . . . . . . . . . . . . . . . . . . .232
BRST(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 DBON(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .639
BSET(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 DBPLUS(P) . . . . . . . . . . . . . . . . . . . . . . . 225,226
BSFL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 DCML(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .350
BSFR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 DCMP(P)(_U). . . . . . . . . . . . . . . . . . . . . . . . . .171
BTOW(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 DCOS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .502 I
DDABIN(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . .312
DDEC(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .248
C
DDEG(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .514
CALL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 DDIV(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .219
CCD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 DDIVISION(P)(_U) . . . . . . . . . . . . . . . . . . . . . .217
CJ(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 DDRVA . . . . . . . . . . . . . . . . . . . . . . . . . . 860,862
CML(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 DDRVI . . . . . . . . . . . . . . . . . . . . . . . . . . . 853,855
CMLB(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 DDSZR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .829
CMP(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 169 DDVIT . . . . . . . . . . . . . . . . . . . . . . . . . . . 834,836
CONCAT(_E) . . . . . . . . . . . . . . . . . . . . . . . . 1013 DEADD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .475
COS(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966 DEBCD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .494
COS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 DEBIN(P). . . . . . . . . . . . . . . . . . . . . . . . . . . . .496
COUNTER_FB_M . . . . . . . . . . . . . . . . . . . . . 1049 DEC(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .246
CPY_BITARR(_E) . . . . . . . . . . . . . . . . . . . . . . 953 DECMP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .463
CPY_BIT_OF_INT(_E) . . . . . . . . . . . . . . . . . . 956 DECO(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326
CRC(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667 DEDIV(P). . . . . . . . . . . . . . . . . . . . . . . . . . . . .485
CTD(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1044 DEG(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .514
CTU(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1042 DELETE(_E) . . . . . . . . . . . . . . . . . . . . . . . . .1017
CTUD(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . 1046 DEMOV(P). . . . . . . . . . . . . . . . . . . . . . . . . . . .499
DEMUL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .483
DENEG(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .498
D DESQR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .516
D-(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 199,201 DESTR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .438
D*(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 DESUB(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .477
D/(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 DEVAL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .491
D+(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . 194,195 DEXP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .518
DABIN(P)(_U). . . . . . . . . . . . . . . . . . . . . . . . . 310 DEZCP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .465
1083
DFMOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 DSORTTBL2(_U) . . . . . . . . . . . . . . . . . . . . . . .655
DFROM(P) . . . . . . . . . . . . . . . . . . . . . . . . 705,707 DSPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .577
DFROMD(P). . . . . . . . . . . . . . . . . . . . . . . 711,713 DSQRT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .666
DGBIN(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . 309 DSTOH(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .685
DGRY(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 307 DSTR(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .435
DHCMOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . 802 DSUB(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .203
DHIOEN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 797 DSUM(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .636
DHOURM. . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 DSW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345
DHSCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790 DSWAP(P). . . . . . . . . . . . . . . . . . . . . . . . . . . .363
DHSCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788 DSZR . . . . . . . . . . . . . . . . . . . . . . . . . . . 825,827
DHSCS_I . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788 DTAN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .504
DHSZ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 DTEST(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .277
DHTOS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 DTO(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 707,708
DI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385,387 DTOD(P) . . . . . . . . . . . . . . . . . . . . . . . . . 713,714
DI_1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 DUTY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .697
DINC(P)(_U). . . . . . . . . . . . . . . . . . . . . . . . . . 247 DVAL(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .321
DINT2FLT(P) . . . . . . . . . . . . . . . . . . . . . . . . . 489 DVIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831,833
DINT2INT(P) . . . . . . . . . . . . . . . . . . . . . . . . . 300 DWORD_TO_BOOL(_E) . . . . . . . . . . . . . . . . . .895
DINT2UDINT(P) . . . . . . . . . . . . . . . . . . . . . . . 302 DWORD_TO_DINT(_E) . . . . . . . . . . . . . . . . . .900
DINT2UINT(P) . . . . . . . . . . . . . . . . . . . . . . . . 301 DWORD_TO_INT(_E) . . . . . . . . . . . . . . . . . . . .898
DINT_TO_BCD(_E). . . . . . . . . . . . . . . . . . . . . 917 DWORD_TO_TIME(_E) . . . . . . . . . . . . . . . . . .901
DINT_TO_BITARR(_E) . . . . . . . . . . . . . . . . . . 952 DWORD_TO_WORD(_E) . . . . . . . . . . . . . . . . .896
DINT_TO_BOOL(_E) . . . . . . . . . . . . . . . . . . . 912 DWSUM(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . .659
DINT_TO_DWORD(_E) . . . . . . . . . . . . . . . . . . 915 DXCH(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .361
DINT_TO_INT(_E) . . . . . . . . . . . . . . . . . . . . . 916 DXNR(P) . . . . . . . . . . . . . . . . . . . . . . . . . 269,270
DINT_TO_REAL(_E) . . . . . . . . . . . . . . . . . . . . 919 DXOR(P) . . . . . . . . . . . . . . . . . . . . . . . . . 263,264
DINT_TO_STRING(_E) . . . . . . . . . . . . . . . . . . 921 DZCP(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .175
DINT_TO_TIME(_E) . . . . . . . . . . . . . . . . . . . . 920 DZONE(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . .547
DINT_TO_WORD(_E) . . . . . . . . . . . . . . . . . . . 913
DIS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
E
DIV(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 977
DIV(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 E-(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471,473
DIVISION(P)(_U) . . . . . . . . . . . . . . . . . . . . . . 209 E*(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .479
DIV_TIME(_E) . . . . . . . . . . . . . . . . . . . . . . . 1030 E/(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .481
DLIMIT(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . 539 E+(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 467,469
DLOG10(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 524 EDIVISION(P) . . . . . . . . . . . . . . . . . . . . . . . . .481
DLOGE(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 EI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .385
DMAX(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 643 EMAX(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .526
DMEAN(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . 663 EMIN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .528
DMIN(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 647 EMINUS(P) . . . . . . . . . . . . . . . . . . . . . . . 471,473
DMINUS(P)(_U) . . . . . . . . . . . . . . . . . . . . 199,201 EMOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .499
DMOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 EMULTI(P). . . . . . . . . . . . . . . . . . . . . . . . . . . .479
DMUL(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 215 ENCO(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .328
DMULTI(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . 213 END . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162
DNEG(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 ENEG(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .498
DOR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 257,258 EPLUS(P) . . . . . . . . . . . . . . . . . . . . . . . . 467,469
DPLSV . . . . . . . . . . . . . . . . . . . . . . . . . . 847,848 EQ(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1004
DPLSY . . . . . . . . . . . . . . . . . . . . . . . . . . 589,593 ESQRT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .516
DPLUS(P)(_U) . . . . . . . . . . . . . . . . . . . . . 194,195 ESTR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .438
DPRUN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 EVAL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .491
DPWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 EXP(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .964
DRAD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512 EXP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .518
DRCL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 EXPT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . .981
DRCR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
DROL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
DROR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
F
DRVA . . . . . . . . . . . . . . . . . . . . . . . . . . . 857,859 FDEL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .414
DRVI . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849,851 FEND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161
DRVMUL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841 FF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136
DRVTBL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 FIND(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . .1022
DSCL(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 552 FINS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .412
DSCL2(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . 558 FLT2DINT(P) . . . . . . . . . . . . . . . . . . . . . . . . . .292
DSERMM(P) . . . . . . . . . . . . . . . . . . . . . . . . . 633 FLT2INT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . .290
DSFL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 FLT2UDINT(P) . . . . . . . . . . . . . . . . . . . . . . . . .293
DSFR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 FLT2UINT(P) . . . . . . . . . . . . . . . . . . . . . . . . . .291
DSIN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 FMOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356
1084
FOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 INT2UDINT(P) . . . . . . . . . . . . . . . . . . . . . . . . .296
FROM(P) . . . . . . . . . . . . . . . . . . . . . . . . . 705,707 INT2UINT(P) . . . . . . . . . . . . . . . . . . . . . . . . . .294
FROMD(P) . . . . . . . . . . . . . . . . . . . . . . . . 711,713 INT_TO_BCD(_E) . . . . . . . . . . . . . . . . . . . . . .906
F_TRIG(_E) . . . . . . . . . . . . . . . . . . . . . . . . . 1040 INT_TO_BITARR(_E) . . . . . . . . . . . . . . . . . . . .951
INT_TO_BOOL(_E) . . . . . . . . . . . . . . . . . . . . .902
INT_TO_DINT(_E) . . . . . . . . . . . . . . . . . . . . . .905
G
INT_TO_DWORD(_E) . . . . . . . . . . . . . . . . . . . .904
G.ABRST1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 864 INT_TO_REAL(_E) . . . . . . . . . . . . . . . . . . . . . .908
G.ABRST2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 864 INT_TO_STRING(_E) . . . . . . . . . . . . . . . . . . . .910
G(P).CCPASET . . . . . . . . . . . . . . . . . . . . . . . 782 INT_TO_TIME(_E) . . . . . . . . . . . . . . . . . . . . . .909
G(P).UINI . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 INT_TO_WORD(_E) . . . . . . . . . . . . . . . . . . . . .903
G(P)_CCPASET . . . . . . . . . . . . . . . . . . . . . . . 782 INV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
G(P)_UINI . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 IRET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .393
G_ABRST1 . . . . . . . . . . . . . . . . . . . . . . . . . . 864 IST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .612
G_ABRST2 . . . . . . . . . . . . . . . . . . . . . . . . . . 864 IVBWR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .814
GBIN(P)(_U). . . . . . . . . . . . . . . . . . . . . . . . . . 308 IVCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .806
GE(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004 IVDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .808
GET_BIT_OF_INT(_E) . . . . . . . . . . . . . . . . . . 954 IVMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .816
GET_BOOL_ADDR . . . . . . . . . . . . . . . . . . . . . 957 IVRD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .810
GET_INT_ADDR . . . . . . . . . . . . . . . . . . . . . . 957 IVWR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .812
GET_WORD_ADDR . . . . . . . . . . . . . . . . . . . . 957
GOEND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 L
GP.PFWRT . . . . . . . . . . . . . . . . . . . . . . . . . . 873
GP.PINIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 876 LD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104
GP.PSTRT1 . . . . . . . . . . . . . . . . . . . . . . . . . . 867 LD<(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
GP.PSTRT2 . . . . . . . . . . . . . . . . . . . . . . . . . . 867 LD<=(_U). . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
GP.READ. . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 LD<>(_U). . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
GP.RECV. . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 LD=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
GP.SEND. . . . . . . . . . . . . . . . . . . . . . . . . . . . 771 LD>(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
GP.SREAD . . . . . . . . . . . . . . . . . . . . . . . . . . 756 LD>=(_U). . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
GP.SWRITE . . . . . . . . . . . . . . . . . . . . . . . . . . 765 LD$< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
GP.TEACH1 . . . . . . . . . . . . . . . . . . . . . . . . . . 870 LD$<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
GP.TEACH2 . . . . . . . . . . . . . . . . . . . . . . . . . . 870 LD$<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
GP.WRITE . . . . . . . . . . . . . . . . . . . . . . . . . . . 760 LD$= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
GP_PFWRT . . . . . . . . . . . . . . . . . . . . . . . . . . 873 LD$> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
GP_PINIT . . . . . . . . . . . . . . . . . . . . . . . . . . . 876 LD$>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
GP_PSTRT1 . . . . . . . . . . . . . . . . . . . . . . . . . 867 LDD<(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_PSTRT2 . . . . . . . . . . . . . . . . . . . . . . . . . 867 LDD<=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_READ . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 LDD<>(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .167 I
GP_RECV . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 LDD=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_SEND . . . . . . . . . . . . . . . . . . . . . . . . . . . 771 LDD>(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_SREAD . . . . . . . . . . . . . . . . . . . . . . . . . . 756 LDD>=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_SWRITE . . . . . . . . . . . . . . . . . . . . . . . . . 765 LDD_EQ(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_TEACH1 . . . . . . . . . . . . . . . . . . . . . . . . . 870 LDD_GE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_TEACH2 . . . . . . . . . . . . . . . . . . . . . . . . . 870 LDD_GT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
GP_WRITE . . . . . . . . . . . . . . . . . . . . . . . . . . 760 LDD_LE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
GRY(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 306 LDD_LT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
GT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004 LDD_NE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
LDDT< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
LDDT<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
H
LDDT<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
HCMOV(P) . . ......................... 800 LDDT= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
HEXA(P) . . . ......................... 314 LDDT> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
HIOEN(P). . . ......................... 794 LDDT>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
HOURM . . . . ......................... 699 LDDT_EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
HTOS(P) . . . ......................... 679 LDDT_GE . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
LDDT_GT . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
LDDT_LE. . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
I LDDT_LT . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
IMASK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 LDDT_NE . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
INC(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 LDE<. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
INCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 LDE<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
INSERT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . 1015 LDE<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
INSTR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 LDE=. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
INT2DINT(P) . . . . . . . . . . . . . . . . . . . . . . . . . 295 LDE>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
INT2FLT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 487 LDE>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
1085
LDE_EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 MOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347
LDE_GE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 MOVB(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .364
LDE_GT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 MOVE(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . .983
LDE_LE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 MPP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111
LDE_LT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 MPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111
LDE_NE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 MRD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111
LD_EQ(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 MTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .609
LDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 MUL(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .973
LDFI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 MUL(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .207
LD_GE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 MULTI(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . .205
LD_GT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 MUL_TIME(_E) . . . . . . . . . . . . . . . . . . . . . . .1028
LDI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 MUX(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . .1002
LD_LE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
LD_LT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
N
LD_NE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165
LDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 NDIS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337
LDPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 NE(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1006
LDSTRING_EQ . . . . . . . . . . . . . . . . . . . . . . . 416 NEG(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .324
LDSTRING_GE . . . . . . . . . . . . . . . . . . . . . . . 416 NEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .395
LDSTRING_GT . . . . . . . . . . . . . . . . . . . . . . . 416 NOT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .995
LDSTRING_LE . . . . . . . . . . . . . . . . . . . . . . . . 416 NUNI(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .339
LDSTRING_LT . . . . . . . . . . . . . . . . . . . . . . . . 416
LDSTRING_NE . . . . . . . . . . . . . . . . . . . . . . . 416
LDTM< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 O
LDTM<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104
LDTM<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .993
LDTM= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR<(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
LDTM> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR<=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
LDTM>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR<>(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
LDTM_EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
LDTM_GE . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR>(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
LDTM_GT . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR>=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
LDTM_LE. . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR$< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
LDTM_LT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR$<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
LDTM_NE . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 OR$<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
LE(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004 OR$= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
LEFT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1009 OR$> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
LEFT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 OR$>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
LEN(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008 ORB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
LEN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 ORD<(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
LIMIT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1000 ORD<=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .167
LIMIT(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 537 ORD<>(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .167
LN(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961 ORD=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
LOG(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962 ORD>(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
LOG(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 ORD>=(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .167
LOG10(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 ORD_EQ(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
LOGTRG . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 ORD_GE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
LOGTRGR . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 ORD_GT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
LT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004 ORD_LE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
ORD_LT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
M ORD_NE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .167
ORDT< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MAX(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998 ORDT<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MAX(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 641 ORDT<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 ORDT= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 ORDT> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MEAN(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . 661 ORDT>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MEF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 ORDT_EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 ORDT_GE . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MID(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1011 ORDT_GT . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MIDR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 ORDT_LE . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MIDW(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 ORDT_LT . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MIN(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998 ORDT_NE . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
MIN(P)(_U). . . . . . . . . . . . . . . . . . . . . . . . . . . 645 ORE< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
MINUS(P)(_U) . . . . . . . . . . . . . . . . . . . . . 188,190 ORE<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
MOD(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 979 ORE<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
1086
ORE= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 R
ORE> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
ORE>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 RAD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .512
ORE_EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 RAMPF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .570
ORE_GE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 RBFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .878
ORE_GT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 RCL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374
ORE_LE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 RCR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371
ORE_LT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 REAL_TO_DINT(_E). . . . . . . . . . . . . . . . . . . . .929
ORE_NE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 REAL_TO_INT(_E) . . . . . . . . . . . . . . . . . . . . . .927
OR_EQ(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 REAL_TO_STRING(_E) . . . . . . . . . . . . . . . . . .931
ORF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 REF(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .703
ORFI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 REPLACE(_E) . . . . . . . . . . . . . . . . . . . . . . . .1019
OR_GE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 RET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
OR_GT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 RETSTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . .719
ORI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 RFS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .703
OR_LE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 RIGHT(_E). . . . . . . . . . . . . . . . . . . . . . . . . . .1009
OR_LT(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 RIGHT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .445
OR_NE(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 165 RND(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .530
ORP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 ROL(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .989
ORPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 ROL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374
ORSTRING_EQ . . . . . . . . . . . . . . . . . . . . . . . 416 ROR(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .991
ORSTRING_GE . . . . . . . . . . . . . . . . . . . . . . . 416 ROR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371
ORSTRING_GT . . . . . . . . . . . . . . . . . . . . . . . 416 ROTC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .567
ORSTRING_LE . . . . . . . . . . . . . . . . . . . . . . . 416 RS(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1036
ORSTRING_LT . . . . . . . . . . . . . . . . . . . . . . . 416 RS2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .804
ORSTRING_NE . . . . . . . . . . . . . . . . . . . . . . . 416 RST . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123,127
ORTM< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 RST F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
ORTM<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 R_TRIG(_E) . . . . . . . . . . . . . . . . . . . . . . . . . .1038
ORTM<> . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
ORTM= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 S
ORTM> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
ORTM>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 S(P).CPRTCL . . . . . . . . . . . . . . . . . . . . . . . . .820
ORTM_EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 S(P).SOCRDATA . . . . . . . . . . . . . . . . . . . . . . .735
ORTM_GE . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 S(P)_CPRTCL . . . . . . . . . . . . . . . . . . . . . . . . .820
ORTM_GT . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 S(P)_SOCRDATA . . . . . . . . . . . . . . . . . . . . . .735
ORTM_LE . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 SCL(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .549
ORTM_LT . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 SCL2(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .555
ORTM_NE . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 SEGD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329
OUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114,120 SEGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331 I
OUT C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 SEL(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .996
OUT F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 SERMM(P) . . . . . . . . . . . . . . . . . . . . . . . . . . .631
OUT LC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121,125
OUT ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SET F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
OUT T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SET_BIT_OF_INT(_E) . . . . . . . . . . . . . . . . . . .955
OUT_C . . . . . . . . . . . . . . . . . . . . . . . . . . 117,118 SFL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
OUTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SFR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141
OUTH ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SFRD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406
OUTH T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SFT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139
OUTHS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SFTL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151
OUTHS ST . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SFTR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149
OUTHS T . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SFWR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .410
OUT_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SHL(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .985
SHR(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .987
SIMASK . . . . . . . . . . . . . . . . . . . . . . . . . . . . .392
P SIN(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .965
PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 SIN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500
PLF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 SMOV(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .351
PLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 SORTTBL(_U) . . . . . . . . . . . . . . . . . . . . . . . . .649
PLSV . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845,846 SORTTBL2(_U) . . . . . . . . . . . . . . . . . . . . . . . .652
PLSY . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581,585 SP.ECPRTCL . . . . . . . . . . . . . . . . . . . . . . . . .737
PLUS(P)(_U) . . . . . . . . . . . . . . . . . . . . . . 182,184 SP.SLMPSND . . . . . . . . . . . . . . . . . . . . . . . . .741
POP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 SP.SOCCINF . . . . . . . . . . . . . . . . . . . . . . . . . .733
POW(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 SP.SOCCLOSE . . . . . . . . . . . . . . . . . . . . . . . .725
PRUN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 SP.SOCOPEN . . . . . . . . . . . . . . . . . . . . . . . . .722
PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 SP.SOCRCV . . . . . . . . . . . . . . . . . . . . . . . . . .727
SP.SOCSND . . . . . . . . . . . . . . . . . . . . . . . . . .730
SPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .573
1087
SP_ECPRTCL . . . . . . . . . . . . . . . . . . . . . . . . 737 U
SP_SLMPSND . . . . . . . . . . . . . . . . . . . . . . . . 741
SP_SOCCINF . . . . . . . . . . . . . . . . . . . . . . . . 733 UDCNTF . . . . . . . . . . . . . . . . . . . . . . . . . . . . .565
SP_SOCCLOSE . . . . . . . . . . . . . . . . . . . . . . . 725 UDINT2DINT(P) . . . . . . . . . . . . . . . . . . . . . . . .305
SP_SOCOPEN . . . . . . . . . . . . . . . . . . . . . . . . 722 UDINT2FLT(P) . . . . . . . . . . . . . . . . . . . . . . . . .490
SP_SOCRCV . . . . . . . . . . . . . . . . . . . . . . . . . 727 UDINT2INT(P) . . . . . . . . . . . . . . . . . . . . . . . . .303
SP_SOCSND . . . . . . . . . . . . . . . . . . . . . . . . . 730 UDINT2UINT(P) . . . . . . . . . . . . . . . . . . . . . . . .304
SQRT(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 960 UINT2DINT(P) . . . . . . . . . . . . . . . . . . . . . . . . .298
SQRT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665 UINT2FLT(P) . . . . . . . . . . . . . . . . . . . . . . . . . .488
SR(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1034 UINT2INT(P) . . . . . . . . . . . . . . . . . . . . . . . . . .297
SRET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 UINT2UDINT(P) . . . . . . . . . . . . . . . . . . . . . . . .299
STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 UNI(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .335
STMR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
STOH(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683 V
STOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
STR(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 432 VAL(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .318
STRDEL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 459
STRINGMOV(P) . . . . . . . . . . . . . . . . . . . . . . . 423 W
STRINGPLUS(P) . . . . . . . . . . . . . . . . . . . 419,421
STRING_TO_BOOL(_E) . . . . . . . . . . . . . . . . . 940 WAND(P). . . . . . . . . . . . . . . . . . . . . . . . . 249,250
STRING_TO_DINT(_E) . . . . . . . . . . . . . . . . . . 943 WBFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .881
STRING_TO_INT(_E) . . . . . . . . . . . . . . . . . . . 941 WDT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .394
STRING_TO_REAL(_E) . . . . . . . . . . . . . . . . . 945 WOR(P) . . . . . . . . . . . . . . . . . . . . . . . . . 255,256
STRING_TO_TIME(_E) . . . . . . . . . . . . . . . . . . 948 WORD_TO_BOOL(_E) . . . . . . . . . . . . . . . . . . .890
STRINS(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 WORD_TO_DINT(_E) . . . . . . . . . . . . . . . . . . . .893
SUB(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 975 WORD_TO_DWORD(_E) . . . . . . . . . . . . . . . . .891
SUB(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . 192 WORD_TO_INT(_E) . . . . . . . . . . . . . . . . . . . . .892
SUB_TIME(_E) . . . . . . . . . . . . . . . . . . . . . . . 1026 WORD_TO_TIME(_E). . . . . . . . . . . . . . . . . . . .894
SUM(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635 WSFL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155
SWAP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 WSFR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153
WSUM(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . .658
WTOB(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .341
T WXNR(P). . . . . . . . . . . . . . . . . . . . . . . . . 267,268
TADD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675 WXOR(P) . . . . . . . . . . . . . . . . . . . . . . . . 261,262
TAN(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967
TAN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 X
TBL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837,838
TCMP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 XCALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .404
TEST(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 XCH(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .360
TIMER_100_FB_M . . . . . . . . . . . . . . . . . . . . 1057 XOR(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .993
TIMER_10_FB_M . . . . . . . . . . . . . . . . . . . . . 1057
TIMER_1_FB_M . . . . . . . . . . . . . . . . . . . . . . 1057 Z
TIMER_CONT_FB_M . . . . . . . . . . . . . . . . . . 1057
TIMER_CONTHS_FB_M . . . . . . . . . . . . . . . . 1057 ZCP(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . . .173
TIME_TO_BOOL(_E) . . . . . . . . . . . . . . . . . . . 934 ZONE(P)(_U) . . . . . . . . . . . . . . . . . . . . . . . . . .545
TIME_TO_DINT(_E) . . . . . . . . . . . . . . . . . . . . 938 ZPOP(P) . . . . . . . . . . . . . . . . . . . . . . . . . 533,536
TIME_TO_DWORD(_E). . . . . . . . . . . . . . . . . . 936 ZPOP(P)_2 . . . . . . . . . . . . . . . . . . . . . . . . . . .536
TIME_TO_INT(_E) . . . . . . . . . . . . . . . . . . . . . 937 ZPUSH(P) . . . . . . . . . . . . . . . . . . . . . . . . 531,534
TIME_TO_STRING(_E) . . . . . . . . . . . . . . . . . . 939 ZPUSH(P)_2 . . . . . . . . . . . . . . . . . . . . . . . . . .534
TIME_TO_WORD(_E) . . . . . . . . . . . . . . . . . . . 935 ZRST(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
TO(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . 707,708
TOD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . 713,714
TOF(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1055
TOF_10(_E) . . . . . . . . . . . . . . . . . . . . . . . . . 1055
TON(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053
TON_10(_E) . . . . . . . . . . . . . . . . . . . . . . . . . 1053
TP(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1051
TP_10(_E) . . . . . . . . . . . . . . . . . . . . . . . . . . 1051
TRD(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
TSUB(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
TTMR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
TWR(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
TZCP(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
1088
MEMO
1089
REVISIONS
Revision date Revision Description
October 2014 A First Edition
January 2015 B ■Added or modified parts
Section 6.5, 6.6, 7.12, 7.16, 7.17, Chapter 8, 9, 10, 11, 12, 13, Appendix 1
"FBD/LD language" (for each instruction)
Error correction
February 2015 C Error correction
April 2015 D A part of the cover design is changed.
August 2015 E ■Added or modified parts
RELEVANT MANUALS, Section 8.24, 10.1, Chapter 12, Appendix 3
Section 1.4 was changed to Chapter 2.
May 2016 F ■Added or modified parts
RELEVANT MANUALS, TERMS, Section 4.1, 4.2, 8.2, 8.15, 8.24, Chapter 12, 13, 14, 16
October 2016 G ■Added or modified parts
TEAMS, 3.3, 3.5, 6.3, 8.25, 10.3, 10.4, 14.1, Appendix 2, 3
April 2017 H ■Added or modified parts
RELEVANT MANUALS, TERM, Section 4.6, Chapter 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 24, 30,
Appendix 2, 3
This manual confers no industrial property rights or any rights of any other kind, nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot
be held responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual.
1090
WARRANTY
Please confirm the following product warranty details before using this product.
1. Gratis Warranty Term and Gratis Warranty 2. Onerous repair term after discontinuation
Range of production
If any faults or defects (hereinafter "Failure") found to (1) Mitsubishi shall accept onerous product repairs for
be the responsibility of Mitsubishi occurs during use of seven (7) years after production of the product is
the product within the gratis warranty term, the discontinued.
product shall be repaired at no cost via the sales Discontinuation of production shall be notified with
representative or Mitsubishi Service Company. Mitsubishi Technical Bulletins, etc.
However, if repairs are required onsite at domestic or (2) Product supply (including repair parts) is not
overseas location, expenses to send an engineer will available after production is discontinued.
be solely at the customer's discretion. Mitsubishi shall
not be held responsible for any re-commissioning,
3. Overseas service
maintenance, or testing on-site that involves Overseas, repairs shall be accepted by Mitsubishi's
replacement of the failed module. local overseas FA Center. Note that the repair
conditions at each FA Center may differ.
[Gratis Warranty Term] 4. Exclusion of loss in opportunity and
The gratis warranty term of the product shall be for secondary loss from warranty liability
one year after the date of purchase or delivery to a Regardless of the gratis warranty term, Mitsubishi
designated place. Note that after manufacture and shall not be liable for compensation to:
shipment from Mitsubishi, the maximum distribution (1) Damages caused by any cause found not to be
period shall be six (6) months, and the longest gratis the responsibility of Mitsubishi.
warranty term after manufacturing shall be eighteen (2) Loss in opportunity, lost profits incurred to the
(18) months. The gratis warranty term of repair parts user by Failures of Mitsubishi products.
shall not exceed the gratis warranty term before (3) Special damages and secondary damages
repairs. whether foreseeable or not, compensation for
accidents, and compensation for damages to
[Gratis Warranty Range] products other than Mitsubishi products.
(4) Replacement by the user, maintenance of on-site
(1) The range shall be limited to normal use within the
equipment, start-up test run and other tasks.
usage state, usage methods and usage
environment, etc., which follow the conditions and 5. Changes in product specifications
precautions, etc., given in the instruction manual, The specifications given in the catalogs, manuals or
user's manual and caution labels on the product. technical documents are subject to change without
(2) Even within the gratis warranty term, repairs shall prior notice.
be charged for in the following cases. 6. Product application
1. Failure occurring from inappropriate storage or (1) In using the Mitsubishi MELSEC programmable
handling, carelessness or negligence by the controller, the usage conditions shall be that the
user. Failure caused by the user's hardware or application will not lead to a major accident even if
software design. any problem or fault should occur in the
2. Failure caused by unapproved modifications,
programmable controller device, and that backup
etc., to the product by the user.
and fail-safe functions are systematically provided
3. When the Mitsubishi product is assembled into
outside of the device for any problem or fault.
a user's device, Failure that could have been
avoided if functions or structures, judged as (2) The Mitsubishi programmable controller has been
necessary in the legal safety measures the designed and manufactured for applications in
user's device is subject to or as necessary by general industries, etc. Thus, applications in which
industry standards, had been provided. the public could be affected such as in nuclear
4. Failure that could have been avoided if power plants and other power plants operated by
consumable parts (battery, backlight, fuse, respective power companies, and applications in
etc.) designated in the instruction manual had which a special quality assurance system is
been correctly serviced or replaced. required, such as for railway companies or public
5. Relay failure or output contact failure caused service purposes shall be excluded from the
by usage beyond the specified life of contact programmable controller applications.
(cycles). In addition, applications in which human life or
6. Failure caused by external irresistible forces property that could be greatly affected, such as in
such as fires or abnormal voltages, and failure aircraft, medical applications, incineration and fuel
caused by force majeure such as earthquakes, devices, manned transportation, equipment for
lightning, wind and water damage. recreation and amusement, and safety devices,
7. Failure caused by reasons unpredictable by shall also be excluded from the programmable
scientific technology standards at time of controller range of applications.
shipment from Mitsubishi. However, in certain cases, some applications may
8. Any other failure found not to be the be possible, providing the user consults their local
responsibility of Mitsubishi or that admitted not Mitsubishi representative outlining the special
to be so by the user. requirements of the project, and providing that all
parties concerned agree to the special
circumstances, solely at the user's discretion.
1091
TRADEMARKS
Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or
other countries.
Ethernet is a trademark of Xerox Corporation.
Anywire and ANYWIREASLINK is a registered trademark of the Anywire Corporation.
MODBUS is a registered trademark of Schneider Electric SA.
The company name and the product name to be described in this manual are the registered trademarks or trademarks of
each company.
1092
Manual number: JY997D55801H
Model: FX5-P-MF-E
Model code: 09R539
When exported from Japan, this manual does not require application to the
Ministry of Economy, Trade and Industry for service transaction permission.
HEAD OFFICE: TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN