• 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.
Describes basic knowledge required for program design, functions of the CPU module, <JY997D55401> devices/labels, and parameters. MELSEC iQ-F FX5 Series Programming Manual [Program Design] Describes specifications of ladders, ST, and other programs and labels. <JY997D55701> MELSEC iQ-F FX5 Series Programming Manual [Instructions, Describes specifications of instructions and functions that can be used in programs.
Page 17
User's manual [Application] Abbreviation of MELSEC iQ-F FX5 Series User's Manual [Application] Programming manual Generic term for MELSEC iQ-F FX5 Series Programming Manual [Program Design] and MELSEC iQ-F FX5 Series Programming Manual [Instructions, Standard Functions/Function Blocks] Programming manual [Program Design]...
HOW TO READ THIS MANUAL The following describes the page layout and symbols used in this manual. How to read PART 3 and PART 4 The contents described in this section are provided only for explaining how to read this manual. Thus, the actual description may differ.
Page 19
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 Series Programming Manual [Program Design] Indicates the applicable devices for each operand. The following table describes the usage classification.
Page 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. Indicates function symbols. When character strings in brackets are added to the end of the function symbol for standard functions and function blocks, the function symbol indicates multiple functions.
OVERVIEW Instruction Configuration Many instructions available for CPU module are each divided into the instruction part and device part. The instruction part and device part are used as follows. • Instruction part: Indicates the function of the relevant instruction. • Device part: Indicates the data used for the instruction. The device part is further classified to source data, destination data, and numerical data.
Data Specification Method The following table lists the types of data that can be used for instructions in CPU modules. Data used in devices and labels 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...
Page 24
Label data ■Primitive data type Data type (label) Specifiable label • Bit type label (BOOL) • Bit-specified word [unsigned]/bit string [16 bits] type label • Bit-specified word [signed] type label • Timer/retentive timer/long timer/long retentive timer type label contact/coil • Counter/ long counter type label contact/coil Word [unsigned]/bit string [16 bits] •...
Page 25
■Generic data type Data type (label) Specifiable label Bit, word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits], single-precision real number, hour, character string, structure ANY_BITADDR ANY_BOOL ANY_ELEMENTARY Bit, word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits], single-precision real number, hour, character string ANY_WORDADDR Word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits],...
Bit data Data size and data range Bit data is handled in increments of bits such as contacts and coils. Data name Data size Value range Bit data 1 bit 0, 1 Handling bit data with bit devices and labels Bit data of one point per point can be handled.
16-bit data (word data) Data size and data range 16-bit data includes signed and unsigned 16-bit data. In signed 16-bit data, a negative number is represented in two's complement. Data name Data size Value range Decimal notation Hexadecimal notation Signed 16-bit data 16 bits (1 word) -32768 to 32767 0000H to FFFFH...
Page 28
Nibble specification range The following table lists the range of 16-bit data for each nibble specification. Nibble Decimal notation Hexadecimal notation specification 0 to 15 0H to FH 0 to 255 00H to FFH 0 to 4095 000H to FFFH Signed 16-bit data: -32768 to 32767 0000H to FFFFH Unsigned 16-bit data: 0 to 65535...
Handling 16-bit data with word devices/labels ■Word device One point of word device can handle 16-bit data. ■Word type label One point of word type label can handle 16-bit data. 32-bit data (double word data) Data size and data range 32-bit data includes signed and unsigned 32-bit data.
Page 30
Nibble specification range The following table lists the range of 32-bit data for each nibble specification. Nibble Decimal notation Hexadecimal notation specification 0 to 15 0H to FH 0 to 255 00H to FFH 0 to 4095 000H to FFFH 0 to 65535 0000H to FFFFH 0 to 1048575...
Page 31
■Specifying a bit device with nibble specification in the source (s) When a bit device with nibble specification is specified in the source of an instruction, 0 is stored in the bits, which follow the bit for which nibble specification is made in the source, in the word device of the destination. Ladder example Processing •...
Real number data (floating-point data) Data size and data range Real number data includes single-precision 32-bit real number data. Real number data can be stored only in devices other than bit devices or in single-precision real data type labels. Data name Data size Value range -126...
Page 33
The monitor function of the engineering tool can monitor real number data of CPU modules. To represent "0" in real number data, set all numbers in each of the following range to 0. • Single-precision real number data: b0 to b31 The setting range of real number data is as follows.
Character string data Format of character string data The following table lists the types of character string data, each of which ends with a NULL code to be handled as a character string. Type Character code Last character Character string ASCII code NULL(00H) Character string data is stored in devices or an array in ascending order of device numbers or array element numbers.
Execution Condition Types of execution conditions The following are the five types of execution conditions of the instructions and functions of CPU module. ■On An instruction is executed during on. It is executed only while the precondition of the instruction is on. When the precondition is off, the instruction is not executed.
Precautions on Programming Errors common to instructions The following table lists the conditions under which an error occurs when the instruction is executed. Error content Error code An I/O number which corresponds to no module is specified. 2801 • An I/O number which is out of range (0 to 1777(Octal number)) is specified. 2820 •...
Operations arising when the OUT, SET/RST, and PLS/PLF instructions of the same device are used If two or more OUT, SET/RST, and PLS/PLF instructions are executed using the same device during one scan, they operate as described in this section. For OUT instructions of the same device More than one OUT instruction of the same device must not be issued during one scan.
Page 38
If SET/RST instructions of the same device are used ■For SET instructions The SET instruction turns on the specified device if the execution command is on, and causes no operation if it is off. Thus, if two or more SET instructions of the same device are executed during one scan, the specified device turns on even if one execution command is on.
Page 39
If PLS instructions of the same device are used The PLS instruction turns on the specified device when the execution command specifies an off-to-on change. The specified device is turned off unless the execution command specifies an off-to-on change (i.e. off to off, on to on, on to off). Thus, if two or more PLS instructions of the same device are issued during one scan, the specified device is turned on when the execution command of each PLS instruction specifies an off-to-on change.
Page 40
• If the off-to-on changes of X0 and X1 are at the same timing PLS M0 PLS M0 PLS M0 (1) Since X0 turns on, M0 turns on. (2) Since X1 turns on, M0 remains on. (3) Since X0 is other than turning on, M0 turns off. (4) Since X1 is other than turning on, M0 remains off.
Page 41
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 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 on-to-off change.
Page 42
• If the on-to-off changes of X0 and X1 are at the same timing PLF M0 PLF M0 PLF M0 (1) Since X0 turns off, M0 turns on. (2) Since X1 turns off, M0 remains on. (3) Since X0 is other than turning off, M0 turns off. (4) Since X1 is other than turning off, M0 remains off.
PART 2 INSTRUCTION/ FUNCTION LIST This part consists of the following chapters. 2 CPU MODULE INSTRUCTION 3 MODULE SPECIFIC INSTRUCTION 4 STANDARD FUNCTIONS/FUNCTION BLOCKS...
CPU MODULE INSTRUCTION Sequence Instruction Contact instruction ■Operation start, series connection, parallel connection Instruction symbol Description Reference Starts logical operation (Starts NO contact logical operation) Page 98 Starts logical NOT operation (Starts NC contact logical operation) Logical AND (NO contact series connection) Logical NAND (NC contact series connection) Logical OR (NO contact parallel connection) Logical NOR (NC contact parallel connection)
Page 45
■Converting the operation result into a pulse Instruction symbol Description Reference Conversion of operation result to rising edge pulse Page 107 Conversion of operation result to falling edge pulse Output instruction ■Out (excluding the timer, counter and annunciator) Instruction symbol Description Reference Device output...
Page 46
Shift instruction ■Shifting bit devices Instruction symbol Description Reference 1 bit shift of the device Page 125 SFTP ■Shifting 16-bit data to the right/left by n bit (s) Instruction symbol Description Reference Page 127 bn-1 Carry flag SFRP (SM700, SM8022) 0···0 Page 128 bn+1 bn...
Page 47
■Shifting n-bit data to the right/left by n bit (s) Instruction symbol Description Reference SFTR Page 133 (n1) (n2) (n2) SFTRP SFTL Page 134 (n1) (n2) (n2) SFTLP ■Shifting n-word data to the right/left by n word (s) Instruction symbol Description Reference WSFR...
Page 53
■Adding/subtracting 16-bit binary block data Instruction symbol Description Reference Adds the 16-bit binary bit data in the device area ((n) points) from (s1) and the data or constants in Page 202 the device area ((n) points) from (s2) at once, and stores the result in the device area ((n) points) BK+P from (d).
Page 54
Logical operation instruction ■Performing an AND operation on 16-bit/32-bit data Instruction symbol Description Reference (d)(s) (d) WAND Page 215 WANDP (s1) (s2) (d) WAND Page 216 WANDP [(d)+1, (d)] [(s)+1, (s)] [(d)+1, (d)] DAND Page 217 DANDP [(s1)+1, (s1)]...
Page 55
■Performing an XNOR operation on 16-bit/32-bit data Instruction symbol Description Reference WXNR Page 230 WXNRP WXNR Page 231 (s1) (s2) WXNRP DXNR Page 232 [(d)+1, (d)] [(s)+1, (s)] [(d)+1, (d)] DXNRP DXNR Page 233 [(s1)+1, (s1)] [(s2)+1, (s2)] [(d)+1, (d)] DXNRP ■Performing an XNOR operation on 16-bit block data Instruction symbol...
Page 56
■Batch-resetting devices Instruction symbol Description Reference ZRST Page 240 (d2) (d1)+2 (d1)+1 (d1) (d1), (d2) are bit devices: Writes off (reset) from (d1) to (d2) ZRSTP (d1), (d2) are word devices: Writes K0 from (d1) to (d2) (d2) (d1)+2 (d1)+1 (d1) Data conversion instruction ■Converting binary data to BCD 4-digit/8-digit data...
Page 57
■Converting 16-bit signed binary data to 32-bit signed binary data Instruction symbol Description Reference INT2DINT Converts 16-bit signed data in the device specified by (s) to 32-bit signed data, and stores the Page 256 converted data in the device specified by (d). INT2DINTP ■Converting 16-bit unsigned binary data to 16-bit/32-bit signed binary data Instruction symbol...
Page 58
■Converting 16-bit/32-bit binary data to Gray code Instruction symbol Description Reference Page 266 Conversion to gray code BIN (-32768 to 32767) GRYP GRY_U Conversion to gray code BIN (0 to 65535) GRYP_U DGRY Page 267 Conversion to gray code (s+1, s) (d+1, d) BIN (-2147483648 to 2147483647) DGRYP...
Page 59
■Converting character string to 16-bit/32-bit binary data Instruction symbol Description Reference Converts a character string including decimal point in the device specified by (s) to a 1 word binary Page 277 value and number of decimal fraction digits, and stores the converted data in the devices specified VALP by (d1) and (d2).
Page 60
Data transfer instruction ■Transferring 16-bit/32-bit data Instruction symbol Description Reference Page 296 MOVP DMOV Page 297 (s+1, s) (d+1, d) DMOVP ■Inverting and transferring 16-bit/32-bit data Instruction symbol Description Reference Page 298 CMLP DCML Page 299 (s+1, s) (d+1, d) DCMLP ■Shift move Instruction symbol...
Page 61
■Exchanging 16-bit/32-bit data Instruction symbol Description Reference Page 307 (d1) (d2) XCHP DXCH Page 308 (d1+1, d1) (d2+1, d2) DXCHP ■Exchanging the upper and lower bytes of 16-bit data Instruction symbol Description Reference SWAP Page 309 ··· b8 b7 ··· 8 bits 8 bits SWAPP...
Application instruction Rotation instruction ■Rotating 16-bit data to the right Instruction symbol Description Reference Page 317 Carry flag (SM700, SM8022) RORP (n) bit right rotation Carry flag (SM700, SM8022) RCRP (n) bit right rotation ■Rotating 16-bit data to the left Instruction symbol Description Reference...
Page 63
Program branch instruction ■Pointer branch Instruction symbol Description Reference When the input condition is met, jump to pointer (P) Page 326 ■Jumping to END Instruction symbol Description Reference GOEND When the input condition is met, jump to END instruction Page 329 Program execution control instruction ■Disabling/enabling interrupt programs Instruction symbol...
Page 64
■Calling a subroutine program Instruction symbol Description Reference CALL Executes a subroutine program specified by (P) when the input condition is met. Page 344 CALLP ■Returning from the subroutine program Instruction symbol Description Reference Returns from the subroutine program. Page 348 SRET ■Calling a subroutine program Instruction symbol...
Page 65
■Deleting/inserting data from/to the data table Instruction symbol Description Reference FINS Page 357 Number of stored data Number of stored data +1 FINSP Specify by (n) FDEL Page 359 Number of stored data Number of stored data -1 FDELP Specify by (n) Character string operation instruction ■Comparing character strings Instruction symbol...
Page 66
■Converting 16-bit/32-bit binary data to decimal ASCII Instruction symbol Description Reference BINDA Converts the 1 word binary value specified by (s) to 5 digits decimal ASCII value, and stores in the Page 370 word device specified by (d). BINDAP BINDA_U BINDAP_U DBINDA Converts the 2 word binary value specified by (s) to 10 digits decimal ASCII value, and stores in the...
Page 67
■Storing/replacing the specified number of character strings Instruction symbol Description Reference MIDR Stores the specified number of characters from the position specified by (s2) of the character string Page 394 (s1) into the device specified by (d). MIDRP MIDW Stores the specified number of characters from the character string (s1) into the location specified Page 396 by (s2) of the character string (d).
Page 68
Instruction symbol Description Reference • In case of 3 operands Page 413 [(s1)+1, (s1)] - [(s2)+1, (s2)] [(d)+1, (d)] DESUB Page 416 DESUBP ■Multiplying/dividing single-precision real numbers Instruction symbol Description Reference [(s1)+1, (s1)] [(s2)+1, (s2)] [(d)+1, (d)] Page 418 DEMUL Page 422...
Page 69
■Transferring single-precision real number data Instruction symbol Description Reference EMOV Page 438 (s+1, s) (d+1, d) EMOVP Real number DEMOV DEMOVP ■Calculating the sine of single-precision real number Instruction symbol Description Reference Sin [(s)+1, (s)] [(d)+1, (d)] Page 439 SINP DSIN DSINP...
Page 70
■Converting single-precision real number angle to radian Instruction symbol Description Reference Page 451 (s+1, s) (d+1, d) Converts from degrees to radians RADP DRAD DRADP ■Converting single-precision real number radian to angle Instruction symbol Description Reference Page 452 (s+1, s) (d+1, d) Converts from radians to degrees DEGP...
Page 71
■Searching the minimum value of single-precision real number Instruction symbol Description Reference EMIN These instructions search for the minimum value in the (n) points of single-precision real number Page 463 block data specified by the device starting from the one specified by (s), and store the minimum EMINP value in the device areas specified by (d).
Page 72
■Dead band control of 16-bit/32-bit binary data Instruction symbol Description Reference When (s1) (s3) (s2): 0 (d) BAND Page 476 When (s3) < (s1): (s3) - (s1) (d) BANDP When (s2) < (s3): (s3) - (s2) (d) BAND_U BANDP_U When [(s1)+1, (s1)] ...
Page 73
Special timer instruction ■Teaching timer Instruction symbol Description Reference TTMR Page 496 (On time of TTMR) (s) (s)=0:1, (s)=1:10, (s)=2:100 ■Special function timer Instruction symbol Description Reference STMR The 4 points from the bit device specified by (d) operate as shown below, depending on the ON/ Page 498 OFF status of the input conditions for the STMR instruction: (d)+0: Off delay timer output...
Page 74
■32-bit binary data absolute method Instruction symbol Description Reference DABSD Creates many output patterns corresponding to the current value of a counter. Page 540 ■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 542 from (s1) (which occupies (n) lines ...
Page 75
■Searching the maximum value of 16-bit/32-bit data Instruction symbol Description Reference This instruction searches the data of (n) points from the device specified by (s) in 16-bit units, and Page 555 stores the maximum value in the device specified by (d). MAXP MAX_U MAXP_U...
Page 76
■Calculating the mean value of 16-bit/32-bit data Instruction symbol Description Reference MEAN These instructions calculate the mean value of (n) points (16-bit binary data) in the devices starting Page 570 from the one specified by (s), and store the result in the device specified by (d). MEANP MEAN_U MEANP_U...
Page 78
■Comparing time data Instruction symbol Description Reference LDTM=, ANDTM=, ORTM= Page 594 (s1) (s2) Hour Hour (s1)+1 (s2)+1 Minute Minute Result (s1)+2 Seconds (s2)+2 Seconds LDTM<>, ANDTM<>, (s1) (s2) Hour Hour ORTM<> (s1)+1 (s2)+1 Minute < > Minute Result Seconds Seconds (s1)+2 (s2)+2...
Page 79
■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 603 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.
Built-in Ethernet Function Instruction Socket communication function instruction ■Opening a connection Instruction symbol Description Reference SP.SOCOPEN This instruction opens the connection specified by (s1). Page 619 ■Closing a connection Instruction symbol Description Reference SP.SOCCLOSE This instruction closes the connection specified by (s1). (Closing a connection) Page 622 ■Reading receive data during the END processing Instruction symbol...
MODULE SPECIFIC INSTRUCTION High-speed Counter Instruction High-speed processing instruction ■Setting 32-bit data comparison Instruction symbol Description Reference DHSCS Turns ON the bit device of (d) when the current value of the high-speed counter of CH specified by Page 634 (s2) is changed to the value specified by (s1). ■Reset 32-bit data comparison Instruction symbol Description...
Positioning Instruction Positioning instruction ■Zero return(OPR) with 16-bit/32- bit data DOG search Instruction symbol Description Reference DSZR • When FX3 series-compatible operand is specified Page 650 Specifies the proximity dog signal, zero signal and device (Y). Outputs a pulse with the specified DDSZR Page 652 device (Y) to perform the zero return operation.
■16-bit/32-bit data absolute positioning Instruction symbol Description Reference DRVA • When FX3 series-compatible operand is specified Page 671 Specifies the travel distance from the reference position, speed and performs pulse output with the DDRVA Page 673 specified device (Y). • When FX5 series operand is specified Specifies the travel distance from the reference position, speed and performs pulse output with the specified axis number.
BFM Device Read/ Write Instruction Divided BFM Read Instruction symbol Description Reference RBFM Divides and reads data from the continuous buffer memory in the intelligent module. Page 684 (This instruction cannot be used with the FX5 series intelligent module.) Divided BFM Write Instruction symbol Description Reference...
STANDARD FUNCTIONS/FUNCTION BLOCKS Standard Functions Type conversion functions Converting BOOL to WORD/DWORD Function symbol Description Reference BOOL_TO_WORD Converts BOOL type data to WORD type data. Page 690 BOOL_TO_WORD_E BOOL_TO_DWORD Converts BOOL type data to DWORD type data. Page 691 BOOL_TO_DWORD_E Converting BOOL to INT/DINT Function symbol Description...
Page 86
Converting WORD to INT/DINT Function symbol Description Reference WORD_TO_INT Converts WORD type data to INT type data. Page 698 WORD_TO_INT_E WORD_TO_DINT Converts WORD type data to DINT type data. Page 699 WORD_TO_DINT_E Converting WORD to TIME Function symbol Description Reference WORD_TO_TIME Converts WORD type data to TIME type data.
Page 87
Converting INT to DINT Function symbol Description Reference INT_TO_DINT Converts INT type data to DINT type data. Page 711 INT_TO_DINT_E Converting INT to BCD Function symbol Description Reference INT_TO_BCD Converts INT type data to BCD type data. Page 712 INT_TO_BCD_E Converting INT to REAL Function symbol Description...
Page 88
Converting DINT to BCD Function symbol Description Reference DINT_TO_BCD Converts DINT type data to BCD type data. Page 723 DINT_TO_BCD_E Converting DINT to REAL Function symbol Description Reference DINT_TO_REAL Converts DINT type data to REAL type data. Page 725 DINT_TO_REAL_E Converting DINT to TIME Function symbol Description...
Page 89
Converting TIME to WORD/DWORD Function symbol Description Reference TIME_TO_WORD Converts TIME type data to WORD type data. Page 741 TIME_TO_WORD_E TIME_TO_DWORD Converts TIME type data to DWORD type data. Page 742 TIME_TO_DWORD_E Converting TIME to INT/DINT Function symbol Description Reference TIME_TO_INT Converts TIME type data to INT type data.
Page 90
Converting INT/DINT to bit array Function symbol Description Reference INT_TO_BITARR Outputs low-order (n) bits of INT type data to a bit array. Page 757 INT_TO_BITARR_E DINT_TO_BITARR Outputs low-order (n) bits of DINT type data to a bit array. Page 758 DINT_TO_BITARR_E Bit array copy Function symbol...
Standard functions of one numeric variable Absolute value Function symbol Description Reference Outputs the absolute value of an input value. Page 764 ABS_E Square root Function symbol Description Reference SQRT Outputs the square root of an input value. Page 766 SQRT_E Natural logarithm operation Function symbol...
Arc cosine operation Function symbol Description Reference ACOS Outputs the arc cosine value of an input value. Page 775 ACOS_E Arc tangent operation Function symbol Description Reference ATAN Outputs the arc tangent value of an input value. Page 776 ATAN_E Standard arithmetic functions Addition Function symbol...
Standard bit shift functions Shifting n-bit data to left/right Function symbol Description Reference Shifts an input value leftward by (n) bits and outputs the result. Page 791 SHL_E Shifts an input value rightward by (n) bits and outputs the result. Page 793 SHR_E Rotating n-bit data to left/right...
Multiplexer Function symbol Description Reference Outputs one of multiple input values. Page 808 MUX_E Standard comparison functions Compare Function symbol Description Reference Outputs the data comparison result of input values. Page 810 GT_E GE_E EQ_E LE_E LT_E Page 812 NE_E Standard character string functions Character string length detection Function symbol...
Inserting character string Function symbol Description Reference INSERT Inserts a character string into another character string and output the result. Page 821 INSERT_E Deleting character string Function symbol Description Reference DELETE Deletes an arbitrary range of a character string and outputs the result. Page 823 DELETE_E Replacing character string...
Standard Function Blocks Bistable function blocks Bistable function blocks (set priority) Function block symbol Description Reference Judges two input values and outputs 1 (TRUE) or 0 (FALSE). (Set priority) Page 840 SR_E Bistable function blocks (reset priority) Function block symbol Description Reference Judges two input values and outputs 1 (TRUE) or 0 (FALSE).
Timer function blocks Timer function blocks Function block symbol Description Reference TIMER_1_FB_M When the execution condition is established, these function blocks start the timer count to the set Page 854 time. TIMER_10_FB_M TIMER_100_FB_M TIMER_CONT_FB_M TIMER_CONTHS_FB_M 4 STANDARD FUNCTIONS/FUNCTION BLOCKS 4.2 Standard Function Blocks...
Page 98
MEMO 4 STANDARD FUNCTIONS/FUNCTION BLOCKS 4.2 Standard Function Blocks...
PART 3 CPU MODULE INSTRUCTIONS This part consists of the following chapters. 5 SEQUENCE INSTRUCTIONS 6 BASIC INSTRUCTIONS 7 APPLICATION INSTRUCTION 8 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS...
SEQUENCE INSTRUCTIONS Contact Instructions Operation start, series connection, parallel connection LD, LDI, AND, ANI, OR, ORI • LD: NO contact operation start instruction/LDI: NC contact operation start instruction These instructions capture the ON/OFF information of the device specified by (s), and use that as the operation result. •...
Page 101
Processing details ■LD, LDI • The LD instruction is the NO contact operation start instruction, and the LDI instruction is the NC contact operation start instruction. These instructions capture the ON/OFF information of the specified device, and use the result as the operation result.
Pulse operation start, pulse series connection, pulse parallel connection LDP, LDF, ANDP, ANDF, ORP, ORF • LDP: Rising edge pulse operation start instruction This becomes conductive (ON) only at the rising edge (OFF to ON) of the bit device specified by (s). •...
Page 103
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 01.
Pulse NOT operation start, pulse NOT series connection, pulse NOT parallel connection LDPI, LDFI, ANDPI, ANDFI, ORPI, ORFI • LDPI: Rising edge pulse NOT operation start instruction This instruction becomes conductive (ON) at OFF, ON and the falling edge (ON to OFF) of the bit device specified by (s). •...
Page 105
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 10.
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 block B block A block B block Processing details ■ANB •...
Storing/reading/clearing the operation result MPS, MRD, MPP • MPS: This instruction stores the preceding operation result (ON/OFF) to memory. • MRD, MPP: These instructions read the operation result stored by the MPS instruction, and executes operations from the next step using that operation result. Ladder diagram Structured text ENO:=MPS(EN);...
Inverting the operation result This instruction inverts the operation result up to this instruction. Ladder diagram Structured text ENO:=INV(EN); Processing details • This instruction inverts the operation result up to this instruction. Operation result up to the INV Operation result after execution of instruction INV instruction Operation error...
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.
Output Instructions Out (excluding the timer, counter and annunciator) This instruction outputs the operation result up to this instruction to the specified device. Ladder diagram Structured text ENO:=OUT(EN,d); Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) ...
Timer OUT T, OUTH T, OUTHS T, OUT ST, OUTH ST, OUTHS ST The timer counts up to the set value when the operation result up to the OUT instruction is ON and the coil of the timer/ retentive timer specified by (d) turns ON. When the timer times up, NO contact becomes conductive and NC contact becomes non conductive.
Page 112
• OUTHS instruction: 0.001 to 32.767 seconds For the counting method, refer to the following. MELSEC iQ-F FX5 Series 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.
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.
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.
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) Annunciator number that turns ON ANY_BOOL ■Applicable devices...
Setting devices (excluding annunciator) The status of the device specified by (d) changes as follows when the execution command turns ON. • Bit device: Turns the coils and contacts ON. • Bit specification of word device: Set the specified bit to 1. Ladder diagram Structured text ENO:=SET(EN,d);...
Resetting devices (excluding annunciator) The status of the device specified by (d) changes as follows when the RST input turns ON. • Bit devices: Turns the coils and contacts OFF. • Timers, counters: Sets the current value to 0, and turns coils and contacts OFF. •...
Setting annunciator SET F This instruction turns ON the specified annunciator. Ladder diagram Structured text ENO:=SET(EN,d); Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) Annunciator number (F number) that is set ANY_BOOL ■Applicable devices Operand Word...
Resetting annunciator RST F This instruction turns OFF the specified annunciator. Ladder diagram Structured text ENO:=RST(EN,d); Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) Annunciator number (F number) that is reset ANY_ELEMENTARY ■Applicable devices Operand Word...
Setting annunciator (with check time) This instruction sets the annunciator (F device). Ladder diagram Structured text ENO:=ANS(EN,s,m,d); Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) Timer number for evaluation time 16-bit signed binary ANY16 Evaluation time data 1 to 32767...
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); 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.
Rising edge output This instruction turns ON the device specified by (d) for one scan when the PLS command turns from OFF to ON, and turns OFF in other cases. Ladder diagram Structured text ENO:=PLS(EN,d); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
Page 123
Precautions • When write during RUN is completed for a circuit including a rising edge instruction (LDP/ANDP/ORP instruction), the 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.
Falling edge output This instruction turns ON the device specified by (d) for one scan when the PLF command turns from ON to OFF, and turns OFF in other cases. Ladder diagram Structured text ENO:=PLF(EN,d); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
Inverting the bit device output This instruction reverses the output status of the device specified by (d) when the execution command changes from OFF to Ladder diagram Structured text ENO:=FF(EN,d); Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) ...
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) Bit device number whose output is alternated ANY_BOOL ■Applicable devices...
Shift Instructions Shifting bit devices SFT(P) • In case of bit device: These instructions shift the ON/OFF status of the device before the device specified by (d) to the device specified by (d). • When bit of word device is specified: These instructions shift the 1/0 status of the bit before the bit specified by (d) to the bit specified by (d).
Page 128
■When bit of word device is specified: • This instruction shifts the 1/0 status of the bit before the bit specified by (d) to the bit specified by (d). The bit before the bit specified by (d) becomes 0. 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.
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
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); Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
Shifting n-bit(s) data to the right by (n) bit(s) SFTR(P) These instructions shift (n1) bits of data to the right by (n2) bit(s) from the device specified by (d). Ladder diagram Structured text ENO:=SFTR(EN,s,n1,n2,d); ENO:=SFTRP(EN,s,n1,n2,d); (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
Shifting n-bit data to the left by n bit(s) SFTL(P) These instructions shift (n1) bits of data to the left by (n2) bit(s) from the device specified by (d). Ladder diagram Structured text ENO:=SFTL(EN,s,n1,n2,d); ENO:=SFTLP(EN,s,n1,n2,d); (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
Shifting n-word data to the right by n word(s) WSFR(P) This instruction shifts (n1) words of data to the right by (n2) word(s) from the device specified by (d). Ladder diagram Structured text ENO:=WSFR(EN,s,n1,n2,d); ENO:=WSFRP(EN,s,n1,n2,d); (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
Shifting n-word data to the left by n word(s) WSFL(P) This instruction shifts (n1) words of data to the left by (n2) word(s) from the device specified by (d). Ladder diagram Structured text ENO:=WSFL(EN,s,n1,n2,d); ENO:=WSFLP(EN,s,n1,n2,d); (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
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); Master control ladder Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type...
Page 140
Processing details These instructions create program with efficient ladder switching by opening/closing common buses in ladders. Ladder using master control is illustrated below. Display of engineering tool Actual operation ladder (1) Executed only when X0 is on ■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).
Page 141
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: Display of engineering tool Actual operation circuit...
Page 142
Precautions • If an instruction (e.g. LD, LDI) to be connected to the bus is not programmed following the MC instruction, a ladder error (error code: 33E0) occurs. • These instructions cannot be used in FOR to NEXT, P to RET (SRET), and I to IRET. Also, do not block by I, IRET, FEND, END, RET (SRET), etc.
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 ENO:=FEND(EN);...
Ending the sequence program This instruction indicates the end of a program. Ladder diagram Structured text 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. Sequence program •...
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);...
No Processing Instruction No operation This instruction is used, for example, to insert a space for debugging the program. Ladder diagram Structured text Not supported. Processing details ■NOP • Execution of the no processing instruction does not affect operation. • This instruction is used in the following instances: •...
BASIC INSTRUCTIONS Comparison Operation Instructions Comparing 16-bit binary data LD(_U), AND(_U), OR(_U) These instructions perform a comparison operation between the 16-bit binary data in the device specified by (s1) and the 16- bit binary data in the device specified by (s2). (Devices are used as NO contacts.) Ladder diagram Structured text Not supported...
Page 148
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...
Comparing 32-bit binary data LDD(_U), ANDD(_U), ORD(_U) These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the 32- bit binary data in the device specified by (s2). (Devices are used as NO contacts.) Ladder diagram Structured text Not supported...
Page 150
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...
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) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 152
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) 2820 The range of 3 points of data starting from the device specified by (d) exceeds said device. 6 BASIC INSTRUCTIONS 6.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) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 154
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) 2820 The range of 3 points of data starting from the device specified by (d) exceeds said device. 6 BASIC INSTRUCTIONS 6.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.
Page 156
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.
Comparing 32-bit binary data band DZCP(P)(_U) These instructions perform a comparison operation on the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2) with the 32-bit binary data in the device specified by comparison source (s3), and output the comparison result (below, within zone, above) to the device specified by (d) onwards.
Page 158
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.
Comparing 16-bit binary block data BKCMP(P)(_U) These instructions perform a comparison operation between (n) point(s) of 16-bit binary data in the device starting from the one specified by (s1) and (n) point(s) of 16-bit binary data in the device starting from the one specified by (s2), and store the operation result in the device specified by (d).
Page 160
• A constant can be directly specified in (s1). Operation result ∙∙∙ (s2) 32000 (BIN) (s2)+1 4321 (BIN) (d)+1 (s2)+2 32000 (BIN) (d)+2 (s1) 32000 (BIN) (s2)+(n-2) 1234 (BIN) (d)+(n-2) (s2)+(n-1) (d)+(n-1) 5678 (BIN) • The following table lists the comparison operation result of each instruction. Instruction symbol Condition Result...
Comparing 32-bit binary block data DBKCMP(P)(_U) These instructions perform a comparison operation between the (n) point(s) of 32-bit binary data starting from the device specified by (s1) and the (n) point(s) of 32-bit binary data starting from the device specified by (s2), and store the operation result in the device specified by (d).
Page 162
• A constant can be directly specified in (s1). Operation result ··· (s2)+1, (s2) 32700 (BIN) (s2)+3, (s2)+2 40000 (BIN) (d)+1 ··· (s2)+5, (s2)+4 32800 (BIN) >= (d)+2 (s1)+1, (s1) 32800 (BIN) (s2)+(2n-1), (s2)+(2n-2) 2147400 (BIN) (d)+(n-1) • (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).
Arithmetic Operation Instructions Adding 16-bit binary data +(P)(_U) instruction and ADD(P)(_U) instruction can be used for addition of 16-bit binary data. +(P)(_U) [using two operands] These instructions add the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the result in the device specified by (d).
Page 164
+(P)(_U) [using three operands] These instructions add the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=PLUS(EN,s1,s2,d);...
Page 165
ADD(P)(_U) These instructions add the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=ADDP(EN,s1,s2,d); ENO:=ADD_U(EN,s1,s2,d);...
Page 166
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. (D0)+25 →...
Subtracting 16-bit binary data -(P)(_U) instruction and SUB(P)(_U) instruction can be used for subtraction of 16-bit binary data. -(P)(_U) [using two operands] These instructions subtract the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the result in the device specified by (d).
Page 168
-(P)(_U) [using three operands] These instructions subtract the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=MINUS(EN,s1,s2,d);...
Page 169
SUB(P)(_U) These instructions subtract the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=SUBP(EN,s1,s2,d); ENO:=SUB_U(EN,s1,s2,d);...
Page 170
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. (D0)-25 →...
Adding 32-bit binary data D+(P)(_U) instruction and DADD(P)(_U) instruction can be used for addition of 32-bit binary data. D+(P)(_U) [using two operands] These instructions add the 32-bit binary data in the device specified by (d) and the 32-bit binary data in the device specified by (s), and store the result in the device specified by (d).
Page 172
D+(P)(_U) [using three operands] These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DPLUS(EN,s1,s2,d);...
Page 173
DADD(P)(_U) These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DADD(EN,s1,s2,d); ENO:=DADD_U(EN,s1,s2,d);...
Page 174
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.
Subtracting 32-bit binary data D-(P)(_U) instruction and DSUB(P)(_U) instruction can be used for subtraction of 32-bit binary data. D-(P)(_U) [using two operands] These instructions subtract the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the result in the device specified by (d).
Page 176
D-(P)(_U) [using three operands] These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DMINUS(EN,s1,s2,d);...
Page 177
DSUB(P)(_U) These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DSUB(EN,s1,s2,d); ENO:=DSUB_U(EN,s1,s2,d);...
Page 178
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.
Multiplying 16-bit binary data *(P)(_U) instruction and MUL(P)(_U) instruction can be used for multiplication of 16-bit binary data. *(P)(_U) These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
Page 180
MUL(P)(_U) These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=MULP(EN,s1,s2,d); ENO:=MUL_U(EN,s1,s2,d);...
Page 181
• Nibble can be specified ranging from K1 to K8 for (d). For example, when K2 is specified, only the lower-order 8 bits can be obtained out of the product (32 bits). (s1) (s2) Command input K2Y0 (s1) K53(0035H) × K15(000FH) (s2) When command contact is ON...
Dividing 16-bit binary data /(P)(_U) instruction and DIV(P)(_U) instruction can be used for division of 16-bit binary data. /(P)(_U) These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
Page 183
DIV(P)(_U) These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DIVP(EN,s1,s2,d); ENO:=DIV_U(EN,s1,s2,d);...
Page 184
Precautions ■Operation result • The most significant bit of the quotient and remainder indicates the sign (positive: 0, negative: 1), respectively. • The quotient is negative when either (s1) or (s2) is negative. The remainder is negative when the (s1) is negative. ■Device specified by (d) •...
Multiplying 32-bit binary data D*(P)(_U) instruction and DMUL(P)(_U) instruction can be used for multiplication of 32-bit binary data. D*(P)(_U) These instructions multiply the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
Page 186
Operation error Error code Description (SD0/SD8067) 2820 The range of the device specified by (d) exceeds the range of said device. 6 BASIC INSTRUCTIONS 6.2 Arithmetic Operation Instructions...
Page 187
DMUL(P)(_U) These instructions multiply the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DMUL(EN,s1,s2,d); ENO:=DMUL_U(EN,s1,s2,d);...
Page 188
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) 2820 The range of the device specified by (d) exceeds the range of said device. 6 BASIC INSTRUCTIONS 6.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).
Page 190
DDIV(P)(_U) These instructions divide the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DDIV(EN,s1,s2,d); ENO:=DDIV_U(EN,s1,s2,d);...
Page 191
Operation error Error code Description (SD0/SD8067) 2820 The range of the device specified by (d) exceeds the range of said device. 3400 0 is specified for (s2) value. 3403 Signed operation is performed and the operation result exceeds 2147483647. 6 BASIC INSTRUCTIONS 6.2 Arithmetic Operation Instructions...
Adding BCD 4-digit data B+(P) [using two operands] These instructions add the BCD 4-digit data in the device specified by (d) and the BCD 4-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
Page 193
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);...
Subtracting BCD 4-digit data B-(P) [using two operands] These instructions subtract the BCD 4-digit data in the device specified by (d) and the BCD 4-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
Page 195
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);...
Adding BCD 8-digit data DB+(P) [using two operands] These instructions add the BCD 8-digit data in the device specified by (d) and the BCD 8-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
Page 197
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);...
Subtracting BCD 8-digit data DB-(P) [using two operands] These instructions subtract the BCD 8-digit data in the device specified by (d) and the BCD 8-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
Page 199
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:=DBMINUSP(EN,s1,s2,d); ENO:=DBMINUS(EN,s1,s2,d); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand...
Multiplying BCD 4-digit data B*(P) These instructions multiply the BCD 4-digit data specified by (s1) and the BCD 4-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) Setting data ■Descriptions, ranges, and data types...
Dividing BCD 4-digit data B/(P) These instructions divide the BCD 4-digit data specified by (s1) by the BCD 4-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) Setting data ■Descriptions, ranges, and data types...
Multiplying BCD 8-digit data DB*(P) These instructions multiply the BCD 8-digit data specified by (s1) and the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) Setting data ■Descriptions, ranges, and data types...
Dividing BCD 8-digit data DB/(P) These instructions divide the BCD 8-digit data specified by (s1) by the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) Setting data ■Descriptions, ranges, and data types...
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 Not supported...
Page 205
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). •...
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 Not supported...
Page 207
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). •...
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 Not supported...
Page 209
Processing details • These instructions add (n) point(s) of 32-bit binary data from the device specified by (s1) and the (n) point(s) of 32-bit binary data from the device specified by (s2), and store the results of addition in the device specified by (d). •...
Page 210
Operation error Error code Description (SD0/SD8067) 2820 The range of (n) point(s) of data starting from the device specified by (s1), (s2), or (d) exceed the corresponding device range. 2821 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).
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 Not supported...
Page 212
• 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). If 4 points of the device from (s2) and (d) match ···...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) INC(P) Device to be incremented by +1 -32768 to +32767...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DEC(P) Device to be decremented by -1 -32768 to +32767...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DINC(P) Head device to be incremented by +1 -2147483648 to +2147483647...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DDEC(P) Head device to be decremented by 1 -2147483648 to +2147483647...
Logical Operation Instructions Performing an AND operation on 16-bit data WAND(P) [using two operands] These instructions AND each bit of 16-bit binary data from the device specified by (d) and each bit of 16-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
Page 218
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);...
Performing an AND operation on 32-bit data DAND(P) [using two operands] These instructions AND each bit of 32-bit binary data from the device specified by (d) and each bit of 32-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
Page 220
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);...
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);...
Performing an OR operation on 16-bit data WOR(P) [using two operands] 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). Ladder diagram Structured text Not supported...
Page 223
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);...
Performing an OR operation on 32-bit data DOR(P) [using two operands] 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). Ladder diagram Structured text Not supported...
Page 225
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);...
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);...
Performing an XOR operation on 16-bit data WXOR(P) [using two operands] 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). Ladder diagram Structured text Not supported...
Page 228
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);...
Performing an XOR operation on 32-bit data DXOR(P) [using two operands] 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). Ladder diagram Structured text Not supported...
Page 230
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);...
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);...
Performing an XNOR operation on 16-bit data WXNR(P) [using two operands] 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). Ladder diagram Structured text Not supported...
Page 233
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);...
Performing an XNOR operation on 32-bit data DXNR(P) [using two operands] 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). Ladder diagram Structured text Not supported...
Page 235
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);...
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);...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
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) Setting data ■Descriptions, ranges, and data types Operand Description Range...
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) Setting data ■Descriptions, ranges, and data types Operand Description Range...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Head device to be reset ANY_BOOL ...
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);...
Page 243
• 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). FMOV K100 K0 is written to D0 to D99. 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.
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.
Page 245
Number of digits Data range K1Y0 1-digit 0 to 9 K2Y0 2-digit 00 to 99 K3Y0 3-digit 000 to 999 K4Y0 4-digit 0000 to 9999 Precautions • Binary data is used in all operations in CPU module including arithmetic operations (+-), increment and decrement instructions.
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.
Page 247
(d)+1, (d) Number of digits Data range K1Y0 1-digit 0 to 9 K2Y0 2-digit 00 to 99 K3Y0 3-digit 000 to 999 K4Y0 4-digit 0000 to 9999 K5Y0 5-digit 00000 to 99999 K6Y0 6-digit 000000 to 999999 K7Y0 7-digit 0000000 to 9999999 K8Y0 8-digit 00000000 to 99999999...
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.
Page 249
Number of digits Data range K1X0 1-digit 0 to 9 K2X0 2-digit 00 to 99 K3X0 3-digit 000 to 999 K4X0 4-digit 0000 to 9999 Precautions • Binary data is used in all operations in CPU module including arithmetic operations (+-), increment and decrement instructions.
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.
Page 251
(s)+1, (s) Number of digits Data range K1X0 1-digit 0 to 9 K2X0 2-digit 00 to 99 K3X0 3-digit 000 to 999 K4X0 4-digit 0000 to 9999 K5X0 5-digit 00000 to 99999 K6X0 6-digit 000000 to 999999 K7X0 7-digit 0000000 to 9999999 K8X0 8-digit 00000000 to 99999999...
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 first digit after the decimal point of the single- precision real number is rounded off.
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 first digit after the decimal point of the single- precision real number is rounded off.
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 first digit after the decimal point of the single- precision real number is rounded off.
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 first digit after the decimal point of the single- precision real number is rounded off.
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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 Not supported...
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);...
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);...
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);...
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);...
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);...
Page 273
Operation error Error code Description (SD0/SD8067) 2820 The device specified by (s) exceeds the corresponding device range. 3401 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).
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);...
Page 275
Operation error Error code Description (SD0/SD8067) 2820 The device specified by (s) exceeds the corresponding device range. 3401 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).
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);...
Page 277
Conversion source data ASCII data Hexadecimal code D200 low-order D200 high-order D201 low-order D201 high-order D202 low-order D202 high-order D203 low-order D203 high-order D204 low-order Number of specified characters and conversion result "" indicates "0". When (n)=K4 D200 D102 D101 D100 41H to "A"...
Page 278
Number of specified characters and conversion result "." indicates "0". When (n)=K2 D200 D102 D101 D100 30H to "0" Does not change D201 41H to "A" 0ABH 0ABCH D100 ABC1H BC12H 0ABH C123H 0ABCH 1234H ABC1H 2345H Precautions • Make sure that only ASCII codes "0" to "9" and "A" to "F" are stored in the device specified by (s). •...
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);...
Page 280
When the character string "-123.45" (signed) is specified by (s) and later (d1) ··· ··· (d1)+1 31H (1) 2DH (-) (s)+1 33H (3) 32H (2) 34H (4) 2EH (.) (s)+2 (d2) - 1 2 3 4 5 - 1 2 3 (s)+3 35H (5) •...
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);...
Page 282
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"...
Page 283
When "20H" exists between the sign and the first non-zero number (a signed value is specified) Total number of digits Number of digits of the decimal part 6 5 4 3 . 32-bit binary data 6 5 4 3 2 1 Ignore When "30H"...
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);...
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);...
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);...
Encoding from 256 to 8 bits ENCO(P) These instructions encode the 2 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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
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);...
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);...
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);...
Page 291
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). Specifies the number of separating bits (s2) (s2)+1...
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);...
Page 293
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). Specifies the number of linked bits (s2) (s2)+1 (s2)+2...
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);...
Page 295
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. ··· ··· ··· ··· (d)+1 (s)+1 When (n)=5 (d)+2 (s)+2 (d)+3 (n)=5 is ignored. (d)+4 • 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.
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.
Page 297
For example, when (n) is 5, lower 8 bits of data from (s) through (s+4) is stored into (d) through (d)+2. ··· ··· ··· ··· (d)+1 (s)+1 When (d)+2 (s)+2 (n)=5 (s)+3 These bits become "00H". (s)+4 • 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.
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
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) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Transfer source data or device number for storing data -2147483648 to +2147483647...
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); Setting data ■Descriptions, ranges, and data types Operand Description...
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); Setting data ■Descriptions, ranges, and data types Operand Description...
Digit move SMOV(P) These instructions distribute and compose data in units of nibble (4 bits). Ladder diagram Structured text ENO:=SMOV(EN,s,m1,m2,n,d); ENO:=SMOVP(EN,s,m1,m2,n,d); (m1) (m2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Word device number storing data whose nibbles will be 16-bit signed binary ANY16 moved...
Page 303
Operation error Error code Description (SD0/SD8067) 3405 Any one of (m1), (m2), (n) is 0. Either (s) or (d) is other than 0 to 9999 when SM8168 is OFF. Either (m1) or (n) is larger than 4. (m2) is larger than (m1) or (n). 6 BASIC INSTRUCTIONS 6.6 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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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); Setting data ■Descriptions, ranges, and data types Operand...
Page 306
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). ··· ··· 1234H 1234H Block move (s)+1 5678H 5678H (d)+1 (s)+2 7FF0H 7FF0H (d)+2...
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); Setting data ■Descriptions, ranges, and data types Operand...
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);...
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) 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 ...
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) 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 ...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Head device for storing the transfer-source data ANY_BOOL ...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 315
Operation error Error code Description (SD0/SD8067) 2820 The devices specified by (s) and (d) exceed the range of the corresponding device. 6 BASIC INSTRUCTIONS 6.6 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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 317
Operation error Error code Description (SD0/SD8067) 2820 The devices specified by (s) and (d) exceed the range of the corresponding device. 6 BASIC INSTRUCTIONS 6.6 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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
APPLICATION INSTRUCTION Rotation Instruction Rotating 16-bit data to the right 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).
Page 320
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. Carry flag (SM700, SM8022) Rotating 1-bit data to the right...
Page 321
■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. Carry flag (SM700, SM8022) Rotating 1-bit data to the right...
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).
Page 323
• 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.
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).
Page 325
• Specify any value between 0 and 31 for (n). If a value 32 or bigger is specified, bits are rotated by the remainder value of n32. For example, when (n) is 34, 2 bits are rotated because 34 divided by 32 equals 1 with a remainder of 2. Precautions •...
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).
Page 327
• Specify any value between 0 and 31 for (n). If a value 32 or bigger is specified, bits are rotated by the remainder value of n32. For example, when (n) is 34, 2 bits are rotated because 34 divided by 32 equals 1 with a remainder of 2. Precautions •...
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 Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 329
• 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. Label (1) While X3 is on, the loop is repeated. (2) To exit the loop, turn on X7.
Page 330
• When the pointer number in operands is same and there is one label, the following operation is caused: (1) When X20 turns ON, the program execution jumps from CJ instruction corresponding to X20 to the label P9. (2) When X20 turns OFF and X21 turns ON, the program execution jumps from CJ instruction corresponding to X21 to the label P9.
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 ENO:=GOEND(EN); Processing details • This instruction moves the program execution to the FEND or END instruction in the same program file. Precautions •...
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. •...
Page 333
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) 3362 Nesting of the DI instruction exceeds 16 levels. 7 APPLICATION INSTRUCTION 7.3 Program execution control instruction...
Disabling the interrupt program with specified priority or lower 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(EN,s);...
Page 335
• 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 Series User's Manual [Application]) • The interrupt-disabled priority can be checked with SD758 (interrupt-disabling priority setting value).
Page 336
• When the DI instruction is executed in an interrupt program Interrupt Program DI K2 IRET Scan execution type DI K3 program Time (1) Interrupt-enabled section for all priority (2) Interrupt-disabled section for the priority 3 or lower (interrupt-enabled section for the priority 2 or higher) (3) Interrupt-disabled section for the priority 2 or lower (interrupt-enabled section for the priority 1 or higher) •...
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); Setting data ■Descriptions, ranges, and data types Operand Description...
Page 338
The IMASK instruction can enable or disable the interrupt pointers I0 to I177 in a batch. Operation error Error code Description (SD0/SD8067) 2820 The 16-point range starting from the device specified by (s) exceeds the corresponding device range. 7 APPLICATION INSTRUCTION 7.3 Program execution control instruction...
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,I,s); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Interrupt pointer number for which interrupts are enabled or disabled I0 to I177...
Returning from the interrupt program IRET This instruction indicates an end of the processing of an interrupt program. Ladder diagram Structured text 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.
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); 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.
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 Repetition program NEXT Setting data...
Page 343
Precautions • The FOR-NEXT loop can be nested up to 16 levels. 3rd level 2nd level 2nd level 1st level NEXT 1st level NEXT 1st level NEXT NEXT NEXT NEXT • The FOR-NEXT loop cannot be interrupted by the I, IRET, SRET, RET, FEND, or END 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 Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 345
Operation error Error code Description (SD0/SD8067) 3340 The branch pointer number outside two nesting levels or more is specified. 3342 The BREAK(P) instructions are used other than between the FOR and NEXT instructions. 3380 The destination pointer specified by (P) does not exist. A pointer in other program file is specified in (P).
Calling a subroutine program CALL(P) This instruction executes the subroutine program specified by (P). Ladder diagram Structured text Not supported Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Start pointer number of the subroutine program Device name ANY16 ■Applicable devices...
Page 347
• 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. CALL CALL CALL FEND 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).
Page 348
[Timing chart] Subroutine is executed. Execution of subroutine P0 triggered by X0 Because the C0 reset instruction is valid, the current value of C0 remains Current Counter unchanged even if a pulses are input. value of reset Remains reset Y7 being output Outputs are latched.
Page 349
[Timing chart] Subroutine is executed. Execution of subroutine P0 triggered by X0 Current value of Counter is reset Counter reset instruction is (part in above deactivated (part program). above program). Resets Y7. Operation error Error code Description (SD0/SD8067) 3360 The 17th level of the nesting is executed. 3380 The subroutine program specified by the pointer in the CALL(P) instructions do not exist.
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 Processing details • These instructions indicate an end of a subroutine program. •...
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 FCALL for (turns off and terminates) the subroutine program.
Page 352
• The XCALL instruction can be nested up to 16 levels. However, the 16 levels are the total of the CALL(P) and XCALL instructions. XCALL P0 X0 XCALL P10 X10 XCALL P20 X20 FEND Operation error Error code Description (SD0/SD8067) 3360 The 17th level of the nesting is executed.
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 354
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.
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 356
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).
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 358
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)+1 ...
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);...
Page 360
Operation error Error code Description (SD0/SD8067) 2820 When the FINS(P) instructions are executed, the data table range exceeds the corresponding device range. 3405 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".
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);...
Page 362
Operation error Error code Description (SD0/SD8067) 2820 When the FDEL(P) instructions are executed, the data table range exceeds the corresponding device range. 3405 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.
Character string operation instruction Comparing character strings LD$, AND$, OR$ These instructions perform a comparison operation between the character string data in the device specified by (s1) and later and the character string data in the device specified by (s2) and later. (Devices are used as a normally open contact.) Ladder diagram Structured text Not supported...
Page 364
Instruction symbol in Instruction symbol in Result Result Conductive state $<= Conductive state $<> Non-conductive state $< Non-conductive state $> Conductive state $>= Conductive state • When the character strings are different, the string with a large character code is considered as the large one. (s1) 42H (B) 41H (A)
Page 365
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.
Concatenating character strings $+(P) [For 2 operands] 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.
Page 367
Operation error Error code Description (SD0/SD8067) 2820 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. 3406 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.
Page 368
$+(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.
Page 369
Operation error Error code Description (SD0/SD8067) 2820 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. 2821 The numbers of the character string-storing devices specified by (s1), (s2), and (d) overlap. 3405 The character string specified by (s1) has more than 16383 characters.
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 Not supported Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 371
Operation error Error code Description (SD0/SD8067) 2820 In the corresponding device range of the device specified by (s) and later, "00H" does not exist. 3405 The character string specified by (s) has more than 16383 characters. 3406 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.
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); ENO:=BINDAP(EN,s,d) ENO:=BINDAP_U(EN,s,d) Setting data...
Page 373
Operation error Error code Description (SD0/SD8067) 2820 The device specified by (d) exceeds the corresponding device range. 7 APPLICATION INSTRUCTION 7.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);...
Page 375
Precautions • (d) occupies six points. Operation error Error code Description (SD0/SD8067) 2820 The device specified by (d) exceeds the corresponding device range. 7 APPLICATION INSTRUCTION 7.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);...
Page 377
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.
Page 378
• 8-bit conversion mode (while SM8161 is ON) Each digit of hexadecimal data stored in the device specified by (s) and later is converted into ASCII code, and transferred to the lower 8 bits of each device specified by (d) and later. SM8161 must always be on in the 8-bit conversion mode. In the following program, conversion is executed as follows: SM400 Devices specified by (s) and later...
Page 379
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.
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);...
Page 381
• 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 16-bit binary data is positive, and "2DH" (-) is stored if the data is negative. •...
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);...
Page 383
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) Total number of digits b8 b7...
Page 384
Operation error Error code Description (SD0/SD8067) 3401 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).
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.
Page 386
■Decimal point format • When 0 is specified in (s2), the decimal point format is applied. (s2) Decimal point format (s2)+1 Total number of digits b8 b7 (s2)+2 Number of digits of ASCII code in "(Value decimal part specifying number of all digits ASCII code for sign - 1)"th digit ASCII code in "(Value...
Page 387
• 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. •...
Page 388
• 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: b8 b7 (s2) Total number of digits 20H (space) 2DH(-) (s2)+1...
Page 389
Operation error Error code Description (SD0/SD3067) 2820 The device specified by (s2) exceeds the corresponding device range. 3401 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.
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 ENO:=LENP(EN,s,d);...
Page 391
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".
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 ENO:=RIGHTP(EN,s,n,d);...
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 ENO:=LEFTP(EN,s,n,d);...
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.
Page 397
• 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. (s1) 42H (B) 41H (A) 46H (F) 45H (E) (s1)+1 44H (D) 43H (C) (d)+1 48H (H) 47H (G)
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.
Page 399
• If the number of characters specified by (s2)+1 is 0, no processing is performed. • When the number of characters specified by (s2)+1 exceeds the last character of the character string specified by (d), data is stored up to the last character of (d). Before execution 42H (B) 41H (A)
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).
Page 401
• A character string can be directly specified in the character string (s1). Character string to be searched for (s1) (s2) 32H (2) 31H (1) "AB" (s2)+1 34H (4) 33H (3) Search start position (s3): 3rd character (s2)+2 42H (B) 41H (A) Fifth character from the head character (s2)+3...
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) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 403
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). (s1) 31H (1) 30H (0) (s1)+1 33H (3) 32H (2) 42H (B) 41H (A) The character string data of the (s1)+2 34H (4)
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 405
Operation error Error code Description (SD0/SD8067) 2820 No NULL code (00H) exists in the corresponding device range of the device specified by (d) and later. 3405 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).
Real Number Instruction Comparing single-precision real numbers LDE, ANDE, ORE 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.) Ladder diagram Structured text Not supported...
Page 407
Operation error There is no operation error. When the E= instruction is used, note that values in the devices may not be equal. EMOV E1.23 E4.56 E4.56 Values in the devices may not be equal. 7 APPLICATION INSTRUCTION 7.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) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 409
Operation error Error code Description (SD0/SD8067) 2820 The device range specified by (d) exceeds the corresponding device range. The specified device value is denormalized number, NaN (not a number), or . 3402 7 APPLICATION INSTRUCTION 7.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);...
Page 411
Operation error Error code Description (SD0/SD8067) 2820 The device range specified by (d) exceeds the corresponding device range. The specified device value is denormalized number, NaN (not a number), or . 3402 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
Adding single-precision real numbers E+(P) [For 2 operands] 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). Ladder diagram Structured text Not supported...
Page 413
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 Not supported (s1)
Subtracting single-precision real numbers E-(P) [For 2 operands] 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). Ladder diagram Structured text Not supported...
Page 415
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 Not supported (s1)
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);...
Page 417
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) The specified device value is denormalized number, NaN (not a number), or .
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);...
Page 419
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) The specified device value is denormalized number, NaN (not a number), or .
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 Not supported (s1)
Page 421
Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402 The value stored in specified device is outside the following range -126 0, 2 |specified device value|<2 7 APPLICATION INSTRUCTION 7.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 Not supported (s1)
Page 423
Operation error Error code Description (SD0/SD8067) 3400 The divisor is 0. The specified device value is denormalized number, NaN (not a number), or . 3402 The value stored in specified device is outside the following range -126 0, 2 |specified device value|<2 7 APPLICATION INSTRUCTION 7.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);...
Page 425
Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402 The value stored in specified device is outside the following range -126 0, 2 |specified device value|<2 7 APPLICATION INSTRUCTION 7.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);...
Page 427
Operation error Error code Description (SD0/SD8067) 3400 The divisor is 0. The specified device value is -0, denormalized number, NaN (not a number), or . 3402 The value stored in specified device is outside the following range -126 0, 2 |specified device value|<2 7 APPLICATION INSTRUCTION 7.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 Not supported Setting data...
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 Not supported Setting data...
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 Not supported Setting data...
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 Not supported Setting data...
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);...
Page 433
• 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. 20H (space) 2DH (-) (s)+1 31H (1) 20H (space) (d)+1 (s)+2 33H (3) 2EH (.) (s)+3 31H (1)
Page 434
• 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.
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); Setting data ■Descriptions, ranges, and data types Operand...
Page 436
Operation error Error code Description (SD0/SD8067) The specified device value is denormalized number, NaN (not a number), or . 3402 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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);...
Page 438
Operation error There is no operation error. 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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);...
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);...
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 ENO:=SINP(EN,s,d);...
Page 442
For the angleradian conversion, refer to the DRAD(P) and DDEG(P) instructions. (Page 451 Converting single-precision real number angle to radian, Page 452 Converting single-precision real number radian to angle) 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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 ENO:=COSP(EN,s,d);...
Page 444
For the angleradian conversion, refer to the DRAD(P) and DDEG(P) instructions. (Page 451 Converting single-precision real number angle to radian, Page 452 Converting single-precision real number radian to angle) 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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 ENO:=TANP(EN,s,d);...
Page 446
Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402 For the angleradian conversion, refer to the DRAD(P) and DDEG(P) instructions. (Page 451 Converting single-precision real number angle to radian, Page 452 Converting single-precision real number radian to angle) 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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 ENO:=ASINP(EN,s,d);...
Page 448
Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402 3405 A value specified in (s) is outside the range from -1.0 to 1.0. For the radianangle conversion, refer to the DRAD(P) and DDEG(P) instructions. (Page 451 Converting single-precision real number angle to radian, Page 452 Converting single-precision real number radian to angle) 7 APPLICATION INSTRUCTION...
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 ENO:=ACOSP(EN,s,d)
Page 450
Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402 3405 A value specified in (s) is outside the range from -1.0 to 1.0. For the radianangle conversion, refer to the DRAD(P) and DDEG(P) instructions. (Page 451 Converting single-precision real number angle to radian, Page 452 Converting single-precision real number radian to angle) 7 APPLICATION INSTRUCTION...
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 ENO:=ATANP(EN,s,d);...
Page 452
For the radianangle conversion, refer to the DRAD(P) and DDEG(P) instructions. (Page 451 Converting single-precision real number angle to radian, Page 452 Converting single-precision real number radian to angle) 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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);...
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);...
Calculating the square root of single-precision real number DESQR(P) These instructions calculate the square root of a value specified by (s), and store the operation result in the device specified by (d). Ladder diagram Structured text ENO:=DESQR(EN,s,d); ENO:=DESQRP(EN,s,d); Setting data ■Descriptions, ranges, and data types Operand Description...
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 ENO:=EXPP(EN,s,d);...
Page 457
• 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). 0.4342945 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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 ENO:=LOGP(EN,s,d);...
Page 459
Operation error Error code Description (SD0/SD8067) The specified device value is denormalized number, NaN (not a number), or . 3402 3405 The value stored in a device specified in (s) is negative. The value stored in a device specified in (s) is 0. 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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);...
Page 461
Operation error Error code Description (SD0/SD8067) 3402 The value specified by (s1) or (s2) is outside the following range. -126 0, 2 |specified value (stored value)|<2 The specified device value is -0, denormalized number, NaN (not a number), or . 3403 The operation result is within the following range.
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);...
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.
Page 464
Operation error Error code Description (SD0/SD8067) 2820 The device areas specified by (s) exceed the corresponding device range. The device areas specified by (d) exceed the corresponding device range. 3402 The block data in the device areas specified by (s) includes a value other than single-precision real number. 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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.
Page 466
Operation error Error code Description (SD0/SD8067) 2820 The device areas specified by (s) exceed the corresponding device range. The device areas specified by (d) exceed the corresponding device range. 3402 The block data in the device areas specified by (s) includes a value other than single-precision real number. 7 APPLICATION INSTRUCTION 7.7 Real Number Instruction...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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); Setting data ■Descriptions, ranges, and data types Operand Description...
Page 469
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.
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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);...
Page 472
• The following shows the areas of (d) and later used for the instructions (when Z0 to 13 and LZ0 to 4 are used). Number of times of batch-storage (d)+1 Reserved by the system (2 words) (d)+2 (d)+3 (d)+4 ZPUSH (Save the whole range (d)+16 of Z and LZ)
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); Setting data ■Descriptions, ranges, and data types Operand...
7.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 ENO:=LIMIT(EN,s1,s2,s3,d);...
Page 475
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.
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 ENO:=DLIMITP(EN,s1,s2,s3,d);...
Page 477
Operation error Error code Description (SD0/SD8067) 3405 The lower limit value specified by (s1) is greater than the upper limit value specified by (s2). 7 APPLICATION INSTRUCTION 7.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);...
Page 479
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.
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);...
Page 481
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.
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);...
Page 483
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.
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);...
Page 485
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.
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);...
Page 487
Point 2 Point 3 Output value (d) Point 1 Point n Point n-1 Input value (s1) Operation error Operation range Operation error • If the operation result is not an integer, the number in the first decimal place is rounded off. •...
Page 488
Operation error Error code Description (SD0/SD8067) 3405 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.
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);...
Page 490
Operation error Operation range Operation error Input value (s1) Point n-1 Output value (d) Point n Point 1 Point 2 • 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. •...
Page 491
Operation error Error code Description (SD0/SD8067) 3405 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.
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);...
Page 493
Point 2 Point 3 Output value (d) Point n-1 Point n Point 1 Input value (s1) Operation error Operation range Operation error • If the operation result is not an integer, the number in the first decimal place is rounded off. •...
Page 494
Setting item Setting device and setting contents Remarks When R0 is specified in (s2) Setting details Number of coordinate points (s2) X coordinate Point 1 (s2)+1 Point 2 (s2)+2 Point 3 (s2)+3 Point 4 (s2)+4 K200 Refer to Point 5 (s2)+5 K200 Point 6...
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);...
Page 496
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.
Page 497
• 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 6 (200, 250) Point 3 Point 7 (50, 100) Point 5 (250, 90)
7.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); Setting data ■Descriptions, ranges, and data types Operand...
Page 499
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.
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); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 501
Processing details • This instruction uses the four devices from the device specified by (d) to perform four types of timer output. Command of the STMR instruction (d)+0 Off delay timer (d)+1 One-shot timer after turning off (d)+2 One-shot timer after turning on On delay timer + Off delay timer (d)+3 Setting value...
7.12 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); (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 503
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.
Page 504
Operation error Error code Description (SD0/SD8067) 1811 The number of the ROTC instructions which are used simultaneously exceeds four. 2820 The device range specified by (s) exceeds the corresponding device range. The device range specified by (d) exceeds the corresponding device range. 3405 The value specified by (n1) is outside the following range.
7.13 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); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description...
Page 506
• 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 Series User's Manual [Application]. For details on the engineering tool, refer to GX Works3 Operating Manual.
7.14 Pulse related instruction Measuring the density of 16 bit binary pulses 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). Ladder diagram Structured text ENO:=SPD(EN,s1,s2,d);...
Page 508
• 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. 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) U/D(A)
Page 509
General-purpose input assignment of the 2-phase 2-input counter A: A phase pulse input, B: B phase pulse input, P: Preset input (reset), E: Enable input (start) If one of X1, X3, X5, X7, X11, X13, X15, X17 is specified as a device, an error occurs. •...
Page 510
• 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 2,147,483,647, the specified measurement time is rounded into “1”...
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). Ladder diagram Structured text ENO:=DSPD(EN,s1,s2,d);...
Page 512
• When a bit device is specified by (s1), the following input assignment devices (shaded area) are valid. 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) U/D(A) U/D(A) U/D(A)
Page 513
General-purpose input assignment of the 2-phase 2-input counter A: A phase pulse input, B: B phase pulse input, P: Preset input (reset), E: Enable input (start) If one of X1, X3, X5, X7, X11, X13, X15, X17 is specified as a device, an error occurs. •...
Page 514
• 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 2,147,483,647, the specified measurement time is rounded into “1”...
16 bit binary pulse output PLSY [For the FX3 Series-compatible 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). Ladder diagram Structured text ENO:=PLSY(EN,s,n,d);...
Page 516
• The following tables show the special relays and special registers related to the PLSY instruction. [Special relays] Axis number Name Descriptions 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...
Page 517
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. •...
Page 518
Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810 The axis number specified by (d) is used by another instruction. 2820 The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
Page 519
PLSY [For the FX5 Series 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). Ladder diagram Structured text ENO:=PLSY(EN,s,n,d);...
Page 520
• The following tables show the special relays and special registers related to the PLSY instruction. [Special relays] Axis number Name Descriptions 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...
Page 521
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. •...
Page 522
Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810 The axis number specified by (d) is used by another instruction. 2820 The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
32 bit binary pulse output DPLSY [For the FX3 Series-compatible 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). Ladder diagram Structured text ENO:=DPLSY(EN,s,n,d);...
Page 524
• The following tables show the special relays and special registers related to the DPLSY instruction. [Special relays] Axis number Name Descriptions 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...
Page 525
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. •...
Page 526
Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810 The axis number specified by (d) is used by another instruction. 2820 The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
Page 527
DPLSY [For the FX5 Series 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). Ladder diagram Structured text ENO:=DPLSY(EN,s,n,d);...
Page 528
• The following tables show the special relays and special registers related to the DPLSY instruction. [Special relays] Axis number Name Descriptions 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...
Page 529
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. •...
Page 530
Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810 The axis number specified by (d) is used by another instruction. 2820 The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
16 bit binary pulse width modulation 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);...
Page 532
Pulse output ON time Initial Timing of reflection on Timing of clearing to initial destination channel value operation value SD5303, SD5302 • When the DHCMOV STOP/PAUSERUN instruction is executed SD5319, SD5318 • When this instruction is SD5335, SD5334 executed • END processing SD5351, SD5350 Pulse output Period...
Page 533
Precautions • Specify the ON time by (s1) and the period by (s2) so that [(s2)-(s1)] is equal to or larger than 3 s. • Specify 2 s or more in Y0 to Y3 and 200 s or more in Y4 to Y7 for the ON time specified by (s1), and specify 5 s or more in Y0 to Y3 and 400 s or more in Y4 to Y7 for the period specified by (s2).
Page 534
• Operations when the PMW output is stopped (while the output pulse is off) Output stop command Period If an output stop command is issued while the OFF time setting is 5 s or less, outputting pulses stops after the set OFF time elapses. OFF time setting OFF time setting is 5 s or less...
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);...
Page 536
Pulse output ON time Initial Timing of reflection on Timing of clearing to initial destination channel value operation value SD5303, SD5302 • When the DHCMOV STOP/PAUSERUN instruction is executed SD5319, SD5318 • When the DPWM instruction is SD5335, SD5334 executed •...
Page 537
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.) •...
Page 538
• Operations when the PMW output is stopped (while the output pulse is off) Output stop command Period If an output stop command is issued while the OFF time setting is 5 s or less, outputting pulses stops after the set OFF time elapses. OFF time setting OFF time setting is 5 s or less...
Page 539
Operation error Error code Description (SD0/SD8067) 1810 The output destination specified by (d) is already used by another instruction (positioning instruction). (The PMW 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 3405 Y10 or later is specified as the output destination specified by (d).
7.15 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); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 541
• 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 ...
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); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 543
• 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 ...
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); (s1) (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 32-bit signed binary ANY32 ...
Page 545
• Timing chart Current Value Current Value SM8029 Complete flag • When the command contact turns on, the output M0 turns on. • When the current value of C0 reaches the comparison value D300, the output M0 is reset, "1" is added to the count value of the process counter C1, and the current value of the counter C0 is reset.
7.16 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.
Page 547
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.
Page 548
• 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.
7.17 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) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
Page 550
• 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 (First time) (s1) K100 K100...
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) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 552
• The following table shows example of search result table. Device number Description Search result item (d)+1, (d) Number of same data (d)+3, (d)+2 Same data position (first position) (d)+5, (d)+4 Same data position (last position) (d)+7, (d)+6 Minimum value position (last position) (d)+9, (d)+8 Maximum value position (last position) Precautions...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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);...
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);...
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 ENO:=MAXP(EN,s,n,d);...
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 ENO:=DMAXP(EN,s,n,d);...
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 ENO:=MINP(EN,s,n,d);...
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 ENO:=DMINP(EN,s,n,d);...
Sorting 16-bit data SORTTBL(_U) These instructions sort data lines in the data table (sorting source) having ((m1)(m2)) points specified by (s) in the ascending order based on the group data in the column number (n), and store the result in the data table (sorting result) having ((m1)(m2)) points specified by (d).
Page 562
• 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.
Page 563
Operation error Error code Description (SD0/SD8067) 1811 These instructions are used more than once. 2820 The device range specified by (s) exceeds the corresponding device range. The device range specified by (d) exceeds the corresponding device range. 3405 The value specified by (m1) is outside the following range. 1 to 32 The value specified by (m2) is outside the following range.
16-bit data alignment 2 SROTTBL2(_U) These instructions sort data lines in the data table (sorting source) of 16-bit binary data having (m1m2) points specified by (s) in the ascending order or descending order based on the group data in the column number (n), and store the result in the data table (sorting result) of 16-bit binary data having ((m1)(m2)) points specified by (d).
Page 565
• When the command input turns on, data sorting is started. Data sorting is completed after (m1) 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.
Page 566
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. •...
32-bit data alignment 2 DSORTTBL2(_U) These instructions sort data lines in the data table (sorting source) of 32-bit binary data having (m1m2) points specified by (s) in the ascending order or descending order based on the group data in the column number (n), and store the result in the data table (sorting result) of 32-bit binary data having ((m1)(m2)) points specified by (d).
Page 568
• When the command input turns on, data sorting is started. Data sorting is completed after (m1) 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.
Page 569
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. •...
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);...
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 Structured text ENO:=DWSUM(EN,s,n,d);...
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);...
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);...
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 ENO:=SQRT(EN,s,d); ENO:=SQRTP(EN,s,d); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
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 "X + 1"...
Page 577
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.
Page 578
Precautions • In these instructions, "X +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...
7.18 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.
Page 580
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. ADRSET D100 Stores the address of D100 to D0.
7.19 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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 582
Device Name Description 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 •...
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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Head device number where the clock write source data is stored 16-bit signed binary ANY16...
Page 584
• 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.
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);...
Page 586
Device Name Description SM8020 Zero If the result is 0:00:00, this special relay turns on. SM8022 Carry If the result exceeds the maximum value of the time data, 23:59:59, this special relay turns on. Precautions • These instructions occupy three points for each of three devices starting from device number specified by (s1), (s2), and (d) respectively.
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 Not supported...
Page 588
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.
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);...
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);...
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);...
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);...
Comparing date data LDDT, ANDDT, ORDT These instructions compare the date data in the devices specified by (s1) and (s2). Or, these instructions compare the date data in the device specified by (s1) with the current date. Set the comparison target by (s3). Ladder diagram Structured text Not supported...
Page 594
• Set each data in binary. • Set the 4 digit "year" data in the devices specified by (s1) and (s2) within the range 1980 to 2079. • Set the "month" data in the devices specified by (s1)+1 and (s2)+1 within the range 1 to 12. •...
Page 595
The date data A, B, and C are compared. 2006/1/1 2007/1/1 2008/1/1 2009/1/1 (2006/9/22) (2007/6/23) (2008/8/8) • The following table lists the comparison operation results between A, B, and C. Even when the data are compared under the same conditions, the results differ depending on the comparison target data. : Continuity, : Non-continuity Comparison target data Condition...
Comparing time data LDTM, ANDTM, ORTM These instructions compare the time data in the devices specified by (s1) and (s2). Or, these instructions compare the time data in the device specified by (s1) with the current time. Set the comparison target by (s3). Ladder diagram Structured text Not supported...
Page 597
• Set each data in binary. • Set the "hour" data as in the 24-hour clock in the devices specified by (s1) and (s2) within the range 0 to 23. • Set the "minute" data in the devices specified by (s1)+1 and (s2)+1 within the range 0 to 59. •...
Page 598
The time data A, B, and C are compared. 0:00 6:00 12:00 18:00 0:00 04:50:55 14:08:59 22:47:05 • The following table lists the comparison operation results between A, B, and C. Even when the data are compared under the same conditions, the results differ depending on the comparison target data. : Continuity, : Non-continuity Comparison target data Condition...
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);...
Page 600
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.
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);...
Page 602
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.
7.20 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,s1,s2,d);...
Page 604
• 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.
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); (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Time after which the alarm (d2) is set to on (unit: hour) 16-bit signed binary ANY16...
Page 606
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); (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Time after which the alarm (d2) is set to on (unit: hour) 32-bit signed binary ANY32 ...
7.21 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);...
Page 608
Operation error Error code Description (SD0/SD8067) 2820 The (n) points of device range starting from the device specified by (s) exceed the range of proximal I/O. 7 APPLICATION INSTRUCTION 7.21 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). •...
Page 610
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 (n) words (n) points ■DFROM(P)
Page 611
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). Module Module Module Module Module No.
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). •...
Page 613
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...
Page 614
■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). Buffer memory CPU module (s2) (s1) (n)2 points...
Reading 1-word/2-word data from another module FROMD(P), DFROD(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. •...
Page 616
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 (n) words (n) points ■DFROD(P)
Page 617
Common items among the FROMD(P), DFROD(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). Module Module Module Module Module No.
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). •...
Page 619
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...
Page 620
■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) (n)2 points...
BUILT-IN ETHERNET FUNCTION INSTRUCTIONS Open/Close Processing Instructions Opening a connection SP.SOCOPEN This instruction opens a connection. Ladder diagram Structured text ENO:=SP_SOCOPEN(EN,U,s1,s2,d); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Dummy Character string ANYSTRING_SINGLE (s1)
Page 622
■Control data Device Item Description Setting range Set by (s2)+0 Execution type/ Specify whether to use the parameter value set using the engineering 0000H User completion type tool or to use the set values of the control data (s2)+2 to (s2)+9 during 8000H the open processing of the connection.
Page 623
Processing details This instruction performs the open processing for the connection specified by (s1). The setting value used by the open processing is selected by (s2)+0. The completion of the SP.SOCOPEN instruction can be checked using the completion devices (d)+0 and (d)+1. •...
Closing a connection SP.SOCCLOSE This instruction closes a connection. Ladder diagram Structured text ENO:=SP_SOCCLOSE(EN,U,s1,s2,d); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Dummy Character string ANYSTRING_SINGLE (s1) Connection number 1 to 8 16-bit unsigned binary ANY16 (s2)
Page 625
Processing details This instruction performs the close processing for the connection specified by (s1). (Connection disconnection) The completion of the SP.SOCCLOSE 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.SOCCLOSE instruction is completed, and turns OFF during the next END processing.
Socket Communications Function Instructions Reading receive data during the END processing SP.SOCRCV This instruction reads the receive data. (Reading during END processing) Ladder diagram Structured text ENO:=SP_SOCRCV(EN,U,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 627
• 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.
Page 628
Operation error Error code Description (SD0/SD8067) 3405 The connection number specified by (s1) is other than 1 to 8. 2820 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. 2822 Device that cannot be specified is specified.
Sending data SP.SOCSND This instruction sends data. Ladder diagram Structured text ENO:=SP_SOCSND(EN,U,s1,s2,s3,d); (s1) (s2) (s3) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Dummy Character string ANYSTRING_SINGLE (s1) Connection number 1 to 8 16-bit unsigned binary ANY16 (s2)
Page 630
Processing details This instruction send the data set by (s3) to the target device of the connection specified by (s1). CPU module (s3)+0 Send data length Send data (s3)+1 Send data (s3)+2 External device SP.SOCSND (Sending data) Send data (s3)+n The completion of the SP.SOCSND instruction can be checked using the completion devices (d)+0 and (d)+1.
Reading connection information SP.SOCCINF This instruction reads the connection information. Ladder diagram Structured text ENO:=SP_SOCCINF(EN,U,s1,s2,d); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Dummy Character string ANYSTRING_SINGLE (s1) Connection number 1 to 8 16-bit unsigned binary ANY16...
Page 632
■Control data Device Item Description Setting range Set by (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 ...
Reading socket communications receive data S(P).SOCRDATA This instruction reads the data in the socket communication receive data area. Ladder diagram Structured text ENO:=S_SOCRDATA(EN,U,s1,s2,n,d); ENO:=SP_SOCRDATA(EN,U,s1,s2,n,d); (s1) (s2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
Page 634
Processing details These instructions read the data for the number of words specified by (n) from the socket communication receive data area of the connection specified by (s1) to the devices from the device specified by (d) onwards. No processing is performed when (n) is 0.
PART 4 MODULE DEDICATED INSTRUCTION This part consists of the following chapters. 9 HIGH-SPEED COUNTER INSTRUCTION 10 EXTERNAL DEVICE I/O INSTRUCTION 11 POSITIONING INSTRUCTION 12 INVERTER COMMUNICATION INSTRUCTION 13 MODBUS COMMUNICATION INSTRUCTION 14 DIVIDED DATA READ/WRITE FROM/TO BFM INSTRUCTION...
HIGH-SPEED COUNTER INSTRUCTION High-speed Processing Instruction Setting 32-bit data comparison 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. Ladder diagram Structured text ENO:=DHSCS(EN,s1,s2,d);...
Page 637
Precautions The value specified in (s2) should only be the channel of high-speed counter number (1 to 8) set by the parameter. If a channel which is not set by the parameter or a value other than K1 to K8 is specified, an operation error occurs. For other precautions, refer to ...
Reset 32-bit data comparison 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. Ladder diagram Structured text ENO:=DHSCR(EN,s1,s2,d);...
Page 639
Precautions The value specified in (s2) should only be the channel of high-speed counter number (1 to 8) set by the parameter. If a channel which is not set by the parameter or a value other than K1 to K8 is specified, an operation error occurs. For other precautions, refer to ...
Comparison of 32-bit data band DHSZ This instruction compares the current value of a high-speed counter with two values (one zone), and outputs the comparison result (refresh). Ladder diagram Structured text ENO:=DHSZ(EN,s1,s2,s3,d); (s1) (s2) (s3) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 641
• When the current value of the high-speed counter CH1 changes (counts) as shown below, the comparison result is turn on to one of the outputs Y0, Y1 or Y2. Comparison Comparison Comparison Output value 1 value 2 source destination SM400 ...
Start/stop of the 16-bit data high-speed I/O function 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) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 643
Function number 10 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 b14 b13 b12 b11 Function number 30 For the multi-output high-speed comparison table, specification of a channel is not required. To start the multi-output high- speed comparison table, set 01H in (s2).
Start/stop of the 32-bit data high-speed I/O function 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) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 645
Function number 10 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 b14 b13 b12 b11 Function number 20 Set the value to turn on the bit of the high-speed comparison table number which is to be started or stopped. Low-order bit position b14 b13 ...
High-speed Current Value Transfer Instruction High-speed current value transfer of 16-bit data 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); Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 647
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. •...
High-speed current value transfer of 32-bit data 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); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 649
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. •...
EXTERNAL DEVICE I/O INSTRUCTION 10.1 Serial Communication 2 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,m,n1,n2,d); (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 651
Operation error Error code Description (SD0/SD8067) 2822 Device that cannot be specified by this instruction is specified. 3405 Data outside the allowable range was input. 2820 The device specified by (s) and (d) exceeds the corresponding device range. 1810 Channel number which is used in another instruction is specified. 3600 Channel number specified by (n2) is not set by parameters.
POSITIONING INSTRUCTION 11.1 Positioning Instruction Zero return(OPR) with 16-bit data DOG search DSZR [For the FX3 Series-compatible operand specification] This instruction executes mechanical zero return. Ladder diagram Structured text ENO:=DSZR(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 653
DSZR [For the FX5 Series operand specification] This instruction executes mechanical zero return. Ladder diagram Structured text ENO:=DSZR(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) 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...
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); (s1) (s2) (d1) (d2) 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...
16-bit data interrupt positioning DVIT [For the FX3 Series-compatible operand specification] This instruction executes interrupt 1-speed constant quantity feed. Ladder diagram Structured text ENO:=DVIT(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Positioning address after an interrupt input...
Page 656
DVIT [For the FX5 Series operand specification] This instruction executes interrupt 1-speed constant quantity feed. Ladder diagram Structured text ENO:=DVIT(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) 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...
32-bit data interrupt positioning DDVIT [For the FX3 Series-compatible operand specification] This instruction executes interrupt 1-speed constant quantity feed. Ladder diagram Structured text ENO:=DDVIT(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Positioning address after an interrupt input...
Page 658
DDVIT [For the FX5 Series operand specification] This instruction executes interrupt 1-speed constant quantity feed. Ladder diagram Structured text ENO:=DDVIT(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) 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...
Positioning by one table operation TBL [For the FX3 Series-compatible operand specification] This instruction executes one specified table operation from the instructions set in the data table using the engineering tool etc. Ladder diagram Structured text ENO:=TBL(EN,n,d); Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 660
TBL [For the FX5 Series operand specification] This instruction executes one specified table operation from the instructions set in the data table using the engineering tool etc. Ladder diagram Structured text ENO:=TBL(EN,n,d); Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
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);...
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); (n1) (n2) (n3) (n4) (n5) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (n1) Start axis number 16-bit unsigned binary...
Page 663
Processing details This instruction executes tables of multiple axes of one module simultaneously. • For (n1), specify the start axis number. When the built-in positioning function of the CPU module is used, the start axis is the axis 1. Thus, specify K1. •...
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);...
16-bit data variable speed pulse PLSV [For the FX3 Series-compatible operand specification] This instruction outputs variable speed pulses with an assigned rotation direction output. Ladder diagram Structured text ENO:=PLSV(EN,s,d1,d2); (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 666
PLSV [For the FX5 Series operand specification] This instruction outputs variable speed pulses with an assigned rotation direction output. Ladder diagram Structured text ENO:=PLSV(EN,s,d1,d2); (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Command speed -32768 to +32767 16-bit signed binary...
32-bit data variable speed pulse DPLSV [For the FX3 Series-compatible operand specification] This instruction outputs variable speed pulses with an assigned rotation direction output. Ladder diagram Structured text ENO:=DPLSV(EN,s,d1,d2); (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 668
DPLSV [For the FX5 Series operand specification] This instruction outputs variable speed pulses with an assigned rotation direction output. Ladder diagram Structured text ENO:=DPLSV(EN,s,d1,d2); (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Command speed -2147483648 to +2147483647 32-bit signed binary...
16-bit data relative positioning DRVI [For the FX3 Series-compatible operand specification] This instruction executes one-speed positioning by incremental drive. Ladder diagram Structured text ENO:=DRVI(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Positioning address...
Page 670
DRVI [For the FX5 Series operand specification] This instruction executes one-speed positioning by incremental drive. Ladder diagram Structured text ENO:=DRVI(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) 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...
32-bit data relative positioning DDRVI [For the FX3 Series-compatible operand specification] This instruction executes one-speed positioning by incremental drive. Ladder diagram Structured text ENO:=DDRVI(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Positioning address...
Page 672
DDRVI [For the FX5 Series operand specification] This instruction executes one-speed positioning by incremental drive. Ladder diagram Structured text ENO:=DDRVI(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) 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...
16-bit data absolute positioning DRVA [For the FX3 Series-compatible operand specification] This instruction executes one-speed positioning by absolute drive. Ladder diagram Structured text ENO:=DRVA(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Positioning address...
Page 674
DRVA [For the FX5 Series operand specification] This instruction executes one-speed positioning by absolute drive. Ladder diagram Structured text ENO:=DRVA(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) 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...
32-bit data absolute positioning DDRVA [For the FX3 Series-compatible operand specification] This instruction executes one-speed positioning by absolute drive. Ladder diagram Structured text ENO:=DDRVA(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Positioning address...
Page 676
DDRVA [For the FX5 Series operand specification] This instruction executes one-speed positioning by absolute drive. Ladder diagram Structured text ENO:=DDRVA(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) 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...
INVERTER COMMUNICATION INSTRUCTION 12.1 Inverter operation monitoring(Status check) 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); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
12.2 Inverter operations control(Drive) 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); (s1) (s2) (s3) Setting data ■Descriptions, ranges, and data types Operand Description Range...
12.3 Inverter parameter read 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); (s1) (s2) (d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Inverter station number K0 to 31...
12.4 Inverter parameter write 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); (s1) (s2) (s3) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Inverter station number K0 to 31...
12.5 Inverter parameter block write 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); (s1) (s2) (s3) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Inverter station number...
12.6 Inverter multi command 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);...
Page 683
Precautions • If a device number outside the range due to indexing, etc. is specified in (d1), the receive data from the inverter is not stored in (d1). However, values set in (s3) and (s3)+1 may be written to the inverter. •...
MODBUS COMMUNICATION INSTRUCTION 13.1 MODBUS Read/Write 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); (s1) (s2) (s3) (s4) (s5)/(d1) (d2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 685
Operation error Error code Description (SD0/SD8067) 1810 Channel used by the instruction is used by other instruction. 3600 Invalid parameter setup. 2822 Device that cannot be used by this instruction is specified. 3405 Data outside the allowable range was input. 2820 The specified device exceeds the range of the corresponding device.
DIVIDED DATA READ/WRITE FROM/TO BFM INSTRUCTION 14.1 Divided BFM Read RBFM This instruction reads data from continuous buffer memory areas in an FX3 series intelligent function module Ladder diagram Structured text ENO:=RBFM(EN,UnHn,s,n1,n2,d); (U/H) (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Description Range...
Page 687
■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.
Page 688
Common items between RBFM instruction and WBFM instruction ■Specification of module number of FX3 series intelligent function module and buffer memory For FX3 series intelligent function module connection method, number of connectable FX3 series intelligent function modules and handling of I/O numbers, refer to manuals of the CPU module and FX3 series intelligent function modules. •...
14.2 Divided BFM write WBFM This instruction writes data to continuous buffer memory areas in an FX3 series intelligent function module. Ladder diagram Structured text ENO:=WBFM(EN,UnHn,s1,s2,n1,n2); (U/H) (s1) (s2) (n1) (n2) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
Page 690
■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.
PART 5 STANDARD FUNCTIONS This part consists of the following chapters. 15 TYPE CONVERSION FUNCTIONS 16 SINGLE NUMBER VARIABLE FUNCTIONS 17 ARITHMETIC OPERATION FUNCTIONS 18 BIT SHIFT FUNCTIONS 19 STANDARD BITWISE BOOLEAN FUNCTIONS 20 SELECTION FUNCTIONS 21 COMPARISON FUNCTIONS 22 CHARACTER STRING FUNCTIONS 23 TIME DATA FUNCTIONS...
TYPE CONVERSION FUNCTIONS 15.1 Converting BOOL to WORD BOOL_TO_WORD(_E) These functions convert BOOL type data to WORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_WORD(s); [With EN/ENO] d:=BOOL_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type...
15.2 Converting BOOL to DWORD BOOL_TO_DWORD(_E) These functions convert BOOL type data to DWORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_DWORD(s); [With EN/ENO] d:=BOOL_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.3 Converting BOOL to INT BOOL_TO_INT(_E) These functions convert BOOL type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_INT(s); [With EN/ENO] d:=BOOL_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.4 Converting BOOL to DINT BOOL_TO_DINT(_E) These functions convert BOOL type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_DINT(s); [With EN/ENO] d:=BOOL_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.5 Converting BOOL to TIME BOOL_TO_TIME(_E) These functions convert BOOL type data to TIME type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_TIME(s); [With EN/ENO] d:=BOOL_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.6 Converting BOOL to STRING BOOL_TO_STRING(_E) These functions convert BOOL type data to STRING type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_STRING(s); [With EN/ENO] d:=BOOL_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.7 Converting WORD to BOOL WORD_TO_BOOL(_E) These functions convert WORD type data to BOOL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_BOOL(s); [With EN/ENO] d:=WORD_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.8 Converting WORD to DWORD WORD_TO_DWORD(_E) These functions convert WORD type data to DWORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_DWORD(s); [With EN/ENO] d:=WORD_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.9 Converting WORD to INT WORD_TO_INT(_E) These functions convert WORD type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_INT(s); [With EN/ENO] d:=WORD_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.10 Converting WORD to DINT WORD_TO_DINT(_E) These functions convert WORD type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_DINT(s); [With EN/ENO] d:=WORD_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.11 Converting WORD to TIME WORD_TO_TIME(_E) These functions convert WORD type data to TIME type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_TIME(s); [With EN/ENO] d:=WORD_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.12 Converting DWORD to BOOL DWORD_TO_BOOL(_E) These functions convert DWORD type data to BOOL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_BOOL(s); [With EN/ENO] d:=DWORD_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.13 Converting DWORD to WORD DWORD_TO_WORD(_E) These functions convert DWORD type data to WORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_WORD(s); [With EN/ENO] d:=DWORD_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 705
Operation error There is no operation error. 15 TYPE CONVERSION FUNCTIONS 15.13 Converting DWORD to WORD...
15.14 Converting DWORD to INT DWORD_TO_INT(_E) These functions convert DWORD type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_INT(s); [With EN/ENO] d:=DWORD_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 707
Operation error There is no operation error. 15 TYPE CONVERSION FUNCTIONS 15.14 Converting DWORD to INT...
15.15 Converting DWORD to DINT DWORD_TO_DINT(_E) These functions convert DWORD type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_DINT(s); [With EN/ENO] d:=DWORD_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.16 Converting DWORD to TIME DWORD_TO_TIME(_E) These functions convert DWORD type data to TIME type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_TIME(s); [With EN/ENO] d:=DWORD_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.17 Converting INT to BOOL INT_TO_BOOL(_E) These functions convert INT type data to BOOL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_BOOL(s); [With EN/ENO] d:=INT_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.18 Converting INT to WORD INT_TO_WORD(_E) These functions convert INT type data to WORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_WORD(s); [With EN/ENO] d:=INT_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.19 Converting INT to DWORD INT_TO_DWORD(_E) These functions convert INT type data to DWORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_DWORD(s); [With EN/ENO] d:=INT_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.20 Converting INT to DINT INT_TO_DINT(_E) These functions convert INT type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_DINT(s); [With EN/ENO] d:=INT_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.21 Converting INT to BCD INT_TO_BCD(_E) These functions convert INT type data to BCD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_BCD(s); [With EN/ENO] d:=INT_TO_BCD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 715
Operation error Error code Description (SD0/SD8067) 3401 Data in the device specified by (s) is out of the valid range (0 to 9999). 15 TYPE CONVERSION FUNCTIONS 15.21 Converting INT to BCD...
15.22 Converting INT to REAL INT_TO_REAL(_E) These functions convert INT type data to REAL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_REAL(s); [With EN/ENO] d:=INT_TO_REAL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.23 Converting INT to TIME INT_TO_TIME(_E) These functions convert INT type data to TIME type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_TIME(s); [With EN/ENO] d:=INT_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.24 Converting INT to STRING INT_TO_STRING(_E) These functions convert INT type data to STRING type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_STRING(s); [With EN/ENO] d:=INT_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 719
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
15.25 Converting DINT to BOOL DINT_TO_BOOL(_E) These functions convert DINT type data to BOOL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_BOOL(s); [With EN/ENO] d:=DINT_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.26 Converting DINT to WORD DINT_TO_WORD(_E) These functions convert DINT type data to WORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_WORD(s); [With EN/ENO] d:=DINT_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 722
Operation error There is no operation error. 15 TYPE CONVERSION FUNCTIONS 15.26 Converting DINT to WORD...
15.27 Converting DINT to DWORD DINT_TO_DWORD(_E) These functions convert DINT type data to DWORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_DWORD(s); [With EN/ENO] d:=DINT_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.28 Converting DINT to INT DINT_TO_INT(_E) These functions convert DINT type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_INT(s); [With EN/ENO] d:=DINT_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.29 Converting DINT to BCD DINT_TO_BCD(_E) These functions convert DINT type data to BCD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_BCD(s); [With EN/ENO] d:=DINT_TO_BCD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 726
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
15.30 Converting DINT to REAL DINT_TO_REAL(_E) These functions convert DINT type data to REAL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_REAL(s); [With EN/ENO] d:=DINT_TO_REAL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.31 Converting DINT to TIME DINT_TO_TIME(_E) These functions convert DINT type data to TIME type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_TIME(s); [With EN/ENO] d:=DINT_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.32 Converting DINT to STRING DINT_TO_STRING(_E) These functions convert DINT type data to STRING type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_STRING(s); [With EN/ENO] d:=DINT_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 730
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
15.33 Converting BCD to INT BCD_TO_INT(_E) These functions convert BCD type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BCD_TO_INT(s); [With EN/ENO] d:=BCD_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 732
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
15.34 Converting BCD to DINT BCD_TO_DINT(_E) These functions convert BCD type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BCD_TO_DINT(s); [With EN/ENO] d:=BCD_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 734
• A value input to (s) is within the range from 0H to 9999H (from 0 to 9 for each digit) for the WORD type data value and from 0H to 99999999H (from 0 to 9 for each digit) for the DWORD type data value. •...
15.35 Converting REAL to INT REAL_TO_INT(_E) These functions convert REAL type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=REAL_TO_INT(s); [With EN/ENO] d:=REAL_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 736
Operation error Error code Description (SD0/SD8067) 3401 The single-precision real number in the device specified by (s) is out of the valid range (-32768 to 32767). 3402 • A special number is set to (s). • The set single-precision real number is not located within the following range. -126 |(s)|<...
15.36 Converting REAL to DINT REAL_TO_DINT(_E) These functions convert REAL type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=REAL_TO_DINT(s); [With EN/ENO] d:=REAL_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 738
Operation error Error code Description (SD0/SD8067) 3401 The single-precision real number in the device specified by (s) is out of the valid range (-2147483648 to 2147483647). 3402 A special number is set to (s). • The set single-precision real number is not located within the following range. -126 |(s)|<...
15.37 Converting REAL to STRING REAL_TO_STRING(_E) These functions convert REAL type data to STRING type data (exponent format). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=REAL_TO_STRING(s); [With EN/ENO] d:=REAL_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type...
Page 740
• The string data obtained by conversion is output from (d) as follows: • The number of digits is fixed respectively for the integer part, decimal part and exponent part as follows: Integer part: 1, decimal part: 5, exponent part: 2 •...
Page 741
Operation error Error code Description (SD0/SD8067) 3402 (s) is not located within the following range -126 |specified device value|<2 • 0, 2 • (s) is -0, denormalized number, NaN (not a number), or . 3406 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.
15.38 Converting TIME to BOOL TIME_TO_BOOL(_E) These functions convert TIME type data to BOOL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_BOOL(s); [With EN/ENO] d:=TIME_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.39 Converting TIME to WORD TIME_TO_WORD(_E) These functions convert TIME type data to WORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_WORD(s); [With EN/ENO] d:=TIME_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.40 Converting TIME to DWORD TIME_TO_DWORD(_E) These functions convert TIME type data to DWORD type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_DWORD(s); [With EN/ENO] d:=TIME_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.41 Converting TIME to INT TIME_TO_INT(_E) These functions convert TIME type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_INT(s); [With EN/ENO] d:=TIME_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.42 Converting TIME to DINT TIME_TO_DINT(_E) These functions convert TIME type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_DINT(s); [With EN/ENO] d:=TIME_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.43 Converting TIME to STRING TIME_TO_STRING(_E) These functions convert TIME type data to STRING type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_STRING(s); [With EN/ENO] d:=TIME_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.44 Converting STRING to BOOL STRING_TO_BOOL(_E) These functions convert STRING type data to BOOL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_ BOOL(s); [With EN/ENO] d:=STRING_TO_ BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type...
15.45 Converting STRING to INT STRING_TO_INT(_E) These functions convert STRING type data to INT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_INT(s); [With EN/ENO] d:=STRING_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 750
Operation error Error code Description (SD0/SD8067) 3401 Invalid data which cannot be converted to (s) are input. • Values for each place of the ASCII code are other than "30H" to "39H", "20H", and "00H". • Values for the ASCII data are other than "-32768" to "32767" when STRING_TO_INT(_E) is used. 15 TYPE CONVERSION FUNCTIONS 15.45 Converting STRING to INT...
15.46 Converting STRING to DINT STRING_TO_DINT(_E) These functions convert STRING type data to DINT type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_DINT(s); [With EN/ENO] d:=STRING_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 752
Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE (Operation error did not occur) Operation output value FALSE (Operation error occurred) Indefinite value FALSE (Stops operation) FALSE Indefinite value *1 When FALSE is output from ENO, data output from (d) is undefined.
15.47 Converting STRING to REAL STRING_TO_REAL(_E) These functions convert STRING type data to REAL type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_REAL(s); [With EN/ENO] d:=STRING_TO_REAL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 754
• Exponent format High-order byte Low-order byte 1st word of the character string 31H (1) 2DH (-) 2nd word 33H (3) 2EH (.) 3rd word 30H (0) 35H (5) -1.35034E-10 4th word 34H (4) 33H (3) 5th word 2DH (-) 45H (E) REAL 6th word...
Page 755
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
15.48 Converting STRING to TIME STRING_TO_TIME(_E) These functions convert STRING type data to TIME type data. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_TIME(s); [With EN/ENO] d:=STRING_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.49 Converting Bit Array to INT BITARR_TO_INT(_E) These functions convert a bit array to INT type data for a specified number of bits. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BITARR_TO_INT(s,n); [With EN/ENO] d:=BITARR_TO_INT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
15.50 Converting Bit Array to DINT BITARR_TO_DINT(_E) These functions convert a bit array to DINT type data for a specified number of bits. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BITARR_TO_DINT(s,n) [With EN/ENO] d:=BITARR_TO_DINT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
15.51 Converting INT to Bit Array INT_TO_BITARR(_E) These functions output low-order (n) bits of INT type data to a bit array. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_BITARR(s,n); [With EN/ENO] d:=INT_TO_BITARR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
15.52 Converting DINT to Bit Array DINT_TO_BITARR(_E) These functions output low-order (n) bits of DINT type data to a bit array. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_BITARR(s,n); [With EN/ENO] d:=DINT_TO_BITARR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
15.53 Bit Array Copy CPY_BITARR(_E) These functions copy specified number of bits of a bit array. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=CPY_BITARR(s,n); [With EN/ENO] d:=CPY_BITARR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
15.54 Reading the Specified Bit of Word Label GET_BIT_OF_INT(_E) These functions reads the specified bit of the word label Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=GET_BIT_OF_INT(s,n); [With EN/ENO] d:=GET_BIT_OF_INT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
15.55 Writing the Specified Bit of Word Label SET_BIT_OF_INT(_E) These functions writes the specified bit of the word label. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SET_BIT_OF_INT(s,n); [With EN/ENO] d:=SET_BIT_OF_INT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
15.56 Copying the Specified Bit of Word Label CPY_BIT_OF_INT(_E) These functions copy the specified bit of the word label to the one of another word label. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=CPY_BIT_OF_INT(s,n1,n2); [With EN/ENO] d:=CPY_BIT_OF_INT_E(EN,ENO,s,n1,n2); Setting data ■Descriptions, types, and data types Argument...
15.57 Unnecessary of Type Conversion GET_BOOL_ADDR, GET_INT_ADDR, GET_WORD_ADDR These functions output the input variable as the output variable type. Ladder diagram Structured text d:=GET_BOOL_ADDR(s) d:=GET_INT_ADDR(s); d:=GET_WORD_ADDR(s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Input Input variable Output Output variable BOOL/INT/WORD...
SINGLE NUMBER VARIABLE FUNCTIONS 16.1 Absolute Value ABS(_E) These functions output the absolute value of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ABS(s); [With EN/ENO] d:=ABS_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type...
Page 767
Operation error • When (s) is REAL Error code Description (SD0/SD8067) The data specified by (s) is -0, denormalized number, NaN (not a number), or . 3402 3403 (d) exceeds the following range. (An overflow has occurred.) |(d)|<2 16 SINGLE NUMBER VARIABLE FUNCTIONS 16.1 Absolute Value...
16.2 Square Root SQRT(_E) These functions output the square root of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SQRT(s); [With EN/ENO] d:=SQRT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
16.3 Natural Logarithm Operation LN(_E) These functions output the natural logarithm operation result of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=LN(s); [With EN/ENO] d:=LN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
16.4 Calculating the Common Logarithm LOG(_E) These functions output the operation result of the common logarithm (the logarithm whose base is 10) of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=LOG(s); [With EN/ENO] d:=LOG_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument...
Page 771
Operation error • When (s) is REAL Error code Description (SD0/SD8067) The value specified in (s) is -0, denormalized number, NaN (not a number), or . 3402 3403 The value of (d) exceeds the following range. (An overflow has occurred.) |(d)|<2 3405 Data outside the allowable range was set to (s).
16.5 Exponential Operation EXP(_E) These functions output the exponential operation result of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=EXP(s); [With EN/ENO] d:=EXP_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
16.6 Sine Operation SIN(_E) These functions output the sine of the angle of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SIN(s); [With EN/ENO] d:=SIN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
16.7 Cosine Operation COS(_E) These functions output the cosine of the angle of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=COS(s); [With EN/ENO] d:=COS_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
16.8 Tangent Operation TAN(_E) These functions output the tangent of the angle of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TAN(s); [With EN/ENO] d:=TAN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
16.9 Arc Sine Operation ASIN(_E) These functions output the arc sine value of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ASIN(s); [With EN/ENO] d:=ASIN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
16.10 Arc Cosine Operation ACOS(_E) These functions output the arc cosine value of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ACOS(s); [With EN/ENO] d:=ACOS_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
16.11 Arc Tangent Operation ATAN(_E) These functions output the arc tangent value of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ATAN(s); [With EN/ENO] d:=ATAN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
ARITHMETIC OPERATION FUNCTIONS 17.1 Addition ADD(_E) These functions output the sum of input values ((s1) + (s2) + ... + (s28)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ADD(s1,s2); [With EN/ENO] d:=ADD_E(EN,ENO,s1,s2); *1 The input variable "s" can be changed in the range of 2 to 28. Setting data ■Descriptions, types, and data types Argument...
Page 780
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
17.2 Multiplication MUL(_E) These functions output the product input values ((s1)(s2) ... (s28)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MUL(s1,s2); [With EN/ENO] d:=MUL_E(EN,ENO,s1,s2); *1 The input variable "s" can be changed in the range of 2 to 28. Setting data ■Descriptions, types, and data types Argument...
Page 782
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
17.3 Subtraction SUB(_E) These functions output the difference of input values ((s1) - (s2)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SUB(s1,s2); [With EN/ENO] d:=SUB_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
Page 784
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
17.4 Division DIV(_E) These functions output the quotient of input values ((s1) (s2)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DIV(s1,s2); [With EN/ENO] d:=DIV_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
Page 786
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
17.5 Remainder MOD(_E) These functions output the remainder of input values ((s1) (s2)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MOD(s1,s2); [With EN/ENO] d:=MOD_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
Page 788
Operation error • (s1) and (s2) are INT Error code Description (SD0/SD8067) 3400 The value (divisor) specified by (s2) is 0. • (s1) and (s2) are DINT Error code Description (SD0/SD8067) 3400 The value (divisor) specified by (s2) is 0. 17 ARITHMETIC OPERATION FUNCTIONS 17.5 Remainder...
17.6 Exponentiation EXPT(_E) These functions output the exponentiation of an input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=EXPT(s1,s2); [With EN/ENO] d:=EXPT_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL Cardinal number...
Page 790
Operation error • (s1) is the REAL type and (s2) is the INT type Error code Description (SD0/SD8067) 3402 The value of (s1) is outside the following range. -126 |(s1)|<2 0, 2 The data specified by (s1) is -0, denormalized number, NaN (not a number), or . 3403 The operation result is within the following range.
17.7 Move Operation MOVE(_E) These functions output the assignment of input values. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MOVE(s); [With EN/ENO] d:=MOVE_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL Input...
Page 792
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
BIT SHIFT FUNCTIONS 18.1 n-bit Left Shift SHL(_E) These functions shift an input value leftward by (n) bits and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SHL(s,n); [With EN/ENO] d:=SHL_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 794
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
18.2 n-bit Right Shift SHR(_E) These functions shift an input value rightward by (n) bits and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SHR(s,n); [With EN/ENO] d:=SHR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 796
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
18.3 n-bit Left Rotation ROL(_E) These functions rotate an input value leftward by (n) bits and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ROL(s,n); [With EN/ENO] d:=ROL_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 798
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
18.4 n-bit Right Rotation ROR(_E) These functions rotate an input value rightward by (n) bits and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ROR(s,n); [With EN/ENO] d:=ROR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 800
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
STANDARD BITWISE BOOLEAN FUNCTIONS 19.1 AND Operation, OR Operation, XOR Operation AND(_E), OR(_E), XOR(_E) • AND(_E): Outputs the logical product of input values. • OR(_E): Outputs the logical sum of input values. • XOR(_E): Outputs the exclusive logical sum of input values. Ladder diagram Structured text [Without EN/ENO]...
Page 802
OR(_E) • These functions perform the 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). When the data type is WORD (s1) (s2) Logical Word OR...
19.2 Logical Negation NOT(_E) These functions output the logical negation of input values. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=NOT(s); [With EN/ENO] d:=NOT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL Input...
SELECTION FUNCTIONS 20.1 Selection SEL(_E) These functions output a selected input value. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SEL(s1,s2,s3); [With EN/ENO] d:=SEL_E(EN,ENO,s1,s2,s3); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL Output condition (TRUE: Output s3, FALSE: Output s2)
Page 805
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
20.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 Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MAX(s1,s2);...
Page 807
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
20.3 Limit Control LIMIT(_E) These functions output an input value controlled with the upper and lower limits. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=LIMIT(s1,s2,s3); [With EN/ENO] d:=LIMIT_E(EN,ENO,s1,s2,s3); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
Page 809
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
20.4 Multiplexer MUX(_E) These functions output one of multiple input values. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MUX(n,s1,s2); [With EN/ENO] d:=MUX_E(EN,ENO,n,s1,s2); *1 The input variable "s" can be changed in the range of 2 to 28. Setting data ■Descriptions, types, and data types Argument...
Page 811
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
COMPARISON FUNCTIONS 21.1 Compare GT(_E), GE(_E), EQ(_E), LE(_E), LT(_E) These functions output the data comparison result of input values. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=GT(s1,s2); d:=GE(s1,s2); d:=EQ(s1,s2); d:=LE(s1,s2); d:=LT(s1,s2); [With EN/ENO] d:=GT_E(EN,ENO,s1,s2); d:=GE_E(EN,ENO,s1,s2); d:=EQ_E(EN,ENO,s1,s2); d:=LE_E(EN,ENO,s1,s2); d:=LT_E(EN,ENO,s1,s2);...
Page 813
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
21.2 Compare NE(_E) These functions output the data comparison result of input values. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=NE(s1,s2); [With EN/ENO] d:=NE_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL s1, s2...
Page 815
Operation error • (s1) and (s2) are the STRING type Error code Description (SD0/SD8067) 2820 In the corresponding device range of the device specified by (s) and later, "00H" does not exist. 3405 The character string specified by (s) has more than 16383 characters. 3406 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.
CHARACTER STRING FUNCTIONS 22.1 Character String Length Detection LEN(_E) These functions detect the length of an input character string and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=LEN(s); [With EN/ENO] d:=LEN _E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description...
22.2 Extracting Character String Data from the Left/ Right 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 Structured text [Without EN/ENO]...
Page 818
• RIGHT(_E) These functions output the data for the specified number of characters from the right of a character string input to (s) from (d). The value input to (n) specifies the number of characters to be extracted. When the value input to (n) is 5 "ABCDEF12345"...
22.3 Extract Mid String MID(_E) These functions output the specified number of characters from an arbitrary position of an input character string. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MID(s,n1,n2); [With EN/ENO] d:=MID_E(EN,ENO,s,n1,n2); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 820
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
22.4 Link Character Strings CONCAT(_E) These functions concatenate character strings and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=CONCAT(s1,s2); [With EN/ENO] d:=CONCAT_E(EN,ENO,s1,s2); *1 The input variable "s" can be changed in the range of 2 to 28. Setting data ■Descriptions, types, and data types Argument...
Page 822
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
22.5 Inserting Character String INSERT(_E) These functions insert a character string into another character string and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INSERT(s1,s2,n); [With EN/ENO] d:=INSERT_E(EN,ENO,s1,s2,n); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 824
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
22.6 Deleting Character String DELETE(_E) These functions delete an arbitrary range of a character string and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DELETE(s,n1,n2); [With EN/ENO] d:=DELETE_E(EN,ENO,s,n1,n2); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 826
■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
22.7 Replacing Character String REPLACE(_E) These functions replace an arbitrary range of a character string and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=REPLACE(s1,s2,n1,n2); [With EN/ENO] d:=REPLACE_E(EN,ENO,s1,s2,n1,n2); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 828
• The value input to (n2) specifies the number of the head character position of a character string to be replaced. When the value input to (n1) and (n2) is 5 Value to be input to (s1) Output value "ABCDEFGH123" "ABCD1234523"...
Page 829
Operation error Error code Description (SD0/SD8067) 2820 "00H" is not set to devices from the device number specified by (s1) to the end device number of corresponding device. "00H" is not set to devices from the device number specified by (s2) to the end device number of corresponding device. 3405 The character strings specified by (s1) have more than 255 characters.
22.8 Searching Character String FIND(_E) These functions search for a character string and output the result. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=FIND(s1,s2); [With EN/ENO] d:=FIND_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 831
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
TIME DATA FUNCTIONS 23.1 Addition ADD_TIME(_E) These functions output the sum of input values (TIME data) ((s1) + (s2)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ADD_TIME(s1,s2); [With EN/ENO] d:=ADD_TIME_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 833
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
23.2 Subtraction SUB_TIME(_E) These functions output the difference of input values (TIME data) ((s1) - (s2)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SUB_TIME(s1,s2); [With EN/ENO] d:=SUB_TIME_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 835
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
23.3 Multiplication MUL_TIME(_E) These functions output the multiplication of input values (TIME) ((s1) (s2)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MUL_TIME(s1,s2); [With EN/ENO] d:=MUL_TIME_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
Page 837
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
23.4 Division DIV_TIME(_E) These functions output the quotient of input values (TIME data) ((s1) (s2)). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DIV_TIME(s1,s2); [With EN/ENO] d:=DIV_TIME_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
Page 839
■Operation result Function without EN/ENO The operation processing is executed. The operation output value is output from (d). Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Indefinite value...
Page 840
MEMO 23 TIME DATA FUNCTIONS 23.4 Division...
PART 6 FUNCTION BLOCKS This part consists of the following chapters. 24 BISTABLE FUNCTION BLOCKS 25 EDGE DETECTION FUNCTION BLOCKS 26 COUNTER FUNCTION BLOCKS 27 TIMER FUNCTION BLOCKS...
BISTABLE FUNCTION BLOCKS 24.1 Bistable Function Blocks (Set Priority) SR(_E) These function blocks judge two input values and output 1 (TRUE) or 0 (FALSE). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] SR_1(S1:=s1,R:=s2,Q1:=d); [With EN/ENO] SR_E_1(EN:=EN,ENO:=ENO S1:=s1,R:=s2,Q1:=d); Setting data ■Descriptions, types, and data types Argument Description...
Page 843
Function block with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Previous output value • Timing chart (s1) (s2) When EN and (s1) are When EN, (s1), and (s2) are on, (d) is on.
24.2 Bistable Function Blocks (Reset Priority) RS(_E) These function blocks judge two input values and output 1 (TRUE) or 0 (FALSE). Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] RS_1(S:=s1,R1:=s2,Q1:=d); [With EN/ENO] RS_E_1(EN:=EN, ENO:=ENO S:=s1,R1:=s2,Q1:=d); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 845
Function block with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Previous output value • Timing chart (s1) (s2) When EN and (s1) are on When EN and (s2) are on, and (s2) is off, (d) turns on.
EDGE DETECTION FUNCTION BLOCKS 25.1 Rising Edge Detector R_TRIG(_E) These functions detect the rising edge of a signal, and output a pulse signal. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] R_TRIG_1(CLK:=s,Q:=d); [With EN/ENO] R_TRIG_E_1(EN:=EN, ENO:=ENO CLK:=s,Q:=d); Setting data ■Descriptions, types, and data types Argument Description...
Page 847
Function block with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Previous output value • Timing chart When EN is on and on At the next scan, When EN is off, (d) holds the output the rising edge of (s),...
25.2 Falling Edge Detector F_TRIG(_E) These function blocks detect the falling edge of a signal, and output a pulse signal. Ladder diagram Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] F_TRIG_1(CLK:=s,Q:=d); [With EN/ENO] F_TRIG_E_1(EN:=EN, ENO:=ENO CLK:=s,Q:=d); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 849
Function block with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation) TRUE Operation output value FALSE (Stops operation) FALSE Previous output value • Timing chart When EN is on and on At the next scan, When EN is off, (d) holds the output the falling edge of (s),...
COUNTER FUNCTION BLOCKS 26.1 Up Counter CTU(_E) These function blocks count up the number of times of rising of a signal. Ladder diagram 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] CTU_E_1(EN:=EN, ENO:=ENO CU:=s1,R:=s2,PV:=n,Q:=d1,CV:=d2); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 851
■Operation result Function block without EN/ENO The operation processing is executed. The operation output value is output from (d1) and (d2). • Timing chart When 3 is specified in n (s1) (s2) (d1) (d2) When (s1) is on, When (s2) is on, (d2) counts up.
26.2 Down Counter CTD(_E) These function blocks count down the number of times of rising of a signal. Ladder diagram 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] CTD_E_1(EN:=EN, ENO:=ENO CD:=s1,LD:=s2,PV:=n,Q:=d1,CV:=d2); Setting data ■Descriptions, types, and data types Argument Description Type...
Page 853
■Operation result Function block without EN/ENO The operation processing is executed. The operation output value is output from (d1) and (d2). • Timing chart When 3 is specified in n (s1) (s2) (d1) (d2) When (s2) is on, On the falling edge of (s1), (d2) is initialized.
26.3 Counter Function Block COUNTER_FB_M When the execution condition is established, this function block starts counting up. Ladder diagram Structured text COUNTER_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL Counter set value...
Page 855
Operation error There is no error. 26 COUNTER FUNCTION BLOCKS 26.3 Counter Function Block...
TIMER FUNCTION BLOCKS 27.1 Timer Function Blocks TIMER__M When the execution condition is established, these function blocks start the timer count to the set time. Ladder diagram 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); 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); TIMER_CONTHS_FB_M_1(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:= d2); ( indicates TIMER_1_FB_M, TIMER_10_FB_M, TIMER_100_FB_M, TIMER_CONT_FB_M, TIMER_CONTHS_FB_M.) Setting data ■Descriptions, types, and data types...
Page 857
■TIMER_10_FB_M • When the execution condition of (s1) turns on, counting the current value starts. The timer starts counting from "(s3) 10 ms". When it counts up to "(s2) 10 ms", (d2) turns on. The current measurement value is output into (d1). •...
Page 858
■TIMER_CONT_FB_M • This is a retentive timer that counts the time when the variable is on. When the execution condition of (s1) turns on, counting the current value starts. There are two retentive timers: low-speed (TIMER_CONT_FB_M) and highspeed (TIMER_CONTHS_FB_M) retentive timers. •...
APPENDICES Appendix 1 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 ANDP...
First Edition 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.
(6) months, and the longest gratis of Mitsubishi, loss in opportunity, lost profits incurred to the user or third person by failure of Mitsubishi warranty term after manufacturing shall be eighteen products, special damages and secondary damages (18) months.
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. 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.
Page 888
Manual number: JY997D55801A 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 HIMEJI WORKS: 840, CHIYODA MACHI, HIMEJI, JAPAN Specifications are subject to change without notice.