WUME-FP7CPUEIP. FP7 Web Server Function Manual. WUME-FP7WEB. Instructions for Built-in COM Port. FP7 series User's Manual (SCU Communication).
PLC FP7 | Panasonic Industry Europe GmbH
PROGRAMMABLE CONTROLLER FP7 CPU Unit Command Reference Manual [Applicable Models] FP7 CPU Unit CPS41E/CPS31E/CPS31/CPS21 CPS41ES/CPS31ES/CPS31S WUME-FP7CPUPGR-08 2021.4 panasonic.net/id/pidsx/global Introduction Thank you for purchasing a Panasonic product. Before you use the product, please carefully read through the user's manual, and understand it in detail to use the product properly. Types of Manual · There are different types of user's manual for the FP7 series, as listed below. Please refer to a relevant manual for the unit and purpose of your use. · The manuals can be downloaded on our website https://industrial.panasonic.com/ac/e/dl_center/manual/. Unit name or purpose of use FP7 Power Supply Unit Manual name FP7 CPU Unit User's Manual (Hardware) Manual code WUME-FP7CPUH FP7 CPU Unit Instructions for Built-in LAN Port Instructions for Built-in COM Port FP7 Extension (Communication) Cassette (RS-232C, RS485 Type) FP7 Extension (Communication) Cassette (Ethernet Type) FP7 Extension (Function) Cassette Analog Cassette FP7 Digital Input/Output Unit FP7 Analog Input Unit FP7 Analog Output Unit FP7 Thermocouple Multi-analog Input Unit FP7 RTD Input Unit FP7 Multi Input/Output Unit FP7 High-speed counter unit FP7 Pulse Output Unit FP7 Positioning Unit FP7 Serial Communication Unit FP7 Multi-wire Link Unit FP7 Motion Control Unit PHLS System Programming Software FPWIN GR7 FP7 CPU Unit Command Reference Manual FP7 CPU Unit User's Manual (Logging Trace Function) FP7 CPU Unit User's Manual (Security Function) FP7 CPU Unit User's Manual (LAN Port Communication) FP7 CPU Unit User's Manual (Ethernet Expansion Function) FP7 CPU Unit User's Manual (EtherNet/IP Communication) FP7 Web Server Function Manual FP7 series User's Manual (SCU Communication) FP7 Series User's Manual (Communication Cassette Ethernet Type) FP7 Analog Cassette User's Manual FP7 Digital Input/Output Unit User's Manual FP7 Analog Input Unit User's Manual FP7 Analog Output Unit User's Manual FP7 Thermocouple Multi-analog Input Unit FP7 RTD Input Unit User's Manual FP7 Multi Input/Output Unit User's Manual FP7 High-speed Counter Unit User's Manual FP7 Pulse Output Unit User's Manual FP7 Positioning Unit User's Manual FP7 series User's Manual (SCU Communication) FP7 Multi-wire Link Unit User's Manual FP7 Motion Control Unit User's Manual PHLS System User's Manual FPWIN GR7 Introduction Guidance WUME-FP7CPUPGR WUME-FP7CPULOG WUME-FP7CPUSEC WUME-FP7LAN WUME-FP7CPUETEX WUME-FP7CPUEIP WUME-FP7WEB WUME-FP7COM WUME-FP7CCET WUME-FP7FCA WUME-FP7DIO WUME-FP7AIH WUME-FP7AOH WUME-FP7TCRTD WUME-FP7MXY WUME-FP7HSC WUME-FP7PG WUME-FP7POSP WUME-FP7COM WUME-FP7MW WUME-FP7MCEC WUME-PHLS WUME-FPWINGR7 Table of Contents Table of Contents 1 List of Instructions ................................................................................1-1 1-1 List of Basic Instructions.......................................................................................... 1-2 1-2 List of High-level Instructions .................................................................................. 1-7 2 Overview of Instructions.......................................................................2-1 2-1 Structure of Instructions........................................................................................... 2-2 2-2 Operation unit............................................................................................................2-8 2-3 Operation device list ............................................................................................... 2-10 2-4 Specification of Device Numbers ........................................................................... 2-12 2-5 Explanations about Relays ..................................................................................... 2-14 2-6 Description of the memory area............................................................................. 2-23 2-7 Explanation of constants........................................................................................ 2-35 2-8 Global Devices and Local Devices......................................................................... 2-40 2-9 Range of Data that can be Handled in the PLC ..................................................... 2-41 2-10 Overflow and Underflow ....................................................................................... 2-43 ii Table of Contents 3 Basic Instructions ................................................................................. 3-1 4 High-level Instructions (Data Comparison) .........................................4-1 5 High-level Instructions (Data Transfer)................................................5-1 6 High-level Instructions (Arithmetic/Logic Operations).......................6-1 7 High-level Instructions (Data Conversion) .......................................... 7-1 8 High-level Instructions (Data Shift and Rotation) ...............................8-1 9 High-level Instructions (Bit Manipulation) ........................................9-1 10 High-Level Instruction (Data Processing Control) .......................... 10-1 11 High-level Instructions (Real Number).............................................11-1 12 High-level Instructions (Time) .......................................................... 12-1 13 High-level Instructions (Special) ...................................................... 13-1 14 High-level Instructions (Strings) ...................................................... 14-1 15 High-level Instructions (Communication) ........................................ 15-1 16 High-level instructions (Multi-wire Link Communication)............16-1 17 High-level Instructions (Ethernet Communication).........................17-1 18 High-level Instructions (SD Memory Card)....................................18-1 19 Precautions During Programming ................................................... 19-1 iii Table of Contents 19-1 Common Precautions ........................................................................................... 19-2 19-2 Clock and Time Data ............................................................................................. 19-3 19-3 Data Table for String Instructions ........................................................................ 19-4 19-4 Floating Point Real Number Operation ................................................................ 19-5 19-5 Changing Timer/Counter Set Value in the RUN Mode ........................................ 19-6 19-6 Use of Duplicate Outputs...................................................................................... 19-9 19-7 Leading Edge Detection Method ........................................................................ 19-11 19-8 Precautions for Programming ............................................................................ 19-16 19-9 Common Precautions for SD Memory Card Access Instructions.................... 19-18 19-10 Ethernet Function: IP Addresses ..................................................................... 19-21 19-11 Ethernet Function: I/O Allocation..................................................................... 19-22 20 Appendix ............................................................................................20-1 20-1 List of System Relays ........................................................................................... 20-2 20-2 List of System Data Registers ............................................................................ 20-10 20-3 List of Error Codes .............................................................................................. 20-16 20-4 ASCII Code Table, JIS8 Code Table ................................................................... 20-21 iv 1 1 List of Instructions 1-1 List of Instructions 1-1 List of Basic Instructions Name Mnemonic Symbol Function overview Sequence Basic Instructions Start ST Start Not ST/ Begins a logic operation with a Form A (normally open) contact. Begins a logic operation with a Form B (normally closed) contact. Out OT Outputs the operated result to the specified output. Page 3-2 3-2 3-2 AND AN Connects a Form A (normally open) contact serially. 3-2 AND Not AN/ Connects a Form B (normally closed) contact serially. 3-2 OR OR Connects a Form A (normally open) contact in parallel. 3-2 OR Not OR/ Leading Contact Instruction Trailing Contact Instruction Leading Contact Instruction ST ST AN Trailing Contact Instruction AN Leading Contact Instruction OR Trailing Contact Instruction Not Leading Edge Differential Trailing Edge Differential Leading Edge Differential (Initial Execution Type) OR / DF DF/ DFI AND Stack ANS (DF) (DF/) (DFI) Connects a Form B (normally closed) in parallel. 3-2 Begins a logic operation only for one scan when the leading edge of the trigger is detected. 3-5 Begins a logic operation only for one scan when the trailing edge of the trigger is detected. 3-5 Connects a Form A (normally open) contact serially only for one scan when the leading edge of the trigger is 3-5 detected. Connects a Form A (normally open) contact serially only for one scan when the trailing edge of the trigger is 3-5 detected. Connects a Form A (normally open) contact in parallel only for one scan when the leading edge of the trigger is 3-5 detected. Connects a Form A (normally open) contact in parallel only for one scan when the trailing edge of the trigger is 3-5 detected. Inverts the operated result up to this instruction. 3-7 Turns ON the contact only for one scan when the leading edge of the trigger is detected. 3-8 Turns ON the contact only for one scan when the trailing edge of the trigger is detected. 3-8 Turns ON the contact only for one scan when the leading edge of the trigger is detected. 3-8 The leading edge detection is possible on the first scan. Connects the multiple instruction blocks serially. 3-14 OR Stack ORS Push Stack Read Stack Pop Stack Nop Leading Edge Out Trailing Edge Out PSHS RDS POPS NOP OT OT Connects the multiple instruction blocks in parallel. 3-15 Stores the operated result up to this instruction. 3-16 Reads the operated result stored by the PSHS instruction. 3-16 Reads and clears the operated result stored by the PSHS instruction. 3-16 No operation. 3-19 Outputs the operated result to the specified output only for one scan when the leading edge of the trigger is 3-20 detected (for pulse relay P). Outputs the operated result to the specified output only for one scan when the trailing edge of the trigger is 3-20 detected (for pulse relay P). 1-2 List of Basic Instructions Name Keep Mnemonic KP Symbol Set Reset KP Function overview Page Turns ON at set input trigger and holds until reset trigger turns ON. 3-21 Set SET Reset RST Alternative Out ALT Basic function instructions Timer (32-bit) TM SET RST ALT TMX n S Timer (16-bit) TM16 Unsigned 32-bit Incremental Auxiliary Timer SPTM Down Counter (32-bit) CT Down Counter (16-bit) CT16 Up/Down Counter UDC Shift Register SR TM16X n S SPTM S D Count Reset Count Reset UP/DOWN Count Reset CT n S CT16 -n S UDC n S Data Shift SR Reset D Output is set to and held at ON. Output is set to and held at OFF. Inverts the output condition (ON/OFF) each time the leading edge of the trigger is detected. 3-22 3-22 3-24 On-delay timer. Decrements at the specified time [S]. When the elapsed value is 0, the timer contact turns ON. [S] is specified as 32-bit data (U1 to U4294967295). TMS: 0.01ms units/TML: 1ms units/TMR: 0.01s units/TMX: 0.1s units/TMY: 1s units For TM16, [S] is specified as 16-bit data (U1 to U65535). Functions as an on-delay timer for 0.01 sec units. 3-25 3-34 (Note 1) 3-36 Decrements from the preset value [S]. When the elapsed value is 0, the counter contact turns ON. [S] is specified as 32-bit data (U1 to U4294967295). 3-40 For CT16, [S] is specified as 16-bit data (U1 to U65535). 3-48 (Note 1) Increments or decrements from the preset value [S] based on up/down input. To be used with a comparison instruction described immediately after. 3-51 Shifts the content of the word device specified by [D] 1 bit to the left 3-54 Left/Right Shift Register LRSR L/R Data Shift Reset LRSR D1 D2 Shifts the data range specified by [D1] to [D2] to the left or to the right by 1 bit. 3-58 Control Instruction Master Control Relay MC Master Control Relay End MCE ( MC ) ( MCE ) When execution conditions are OFF, output between MC and MCE is turned OFF. Executes the program between MC and MCE instructions when the trigger (execution condition) is ON. 3-60 3-60 (Note): Can be used with CPU units CPS41/CPS31 Ver.4.2 or later, CPS21 Ver.1.2 or later 1-3 List of Instructions Name Jump Mnemonic JP Label LBL Loop LOOP Label LBL End ED End Program Block EDPB Conditional End CNDE Symbol ( JP n ) ( LBL n) ( LBL n) LOOP n S ( ED ) ( EDPB ) ( CNDE ) Function overview Page Jumps to the LBL instruction with the same number as 3-64 [n] when the trigger (execution condition) is ON and executes the program. 3-64 Jumps to the LBL instruction with the same number as 3-69 [n] when the trigger (execution condition) is ON and executes the program. Set the number of times to repeat the operation to [S]. 3-69 Ends operation of the program. Indicates the end of the main program. 3-73 Ends PB (program block). 3-74 Ends operation of the program when the execution condition is ON. 3-75 Eject EJECT ( EJECT ) Makes a page break when printing out. 3-76 Step Ladder Instructions Start Step SSTP Next Step NSTL Clear Step CSTP SSTP NSTL CSTP Header for program "n" which is managed as a process. Starts the specified process "n" and clears other running processes. (Every scan execution type) Clears running process "n". 3-77 3-77 3-77 Step End STPE STPE End of step ladder area 3-77 Block Clear ZRST ZRST D1 D2 Clears running processes [D1] to [D2]. 3-86 Subroutine Instructions Subroutine Label SBL Subroutine Return RET Local Subroutine Call CALL Local Subroutine Call (Output OFF FCALL Type) Subroutine Call (with PB number Specification) ECALL Subroutine Call (Output OFF Type) (with PB number Specification) EFCALL Interrupt Control Instructions Interrupt Program Definition INTPG (SBL n ) (RET ) (CALL n) (FCAL n) (ECAL n PBm) (EFCAL n PBm) When CALL/FCALL/ECALL/EFCALL instruction is 3-89 executed, it jumps to subroutines with the same label number and executes the subroutines. Use RET instruction to return to the address of the main program 3-89 and execute the program. When the trigger (execution condition) is ON: subroutine is executed. When the trigger (execution condition) is OFF: 3-90 subroutine is not executed. Holds the output from within subroutines. When the trigger (execution condition) is ON: subroutine is executed. When the trigger (execution condition) is OFF: 3-90 subroutine is not executed. However, the output from within subroutines is cleared. For subroutines in the PBn program block: When the trigger (execution condition) is ON: jumps to subroutine. 3-92 When the trigger (execution condition) is OFF: subroutine is not executed. For subroutines in the PBn program block: When the trigger (execution condition) is ON: jumps to subroutine. When the trigger (execution condition) is OFF: 3-92 subroutine is not executed. However, the output from within subroutines is cleared. INTPG Head of the interrupt program. 3-94 Interrupt Return IRET IRET End of the interrupt program. (Note): Can be used with CPU units CPS41/CPS31 Ver.3.2 or later, CPS21 Ver.1.0 or later 3-94 1-4 List of Basic Instructions Name Operation unit CPU Interrupt Disable Mnemonic DI CPU Interrupt Enable EI Unit Interrupt Enable/Disable IMASK Unit Interrupt Request Clear ICLR PB Execution Control Instructions PBn Execution Start STARTPG PBn Execution Stop STOPPG Global PB Number Setting GPB Commenting Instructions Comment Out COMOUT Comment Out End ENDCOM Data Comparison Instruction ST= ST<> Data Comparison (Start) US, SS, UL, SL, SF, DF ST> ST>= ST< ST<= AN= AN<> Data Comparison (AND) US, SS, UL, SL, SF, DF AN> AN>= AN< AN<= Symbol DI EI IMASK.i S D ICLR.i S D Function overview Disables the interrupt to the CPU unit. Enables the interrupt to the CPU unit. Controls to enable or disable the interrupt request from the unit. Clears the interrupt request from the unit. Page 3-99 3-99 3-100 3-101 STARTPG PBn STOPPG PBn ( GPB n ) Activates the waiting PB when the execution condition turns ON. Puts the active PB into waiting mode when the execution condition turns ON. Declares the global PB number (n=1000 to 1999) for the PB in which GPB instruction is written. 3-102 3-102 3-104 (Note 1) COMOUT ENDCOM Comments out the instructions between COMOUT and ENDCOM instructions. 3-105 3-105 S1 = S2 S1 < > S2 S1 > S2 S1 > = S2 S1 < S2 S1 < = S2 S1 = S2 S1 < > S2 S1 > S2 S1 > = S2 S1 < S2 S1 < = S2 Begins a logic operation by comparing two 16-bit data in the comparative condition "S1=S2". Begins a logic operation by comparing two 16-bit data in the comparative condition "S1S2". Begins a logic operation by comparing two 16-bit data in the comparative condition "S1>S2". Begins a logic operation by comparing two 16-bit data in the comparative condition "S1 S2". Begins a logic operation by comparing two 16-bit data in the comparative condition "S1<S2". Begins a logic operation by comparing two 16-bit data in the comparative condition "S1 S2". Connects a Form A (normally open) contact serially by comparing two 16-bit data in the comparative condition "S1 = S2". Connects a Form A (normally open) contact serially by comparing two 16-bit data in the comparative condition "S1S2." Connects a Form A (normally open) contact serially by comparing two 16-bit data in the comparative condition "S1>S2". Connects a Form A (normally open) contact serially by comparing two 16-bit data in the comparative condition "S1S2". Connects a Form A (normally open) contact serially by comparing two 16-bit data in the comparative condition "S1<S2". Connects a Form A (normally open) contact serially by comparing two 16-bit data in the comparative condition "S1S2". 3-106 3-106 3-106 3-106 3-106 3-106 3-106 3-106 3-106 3-106 3-106 3-106 1-5 List of Instructions Name Operation unit Mnemonic OR= OR<> Data Comparison (OR) US, SS, UL, SL, SF, DF OR> OR>= OR< OR<= Symbol S1 = S2 S1 < > S2 S1 > S2 S1 > = S2 S1 < S2 S1 < = S2 Function overview Connects a Form A (normally open) contact in parallel by comparing two 16-bit data in the comparative condition "S1=S2". Connects a Form A (normally open) contact in parallel by comparing two 16-bit data in the comparative condition "S1S2". Connects a Form A (normally open) contact in parallel by comparing two 16-bit data in the comparative condition "S1>S2". Connects a Form A (normally open) contact in parallel by comparing two 16-bit data in the comparative condition "S1S2". Connects a Form A (normally open) contact in parallel by comparing two 16-bit data in the comparative condition "S1<S2". Connects a Form A (normally open) contact in parallel by comparing two 16-bit data in the comparative condition "S1S2". Page 3-106 3-106 3-106 3-106 3-106 3-106 1-6 List of High-level Instructions 1-2 List of High-level Instructions Name Operation unit Mnemonic Operand Function overview Page Data Compare Instructions Data Compare US, SS, UL, SL, SF, DF CMP Compares [S1] and [S2] and outputs the results to the system relay (SRA to SRC). (P) S1, S2 (S1) > (S2) SRA:ON 4-2 (S1) = (S2) SRB:ON (S1) < (S2) SRC:ON US, SS, Band Compare UL, SL, SF, DF WIN (P) S1, S2,S3 Compares the value of [S1] with the lower limit value [S2] and the upper limit value [S3], and outputs the result to the system relay (SRA to SRC). (S1) > (S3) SRA:ON 4-5 (S2) (S1) (S3) SRB:ON (S1) < (S2) SRC:ON Block Comparison - BCMP Compares the comparison block 1 specified by [S3] and the comparison block 2 specified by [S4] for the number of bytes specified by [S2] according the control data (P) S1, S2, S3, S4 specified by [S1], and outputs the result to the system relay (SRB). 4-8 (Note 1) When the blocks match, SRB turns ON. When the blocks do not match, SRB turns OFF. Data Transfer Instructions US, SS, Data Transfer UL, SL, MV (P) S, D (S) (D) 5-2 SF, DF Inversion and Transfer US, SS, UL, SL, SF, DF MV/ (P) S, D (S)(D) 5-4 US, SS, 2 Data Transfer UL, SL, SF, DF MV2 (P) S1, S2, D Transfers the two types of data specified by [S1] and [S2] to the area starting with [D]. 5-6 (Note 2) US, SS, 3 Data Transfer UL, SL, SF, DF MV3 (P) S1, S2, S3, D Transfers the three types of data specified by [S1], [S2], and [S3] to the area starting with [D]. 5-8 (Note 2) Block Transfer US, SS, UL, SL, SF, DF BKMV (P) S1, S2, D Transfers the data between [S1] and [S2] to the area starting with [D]. 5-10 Block Copy US, SS, UL, SL, SF, DF COPY (P) S, D1, D2 Transfers the data for [S1] to all of the areas between [D1] and [D2]. 5-12 Bit Block Transfer US, SS, UL, SL, SF, DF BTM (P) S1, S2, D Transfers the data between bit addresses [S1] and [S2] to the area ending with the low bit specified for [D]. 5-14 Digit Data Transfer - DGT (P) S, S1, n, D, D1 The data for the [n] digit portion starting from the digit specified by [S] and [S1] is saved in the area starting from 5-16 the digit specified by [D] and [D1]. Reset US, SS, UL, SL, SF, DF RST (P) D The [D] area is reset to "0". 5-19 Block Clear bit ZRST (P) D1, D2 The area specified by bit addresses [D1] to [D2] is reset to "0". 5-20 16-bit Data Sign-extended - Block Transfer BKEXT (P) S1, S2, D Performs sign extension for device values in the area specified by [S1] to [S2], and transfers them to the device address specified by [D] and subsequent addresses. 5-22 (Note 3) Block Transfer (32-bit Data to - 16-bit Data) BKMV16 (P) S1, S2, D Transfers only the lower one word of data in the area specified by [S1] to [S2] to an area after the area specified by [D] all at once. 5-24 (Note 3) US, SS, Data exchange UL, SL, SF, DF XCH (P) D1, D2 (D1) (D2), (D2) (D1) (Note 1): Can be used with CPU units CPS41*/CPS31* Ver.3.0 or later, CPS21 Ver.1.0 or later. (Note 2): Can be used with CPU units CPS41*/CPS31 * Ver.3.2 or later, CPS21 Ver.1.0 or later. (Note 3): Can be used with CPU units CPS41*/CPS31 * Ver.4.2 or later, CPS21 Ver.1.2 or later 5-26 1-7 List of Instructions Name Operation unit Mnemonic Operand Function overview Page Exchange of Higher Bytes and Lower Bytes US, SS SWAP (P) S, D Exchanges the higher and lower order bytes of [S] data and stores it in [D]. 5-28 High/Low Byte in n Block - Exchange BSWAP (P) S, n, D Exchanges the high byte and low byte for [n] words from the device address specified by [S], and transfers it to the area starting with [D]. 5-29 (Note 1) Specified PB Local Device Write US, SS, UL, SL, LCWT (P) S, n, PBm, D Writes the data for [n] from the area specified by [S] to the area specified by [PBm]:[D] (local device) and subsequent areas all at once. 5-30 (Note 1) Specified PB Local Device Read US, SS, UL, SL, LCRD (P) PBm, S, n, D Transfers the data for [n] from the area specified by [PBm]:[S] (local device) to the area specified by [D] and subsequent areas. 5-32 (Note 1) Index Register Operation Instructions Index Register Backup UL, SL PUSHIX (P) D (I0) to (IE) (D) to (D29) 5-36 Index Register Recovery UL, SL POPIX (P) S (S) to (S29) (I0) to (IE) 5-37 Arithmetic Operation Instructions US, SS, Addition UL, SL, ADD (P) S1, S2, D (S1) + (S2) (D) 6-2 SF, DF US, SS, Subtraction UL, SL, SUB (P) S1, S2, D (S1) - (S2) (D) 6-4 SF, DF Multiplication US, SS, UL, SL, SF, DF MUL (P) S1, S2, D (S1) × (S2) (D, D+n) "n" changes according to the operation unit. 6-6 Saturation Multiplication US, SS, UL, SL, MLCLIP (P) S1, S2, D (S1) × (S2) (D) 6-8 (Note 1) Division US, SS, UL, SL, DIV SF, DF (P) S1, S2, D (S1) / (S2) Quotient (D) 6-10 Division (With a US, SS, remainder) UL, SL DIVMOD (P) S1, S2, D (S1) / (S2) Quotient (D), Remainder (D+n) "n" changes according to the operation unit. 6-12 Division (FP2 Compatible) US, SS, UL, SL DIVFP2 (P) S1, S2, D (S1) / (S2) Quotient (D), Remainder (SD15, SD16) 6-14 (Note 2) Increment US, SS, UL, SL, INC SF, DF (P) D (D) + 1 (D) 6-16 Decrement US, SS, UL, SL, SF, DF DEC (P) D (D) - 1 (D) 6-17 Arithmetic Instructions (BCD) BCD Data Addition US, UL BCDADD (P) S1, S2, D (S1) + (S2) (D) 6-18 BCD Data Subtraction US, UL BCDSUB (P) S1, S2, D (S1) - (S2) (D) 6-20 BCD Data Multiplication US, UL BCDMUL (P) S1, S2, D (S1) × (S2) (D, D+n) "n" changes according to the operation unit. 6-22 BCD Data Division US, UL BCDDIV (P) S1, S2, D (S1) / (S2) Quotient (D), Remainder (D+n) "n" changes according to the operation unit. 6-24 BCD Data Increment US, UL BCDINC (P) D (D) + 1 (D) 6-26 BCD Data Decrement US, UL BCDDEC (P) D (D) + 1 (D) (Note 1): Can be used with CPU units CPS41*/CPS31 * Ver.3.2 or later, CPS21 Ver.1.0 or later. (Note 2): Can be used with CPU units CPS41*/CPS31 * Ver.4.2 or later, CPS21 Ver.1.2 or later. 6-28 1-8 List of High-level Instructions Name Operation unit Mnemonic Operand Function overview Page Boolean Instructions Logical Conjunction US, SS, UL, SL AND (P) S1, S2, D (S1) (S2) (D) 6-30 Logical Disjunction US, SS, UL, SL OR (P) S1, S2, D (S1) (S2) (D) 6-32 Exclusive OR US, SS, UL, SL XOR (P) S1, S2, D {(S1) (S2) {(S1) (S2)} (D) 6-34 Exclusive NOR US, SS, UL, SL XNR (P) S1, S2, D {(S1) (S2) {(S1) (S2)} (D) 6-36 Combination US, SS, UL, SL COMB (P) S1, S2, S3, D {(S1) (S3)} {(S2) /(S3)} (D) 6-38 Data Conversion Instructions Data Inversion US, SS, UL, SL INV (P) D Performs logical inversion on each bit of data [D], and stores it in [D]. 7-2 Sign Inversion SS, SL NEG (P) S, D Performs sign inversion on data for [S], and stores it in [D]. 7-3 Absolute Value US, SS, UL, SL ABS (P) S, D Calculates the absolute value of the data for [S], and stores it in [D]. 7-4 Sign Extension US, SS EXT (P) S, D Converts the 16-bit BIN data for [S] to 32-bit BIN data while maintaining the signs, and stores it in (D+1, D). 7-5 Conversion: BCD Data US, UL BCD (P) S, D Converts the BIN data specified with [S] to BCD data, and stores it in the area starting with [D]. 7-6 Example) K100 H100 Conversion: BCD BIN US, UL BIN (P) S, D Converts the BCD data specified with [S] to BIN data, and stores it in the area starting with [D]. 7-7 Example) H100 K100 Decoding - DECO (P) S, n, D Decodes part of the data of [S] and stores it in the area starting with [D]. The target for conversion is specified 7-8 with "n". 7-Segment Decoding US SEGT (P) S, D Converts the data of [S] to data for use in a 7-segment display, and stores it in (D+1, D). 7-10 Encoding - ENCO (P) S, n, D Encodes part of the data of [S], and stores it in the area starting with [D]. The target for conversion is specified 7-12 with "n". Digit Unification US UNIT (P) S, n, D The least significant digits of the "n" words data of the 16-bit data starting with [S] are combined and stored in [D]. 7-14 Digit Disintegration US DIST (P) S, n, D Each digit of the data of [S] is separated and stored in each of the least significant digits of the 16-bit data 7-15 starting with [D]. Byte Data Unification - BUNI (P) S, n, D The least significant bytes of the "n" words data of the 16-bit data starting with [S] are combined and stored in the area starting with [D]. 7-16 (Note 1) Byte Data Disintegration - BDIS (P) S, n, D The data of the area starting with [S] is separated into byte units, and stored in the least significant bytes of the 16-bit data starting with [D]. 7-18 (Note 1) Conversion: Binary Gray code US, UL GRY (P) S, D Converts the BIN data stored in [S] to gray code data, and stores it in the area starting with [D]. 7-20 Conversion: Gray Code BIN US, UL GBIN (P) S, D Converts the gray code data stored in [S] to BIN data, and stores it in the area starting with [D]. 7-22 Conversion: Bit Line Bit US Column COLM (P) S, n, D Stores the values for bits 0 to 15 of [S] in bits [n] of [D] to [D+15]. 7-24 Conversion: Bit Column Bit US Line LINE (P) S, n, D Stores the values for bits [n] of [S] to [S+15] in bits 0 to 15 of [D]. 7-26 (Note 1): Can be used with CPU units CPS41*/CPS31 * Ver.3.2 or later, CPS21 Ver.1.0 or later. 1-9 List of Instructions Name Operation unit Mnemonic Operand Function overview Page Data-shift Instructions n-bit Right Shift US, SS, UL, SL SHR (P) D, n Shifts [n] bits of the data of [D] to the right. 8-2 n-bit Left Shift US, SS, UL, SL SHL (P) D, n Shifts [n] bits of the data of [D] to the left. 8-4 n-digit Right Shift US, SS, UL, SL BSR (P) D, n Shifts [n] digits of the data of [D] to the right. 8-6 n-digit Left Shift US, SS, UL, SL BSL (P) D, n Shifts [n] digits of the data of [D] to the left. 8-8 n-bit Right Shift of Multiple Devices bit BITR (P) D1, D2, n Shifts [n] bits of the area of [D1] to [D2] to the right. 8-10 n-bit Left Shift of Multiple Devices bit BITL (P) D1, D2, n Shifts [n] bits of the area of [D1] to [D2] to the left. 8-12 n-word Right Shift of Block Area US, SS WSHR (P) D1, D2, n Shifts [n] words of the area of [D1] to [D2] to the right. 8-14 n-word Left Shift of Block Area US, SS WSHL (P) D1, D2, n Shifts [n] words of the area of [D1] to [D2] to the left. 8-16 n-digit Right Shift of Block Area US, SS WBSR (P) D1, D2, n Shifts [n] digits of the area of [D1] to [D2] to the right. 8-18 n-digit Left Shift of Block Area US, SS WBSL (P) D1, D2, n Shifts [n] digits of the area of [D1] to [D2] to the left. 8-20 Data Rotation Instructions Right Rotation of Data US, UL ROR (P) D, n Rotates [n] bits of the data of [D] to the right. 8-22 Left Rotation of Data US, UL ROL (P) D, n Rotates [n] bits of the data of [D] to the left. 8-24 Right Rotation of Data with Carry-Flag Data US, UL RCR (P) D, n Rotates the area consisting of [D] plus the carry flag (SR9) data to the right by [n] bits. 8-26 Left Rotation of Data with Carry-Flag Data US, UL RCL (P) D, n Rotates the area consisting of [D] plus the carry flag (SR9) data to the left by [n] bits. 8-28 Data Buffer Instructions Data Table Shift-Out and Compress US, SS CMPR (P) D1, D2, D3 Transfer [D2] to [D3]. Any parts of the data between [D1] and [D2] that are 0 are compressed, and shifted in 8-30 order toward [D2]. Data Table Shift-In and Compress US, SS CMPW (P) S, D1, D2 Transfer [S] to [D1]. Any parts of the data between [D1] and [D2] that are 0 are compressed, and shifted in order 8-32 toward [D2]. Buffer Definition US, SS DEFBUF (P) n, D Defines the area of [n] words starting from [D] as the data buffer area to be used for FIFR/BUFW/LIFR instruction. 8-34 Data Read (First-In-First-Out) US, SS FIFR (P) S, D Reads data from the area indicated by the read pointer of the FIFO buffer starting from [S], and stores it in [D]. 8-36 Data Write US, SS BUFW (P) S, D Stores the value of [S] in the area indicated by the write pointer of the buffer starting with [D]. 8-38 Data Read (Last-In-First-Out) US, SS LIFR (P) S, D Reads data from the area indicated by the LIFO pointer of the LIFO buffer starting with [S], and stores it in [D]. 8-40 Ring Buffer Definition - DEFRBUF (P) n, D Defines the area of [n] words starting with [D] as the data buffer area to be used for RBUFW instruction. 8-42 (Note 1) Write to Ring Buffer, Calculation of Total Value and Moving Average Value US, SS RBUFW (P) S, D Reads data from the area indicated by the read pointer of the FIFO buffer starting from [S], and stores it in [D]. (Note 1): Can be used with CPU units CPS41*/CPS31 * Ver.3.2 or later, CPS21 Ver.1.0 or later. 8-44 (Note 1) 1-10 List of High-level Instructions Name Operation unit Mnemonic Operand Function overview Page Bit Manipulation Instructions 16-bit Data Specified Bit Set US BTS (P) D, n Turns ON (1) the [n]th bit in the area specified by [D]. 9-2 (Note 1) 16-bit Data Specified Bit US Reset BTR (P) D, n Turns OFF (0) the [n]th bit in the area specified by [D]. 9-4 (Note 1) Bit Inversion US BTI (P) D, n Invert the value of bit position [n] of the data of [D]. 9-6 Bit Test When the value of bit [n] of the data of [D] is 0, the US BTT (P) D, n system relay (SRB) turns ON. When the value is 1, the 9-7 system relay (SRB) turns OFF. Carry-Flag Set - STC (P) Turns ON the carry flag (SR9). 9-8 Carry-Flag Reset - CLC (P) Turns OFF the carry flag (SR9). 9-9 Data Processing Instructions Data Search US, SS, UL, SL, SF, DF SRC (P) S1, S2, S3, D Searches for the data of [S1] from the data stored in [S2] to [S3], and stores the matching articles and the relative position of where the data first matched in the area starting with [D]. 10-2 ON Bits Count US, UL BCU (P) S, D Counts the number of ON bits in the data of [S], and stores the number in [D]. 10-5 Obtainment of the Max. Value US, SS, UL, SL, SF, DF MAX Searches for the maximum value of the data stored in (P) S1, S2, D [S1] to [S2], and stores the maximum value and the relative position of where the maximum value was first 10-6 detected in the area starting with [D]. Obtainment of the Min. value US, SS, UL, SL, SF, DF MIN Searches for the minimum value of the data stored in (P) S1, S2, D [S1] to [S2], and stores the minimum value and the relative position of where the minimum value was first 10-10 detected in the area starting with [D]. Obtainment of the US, SS, Total and the UL, SL, Mean SF, DF MEAN (P) S1, S2, D Calculates the total and the average of the data stored in [S1] to [S2], and stores it in the area starting with [D]. 10-14 Sort US, SS, UL, SL, SF, DF SORT (P) S1, S2, S3 Changes the order of the data stored in [S1] to [S2]. The sorting conditions are specified in [S3] (descending 10-18 order or ascending order). Linearization US, SS, UL, SL, SF, DF SCAL Creates a data table used for scaling (linearization) in (P) S1, S2, D the area starting with [S2]. Scales the data of [S1] (input 10-21 value X), and stores it in [D] (output value Y). Variance and Standard Deviation Acquisition US, SS STDDEV (P) S, n, D Stores the variance and standard deviation within the range of the device area specified by [S] and [n] into the device area specified by [D]. 10-24 (Note 2) Event Count Instructions Instruction to Count the No. of UL Events EVENTC S1, S2, n, D Counts the number of ON times for the [n] bits of the data specified by [S1], and stores it in the area starting with [D]. 10-26 (Note 3) Instruction to Count the Time of UL Events EVENTT S1, S2, n, D Records the ON time in seconds units for the [n] bits of the data specified by [S1], and stores it in the area starting with [D]. 10-29 (Note 3) PID Instructions PID Operation - PID S Executes PID operation according to the parameters of [S] to [S+29]. The operation results are stored in [S+3] as manipulated value MV. 10-32 (Note 4) PID Operation: PWM Output - Available EZPID S1, S2, S3, S4 Executes PID operation according to the parameters of [S1], [S2], [S3] to [S3+3], and [S4] to [S4+29]. The operation results are stored in [S4] as manipulated value MV. An OUT instruction is written immediately after, and PWM output becomes possible. 10-37 (Note 4) (Note 1): Can be used with CPU units CPS41*/CPS31 * Ver.4.2 or later, CPS21 Ver.1.2 or later. (Note 2): Can be used with CPU units CPS41*/CPS31 * Ver.3.2 or later, CPS21 Ver.1.0 or later. (Note 3): Since EVENTC instruction and EVENTT instruction hold the operation description, it is necessary to set the execution condition to always ON. (Note 4): Since PID instruction and EZPID instruction hold the operation description, it is necessary to set the execution condition to always ON. 1-11 List of Instructions Name Operation unit Mnemonic Data Control Instructions Data Revision Detection US, SS, UL, SL, DTR (P) SF, DF Ramp Output US, SS, UL, SL, SF, DF RAMP Upper and Lower Limit Control US, SS, UL, SL, SF, DF LIMT (P) Deadband Control SS, SL, SF, DF BAND (P) Operand Function overview Page S, D S1, S2, S3, D S1, S2, S3, D S1, S2, S3, D Detects revisions in the data of [S], and reflects it to the carry flag (SR9). [D] is used as an area for holding the previous data values. Executes the linear output for the specified time [S3], from the specified initial value [S1] to the target value [S2]. Depending on whether the input value [S3] is within the range of the upper limit [S1] and the lower limit [S2], calculates the output and stores it in [D]. When (S1) > (S3), (S1) (D) When (S2) < (S3), (S2) (D) When (S1) (S3) (S2), (S3) (D) 10-45 10-47 10-49 Depending on whether the input value [S3] is within the range of the deadband specified by [S1] and [S2], calculates the output and stores it in [D]. When (S1) > (S3), (S3)-(S1) (D) When (S2) < (S3), (S3)-(S2) (D) When (S1) (S3) (S2), 0 (D) 10-51 Zone Control US, SS, UL, SL, SF, DF ZONE (P) S1, S2, S3, D Depending on the range of input value [S3], adds up the biases specified by [S1] or [S2], and stores the result in [D]. When (S3) < 0, (S3) + (S1) (D) When (S3) = 0, 0 (D) When (S3) > 0, (S3) + (S2) (D) 10-53 Time constant processing instructions Time Constant Processing - FILTR S1, S2, S3, D Performs the filtering process on the data specified by [S1] and [S2], and stores it in [D]. 10-55 Floating Point Real Number Function Instructions Sine Operation SF, DF SIN (P) S, D SIN (S) (D) 11-2 Cosine Operation SF, DF COS (P) S, D COS (S) (D) 11-3 Tangent Operation SF, DF Arcsine Operation SF, DF TAN ASIN (P) S, D (P) S, D TAN (S) (D) SIN-1 (S) (D) 11-4 11-5 Arccosine Operation SF, DF ACOS (P) S, D COS-1 (S) (D) 11-6 Arctangent Operation SF, DF ATAN (P) S, D TAN-1 (S) (D) 11-7 Conversion: Coordinate Data SF, DF Angle-Radian ATAN2 (P) S1, S2, D Determines the arctangent from [S1] (X coordinate) and [S2] (Y coordinate), and stores it in [D]. 11-8 Hyperbolic Sine Operation SF, DF SINH (P) S, D SINH (S) (D) 11-9 Hyperbolic Cosine Operation SF, DF COSH (P) S, D COSH (S) (D) 11-10 Hyperbolic Tangent Operation SF, DF TANH (P) S, D TANH (S) (D) 11-11 Exponential Operation SF, DF EXP (P) S, D EXP (S) (D) 11-12 Natural Logarithmic Operation SF, DF LN (P) S, D LN (S) (D) 11-13 Common Logarithmic Operation SF, DF LOG (P) S, D LOG (S) (D) 11-14 Power Operation SF, DF PWR (P) S1, S2, D (S1)(S2) (D) 11-15 Square Root Operation SF, DF SQR (P) S, D SQR (S) (D) 11-16 (Note 1): Since RAMP instruction and FILTER instruction hold the operation description, it is necessary to set the execution condition to always ON. 1-12 List of High-level Instructions Name Operation unit Mnemonic Operand Function overview Page Floating Point Real Number Conversion Instructions Conversion: Degrees Radian SF, DF RAD (P) S, D Converts the angle data in degrees of [S] to angle data in radians, and stores it in [D]. 11-17 Conversion: Radian Degrees SF, DF DEG (P) S, D Converts the angle data in radians of [S] to angle data in degrees, and stores it in [D]. 11-18 Floating Point Real Number Data Rounding the First Decimal Point Down SF, DF FINT (P) S, D Rounds down the first decimal point of the real numbers stored in [S], and stores them in [D]. 11-19 Floating Point Real Number Data Rounding the First Decimal Point Off SF, DF FRINT (P) S, D Rounds off the first decimal point of the real numbers stored in [S], and stores them in [D]. 11-20 Floating Point Real Number Data Sign Changes (Negative/Positive Conversion) SF, DF FNEG (P) S, D Changes the signs of the real numbers stored in [S], and stores them in [D]. 11-21 Floating Point Real Number Data - SF, DF Absolute Value FABS (P) S, D Determines the absolute values of the real numbers stored in [S], and stores them in [D]. 11-22 Conversion: Single-precision Real Number Data SF Double-precision Real Number STOD (P) S, D Converts the single-precision floating point real number stored in the area starting with [S] to a double-precision 11-23 floating point real number. Conversion: Double-precision Real Number Data DF Single-precision Real Number DTOS (P) S, D Converts the double-precision floating point real number stored in the area starting with [S] to a single-precision floating point real number. 11-24 Separation of Mantissa and Exponent of Single-precision or Double-precision Real Number Data SF, DF DISF (P) S, D1, D2 Separates the floating point real number data stored in the area starting with [S] into mantissa and exponent according to the operation unit [i]. 11-25 Combining of Mantissa and Exponent, and Conversion of Single-precision or Double-precision Real Number SF, DF UNIF Combines the data of mantissa and exponent stored in (P) S1, S2, D the areas starting with [S1] and [S2] according to the 11-27 operation unit [i]. Conversion: Integer Single-Precision Floating Point Real US, SS, UL, SL FLT Number Data (P) S, D Converts the integer data stored in [S] to single-precision floating point real number data, and stores it in [D]. 11-29 Conversion: Integer Double-precision Real Number Data US, SS, UL, SL DFLT (P) S, D Converts [S] (signed 32-bit integer data) to real number data, and stores it in [D]. 11-31 Conversion: Single-Precision Floating Point Real Number Data Integer (Max. Value US, SS, UL, SL INT Not Exceeding the Original Data) (P) S, D Converts the single-precision floating point real numbers stored in [S] to integers (maximum value cannot be exceeded), and stores them in [D]. 11-33 1-13 List of Instructions Name Operation unit Mnemonic Conversion: Double-Precision Real Number Data Integer (Max. Value Not US, SS, UL, SL DINT (P) Exceeding the Data) Conversion: Single-Precision Floating Point Real Number Data Integer (Rounding US, SS, UL, SL FIX (P) the First Decimal Point Down) Conversion: Double-Precision Real Number Data Integer (Rounding Down to US, SS, UL, SL DFIX (P) the Closest Whole Number) Conversion: Single-Precision Floating Point Real Number Data Integer (Rounding US, SS, UL, SL ROFF (P) the First Decimal Point Off) Conversion: Double-Precision Real Number Data US, SS, Integer UL, SL DROFF (P) (Rounding the First Decimal Point Off) Clock/Calendar Instructions Conversion: Time Data (Hours, Minutes and - Seconds) Seconds Data HMSS (P) Conversion: Seconds Data Time Data (Hours, - Minutes and Seconds) SHMS (P) Clock Addition - CADD (P) Clock Subtraction - CSUB (P) Operand Function overview Page Converts [S] (real data) to a signed-32-bit integer S, D (maximum value cannot be exceeded), and stores it in 11-36 [D]. Converts the single-precision floating point real S, D numbers stored in [S] to integers (rounding the first 11-39 decimal point down), and stores them in [D]. Converts [S] (real number data) to a signed-32-bit S, D integer (rounding the first decimal point down), and 11-42 stores it in [D]. Converts the single-precision floating point real S, D numbers stored in [S] to integers (rounding the first 11-45 decimal point off), and stores them in [D]. Converts [S] (real number data) to a signed-32-bit S, D integer (rounding the first decimal point off), and stores 11-48 it in [D]. Converts the BIN data stored in [S] to [S+2] which S, D indicates the hour, minute, second into seconds units, 12-2 and stores it in (D+1, D). Converts the second data stored in [S+1, S] to hour, S, D minute, second, and stores it in [D] to [D+2] as BIN 12-3 data. S1, S2, D Adds the time data (hour, minute, second) stored in [S2] to [S2+2] to the clock data (year, month, date, hour, minute, second) stored in [S1] to [S1+5], and stores it in [D] to [D+5]. 12-4 S1, S2, D Subtracts the time data (hour, minute, second) stored in [S2] to [S2+2] from the clock data (year, month, date, hour, minute, second) stored in [S1] to [S1+5], and stores it in [D] to [D+5]. 12-5 Clock Data Seconds Data from - the Base Time TMSEC (P) S, D Converts the clock data specified by [S] to seconds data from the base time (Jan 1, 2001), and stores it in (D+1, 12-6 D). Second Data from the Base Time - Clock Data Setting of Clock/Calendar - Summer Time Acquisition - SECTM (P) S, D TIMEWT (P) S SUMMER (P) S1, S2, S3, D Converts the seconds data from the base time (Jan 1, 2001) stored in [S+1, S] to clock data, and stores it in [D] to [D+5]. 12-7 Sets the clock data (year, month, date, hour, minute, second) stored in [S] to [S+6] as RTC data in CPU units. 12-8 Sets the clock data corrected by [S3] (time difference) in [D] (valid/invalid flag + time data) for the period specified by the period of [S1] to [S2] (month, date, hour, minute). 12-10 (Note 1) 1-14 List of High-level Instructions Name Operation unit Mnemonic Logging Trace Instructions Logging Trace Start Request US, SS LOGST (P) Logging Trace Stop Request US, SS LOGED (P) Sampling Trace US, SS SMPL (P) Special Instructions Self-Diagnostic Error Code Set US ERR (P) Watchdog Timer Reset - System Area Copy - Starting Word Number Acquisition - of Target Slot WDTRES (P) SCOPY (P) GETSTNO (P) Operand n n n n S1, S2, S3, D S, D Function overview Page Requests to start the logging trace function for the number specified by [n]. Requests to stop the logging trace function for the number specified by [n]. Performs sampling during tracing. 13-2 13-3 13-4 Sets the arbitrary error code [n] with the user program. Stores the self-diagnostic error code in the system data register (SD0). Sets the self-diagnosis error occurrence flag (SR0). 13-10 Resets the watchdog timer. 13-12 Copies data in the area specified by [S1], [S2], and [S3] 13-13 to the area specified by [D]. (Note 2) The starting word number of a specified slot is obtained. 13-15 (Note 3) (Note 1): Can be used with CPU units CPS41*/CPS31 * Ver.4.1 or later, CPS21 Ver.1.1 or later. (Note 2): Can be used with CPU units CPS41*/CPS31 * Ver.3.2 or later, CPS21 Ver.1.0 or later. (Note 3): Can be used with CPU units CPS41*/CPS31* Ver.3.0 or later, CPS21 Ver.1.0 or later. 1-15 List of Instructions Name Operation unit Mnemonic Operand Function overview Page Positioning Unit Control Instructions Setting of Positioning - Starting Table POSSET (P) S1, S2, S3 Sets the positioning data table to be started, described right before the program which starts positioning. Specify 13-16 Slot No., Axis No., Table No. for [S1], [S2], [S3]. Acquire Axis Status - PSTRD Reads the main flag status as the axis status for Axis No. (P) S1, S2, D [S2] of the start positioning unit equipped to Slot No. [S1], 13-17 and stores it in [D]. Acquire Positioning Unit - Error/Warning PERRD Reads the error codes and warning codes stored in the (P) S1, S2, D annunciation buffer 1 for Axis No. [S2] of the start positioning unit equipped to Slot No. [S1], and stores them in [D] and [D1]. 13-19 Unit Control Instructions Error and Warning Clear - UCLR (P) S Clears the errors and warnings for the unit equipped to the slot number specified by [S]. 13-21 Character String Conversion Instructions Block Check Code Calculation US, SS BCC (P) S1, S2,, S3, D Calculates the block check code for the data specified by [S2] and [S3], and stores it in the area starting with [D]. The calculation method is specified by [S1]. 14-2 CRC Code Calculation US, SS CRC (P) S1, S2, S3, D Calculates the CRC code for the data specified by [S2] and [S3], and stores it in the area starting with [D]. The calculation method is specified by [S1]. 14-5 Conversion: HEX Hexadecimal ASCII US, SS, UL, SL HEXA Converts the hexadecimal data specified by [S1] and [S2] (P) S1, S2, D to ASCII code, and stores it in the area starting with [D]. Example) HABCD H 42 41 44 43 14-9 BA DC Conversion: Hexadecimal ASCII HEX US, SS, UL, SL AHEX Converts the ASCII code specified by [S1] and [S2] to hexadecimal data, and stores it in the area starting with (P) S1, S2, D [D]. Example) H 44 43 42 41 HCDAB DC BA 14-11 Conversion: BCD Decimal ASCII US, UL BCDA Converts the BCD data specified by [S1] and [S2] to ASCII code, and stores it in the area starting with [D]. The conversion method is specified by [S2]. (P) S1, S2, D Example 1) H1234 H 32 31 34 33 2 1 4 3 14-13 Example 2) H1234 H 34 33 32 31 4 3 2 1 Conversion: Decimal ASCII US, UL BCD ABCD Converts the ASCII code specified by [S1] and [S2] to BCD data, and stores it in the area starting with [D]. The conversion method is specified by [S2]. (P) S1, S2, D Example 1) H 34 33 32 31 H 3412 4 3 2 1 Example 2) H 34 33 32 31 H 1234 4 3 2 1 14-16 Conversion: BIN US, SS, Decimal ASCII UL, SL BINA Converts the BIN data specified by [S1] which indicates a decimal to ASCII code, and stores it in the area starting (P) S1, S2, D with [D]. The number of bytes for the conversion result is specified by [S2]. 14-19 Example) K-100 H 30 30 31 2D 20 20 0 0 1 Conversion: Decimal ASCII BIN US, SS, UL, SL ABIN Converts the ASCII code stored in the area starting with [S1] to BIN data which indicates a decimal, and stores it in the area starting with [D]. The number of bytes to convert (P) S1, S2, D is specified by [S2]. 14-21 Example) H 30 30 31 2[D] 20 20 K-100 0 0 1 Conversion: BIN ASCII US, SS, UL, SL, SF, DF BTOA (P) S1, S2, N, D Converts the BIN data stored in the area starting with [S2] to ASCII data, and stores it in the area starting with [D]. 14-23 The conversion method is specified by [S1] and [N]. ASCII Data Check US, SS, UL, SL, SF, DF ACHK (P) S1, S2, N Checks whether ASCII data converted with ATOB instruction can be converted under normal conditions. 14-34 1-16 List of High-level Instructions Name Operation unit Mnemonic Operand Function overview Page Conversion: ASCII BIN US, SS, UL, SL, SF, DF ATOB (P) S1, S2, N, D Converts the ASCII data stored in the area starting with [S2] to BIN data, and stores it in the area starting with [D]. 14-35 The conversion method is specified by [S1] and [N]. Character String Conversion Instructions Conversion: Character Constant - ASCII Code SSET (P) S, D Converts the character constant specified by [S] to ASCII code, and stores it in the area starting with [D]. 14-47 Text Creation - PRINT (P) S1, S2, D Inserts the data to be output [S2] to the text creation form [S1], creates the text, and stores it in the area specified by [D]. 14-51 (Note 1) Date and Time Character String - Conversion TIMEstr Converts the date and time information specified by [S1] (P) S1, S2, D according to the conversion pattern specified by [S2], and stores the character string in the storage location 14-60 (Note 1) specified by [D]. String Operation Instructions String Compare - SCMP (P) S1, S2 Compares the character string of [S1] with the character string of [S2], and outputs the result to the system relay (SRA to SRC). (S1) > (S2) SRA:ON (S1) = (S2) SRB:ON (S1) < (S2) SRC:ON 14-64 String Addition - SADD (P) S1, S2, D Couples the character string of [S1] with the character string of [S2], and stores it in [D]. 14-66 Obtainment of String Length - LEN (P) S, D The number of character strings stored in the character string table data starting with [S] is stored in [D]. 14-67 Search String Length (Terminating NULL) LENGTH (P) S1, S2, D Detects a termination character (null) from a string and acquires the number of characters. 14-68 (Note 1) String Search - SSRC Searches for data [S1] from the character string table data (P) S1, S2, D starting with [S2], and the relative position of the first 14-70 match is stored in [D]. Takeout of the Right Side of a - String RIGHT Retrieves the number of characters [S2] from the right (P) S1, S2, D side (the side where the device address is larger) of the character string table starting with [S1], and stores it in [D]. 14-72 Takeout of the Left Side of a - String LEFT Retrieves the character strings of [S2] number of (P) S1, S2, D characters from the left side (the side where the device address is smaller) of the character string table starting with [S1], and stores it in [D]. 14-74 Data Read from a Given Position in - the String MIDR (P) S1, S2, S3, D Reads the character strings for [S3] number of character strings from the [S2] byte of the character string table starting with [S1], and stores it in [D]. 14-76 Rewrite from a Given Position in - the String MIDW (P) S1, S2, D, n Reads the character string data for [S2] number of characters from the character string table starting with [S], 14-78 and stores it in [D] from the position of the [n]th byte. Replacement of a Character String - SREP Replaces the character string table starting with [D] with (P) S, D, p, n the character strings of [S1]. The positions and number of characters that can be replaced are specified with [p] and 14-80 [n]. (Note 1): Can be used with CPU units CPS41*/CPS31 * Ver.4.1 or later, CPS21 Ver.1.1 or later. 1-17 List of Instructions Name Operation unit Mnemonic Operand Function overview Page Character String Conversion Instruction (With Storage Area Size) Conversion: Character Constant - ASCII Code ESSET (P) S, D Converts the character constant specified by [S] to ASCII code, and stores it in the area starting with [D]. The storage area size is specified at the head. 14-82 Text Creation (With Storage - Area Size) Inserts the data to be output [S2] to the text creation EPRINT (P) S1, S2, D form [S1], creates the text, and stores it in the area specified by [D]. The storage area size is specified at the head. 14-84 (Note 1) Date and Time Character String Conversion (With - Storage Area Size) ETIMEstr (P) S1, S2, D Converts the date and time information specified by [S1] according to the conversion pattern specified by [S2], and stores the character string in the storage location specified by [D]. The storage area size is specified at the head. 14-90 (Note 1) String Operation Instruction (With Storage Area Size) String Compare - ESCMP (P) S1, S2 Compares the character string of [S1] with the character string of [S2], and outputs the result to the system relay (SRA to SRC). (S1) > (S2) SRA:ON (S1) = (S2) SRB:ON (S1) < (S2) SRC:ON 14-93 String Addition - ESADD (P) S1, S2, D Couples the character string of [S1] with the character string of [S2], and stores it in [D]. 14-95 Obtainment of String Length - ELEN (P) S, D The number of characters stored in the character string table data starting with [S] is stored in [D]. 14-97 String Search - Searches for data [S1] from the character string table ESSRC (P) S1, S2, D data starting with [S2], and the relative position of the 14-98 first match is stored in [D]. Takeout of the Right Side of a - String Retrieves the number of characters [S2] from the right ERIGHT (P) S1, S2, D side (the side where the device address is larger) of the character string table starting with [S1], and stores it in 14-101 [D]. Takeout of the Left Side of a - String ELEFT Retrieves the character strings of [S2] number of (P) S1, S2, D characters from the left side (the side where the device address is smaller) of the character string table starting 14-103 with [S1], and stores it in [D]. Data Read from a Given Position in - the String EMIDR (P) S1, S2, S3, D Reads the character strings for [S3] number of character strings from the [S2] byte of the character string table starting with [S1], and stores it in [D]. 14-105 Rewrite from a Given Position in - the String EMIDW (P) S1, S2, D, n Reads the character string data for [S2] number of characters from the character string table starting with 14-107 [S], and stores it in [D] from the position of the [n]th byte. Replacement of a Character String - ESREP Replaces the character string table starting with [D] with (P) S, D, p, n the character strings of [S1]. The positions and number of characters that can be replaced are specified with [p] and [n]. (Note 1): Can be used with CPU units CPS41*/CPS31* Ver.3.0 or later, CPS21 Ver.1.0 or later. 14-109 1-18 List of High-level Instructions Name Operation unit Mnemonic Communication Instructions Specification of a Communication - Unit Slot Port UNITSEL (P) Operand Function overview S1, S2 Specifies the target of each instruction to execute, described immediately before the communication instruction. The target slots are specified in [S1], and the target COM port numbers or target connections are specified in [S2]. Page 15-2 General-Purpose Communication US, SS Send Instruction GPTRNS (P) S, n, D Transfers the [n] bytes of data stored in the area starting with [S] to external devices via the COM port (SCU) or the LAN port (ET-LAN) of the unit. 15-4 (Note 1) General-Purpose Communication US, SS Send Instruction pGPSEND S, n, D Transfers to external devices using the built-in SCU and built-in ET-LAN of CPU, and the add-on communication port of the SCU unit (SCU: COM port, ET-LAN: connection). 15-4 (Note 2) General-Purpose Communication US, SS Send Instruction GPSEND (P) S, n, D Transfers the [n] bytes of data stored in the area starting with [S] to external devices via the COM port (SCU) or the LAN port (ET-LAN) of the unit. 15-4 (Note 3) General-Purpose Communication Receive Instruction US, SS GPRECV (P) D1, D2 Copies the data received from external devices via the COM port (SCU) or the LAN port (ET-LAN) of the unit to 15-12 the range of [D1] to [D2]. MEWTOCOL/MO DBUS Master US, SS Send Instruction SEND Reads the data from devices within the master unit (P) S, n, D1, D2, D3 starting with [S], and stores the data in the partner station number [D1] from the address starting with [D2]. 15-18 The number of sent data is specified by [n]. MEWTOCOL/MO DBUS Master Communication Receive Instruction US, SS RECV Reads the data from the partner station number [S1] (P) S1, S2, n from the address starting with [S2], and stores the data D1, D2 in the area of the master unit starting with [D1]. The 15-24 number of received data is specified by [n]. MODBUS Master Send Instruction: Function Code Specification US, SS SEND (P) S, n, D1 D2, D3 Reads the data from devices within the master unit starting with [S], and stores the data in the partner station number [D1] from the address starting with [D2]. The MODBUS function code and station No. are specified by [D1], and the number of sent data is specified by [n]. 15-30 MODBUS Master Receive Instruction: Function Code Specification US, SS RECV Reads the data from the partner station number [S1] from the address starting with [S2], and stores the data (P) S1, S2, n D1, D2 in the area of the master unit starting with [D1]. The MODBUS function code and station number are 15-36 specified by [S1], and the number of received data is specified by [n]. Change of SCU Parameter - PMSET pPMSET S, n, D S, n, D The data stored in the area of [n] words starting with [S] is set for the communication parameter of the COM port (SCU) of the unit. 15-42 (Note 4) For PMSET instruction, the acknowledgment process is performed when the instruction is executed. For pPMSET instruction, the acknowledgment process is performed when the scan is finished. 15-42 (Note 5) Obtainment of SCU Parameters - PMGET (P) S, D Reads the communication parameter set for the COM port (SCU) of the unit, and stores it in the area starting with [D]. 15-47 Configuration Change - CONFIG (P) - Changes the settings for MEWTOCOL communication. 15-53 (Note 6) (Note 1): Can be used with CPU units CPS41*/CPS31 * Ver.4.1 or later, CPS21 Ver.1.1 or later. (Note 2): Can be used with CPU units CPS41*/CPS31 * Ver.3.0 or later, CPS21 Ver.1.0 or later. (Note 3): For GPSEND instruction, it is necessary to set the execution condition to ON from the time when the instruction is started to the time when the sending flag turns OFF. (Note 4): For PMSET instruction, it is necessary to set the execution condition to ON from the time when the instruction is started to the time when the processing flag turns OFF. (Note 5): Can be used with CPU units CPS41*/CPS31* Ver.3.1 or later, CPS21 Ver.1.0 or later. (Note 6): Can be used with CPU units CPS41*/CPS31 * Ver.3.42 or later, CPS21 Ver.1.42 or later. 1-19 List of Instructions Name Operation unit Mnemonic Operand Function overview Page Communication Instruction (When Using FP7 Multi-Wire Link Unit) Send Instruction (When Using FP7 Multi-Wire Link Unit) US, SS SEND Data can be transferred from the master unit to the partner unit between PLCs connected by MEWNET-W or (P) S, n, D1, D2, D3 MEWNET-W2. Reads the data from devices within the master unit 16-2 starting with [S], and stores the data in the partner station number [D1] from the address starting with [D2]. The number of sent data is specified by [n]. Receive Instruction (When Using FP7 Multi-Wire Link Unit) US, SS RECV Data can be transferred from the partner unit to the master unit between PLCs connected by MEWNET-W or (P) S1, S2, n D1, D2 MEWNET-W2. Reads the data from the partner station number [S1] from 16-5 the address starting with [S2], and stores it in the device of the master unit starting with [D1]. The number of received data is specified by [n]. Obtainment of MEWNET-W - Parameters PMGET (P) S, D Reads the communication status set for MEWNET-W and the operations of the PLC link, and stores them in the 16-8 area starting with [D]. Obtainment of MEWNET-W2 - Parameters PMGET (P) S, D Reads the communication status set for MEWNET-W2 and the operations of the PLC link, and stores them in the 16-11 area starting with [D]. Obtainment of MEWNET-F - Parameters PMGET (P) S, D Reads the communication status set for MEWNET-F, and stores it in the area starting with [D]. 16-15 Change of MEWNET-W - Parameter PMSET pPMSET S, n, D S, n, D The data stored in the area of [n] words starting with [S] is set for the communication parameter of MEWNET-W. For PMSET instruction, the acknowledgment process is performed when the instruction is executed. For pPMSET instruction, the acknowledgment process is performed when the scan is finished. 16-17 Change of MEWNET-W2 - Parameter PMSET pPMSET S, n, D S, n, D The data stored in the area of [n] words starting with [S] is set for the communication parameter of MEWNET-W2. For PMSET instruction, the acknowledgment process is performed when the instruction is executed. For pPMSET instruction, the acknowledgment process is performed when the scan is finished. 16-20 Special Instruction (When Using FP7 Multi-Wire Link Unit) Error Clear (When Using FP7 Multi-Wire Link US Unit) ERR (P) N Clears internal errors for the FP7 multi-wire link unit. Resets the values for the system relay and system data register. 16-23 1-20 List of High-level Instructions Name Operation unit Mnemonic Operand Function overview Page Ethernet Communication Instruction (Setting) ET-LAN Status Read - RDET (P) D Reads the status for all connections to the LAN port (ET-LAN) of the unit, and stores it in [D]. 17-2 (Note 1) Information Acquisition of Ethernet Unit - (IP/MAC Destination) ETSTAT Stores the unit information (IP/MAC connection (P) S1, S2, D destination) specified by [S1] and [S2] in the area starting with [D]. 17-4 (Note 1) Information Acquisition of Ethernet Unit - (FTP/HTTP/SMTP) ETSTAT (P) S1, S2, D Stores the unit information (FTP/HTTP/SMTP) specified by [S1] and [S2] in the area starting with [D]. 17-13 (Note 1) IP Address Setting - IPv4SET (P) S Sets the IP address with the setting parameters stored in the device address starting with [S] or the number of character constants. The subnet mask and default gateway can be omitted. 17-20 (Note 1) PING Request - pPINGREQ S, D In order to acknowledge the operations of communication relay devices, a PING send request is performed [S] number of times with the devices indicated in [D]. 17-24 (Note 2) User Connection Setting - CONSET (P) S1, S2, D1, D2 Sets the connection setting parameters specified by [S1] and [S2] to the range of [D1] to [D2]. 17-27 (Note 1) Connection Open - OPEN (P) S Opens the connection number specified by [S]. 17-33 (Note 1) Connection Close - CLOSE (P) S Closes the connection number specified by [S]. 17-35 (Note 1) NTP Destination Server Setting - NTPcSV (P) S1, S2 Sets the SNTP server address and time zone to the CPU unit with a built-in ET-LAN. 17-37 (Note 4) Time Adjustment Request - pNTPcREQ S1, S2, D Requests the time adjustment. 17-41 (Note 3) Ethernet Communication Instruction (FTP Client) FTP Client Connected Server - Setting FTPcSV (P) S1, S2, S3 Sets the FTP server of the connection destination to the CPU unit according to the parameters specified by [S1], [S2], and [S3]. 17-46 (Note 1) FTP Client Transfer Setting - FTPcSET (P) S1, S2, S3, S4 Sets and stores the FTP client transfer settings of [S2] 17-51 to [S4] to the transfer setting area specified by [S1]. (Note 1) FTP Client/Logging Trace Transfer - Setting FTPcLOG (P) S1, S2, S3 Sets and stores the logging trace transfer settings of [S2] to [S3] to the logging trace transfer settings area specified by [S1]. 17-59 (Note 1) FTP Client Transfer Request - FTPcREQ (P) S Requests a transfer of the FTP client transfer No. specified by [S]. 17-62 (Note 1) FTP Client Transfer Control - FTPcCTL (P) S1, S2 Controls whether to enable, disable, or cancel the transfer of the FTP client, according to the specification of the control description [S2] for control target [S1]. 17-65 (Note 1) Ethernet Communication Instruction (HTTP Client) HTTP Client Connected Server - Setting HTTPcSV (P) S1, S2, S3 Sets the HTTP server of the connection destination to the CPU unit according to the parameters specified by [S1], [S2], and [S3]. 17-68 (Note 1) HTTP Client Transfer Setting - HTTPcSET (P) S1, S2, S3, S4 Sets and stores the HTTP client transfer settings of [S2] to [S4] to the transfer setting area specified by [S1]. 17-73 (Note 1) HTTP Client Transfer Request - HTTPcRE Q (P) S Requests a transfer of the HTTP client transfer No. specified by [S]. 17-79 (Note 1) HTTP Client Transfer Control - HTTPcCTL (P) S1, S2 Controls whether to enable, disable, or cancel the transfer of the HTTP client, according to the specification of the control description [S2] for control target [S1]. (Note 1): Can be used with CPU units CPS41E*, CPS31E* Ver.3.0 or later. (Note 2): Can be used with CPU units CPS41E*, CPS31E* Ver.3.2 or later. (Note 3): Can be used with CPU units CPS41E*, CPS31E* Ver.4.1 or later. (Note 4): Can be used with CPU units CPS41E*, CPS31E* Ver.4.3 or later. 17-82 (Note 1) 1-21 List of Instructions Name Operation unit Mnemonic Operand Function overview Page Ethernet Communication (SMTP Mail Sending) Instruction Mail Text Setting - SMTPcBD Y (P) S1, S2 Sets the text specified by [S2] into the mail text of the number specified by [S1]. 17-84 (Note 1) Mail Text Read - SMTPcBR D (P) S, D Reads the mail text of the number specified by [S] to the area specified by [D]. 17-87 (Note 1) Mail Server Setting - SMTPcSV (P) S1, S2, S3 Sets the mail transmission server and the sender to the CPU unit according to the parameters specified by [S1], [S2], and [S3]. 17-89 (Note 4) Destination Group Setting - SMTPcAD D (P) S1, S2, S3, S4 Sets the destination group name specified by [S2] and the destination address specified by [S3] and [S4] to the destination group number specified by [S1]. 17-94 (Note 2) Mail Transmission - Setting SMTPcSE T (P) S1, S2, S3, S4 Stores the mail transmission settings of [S1] to [S4] 17-98 in the mail transmission setting area. (Note 2) Logging/Trace Mail Setting - SMTPcLO G (P) S1, S2, S3, S4 Stores the logging/trace mail settings of [S2] to [S4] in the logging/trace transfer setting area specified by [S1]. 17-106 (Note 2) Mail Send Request - SMTPcRE Q (P) S Requests transmission of the mail with the transmission No. specified by [S]. 17-110 (Note 2) Mail Transmission - Control SMTPcCT L (P) S1, S2 Controls whether to enable, disable, or cancel the transmission of mail, according to the specification of the control description [S2] for control target [S1]. 17-113 (Note 2) Ethernet Communication (Ethernet/IP) Instruction EtherNet/IP Information - Acquisition ETSTAT (P) S1, S2, D Reads the parameter information or status information specified by [S1] and [S2], and stores it in the area starting with [D]. 17-116 (Note 3) EtherNet/IP EtherNet/IP Node Status - Acquisition Instruction EIPNDST S, D1, D2 Stores the status for the node number specified by [S] in the device specified by [D1], and stores the execution result in [D2]. 17-121 (Note 3) Cyclic Communicatio - n Start Request EIPSTART S, n, D Starts the node on which the start request is made within the maximum node number specified by [n] from the stop request node number table specified by [S]. 17-145 (Note 3) Cyclic Communicatio - n Stop Request EIPSTOP S, n, D Stops the node on which the stop request is made within the maximum node number specified by [n] from the stop request node number table specified by [S]. 17-147 (Note 3) EtherNet/IP Input Refresh - EIP_IN (P) S1, S2, D Refreshes the input for the connections targeted to 17-149 be refreshed. (Note 3) EtherNet/IP Output Refresh - EIP_OT (P) S1, S2, D Refreshes the output for the connections targeted to be refreshed. 17-153 (Note 3) Ethernet Communication (MC Protocol) Instruction MC Protocol Master Transfer Instruction US, SS SEND (P) S, n, D1 D2, D3 Reads the data from the devices within the master unit starting with [S], and stores the data in the partner station from the address starting with [D1] + [D2]. The device type of the transfer destination device is specified by the high byte of [D1] and the number of sent data is specified by [n]. 17-157 (Note 4) MC Protocol Master Communicatio n Receive Instruction US, SS RECV (P) S1, S2, n D1, D2 Reads the data of the partner station from the address starting with [S1] + [S2], and stores it in the area of the master unit starting with [D1]. The device type of the transfer source device is specified by the high bytes of [S1] and the number of received data is specified by [n]. (Note 1): Can be used with CPU units CPS41E*, CPS31E* Ver.3.2 or later. (Note 2): Can be used with CPU units CPS41E*, CPS31E* Ver.3.0 or later. (Note 3): Can be used with CPU units CPS41E*, CPS31E* Ver.4.0 or later. (Note 4): Can be used with CPU units CPS41E*, CPS31E* Ver.3.1 or later. 17-162 (Note 4) 1-22 List of High-level Instructions Name Operation unit Mnemonic Operand Function overview Page SD Memory Card Access Instruction (Note 1) Operation Memory File Write in BIN Format US, SS CDTWT (P) S, n, D Writes the binary data for [n] words from the area starting with [S] to the SD memory card as a file. 18-2 Data Read from BIN Format File to Operation Memory US, SS CDTRD (P) S, n, D Reads [n] pieces of binary data from the file with the file number specified by [S], and stores it in the device 18-4 address starting with [D]. File Data Write Instruction - CWT (P) S, n, D1, D2 Stores [n] pieces of data stored in the device address starting from [S] to the file specified by [D1] according 18-6 to the parameter specified by [D2]. File Data Read - CRD (P) S1, S2, n D Stores [n] pieces of data to the device address starting from [D] according to the file specified by [S1] 18-18 and the parameter specified by [S2]. Directory Creation - CMKDIR (P) S Creates a folder in an SD memory card. 18-28 Directory Delete - CRMDIR (P) S Deletes a folder in an SD memory card. 18-30 Directory Delete (valid for directories - containing files) CRMDIRFL (P) S Deletes a folder in an SD memory card. 18-30 (Note 2) File Delete - CFDEL (P) S Deletes the file specified by [S] in an SD memory card. 18-32 ASCII Data Write to File STR CPR (P) S, D Writes the character string specified by [S] at the end of the file specified by [D]. 18-34 One Line Read from File STR CRD1 (P) S, D1, D2 Reads the first row data from the row specified by [D2] in the file specified by [S], and stores it in the device address starting from [D1]. 18-36 File Rename - CREN (P) S1, S2 Changes the file name specified by [S1] to the file name specified by [S2]. 18-41 File Copy - CCOPY (P) S1, S2, S3 Copies the file specified by [S1] to the file specified by [S2] according to the parameter specified by [S3]. 18-43 File Move - CMV (P) S1, S2, S3 Moves the file specified by [S1] to the file specified by [S2] according to the parameter specified by [S3]. 18-45 Acquiring SD Memory Card UL Free Space CFREE (P) D Stores the free space amount of the SD memory card in the area specified by [D] in byte units. 18-47 Acquiring SD Memory Card UL Free Space CFREEK (P) D Stores the free space amount of the SD memory card in the area specified by [D] in k (kilo) byte units. 18-48 Acquiring File Status US, SS CFLS (P) S, D Obtains the status of the file name specified by [S], and stores the result in 10-word area ([D] to [D]+9) from [D]. 18-49 Panasonic SD Memory Card Lifetime - Information Read PanaSD (P) D1, D2, D3 Reads the lifetime information of a Panasonic SD memory card. (Note 1): SD card control instruction cannot be used for CPU unit CPS21. (Note 2): Can be used with CPU units CPS41*/CPS31* Ver.4.3 or later. (Note 3): Can be used with CPU units CPS41*/CPS31* Ver.3.2 or later. 18-51 (Note 3) 1-23 List of Instructions 1-24 2 2 Overview of Instructions Overview of Instructions 2-1 Structure of Instructions Structural patterns of basic instructions Sequence basic instructions · Basic instructions are a group of the most essential instructions based on the relay sequence circuit, used for logic operation by the unit of bits. As indicated below, they are expressed by a combination of relay coils and contacts. · Available relays vary by instruction. Refer to explanations for respective instructions. Address Input contact Internal relay coil X100 X101 R0 0 ST AN OT R0 OR 1 Internal relay contact R0 4 ST Output coil Y100 OT Bus bars Basic function instructions · There are a group of instructions that execute timer, counter, shift register and other basic functions. X100 TMX 5 K 30 T5 Y100 In this example, a 0.1-second timer with the timer number 5 is set to 3.0 seconds. It starts counting time when X100 is ON, and the contact T5 turns ON when the timer reaches 3.0 seconds. 2-2 Structure of Instructions Control instructions · These are a group of instructions that determine the order and flow for executing a program. Conditions can be set to modify parts of a program to be executed, or to execute necessary parts only. · Major control instructions include the following. Mnemonic MC-MCE Name Master control relay JP/LBL Jump label LOOP/LBL Loop label Functions When execution conditions are OFF, output between MC and MCE are turned OFF. Jumps to the LBL instruction with the same number when the execution condition is ON. When LBL instruction is in an address that comes after JP instruction, the programs between JP and LBL are not executed, so the operation time is shortened. When execution conditions are ON, the part of a program between LBL and LOOP is repeated for specified times. Step ladder instructions · These instructions handle a section specified by SSTP to STPE as an independent "process", and operate sequential execution or branch execution. Subroutine instructions · These instructions call and execute subroutines when necessary. Subroutines are programs for repeated execution of operations, etc., as specified by SBL and RET. Data comparison instructions These are a group of instructions for comparing two sets of data. They operate as a contact that turns ON and OFF in accordance with the comparison result. DT 10 <=.SS K 100 R100 2-3 Overview of Instructions Structural patterns of high-level instructions Structure of high-level instructions · Mnemonics indicate the specifics of operation (e.g. data transfer, arithmetic operation). · Operation units indicate the units for operation triggered by instructions (e.g. US, SS, UL, SL, SF, DF). · Operands indicate the targets of operation and/or methods for operation processes. There are three types of operands: [S], [D], and [n]. The number and types of operands that need to be specified vary by instruction. Mnemonic Operation unit Operand R0 MV. SS K0 DT0 S D Types of operands Symbol Type S Source D Destination n Number Functions Specify data targeted by operation and/or methods for processing. Specify the storage location for operation result. Numerical data that specify data targeted by operation and/or methods for processing. Every Scan Execution Type and Differential Execution Type · For high-level instructions, there are two execution types: every scan execution type and differential execution type. (1) Every Scan Execution Type This type of instruction is executed repeatedly for every scan while the internal relay is established. ON Internal relay OFF High-level instruction Executed Single scan (2) Differential Execution Type This type of instruction is executed only for a single scan when a leading edge or trailing edge of the internal relay is detected. ON Internal relay OFF High-level instruction Single scan Executed 2-4 Structure of Instructions Input of differential execution type instruction · To input a differential execution type instruction using the tool software FPWINGR, press the [Shift] key and [F6] key, and then select an instruction from the instruction list dialog box. · (P) comes at the head of differential execution type instructions. R0 pMV.SS K0 DT0 How differential execution type instructions work · While the internal relay that is set as the execution condition for differential execution type instructions is turned ON, instructions are only executed at the leading edge of the signal, and after that instructions are not executed. · Instructions are not executed for the first scan if the internal relay for differential execution type instruction is established from the beginning when the mode is switched to RUN mode or when the power supply is turned on in RUN mode. RUN (Power ON) Internal relay Operation of instruction Not executed Executed · When differential execution instruction (P instruction) is used with instructions that change the order of execution of instructions such as MC-MCE or JP-LBL (1 to 6, shown below), the action executed by the instruction may change depending on the timing of the execution of the instruction or the timing of the count input. Take care regarding this point. (1) MC-MCE instruction (2) JP-LBL instruction (3) LOOP-LBL instruction (4) CNDE instruction (5) Step ladder instruction (6) Subroutine instruction REFERENCE · For details, refer to "19-7Leading Edge Detection Method". · Please take care that the program is not described incorrectly when combining the differential execution type high-level instruction with the AND stack instruction or pop stack instruction. For details, refer to "19-8Precautions for Programming". 2-5 Overview of Instructions High-level instructions and internal relay · High-level instructions are always used as a pair with internal relay. · When the operation result of the relay sequence circuit specified for an internal relay is ON, the high-level instruction is executed. Example) When the internal relay R0 is ON, the MV instruction is executed, and K0 is transferred to DT0. R0 MV.SS K0 DT0 · When using high-level instructions repeatedly and the internal relay is the same, from the second time the internal relay can be omitted. R0 MV.SS K50 DT1 R0 MV.SS K1 DT10 R0 MV.SS K50 DT1 MV.SS K1 DT10 2-6 Structure of Instructions Cautions on omitting the internal relay · If every scan execution type instruction and differential execution type instruction are being mixed for one internal relay, perform the programming in the following manner. Example 1) Define every scan execution type and differential execution type separately. R0 MV.SS DT0 DT10 MV.SS DT1 DT11 R0 pMV.SS DT2 DT12 Example 2) Use PSHS, RDS, or POPS instruction R0 MV.SS DT0 DT10 PSHS MV.SS DT1 DT11 RDS pMV.SS DT2 DT12 POPS 2-7 Overview of Instructions 2-2 Operation unit What are operation units? · They specify basic units for operation triggered by respective instructions. · Operation result of the same instruction may vary by the specified operation unit. The range of operand targeted by operation and/or the number of words to store the operation result also vary. · Available operation units vary by instruction. In some instructions, operation units are not specified. Refer to explanations for respective instructions. Operation units are indicated with "i". Example 1) When the operation units in data transfer instructions vary When the operation unit is US (unsigned 16-bit data), the values of DT0 is transferred to DT100. When the operation unit is UL (unsigned 32-bit data), the values of DT0 to DT1 are transferred to DT100 to DT101. R0 MVUS DT0 DT100 I S D R0 MVUL DT0 DT100 I S D Example 2) When the operation units in comparison instructions vary When binary data "1111 1111 1111 1111" is included in DT0 (S1) If the operation unit is US (unsigned 16-bit data), the value of (S1) is handled as a positive number "65535", resulting in (S1) > (S2), and the comparison flag SRA turns ON. If the operation unit is SS (signed 16-bit data), the value of (S1) is handled as a negative number "-1", resulting in (S1) < (S2), and the comparison flag SRC turns ON. R0 CMPUS DT0 U0 I S1 S2 R0 CMPSS DT0 U0 I S1 S2 Types of operation units Symbol Name bit 1-bit data US Unsigned 16-bit data SS Signed 16-bit data UL Unsigned 32-bit data SL Signed 32-bit data SF Single-precision floating point real number data DF Double-precision floating point real number data Available range 0,1 0 to 65535 -32768 to +32767 0 to 4294967295 -2147483548 to +2147483547 -1.175494E-38 to -3.402823E+38 0 +1.175494E-38 to +3.402823E+38 -2.2250738585072014E-308 to -1.7976931348623158E+308 0 +2.2250738585072014E-308 to +1.7976931348623158E+308 2-8 Operation unit Operation units and available constants (: Available) Operation unit K constant U constant H constant Name Size Sign 16bit 32bit 16bit 32bit 16bit 32bit US No - - - - 16bit SS Yes - - - - UL No - - - - 32bit SL Yes - - - - SF 32bit Yes - - - - - - DF 64bit Yes - - - - - - Real number SF DF - - - - - - - - - - String "" - 2-9 Overview of Instructions 2-3 Operation device list Operation device list No. Symbol of bits Global Local Name X _X External input Y _Y External output R _R Internal relay L _L Link relay T _T Timer C _C Counter SR - System relay 1 P - Pulse relay E - IN - Error alarm Relay Direct input OT - Direct output DT*.n LD*.n WX _DT*.n _LD*.n _WX Bit specification of data register Bit specification of link register External input WY _WY External output WR _WR Internal relay WL _WL Link relay DT 16 LD _DT _LD Data register Link register UM - Unit memory SD - WI - WO - System data Direct input Direct output Points 8192 points 8192 points 32768 points 16384 points 4096 points 1024 points Approx. 1120 points 4096 points 4096 points Maximum 1008 points Maximum 1008 points Maximum 1M words (.n: 16 points) 16384 words (.n: 16 points) 512 words 512 words 2048 words 1024 words Maximum 1M words 16384 words Maximum 512 kw/unit Approx. 80 words Maximum 62 words Maximum 62 words Range 0 to 511F 0 to 511F 0 to 2047F 0 to 1023F 0 to 4095 0 to 1023 0 to 255F 0 to 4095 0 to 62F 0 to 62F 0 to 999423 .n: 0 to F 0 to 16383 .n: 0 to F 0 to 511 0 to 511 0 to 2047 0 to 1023 0 to 999423 0 to 16383 0 to 524287 0 to 62 0 to 62 Description Turns ON or OFF based on external input. Externally outputs ON or OFF state. Relay that turns ON or OFF only within program Shared relay used for a PLC link Turns ON when the timer reaches the specified time. Turns ON when the counter reaches the set value. Relay which turns ON or OFF based on specific conditions and is used as a flag. Relay which turns ON at the leading edge only for the first scan when the execution condition is on. Relay that stores error conditions which are freely allocated by the user in the memory. Relay for input/output processing during operation, independent of normal I/O refresh. Device for specifying a specific bit of the 16-bit device DT or LD. This can only be used with basic instruction and communication instruction. Code for specifying 16 external input points as one word (16 bits) of data. Code for specifying 16 external output points as one word (16 bits) of data. Code for specifying 16 internal relay points as one word (16 bits) of data. Code for specifying 16 link relay points as one word (16 bits) of data. Data memory used in program Shared data memory used for a PLC link Device for accessing the unit memory of an intelligent unit. Its size varies by unit, and is allocated by default. Data memory for storing specific data. Various settings and error codes are stored. Device for input/output processing during operation in word units, independent of normal I/O refresh. 2-10 Operation device list No. Symbol of bits Global Local Name Points Range Description TS _TS Timer set value 4096 double words 0 to 4095 Data memory for storing the target value of a timer. It corresponds to the timer number. TE _TE Timer elapsed value 4096 double words 0 to 4095 Data memory for storing the elapsed value of a timer. It corresponds to the timer number. 32 CS _CS Counter setting value 1024 double words 0 to 1023 Data memory for storing the target value of a counter. It corresponds to the counter number CE _CE Counter elapsed value 1024 double words 0 to 1023 Data memory for storing the elapsed value of a counter It corresponds to the counter number I0 to IE - Index modification register 15 double words I0 to IE Register used for modifying memory area addresses and/or constants. (Note 1): Figures in the table indicate the number of devices that can be used in a program. The actual number of input/output points that can be used vary depending on the configuration. (Note 2): Operation devices are categorized into "hold type", which memorizes the status immediately before power failure or switch to the PROG. mode, and "non-hold type", which resets the status. Non-hold area is cleared to zero when the unit is powered on or the mode is switched between PROG and RUN. Types of operation devices Setting of hold or non-hold type Internal relay (R), Data register (DT), Link relay (L), Link register (LD) Can be specified as a hold or non-hold type, using the tool software. Counter (C), Counter set value (CS), Counter set value (CE), Error alarm relay (E) Hold type Input (X), Output (Y), Timer (T), Timer set value (TS), Timer set value (TE), Pulse relay (P), Direct input (IN), Direct output (OT), Index register (I), Unit memory (UM), System data register (SD) Non-hold type (Note 3): Direct input (IN), direct output (OT), and unit memory (UM) are used by specifying unit slot numbers and memory addresses to be controlled by instructions. (Note 4): The number of usable data registers (DT) varies according to the type of CPU unit and memory configuration settings. However, data registers (DT) that can be used as hold type are a maximum of 262,144 words (DT0 to DT262143) for CPS4*/CPS3*, and a maximum of 131,072 words (DT0 to DT131071) for CPS21. Unit type Memory type Memory selection patterns 1 2 3 4 5 CPS4* Data register capacity (word) 65,536 131,072 262,144 524,288 999,424 CPS3* Data register capacity (word) 131,072 262,144 425,985 589,824 CPS21 Data register capacity (word) 131,072 262,144 List of constants Symbol Name K Signed decimal constant U Unsigned decimal constant H Hexadecimal constant SF Single-precision floating point real number constant No. of operation bits 16 32 16 32 16 32 32 DF Double-precision floating point real number constant 64 "" Character constant 8 Range -32768 to +32767 -2147483548 to +2147483547 0 to 65535 0 to 4294967295 0 to FFFF 0 to FFFF FFFF -1.175494E-38 to -3.402823E+38 0 +1.175494E-38 to +3.402823E+38 -2.2250738585072014E-308 to -1.7976931348623158E+308 0 +2.2250738585072014E-308 to +1.7976931348623158E+308 Up to 256 characters 2-11 Overview of Instructions 2-4 Specification of Device Numbers For external input (X), external output (Y), internal relay (R), link relay (L), pulse relay (P), system relay (SR), direct input (IN), direct output (OT) Since relays may be handled in units of 16 points, their numbers should be expressed as a combination of decimal and hexadecimal numbers. 1,2,3... Decimal 0,1,2...9,A,B...F Hexadecimal <Example> External input X X 0, X 1, X F X10, X11, X1F X2 0, X2 1, X2 F Relay number of external input/output · Only what is actually allocated to the input contact can be used for external input (X). · Only what is actually allocated to the output contact can be output for external output (Y). External outputs (Y) that are not allocated can be used as internal relays. · Allocation of numbers is decided according to the combination of units. Timer contact (T), counter contact (C), and error alarm relay (E) · The numbers of timer/counter contacts correspond to the numbers of timers/counters, and should be specified by decimal numbers. · The numbers of error alarm relays should be specified by decimal numbers. Decimal 0, 1, 2... T 0,T 1 T4095 C 0,C 1 C1023 E0, E1 E4095 2-12 Specification of Device Numbers Bit specification of word devices (DT*.n, LD*.n) · As for data register DT and link register LD, specific bits in 16-bit data can be extracted and used as bit data, by specifying the device type, device number, and bit number. · The device number and the bit number should be separated by a period (.). · This can only be used with basic instruction and communication instruction. Refer to "Available devices" of the respective instructions. Device type DT, LD Device no.: Decimal Bit no.: Hexadecimal 1, 2, 3... 0, 1, 2 ... 9, A, B ... F <Example> For word devices DT*.n DT0.0, DT0.1, ------- DT0.F, DT10.0, DT10.1, ---- DT10.F DT20.0, DT20.1, ---- DT20.F How to count memory area numbers The numbers of respective memory areas (e.g. data register DT) should be specified by decimal numbers. (This excludes index registers.) <Example> For data register DT DT0, DT1,-----------DT9 DT10, DT11, -------DT19 2-13 Overview of Instructions 2-5 Explanations about Relays X External input How external input (X) works · External input is used to feed signals to the programmable controller from an external input device such as a limit switch or a sensor connected to an input point. Usage restrictions · External inputs that are not allocated cannot be used. · The ON or OFF status of the external input relays cannot be changed by the program in the programmable controller. · There are no restrictions on the number of times one external input relay is programmed. Y External output How external output (Y) works · External output is used to send the results of the program operations as signals to the loads connected to output points (e.g. relays, solenoids). The ON or OFF state of an external output is sent as a control signal. Usage restrictions · External outputs that are not allocated can be used as internal relays. (However, they cannot be specified for hold-type devices.) · When used as contacts, there are no restrictions on the number of times that can be used. · As a rule, when you specify the relay as the output destination of operation results (using OT and KP instructions), the specification is limited to once in a program (to prevent duplicate output). · You can also enable duplicate output using the setting for "Duplicate output authorization" in "Select operation" in the "CPU configuration" dialog box using the tool software FPWIN GR7. · Use in the SET or RST instruction is not regarded as duplicate output. Yn Yn Duplicated output · Even when a project total check is conducted using the tool software FPWIN GR7, the instruction used at the start is not indicated. Instead, the second and later outputs that are regarded as duplicate use are indicated. 2-14 Explanations about Relays R Internal relay How internal relay (R) works · An internal relay only operates within a program. Its ON or OFF state is not externally output. · Once the operation result is output and switched ON (Coil: ON), the same relay used as a contact is also switched ON. R0 R0 MV.SS K0 DT0 Hold type relay and non-hold type relay · Internal relays are categorized into two types, depending on how the relay operates after powering off or switching from RUN to PROG. mode: 1) Hold type relay, which remembers the ON/OFF status immediately before the relay is stopped and can resume operation using the same status after restarting 2) Non-hold type relay, which resets the status when the relay is stopped · You can configure the settings for hold and non-hold types in "Global hold-type start no." in "Setting of the no. of local devices to be used (in total)" in the "Memory configuration" dialog box using the tool software FPWIN GR7. · If the beginning of a hold type relay is specified using a word number, relays before that point will be non-hold types, and subsequent relays will be hold types. · Hold type and non-hold type settings can be set for each global device and local device. "Memory configuration" > "Setting of the no. of local devices to be used (in total)" > "Global holding start number" Non-hold type Hold type Usage restrictions · When used as contacts, there are no restrictions on the number of times that can be used. · As a rule, when you specify the relay as the output destination of operation results (using OT and KP instructions), the specification is limited to once in a program (to prevent duplicate output). · You can also enable duplicate output using the setting for "Duplicate output authorization" in "Select operation" in the "CPU configuration" dialog box using the tool software FPWIN GR7. Additionally, use of SET or RST instruction is not regarded as duplicate output. 2-15 Overview of Instructions SR System relay How system relay (SR) works · A system relay turns ON or OFF under specific conditions. · Its ON or OFF state is not externally output. The relay only operates within a program. Types of system relays (SR) Classification Function Operation status flag Operation status is indicated by ON or OFF. Error flag Turns ON when an error occurs and indicates abnormalities. Relay that turns ON or OFF under specific conditions Can be used with the desired conditions in the program. Example Under operation (RUN) (SR20), under forced input/output (SR29), results of comparison instruction (SRA to SRC) Operation error (SR7, SR8) Normally ON relay (SR10), ON/OFF for each scan (SR12) Initial pulse relay (SR13 to SR14), clock pulse (SR18 to SR1E) T Timer How timer (T) works · When a timer is activated and the set time elapses, the timer contact with the same number as the timer turns ON. · When the timer is in the time-up state and the timer execution condition turns OFF, the timer contact turns OFF. All timers are non-hold type. Timer no. TMX n U0 Time up Tn TnON Timer contact: ON n: Timer no. Usage restrictions · When used as contacts, there are no restrictions on the number of times that can be used. 2-16 Explanations about Relays C Counter How counter (C) works · When the decrement-type preset counter is activated and the counter value reaches zero, the counter contact with the same number as the counter turns ON. · When the counter's reset input is turned ON, the counter contact turns OFF. · All counters are hold type. Count input Counter no. Reset input CT n U0 Count up CnON Cn Counter contact: ON n: Counter no. Usage restrictions · When used as contacts, there are no restrictions on the number of times that can be used. 2-17 Overview of Instructions L Link relay How link relay (L) works · Link relays are relays for when multiple controllers are connected in a network, as a "PLC link" relay for shared use between controllers. · If the operation result is output to a link relay (coil) on a PLC, it is sent to other PLC connected in the network, and the operation result is reflected in link relays (contacts) with the same number. · You can send and receive bit information between PLCs in this manner when using link relays. Ln ON MEWNET-W0 Ln ON Range of link relays used · The range of link relays that can be used varies depending on the type of network and unit combinations. · It is necessary to set the range of use and the number of points for each individual network. Setting of hold type relay and non-hold type relay · Link relays are categorized into two types, depending on how the relay operates after powering off or switching from RUN to PROG. mode: (1) Hold type relay, which remembers the ON/OFF status immediately before the relay is stopped, until operation resumes (2) Non-hold type relay, which resets the status when the relay is stopped · You can set the range of hold and non-hold types in "Global hold-type start no." in "Setting of the no. of local devices to be used (in total)" in the "Memory configuration" dialog box using the tool software FPWIN GR7. · If you specify the beginning of a hold type relay using a word number, relays before that point will be non-hold types, and subsequent relays will be hold types. For example, when the "Global hold-type start no." in "Setting of the no. of local devices to be used (in total)" in "Memory configuration" is set to 10, L0 to L9F will be non-hold type, and L100 to L63F will be hold type. · Take note that when using a relay as a receiving link relay, even if you set the link relay to hold type in the system configuration, hold operations will not be performed. · Hold type and non-hold type settings can be set for each global device and local device. Usage restrictions · When used as contacts, there are no restrictions on the number of times that can be used. · As a rule, when you specify the relay as the output destination of operation results (using OT and KP instructions), the specification is limited to once in a program (to prevent duplicate output). · You can also enable duplicate output using the setting for "Duplicate output authorization" in "Select operation" in the "CPU configuration" dialog box using the tool software FPWIN GR7. Additionally, use of SET or RST instruction is not regarded as duplicate output. 2-18 Explanations about Relays P Pulse relay How pulse relay (P) works · Pulse relay is a relay that is only turned ON for one scan. Its ON or OFF state is not externally output. The relay only operates within a program. · A pulse relay only goes ON when a leading edge start instruction (OT) or a trailing edge start instruction (OT) is executed. · When used as the trigger, the pulse relay only operates for one scan when the leading edge or trailing edge is detected. <Example 1> Differential execution at the leading edge for input X100. X100 P0 P0 R100 X100 P0 R100 Single scan <Example 2> Differential execution at the trailing edge for input X101. X101 P1 P1 R101 X101 P1 R101 Single scan Usage restrictions · Pulse relays are cleared when the power is turned off. · As a rule, when you specify the relay as an output destination for an OT or OT instruction, the specification is limited to once in a program (double output is prohibited). · When used as contacts, there are no restrictions on the number of times that can be used. · A pulse relay cannot be specified as an output destination for an OT, KP, SET, RST or ALT instruction. · A word unit pulse relay (WP) cannot be specified as a storage location for a high-level instruction. 2-19 Overview of Instructions E Error alarm relay How error alarm relay (E) works · Error alarm relays are used to feed back error conditions freely assigned by the user to internal relays, and to store them in memory. · Error alarm relays are turned ON and OFF using the SET and RST instructions in the user program. · When an error alarm relay goes ON, the number of error alarm relays which are on, the relay numbers, and the data of the calendar timer which went on first are stored in a memory area in the CPU unit. System data register SD No. SD80, SD81 SD82, SD83 SD84, SD85 SD60 SD61 to SD79 Description Year/month data Day/hour data Minute/second data Data for the calendar timer when the relay was initially turned ON Number of relays that are turned ON Number of relays that are turned ON · Information for up to 500 error alarm relays can be stored in the memory area. Relays that can be monitored or operated by the user, however, are those in the range from SD61 to SD79 only. Usage restrictions · An error alarm relay (E) cannot be specified as an output destination for an OT, KP, or ALT instruction. · An error alarm relay (E) can be turned ON and OFF in multiple locations in the program, using the SET and RST instructions. However, no check is carried out for overlapping use. Program for setting (turning on) an error alarm relays · The SET instruction should be used to turn ON error alarm relays in the error alarm conditions, as shown below. · Error alarm relays are held even if the error condition goes OFF. <Example> If R0 goes ON when an error occurs R0 E15 SET SD60 K3 +1 K4 No. of error alarm relays in the ON state SD61 K21 K21 SD62 K12 SD63 K5 K12 Relay numbers of error alarm relays in the ON state K5 SD64 K0 K15 SD65 K0 K0 2-20 Explanations about Relays Reset program for a given error alarm relay · The RST instruction should be used to turn OFF error alarm relays when an error has been corrected. <Example> If R0 goes ON when an error is corrected R0 E12 RST SD60 K3 SD61 K21 SD62 K12 SD63 K5 SD64 K0 SD65 K0 X1ON -1 K3 No. of error alarm relays in the ON state K21 Relay numbers of error alarm relays K5 in the ON state K0 K0 Clearing all buffer areas · To reset all error alarm relays, use RST instruction to specify the system data register SD60, following the method shown on the next page. Clearing buffer areas and initial data · Of the areas in which relay numbers are stored, only SD60 and SD61 can be cleared by directly specifying the system data register with RST instruction. · When SD60 is specified, all of the error information in the buffer is cleared, and when SD61 is specified, the relay number at the head of the buffer area is cleared, and the buffer is filled as shown in the example below. <Example> When the content of SD61 is deleted with RST instruction R0 RST.US SD61 Range visible to the user Storage buffer 1 Storage buffer 2 Storage buffer 3 Storage buffer 4 Storage buffer 17 Storage buffer 18 Storage buffer 19 Storage buffer 20 Storage buffer 21 Range invisible to the user Storage buffer 499 Storage buffer 500 K1 K2 K3 K4 K17 K18 K19 K20 K21 K499 K500 SD61 SD62 SD63 SD64 SD77 SD78 SD79 K2 SD61 K3 SD62 K4 SD63 K5 SD64 K18 SD77 K19 SD78 K20 SD79 K21 K22 K500 2-21 Overview of Instructions IN Direct input How direct input (IN) works · The reading for external input (X) is updated as a batch when input/output refresh is executed, however if direct input (IN) is used, the reading for external input is updated when the operation is executed. · This is effective for controls that require a high-speed response. · This is specified in the program with a combination of a slot number (S1, S2...) and a corresponding address (IN0, IN1...). · When using direct input (IN), it is necessary to select the setting to "exclude this unit from the target for I/O refresh" when configuring the settings for the I/O map. OT Direct output How direct output (OT) works · External output (Y) is output as a batch when input/output refresh is executed, however if direct output (OT) is used, the operation result up until that time (ON/OFF) is output to the external output when the operation is executed. · This is effective for controls that require a high-speed response. · This is specified in the program with a combination of a slot number (S1, S2...) and a corresponding address (OT0, OT1...). · When using direct output (OT), it is necessary to select the setting to "exclude this unit from the target for I/O refresh" when configuring the settings for the I/O map. S1:IN0 S2:OT10 DT*.n Data register (bit specification) · Refer to "DT Data register" in "DT Data register". LD*.n Link register (bit specification) · Refer to "LD Link register" in "LD Link register". 2-22 Description of the memory area 2-6 Description of the memory area DT Data register How data register (DT) works · Data registers are memory areas which are handled in word (16-bit) units, and are used to store data such as numerical data that consists of 16 bits. DTn 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 0 [Example of program to write numerical values into DTn] MV.US U or H DT n · When 32-bit (double word) data is handled in data registers, use two data registers as a set. In the program, specify the number of the data register for the lower 16 bits. DT n+1 DT n 0001 1010 0101 0010 0001 0101 0101 1000 Hold data and non-hold data · Data registers are categorized into two types, depending on how the register operates after powering off or switching from RUN to PROG. mode: (1) Hold type data register, which remembers the ON/OFF status immediately before the data register is stopped and can resume operation using the same status after restarting (2) Non-hold type data register, which resets the status when the data register is stopped · Hold type and non-hold type settings can be set for each global device and local device. · You can configure the settings for hold and non-hold types in "Global hold-type start no." in "Setting of the no. of local devices to be used (in total)" in the "Memory configuration" dialog box using the tool software FPWIN GR7. If the beginning of a hold type data register is specified using a word number, relays before that point will be non-hold types, and subsequent relays will be hold types. "Memory configuration" > "Setting of the no. of local devices to be used (in total)" > "Global holding start number" Non-hold type Hold type 2-23 Overview of Instructions DT*.n Data register (bit specification) How bit specification of data register (DT*.n) works · For the data register, specific bits of word data (16-bit data) can be extracted and used as bit data by using bit specification. [Examples of usable instructions] ST, ST/, ST, ST, AN, AN/, AN, AN, OR, OR/, OR, OR, OT, KP, SET, RST, ALT, SEND, RECV, PMSET [Example of program in which the F bit of DT100 is extracted and used as bit data] R0 DF R1 SET R1 UNITSEL U0 U1 S1 S2 PMSET DT0 S U12 DT100 n D R1 DT100.F DF/ R1 RST Precautions for Use · If the ON/OFF status changes for any of the bit data of the data register (DT*.n), the value of the data register (DT) also changes. DT10 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 (H9) DT10.1ON DT10 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 (HB) 2-24 Description of the memory area LD Link register How link register (LD) works · Link register is data memory for when control units are connected in a network, as a "PLC link" data memory for shared use between control units. · When data is written to the link register of a PLC, the same contents are stored in link registers with the same number for other PLC connected in the network. · You can send and receive data between PLCs in this manner when using link registers. LDn MEWNET-W0 LDn Range of link registers used · The range of link registers that can be used varies depending on the network type and the combination of units. · It is necessary to set the range of use and the number of points for each individual network. Setting of hold type register and non-hold type register · Link registers are categorized into two types, depending on how the register operates after powering off or switching from RUN to PROG. mode: (1) Hold type register, which remembers the content of the register immediately before the link register is stopped, until operations resumes (2) Non-hold type register, which resets the content when the data register is stopped · You can configure the settings for the range of hold and non-hold types in "Global hold-type start no." in "Setting of the no. of local devices to be used (in total)" in the "Memory configuration" dialog box. · Take note that when using a link register as a receiving link register, even if you set the link register to hold type in the configuration, hold operations will not be performed. · Hold type and non-hold type settings can be set for each global device and local device. 2-25 Overview of Instructions LD*.n Link register (bit specification) How bit specification of link register (LD*.n) works · For the link register, specific bits of word data (16-bit data) can be extracted and used as bit data by using bit specification. [Examples of usable instructions] ST, ST/, ST, ST, AN, AN/, AN, AN, OR, OR/, OR, OR, OT, KP, SET, RST, ALT, SEND, RECV, PMSET Precautions for Use · If the ON/OFF status changes for any of the bit data of the link register (LD*.n), the value of the link register (LD) also changes. LD10 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 (H9) LD10.1ON LD10 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 (HB) UM Unit memory How unit memory (UM) works · Unit memory is used to send and receive data between CPU units and intelligent units. · The amount of data in unit memory and its allocation varies depending on the type of unit. · The address for the unit memory is specified as a 5-digit hexadecimal. (H 0 to H 7FFFF (Maximum)) · In the program, an address is specified with a corresponding slot number (S1, S2...). Unit memory (UM) usage example · The following is an example of transferring the constant H0 to the address H 00081 of the unit memory (UM) of slot number 1. MV.SL H0 S1:UM00081 SD System data register How system data register (SD) works · System data register is a memory area in which designated contents are stored. · There are three types of areas: an area for read-only, an area for read-and-write, and an area used by the system. · The types of system data registers are as follows. Types of system data registers (SD) Classification Function Environment settings, operation status The operation statuses of the PLC specified with the configuration data and the various types of instructions are stored. Example) Scan time Details of error Information such as information of a unit in which an abnormality occurred is stored. Example) Self-diagnostic error code, slot number of the unit in which the abnormality occurred, the address where the operation error occurred Calendar timer The year, month, day, hour, minute, second, and day of the week tracked by the calendar timer are stored here. 2-26 Description of the memory area WX, WY, WR, WL How WX, WY, WR, WL works · Relays (X, Y, R, L) can be handled as blocks of 16 points. · Pulse relays (P) and error alarm relays (E) cannot be handled in word units. · These are one-word (16-bit) memory areas, thus they can be treated as data memory. · The composition of the word-unit memory areas is shown below. Each element has a corresponding number, as shown below. WR0 RF RE RD RC RB RA R9 R8 R7 R6 R5 R4 R3 R2 R1 R0 WR1 R1F R1E · · · · · · · · · · · R12 R11 R10 WR2 R2F R2E · · · · · · · · · · · R22 R21 R20 WX, WY, WR, WL usage example · WX and WY can be used for reading the input from intelligent units and for the external input/output in word units. R100 MV.US WX0 DT0 · WR can also be used as a shift register. X100 X101 X102 SR W R0 · All of the relays can be used to monitor 16-bit words. Precautions for Use · If an ON or OFF status of one of the relays composing the memory are changes, the memory area value will also change. WR0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 (H9) R1ON WR0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 (HB) 2-27 Overview of Instructions WI, WO How WI, WO works · Relays (IN, OT) can be handled as blocks of 16 points. · These are one-word (16-bit) memory areas, thus they can be treated as data memory. · The composition of the word-unit memory areas is shown below. Each element has a corresponding number, as shown below. WI0 INF INE IND INC INB INA IN9 IN8 IN7 IN6 IN5 IN4 IN3 IN2 IN1 IN0 WI1 IN1F IN1E · · · · · · · · · · · IN12 IN11 IN10 WI2 IN2F IN2E · · · · · · · · · · · IN22 IN21 IN20 WI, WO usage example · When WI/WO is specified or when an operation is executed, input and output processing are performed. · When using WI/WO, it is necessary to select the setting to "exclude this unit from the target for I/O refresh" when configuring the settings for the I/O map on the programming tool. R100 MV.US S1:WI0 DT0 · This is specified in the program with a combination of a slot number (S1, S2...) and a corresponding address (WI0, WI1.../WO0, WO1...). · All of the relays can be used to monitor 16-bit words. Precautions for Use · If an ON or OFF status of one of the relays composing the memory are changes, the memory area value will also change. S1:WI0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 (H9) S1IN1 ON S1:WI0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 (HB) 2-28 Description of the memory area TS, CS Timer/ Counter setting value register How the set value area (TS, CS) works · A set value for a timer (TS) or counter (CS) is stored in the set value area with the same number as the timer or counter. · To set the value, specify a decimal number or the number of the set value area (TS/CS) when you enter the TM or CT instruction in the program. · The set value area (TS/CS) is a 32-bit memory area which stores a decimal number from 0 to 4,294,967,295. TSn TM n U 30 U 30 CT n U 10 CSn U 10 Using the set value area (TS, CS) · During RUN mode, a set value for a timer or counter can be changed by rewriting the corresponding set value area. · The values in the set value area can be overwritten by user programs such as data transfer instructions. · Reading and writing of values can also be performed with the programming tool. Reference: · Numbers of TS and TE correspond to timer numbers, and numbers of CS and CE correspond to counter numbers. Timer and counter No. T0 T1 T4095 Set value area TS0 TS1 TS4095 Elapsed value area TE0 TE1 TE4095 C0 C1 C1023 CS0 CS1 CS1023 CE0 CE1 CE1023 · Timer/counter settings for FP7 series can be specified using unsigned constants (U constants). · The set value area (TS, CS) occupies a 32-bit area. 2-29 Overview of Instructions TE, CE Timer/counter elapsed value register How the elapsed value area (TE, CE) works · While a timer or counter is operating, the elapsed value is stored in the elapsed value area (TE/CE) with the same number as the timer or counter. · When the value of the elapsed value area (TE/CE) reaches zero, the timer or counter contact with the same number turns ON. · The elapsed value area (TE/CE) is a 32-bit memory area which stores a decimal number from 0 to 4,294,967,295. TSn TSn TEn TM n U 30 U30 U30 Tn 29 28 1 TEn 0 Using the elapsed value area (TE, CE) · The elapsed value of a timer or counter in operation can be changed to prolong or shorten the operation. · The values in the elapsed value area can be overwritten by user programs such as data transfer instructions. · Reading and writing of values can also be performed with the programming tool. Precautions during programming · Timer/counter settings for FP7 series can be specified using unsigned constants (U constants). · The elapsed value area (TE, CE) occupies a 32-bit area. 2-30 Description of the memory area I0 to IE Index registers How index registers work · Index registers are used to indirectly specify constants and memory area addresses. · Depending on the values of the index register, changes to addresses and constants are called "index modification." · Fifteen 32-bit registers are available for I0 to IE. Notes on using index registers · When the result of an address modifier exceeds the range for the memory area, an operation error occurs. Example) When the result of the modifier is an address with a negative value or value that is too large Values that can be modified with index registers · Number of the memory area used for a basic instruction · Slot number or memory area number · Number of the memory area used for a high-level instruction · Value of the constant specified for a high-level instruction · K constant (16-bit, 32-bit) · U constant (16-bit, 32-bit) · H constant (16-bit, 32-bit) Value that cannot be modified with index registers · Floating point data · Depending on the instruction, index modification cannot be applied to some operands. Refer to the "Available devices" section of the description page for each instruction. · An index register (I0 to IE) occupies a 32-bit area. How to apply index modification <Example 1> Modifying a transfer destination The address in the data register (DT) for the transfer destination varies according to the value of DT0. R0 MV.UL DT0 I0 MV.SS DT100 I0DT200 Example) When the value in DT0 is K10, the value in DT100 is written into DT210. I0 DT200 DT210 K10 10 + 200 = 210 2-31 Overview of Instructions <Example 2> Modifying a transfer destination R0 MV.UL DT0 I0 MV.SS I0DT100 DT200 The address in the data register (DT) for the transfer destination varies according to the value of DT0. Example) When the value of DT0 is U8, the value in DT108 is transferred to DT200. I0 DT100 DT108 U8 8 + 100 = 108 Modifying an address Address = basic address + value of I0 to IE I0DT11 Standard address 11 + 11 + 11 + I0 value K0 K10 K-10 Targeted address = DT11 = DT21 = DT1 Modifying a constant Constant = basic address + value of I0 to IE I0K100 I0H10 Standard value K100 + K100 + K100 + I0 value Constant K0 = K10 = K-10 = K100 K100 K90 Standard value H10 + H10 + I0 value HA H10 Constant = H1A = H20 2-32 Description of the memory area Notes on index modification of a relay number · For the external relay (X), external output relay (Y), and internal relay (R), when using index modification on relay numbers, be aware that the last digit of the relay number is hexadecimal and the higher digits are decimal. <Example> For external input (X) X 0, X 1, X F X X10, X11, X1F Decimal 1, 2, 312 X20, X21, X2F Hexadecimal 0, 1, 2, 39 A, BF Examples of index modification Value of index register K H Post-modification relay number 0 0 X0 1 1 X1 9 9 X9 10 A XA 15 F XF 16 10 X10 31 1F X1F 159 9F X9F 160 A0 X100 161 A1 X101 255 FF X15F 256 100 X160 257 101 X161 266 10A X16A 267 10B X16B 2-33 Overview of Instructions Modification of No. of basic instruction Object Modification examples Timer number Modify TML20 TML I020 Counter number Modify CT200 CT I0200 Shift register number Modify SRWR0 SR I0WR0 Specification of a label number in a jump instruction Modify JP1 JP I01 Specification of a label number in a loop instruction Modify LOOP5 LOOP I05 Subroutine program number Modify CALL10 CALL I010 Limitations for modifying the timer/counter number · The timer number and counter number can only be modified when a memory area has been specified for the setting value. TMXI0 0 TS 0 Specified by a memory area no. · When a constant is specified for the setting value, the timer/counter number cannot be modified. TMXI0 0 U30 Specified by a constant Limitations for modifying DT.n (bit specification of data register) When modifying DT.n (bit specification of data register), the maximum number of DT that can be specified is 32767. I0DT32767.F R0 Limitations for modifying LD.n (bit specification of link register) When modifying LD.n (bit specification of link register), the maximum number of LD that can be specified is 16383. 2-34 Explanation of constants 2-7 Explanation of constants K Signed decimal constant How signed decimal constant (K) works · The constant is a value which has been converted from binary data into decimal data. When entering the constant, specify "K" before the numerical value. · The constant is primarily used to specify data sizes and quantities. · In the PLC, the decimal constant (K) is processed as binary (BIN) data in word units of 16 bits, as shown below. · The positive/negative sign is determined by the most significant bit (sign bit). A "0" indicates a positive sign (+), and a "1" indicates a negative sign (-). · Data is normally handled in units of one word (16 bits), however, it is also occasionally handled in units of two words (32 bits). In this case, as well, the most significant bit serves as the sign bit. Format for signed decimal constant (K) <Example> Decimal "+32" (K32) 15 12 9 5 0 0 00000000 00100000 [+] <Example> Decimal "-32" (K-32) 15 12 9 5 0 1 11 1 1 111 1 1110 0 0 00 [-] Range that can be specified using a decimal constant (K) Operation Available range 16-bit operation K-32,768 to K32,767 32-bit operation K-2,147,483,648 to K2,147,483,647 2-35 Overview of Instructions U Unsigned decimal constant How unsigned decimal constant (U) work · The constant is a value which has been converted from binary data into decimal data. When entering and reading the constant, specify "U" before the numerical value. · The constant is primarily used to specify data sizes and quantities such as the setting values for the timer. · In the PLC, the decimal constant (U) is processed as binary (BIN) data in units of 16 bits, as shown below. · For unsigned decimal (U), all 16 bits are used to represent a numerical value, so it is not possible to represent a negative value. · Data is normally handled in units of one word (16 bits), however, it is also occasionally handled in units of two words (32 bits). Format for unsigned decimal constant (U) <Example> Decimal "+32" (U32) 15 12 9 5 0 0 000 000000100000 <Example> Decimal "+65504" (U65504) 15 12 9 5 0 1 111 111111100000 Range that can be specified using a decimal constant (U) Operation Available range 16-bit operation U0 to U65,535 32-bit operation U0 to U4,294,967,295 H Hexadecimal constant How hexadecimal constant (H) work · The constant is a value which has been converted from binary data into hexadecimal data. When entering and reading the constant, specify "H" before the numerical value. · Hexadecimal constants are primarily used to specify an ordering of 1's and 0's in 16-bit data, such as system data register settings and specification of control data for high-level instructions. Hexadecimal constants are also used to specify BCD data. · In the PLC, the hexadecimal constant (H) is processed as binary (BIN) data in units of 16 bits, as shown below. · Data is normally handled in units of one word (16 bits), however, it is also occasionally handled in units of two words (32 bits). Format for hexadecimal constant (H) <Example> Hexadecimal "2A" (H2A) 15 12 9 5 0 00000000 00101010 2 A Range that can be specified for a hexadecimal constant (H) Operation Available range 16-bit operation H0 to HFFFF 32-bit operation H0 to HFFFFFFFF 2-36 Explanation of constants SF Single-precision floating point real number constant Format for single-precision floating point · Following IEEE754 format, the single precision floating point format consists of 1 sign bit, 8 exponential bits, and 23 mantissa bits. · Operation instructions for processing real numbers and conversion instructions for real number integers are provided by default, so it is not necessary to worry about data format while programming. 31 30 2322 16 15 0 Sign bit 1 bit Exponent portion 8 bits Mantissa portion 23 bits Range of single-precision floating point real number constants Operation Available range 32-bit operation Negative range: -1.175494E-38 to -3.402823E+38 0 Positive range: 3.402823E+38 to 1.175494E-38 Storage area for single-precision floating point real number constants · For the storage area for data of real numbers converted using the operation instructions for single-precision floating point real number constants, 1 unit of data uses an area of 2 words (32 bits). · When using the storage area for real number data in data transfer instructions or other instructions, input SF for the operation unit. <Example> If SF is set for the operation unit of the instruction code, 2 words of data are included in DT. DT0-DT1 Source 1.234567 MV.SF DT 0 DT 10 DT10-DT11 Destination 1.234567 2-37 Overview of Instructions DF Double-precision floating point real number constant Format for double-precision floating point · Following IEEE754 format, the double precision floating point format consists of 1 sign bit, 11 exponential bits, and 52 mantissa bits. · Operation instructions for processing real numbers and conversion instructions for real number integers are provided by default, so it is not necessary to worry about data format while programming. 63 62 52 51 48 47 32 31 16 15 0 Sign bit 1 bit Exponent portion 11 bits Mantissa portion 52 bits Range of double-precision floating point real number constants Operation Available range 64-bit operation Negative range: -2.2250738585072014E-308 to -1.7976931348623158E+308 0 Positive range: +2.2250738585072014E-308 to +1.7976931348623158E+308 Storage area for double-precision floating point real number constants · For the storage area for data of real numbers converted using the operation instructions for double-precision floating point real number constants, 1 unit of data uses an area of 4 words (64 bits). · When using the storage area for real number data in data transfer instructions or other instructions, input DF for the operation unit. <Example> If DF is set for the operation unit of the instruction code, 4 words of data are included in DT. DT0-DT3 Source 1.234567 MV.DF DT 0 DT 10 DT10-DT13 Destination 1.234567 2-38 Explanation of constants "" Character constant How character constant ("") work · Binary data is handled as ASCII code. When entering data, enclose characters with "". · The instruction for which character constants can be set is SSET instruction (conversion of character constant ASCII code). This can only be input using the tool software. · Character constants ("") are stored as ASCII code in the specified memory area in the PLC as shown below. Format for character constants ("") <Example> When character constant "MEWNET" is input T E 54 45 1 word N W 4E 57 1 word E M (Characters) 45 4D (ASCII codes) 1 word 2-39 Overview of Instructions 2-8 Global Devices and Local Devices Global devices · While a global device has a unique number throughout the entire program, a local device has a unique number inside each program block. · For example, "Global device DT100" refers to the same data memory in program blocks A and B. Therefore, data of DT100 is overwritten if the relevant information is revised in either program block A or B. · Global devices are utilized when the operation memory is required to be shared between multiple program blocks (PB) for external input/output or other purposes. Program block A Program block B DT100 Refer to the same area Local devices · If data of local device dt10 is changed in either program block A or B, since the local device is allocated to different data memory, the data for one program block will not be overwritten by the other program block. Program block A Program block B _DT10 Same name but separated _DT10 List of available memory areas for local devices (: Available) Bit device 16-bit device X, Y, R,L, T, C P, E, SR, IN, OT DT.n, LD.n WX, WY, WR, WL, DT, LD SD, WI, WO, UM 32-bit device TS, CS,TE, CE 2-40 Range of Data that can be Handled in the PLC 2-9 Range of Data that can be Handled in the PLC 16-bit data Data handled in the PLC (binary 16-bit) Decimal conversion Unsigned Signed Hexadecimal conversion 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 U32767 K32767 H7FFF 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 U 1 K 1 H 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 U 0 K 0 H 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 U65535 U32768 K -1 K-32768 HFFFF H8000 32-bit data Data handled in the PLC (binary 32-bit) 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Decimal conversion Unsigned Signed U2147483547 K2147483547 U 1 K 1 Hexadecimal conversion H7FFFFFFF H 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 U 0 K 0 H 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 U4294967295 K -1 HFFFFFFFF U2147438648 K-2147438648 H80000000 Range of data that can be handled in the PLC Type of operation Operational range Binary operation 16 bits 32 bits Unsigned Signed Unsigned Signed U 0 to U 65,535 K -32,768 to K 32767 U 0 to U 4,294967295 K -2,147,483,548 to K 2,147,483,54 BCD operation 16 bits 32 bits Unsigned Unsigned H 0 to H 9999 H 0 to H 99999999 (Note): If a value goes outside of the range shown above in either direction, it becomes overflow or underflow. 2-41 Overview of Instructions Representation of decimals in the PLC · Decimals are processed as either 16-bit or 32-bit binary data. · Signed data is processed as follows: (1) If the highest-order bit is a sign bit and a positive number, the value is "0", or if it is negative, the value is "1". (2) For positive numbers, the digits aside from the highest-order digit describe the size of the data in bits. <Example> Representation of the decimal "1868" 0000011101001100 16,384 8,192 4,096 2,048 1,024 512 256 128 64 32 16 8 4 2 1 The other bits indicate the data size. 1,024 + 512 + 256 + 64 + 8 + 4 = 1868 The highest digit bit is '0', representing a positive figure. (3) For negative numbers, 2's complement is used. 2's complement is binary data in which 0 and 1 are inverted in the binary data for the positive number, and then 1 is added to the binary data. <Example> Representation of the decimal "-4" 0000000000000100 Invert 0 and 1 Decimal BIN represetation of a decimal '4' 1111111111111011 Add 1 1111111111111100 The highest digit bit becomes '1'. Decimal BIN represetation of a decimal '-4' 2-42 Overflow and Underflow 2-10 Overflow and Underflow What are overflow and underflow? · A value resulting from operation instruction sometimes fails to satisfy the range that can be handled. · When a value is larger than the maximum value it is called "overflow" and when a value is lower than the minimum value it is called "underflow." Overflow and underflow in binary operations · If numerical values go beyond the range shown below, those values become overflow or underflow. <16-bit operation> (Higher than the maximum value is overflow) Unsigned Signed Maximum value U65535 HFFFF K32767 H7FFF U32768 U32767 U 1 H8000 H7FFF H 1 K 1 K 0 K -1 H 1 H 0 HFFFF Minimum value U 0 H 0 K-32768 H8000 <32-bit operation> (Lower than the minimum value is underflow) (Higher than the maximum value is overflow) Unsigned Signed Maximum value U4294967295 HFFFFFFFF K2147483647 H7FFFFFFF U2147483648 U2147483647 U 1 H80000000 H7FFFFFFF H 1 K 1 K 0 K -1 H 1 H 0 HFFFFFFFF Minimum value U 0 H 0 K-2147483648 H80000000 (Lower than the minimum value is underflow) 2-43 Overview of Instructions Values for overflow and underflow · As shown in the figures, the numerical values that can be handled by an operation are in a loop status, in which the maximum value and minimum value are connected. Example 1) 16-bit binary operation Unsigned Overflow Max. value U 65,535 H FFFF U 32,768 H 8000 U 32,767 H 7FFF U Min. value U 1 H1 0 H0 Underflow Max. value and min. value are linked Signed Overflow Max. value K 32,767 H 7FFF K 1 H1 K 0 H0 K -1 H FFFF Max. value and min. value are linked Min. value K -32,768 H 8000 Underflow Example 2) 16-bit BCD operation Overflow Max. value H 9999 Min. value H 0 Max. value and min. value are linked Underflow 2-44 3 3 Basic Instructions Basic Instructions ST, ST/, OT (START, START NOT, OUT) AN, AN/ (AND, AND NOT) OR, OR/ (OR, OR NOT) Ladder diagram ST R0 OT Y110 R0 ST/ Y111 X100 AN AN/ R1 R2 Y110 X100 R0 OR R1 OR/ Y110 Available devices (: Available) Operand Bit device X Y R LTCP ST ST/ AN, AN/ OR, OR/ bit Specification of bit of word device E SR IN OT DT.n LD.n Index modification OT 3-2 Basic Instructions Outline of operation Type of instruction Operation ST Begins a logic operation by treating the input contact specified by the ST instruction as a Form A (normally open). ST/ Begins a logic operation by treating the input contact specified by the ST/ instruction as a Form B (normally closed). AN Executes an AND operation with the preceding operation result in serial connection by treating the input contact specified by the AN instruction as a Form A (normally open). AN/ Executes an AND operation with the preceding operation result in serial connection by treating the input contact specified by the AN/ instruction as a Form B (normally closed). OR Executes an OR operation with the preceding operation result in parallel connection by treating the input contact specified by the OR instruction as a Form A (normally open). OR/ Executes an OR operation with the preceding operation result in parallel connection by treating the input contact specified by the OR/ instruction as a Form B (normally closed). OT/ Outputs the operation result to the specified coil. Example of operation (1) Program operation for "ST", "ST/", and "OT" in ladder diagram Outputs to Y110 when R0 is ON and to Y111 when R0 is OFF. R0 Y110 Y111 (2) Program operation for "AN" and "AN/" in ladder diagram Outputs to Y110 when X100 is ON, R1 is ON, and R2 is OFF. X100 R1 R2 Y110 3-3 Basic Instructions (3) Program operation for "OR" and "OR/" in ladder diagram Outputs to Y110 when X100 is ON, R0 is ON, or R1 is OFF. X100 R0 R1 Y110 Precautions during programming · The ST, ST/, OR, and OR/ instructions are initiated from the bus bar. · The AN, AN/, OR, and OR/ instructions can be used in series. · When an external switch (e.g., emergency stop switch) is a Form B (normally closed), be sure to use the ST instruction in the program. 3-4 Basic Instructions ST, ST (Leading and Trailing Contact Instructions) AN, AN (Leading and Trailing Contact Instructions) OR, OR (Leading and Trailing Contact Instructions) Ladder diagram R0 ST Y110 X100 AN R0 Y110 X100 R0 OR Y110 Available devices (: Available) Operand Bit device XYRL TCP bit E SR IN OT Specification of bit of word device DT.n LD.n Index modification Outline of operation Type of Operation instruction ST Continuity only exists for a single scan where the signal changes from the OFF state to the ON state (i.e., rises). Begins a logic operation by treating the input contact as a Form A (normally open) or Form B (normally closed). Continuity only exists for a single scan where the signal changes from the OFF state to the ON state (i.e., rises). AN Executes an AND operation with the preceding operation result in serial connection by treating the input contact as a Form A (normally open) or Form B (normally closed). OR Continuity only exists for a single scan where the signal changes from the OFF state to the ON state (i.e., rises). Executes an OR operation with the preceding operation result in parallel connection by treating the input contact as a Form A (normally open) or Form B (normally closed). ST Continuity only exists for a single scan where the signal changes from the ON state to the OFF state (i.e., falls). Begins a logic operation by treating the input contact as a Form A (normally open) or Form B (normally closed). Continuity only exists for a single scan where the signal changes from the ON state to the OFF state (i.e., falls). AN Executes an AND operation with the preceding operation result in serial connection by treating the input contact as a Form A (normally open) or Form B (normally closed). OR Continuity only exists for a single scan where the signal changes from the ON state to the OFF state (i.e., falls). Executes an OR operation with the preceding operation result in parallel connection by treating the input contact as a Form A (normally open) or Form B (normally closed). 3-5 Basic Instructions Example of operation (1) Program operation for "ST" in ladder representation Outputs to Y110 only for a single scan where R0 changes from the OFF state to the ON state (i.e., rises). R0 Leading edge Leading edge Y110 Single scan Single scan (2) Program operation for "AN " in ladder diagram Outputs to Y110 only for a single scan when R0 changes from OFF to ON (rises) while X100 is ON. X100 R0 Leading edge Y110 Single scan (3) Program operation for "OR " in ladder diagram. Outputs to Y110 only for a single scan where X100 or R0 changes from the ON state to the OFF state (i.e., falls). X100 Trailing edge Trailing edge R0 Trailing edge Y110 Single scan Single scan Single scan 3-6 / (NOT) Ladder diagram X100 Y110 Y111 Outline of operation · The / instruction inverts the preceding operation result. Example of operation When X100 is ON, Y110 is ON and Y111 is OFF. X100 Y110 Y111 Basic Instructions 3-7 Basic Instructions DF, DF/ (Leading Edge Differential, Trailing Edge Differential) DFI (Leading Edge Differential (Initial Execution Type)) Ladder diagram X100 DF Y110 X101 DF/ Y111 X100 DFI Y110 Outline of operation Type of Operation instruction DF The DF instruction only generates output (differential output) for a single scan where the execution condition changes from the OFF state to the ON state (i.e., rises). DF/ The DF/ instruction only generates output (differential output) for a single scan where the execution condition changes from the ON state to the OFF state (i.e., falls). DFI The DFI instruction only generates output (differential output) for a single scan where the execution condition changes from the OFF state to the ON state (i.e., rises). Precautions during programming · There are no restrictions on the number of times the differential instruction (DF, DF/, or DFI) can be used. · The differential instruction only detects changes in the ON/OFF states of a contact. · The DF and DF/ instructions do not generate output if the execution condition is already satisfied (i.e., ON state) when the operation mode is switched to RUN or the power is turned on in the RUN mode. · The DFI instruction generates output (differential output) for the first single scan even if the execution condition is already satisfied when the RUN mode is initiated. · If the execution condition can be already satisfied (i.e., on state) when the operation mode is switched to RUN or the power is turned on in the RUN mode, output will not be obtained for the first single scan by the DF instruction. Use the DFI instruction instead in this case. · Be careful when using a differential instruction with an instruction (1 to 6 below) which changes the order of instruction execution such as MC - MCE, JP - LBL. 1) MC - MCE instructions 2) JP - LBL instructions 3) LOOP - LBL instructions 4) CNDE instruction 5) Step ladder instructions 6) Subroutine instructions · When using a differential instruction with an AND stack (ANS) instruction or pop stack (POPS) instruction, be sure to write the code correctly. 3-8 Basic Instructions Example of operation (1) Program operation for "DF" in ladder diagram Outputs to Y110 only for a single scan where X100 changes from the OFF state to the ON state (i.e., rises). X100 Y110 Leading edge Single scan (2) Program operation for "DF/" in ladder diagram Outputs to Y111 only for a single scan where X101 changes from the ON state to the OFF state (i.e., falls). X101 Trailing edge Trailing edge Y111 Single scan Single scan (3) Program operation for "DFI" in ladder diagram Outputs to Y110 only for a single scan where X100 changes from the OFF state to the ON state (i.e., rises). X100 Y110 Leading edge Single scan Single scan 3-9 Basic Instructions Sample program · The circuits shown below operate as described. (1) Example 1 using DF instruction When the leading edge differential is set between input information (X100, X101) X100 X101 Y110 DF X100 X101 Y110 1) While X101 is OFF, Y110 remains OFF even when X100 rises. 2) While X100 is ON, Y110 remains OFF even when X101 rises. 3) While X101 is ON, Y110 becomes ON for a single scan when X100 rises. (2) Example 2 using DF instruction When the leading edge differential is set after parallel connection of input information (X100, X101) X100 Y110 DF X101 X100 X101 Y110 No output generated here 3-10 Basic Instructions (3) Example 3 using DF instruction When the leading edge differential is set for each input information (X100, X101) X100 Y110 DF X101 DF X100 X101 Y110 3-11 Basic Instructions Application example of differential instructions · Using differential instructions makes it easy to create and adjust programs. <Application example for self-holding circuit> · Differential instructions are convenient when input signals are long. X100 DF R0 Y110 Y110 X101 R0 DF X100 X101 R0 Y110 Y110 If there is no differential instruction in above ladder diagram 3-12 Basic Instructions <Application example for alternating circuit> · Differential instructions can also be applied to an alternating circuit which uses a single signal to hold and release the circuit. <Example 1> X100 R0 DF R0 Y110 Y110 R0 Y110 <Example 2> X100 DF R0 R0 Y110 Y110 R0 Y110 3-13 Basic Instructions ANS (AND Stack) Ladder diagram X100 X102 X101 X103 Y110 Outline of operation · This instruction connects blocks, connected in parallel, in serial. · Each block should start with the ST instruction. Example of operation In the above ladder diagram, when X100 or X101 is ON and X102 or X103 is ON, the signal is output to Y110. X100 or X101 is on and X102 or X103 is on, ouputs to Y110. (X100 OR X101) AND (X102 OR X103) Y110 X100 X101 X102 X103 Y110 When blocks are sequential · When blocks are sequential, divide them as shown below. X100 X102 X104 Y110 X101 X103 X105 3-14 ORS (OR Stack) Ladder diagram X100 X101 X102 X103 Y110 Basic Instructions Outline of operation · This instruction connects blocks, connected in serial, in parallel. · Each block should start with the ST instruction. Example of operation In the above ladder diagram, when X100 and X101 are ON or X102 and X103 are ON, the signal is output to Y110. X100 and X101 are ON or X102 and X103 are ON, outputs to Y110. (X100 AND X101) OR (X102 AND X103) Y110 X100 X101 X102 X103 Y110 When blocks are sequential · When blocks are sequential, divide them as shown below. X100 X102 X104 X101 X103 X105 Y110 3-15 Basic Instructions PSHS (Push Stack) RDS (Read Stack) POPS (Pop Stack) Ladder diagram X100 X101 Y110 X102 Y111 X103 Y112 Outline of operation Type of instruction Operation PSHS Saves the preceding operation result in this instruction, and continues with the operation from the next step. RDS Reads the operation result saved by the PSHS instruction, and continues with the operation using it from the next step. POPS Reads the operation result saved by the PSHS instruction, continues with the operation using it from the next step, and resets the operation result saved by the PSHS instruction. · Saves a single operation result, and read it and performs multiple operations. · This instruction is used to branch from a single contact and connect to further contacts. Example of operation 1) When X100 is ON, the PSHS instruction saves the operation result and outputs it to Y110 if X101 is ON. 2) The RDS instruction reads the operation result and outputs it to Y111 if X102 is ON. 3) The POPS instruction reads the operation result and outputs it to Y112 if X103 is OFF, and resets the operation result saved by the PSHS instruction. X100 X101 Y110 X102 Y111 X103 Y112 3-16 Basic Instructions Precautions during programming · Use the RDS instruction when the operation result will be further used and the POPS instruction if it will not be used any more. (Be sure to use the POPS instruction at the end of a series of instructions.) X100 X101 Y110 PSHS X102 Y111 RDS X103 X104 Y112 POPS · The RDS instruction can be used repeatedly for an unlimited number of times. X100 Y110 X101 RDS X102 X103 RDS X104 X105 RDS X106 X107 Y111 Y112 Y113 Y114 3-17 Basic Instructions Precaution when using PSHS instruction repeatedly · There is a limit on the number of times the PSHS instruction can be used repeatedly. The maximum number of times it can be used repeatedly before using the next POPS instruction is eight. · If the number of times for repeated use exceeds the limit, the program will not operate correctly. X100 X101 PSHS PSHS X108 Y110 PSHS PSHS 1st time 2nd time 8th time 9th time * This PSHS instruction does not operate correctly. · If the POPS instruction is used while the PSHS instruction is used repeatedly, the operation results will be read with the result saved by the last PSHS instruction first. The numbers in the figure correspond to the instruction results. X100 X101 X102 X103 X104 Y110 PSHS PSHS PSHS PSHS PSHS X100 X101 X102 X103 X104 X105 Y110 POPS POPS POPS POPS POPS X106 Y111 X107 Y112 X108 Y113 X109 Y114 X10A Y115 3-18 NOP (Nop) Ladder diagram X100 X101 1 Number of NOPs X102 NOP Y110 Basic Instructions Outline of operation · This instruction does not affect the preceding operation results. The program will operate in the same manner whether or not the NOP instruction is used. · The NOP instruction may be used to make it easy to view the program code when reviewing and/or modifying it. · To erase an instruction without changing the program address, write the NOP instruction over it. · To send the address of a program portion without modifying the program, insert the NOP instruction. · The NOP instruction is useful, for example, to divide a long program into several blocks. Sample program addresses addresses 0 ST X100 0 ST X100 1 AN X101 1 AN X101 2 AN/ X102 2 NOP NOP instruction is inserted here and the addresses change. 3 OT Y100 3 AN/ X102 4 OT Y100 Deleting NOP instruction · After creating a program, all NOP instructions contained in it can be deleted using a programming tool. 3-19 Basic Instructions OT, OT (Leading, Trailing Edge Out) Ladder diagram X100 P0 X101 P1 Available devices (: Available) Operand bit Bit device XYRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification Outline of operation Type of instruction Operation OT Generates output only for a single scan where the preceding operation result changes from the OFF state to the ON state (i.e., rises). OT Generates output only for a single scan where the preceding operation result changes from the ON state to the OFF state (i.e., falls). Example of operation (1) Program operation for "OT" in ladder diagram Outputs to the pulse relay P0 only for a single scan where X100 changes from the OFF state to the ON state (i.e., rises). Also outputs to P0 even if X100 is ON for the first scan. X100 P0 Leading edge Single scan (2) Program operation for "OT" in ladder diagram Outputs to the pulse relay P1 only for a single scan where X101 changes from the ON state to the OFF state (i.e., falls). X101 P1 Trailing edge Single scan 3-20 KP (Keep) Ladder diagram X100 Set KP X101 R0 Reset Basic Instructions Available devices (: Available) Operand bit Bit device XYRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification Outline of operation · This instruction turns ON the specified coil output when the set input (X100) turns ON and holds the ON state. Release the output state when the reset input (X101) turns ON. · While the state is being held, the output state is held regardless of the ON or OFF state of the set input (X100) until the reset input (X101) is entered. · If the set input (X100) and the reset input (X101) turn ON simultaneously, the reset input (X101) will take precedence. Example of operation 1) Turns ON the specified coil (R0) output when X100 turns ON and holds the ON state. 2) Release the output state when X101 turns ON. X100 X101 R0 Precautions during programming · The output destination holds the state even while the MC instruction is in operation. · The state will be reset when the operation mode is switched from RUN to PROG. or the power is turned off. However, this is not the case when an internal relay set to the hold type is specified as the output destination. 3-21 Basic Instructions SET, RST (Set, Reset) Ladder diagram X100 DF R0 SET X101 DF R0 RST Available devices (: Available) Operand bit Bit device XYRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification Outline of operation Type of instruction Operation SET Turns ON the output when the execution condition is ON and holds the state regardless of changes of the execution condition. RST Turns OFF the output coil when the execution condition is ON and holds the OFF state regardless of changes of the execution condition. Example of operation 1) When X100 turns ON, R0 turns ON and its state is held. 2) When X101 turns ON, R1 turns OFF and its state is held. X100 X101 R0 Precautions during programming · The same output coil can be specified as the output destination of the SET and RST instructions for any number of times. · Using relays with the SET and RST instructions does not result in duplicate output. It will also not be handled as a syntax error by the total check function. · The RST instruction can be used to turn off the relay. · The output destination of the SET instruction holds the state even while the MC instruction is in operation. · The output destination of the SET instruction will be reset when the operation mode is switched from RUN to PROG. or the power is turned off. However, this is not the case when an internal relay set to the hold type is specified as the output destination. · A pulse relay (P) cannot be specified as an output destination of the SET and RST instructions. · The error alarm buffer can be all cleared by RST SD60. · The first entry of the error alarm buffer can be cleared by RST SD61. 3-22 Basic Instructions Processing mechanism of SET and RST instructions · When operations are processed, the output content is rewritten at each step. · Since I/O refresh is done when the ED instruction is executed, data actually output depends on the final operation result. · In order to output an operation result while processing is in progress, use the direct output (OT) instruction. X100 Y110 SET Y110 R0 X101 Y110 RST X102 Y110 SET When X100 to X102 are all ON in the above program 1) Processing is done with Y110 to be ON. 2) Processing is done with Y110 to be OFF. 3) Processing is done with Y110 to be ON. Use SET and RST instructions with differential instructions · Putting the differential DF instructions before the SET and RST instructions makes it easy to create and adjust the program. · This is especially effective if the same output destination is used in many places within the program. 3-23 Basic Instructions ALT (Alternative Out) Ladder diagram X100 R0 DF ALT Available devices (: Available) Operand bit Bit device XYRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification Outline of operation · This instruction inverts the ON/OFF state of the specified coil when the preceding operation result changes from the OFF state to the ON state (i.e., rises). · The ON/OFF state of the specified coil is held until the ALT instruction specifying the coil is executed next. (Flip-flop control) Example of operation ON/OFF states of output R0 is inverted whenever X100 changes from the OFF to ON states (rises). X100 R0 Leading Leading edge edge Leading edge Precautions during programming · The ALT instruction detects rising from OFF to ON of the input and inverts the output. · While the input remains ON, the output is inverted at the leading edge only and not inverted later. · The output will not be inverted for the first scan if the input is already ON when the operation mode is switched to RUN or the power is turned on in the RUN mode. · Be careful when using this instruction with an instruction that changes the order of instruction execution such as MC - MCE or JP - LBL (1 to 6, shown below), because the operation of the instruction may change depending on the timing of the instruction execution and input. 1) MC - MCE instructions 2) JP - LBL instructions 3) LOOP - LBL instructions 4) CNDE instruction 5) Step ladder instructions 6) Subroutine instructions 3-24 TM (Timer) Ladder diagram R0 T5 n S TMX 5 U 30 Y111 Basic Instructions List of operands Operand Description n Timer number S Timer set value Available devices (: Available) 16-bit device 32-bit device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS *1 TE CE IX Integer K U H Real number String Index modification SF DF " " *2 n S *1: Only TS can be specified for TM instruction. *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) 3-25 Basic Instructions Outline of operation · The timer is the non-hold type that is reset when the power is turned off or the operation mode is switched from RUN to PROG. · When the execution condition is ON, the timer starts decrementing from the set time [S]. When the elapsed value reaches 0, the timer contact [Tn] (n is the timer contact number) turns ON. · When the execution condition turns OFF while the timer is decrementing, the timer stops and resets the elapsed value (clears it to zero). · The OT instruction can be written immediately after the timer coil. Regarding the specification of timer time · The setting time of the timer is calculated as (timer unit) x (timer set value). · The timer set value [S] is specified within the range between U1 to U4294967295, using a decimal constant. "TMS" is specified within the range from 0.00001 to 42949.67295 seconds, in units of 0.00001 seconds. "TML" is specified within the range from 0.001 to 4294967.295 seconds, in units of 0.001 seconds. "TMR" is specified within the range from 0.01 to 42949672.95 seconds, in units of 0.01 seconds. "TMX" is specified within the range from 0.1 to 429496729.5 seconds, in units of 0.1 seconds. "TMY" is specified within the range from 1 to 4294967295 seconds, in units of 1 seconds. Example of operation R0 T5 5s Y111 Precautions during programming · The timer set value area TS and timer elapsed value area TE both occupy 32-bit areas. This is also true when a device such as DT is used in the operand [S]. Be careful not to overwrite the areas with another program. · Since decrementing occurs during an operation, create the program so that decrementing occurs once during a single scan time. If multiple operations occur during a single scan due to an interruption handler program or jump/loop instruction, or decrementing never occurs, the correct result will not be obtained. · When using a timer instruction with an AND stack (ANS) instruction or pop stack (POPS) instruction, be sure to write the code correctly. 3-26 Basic Instructions Mechanism of timer operation · This is an example when the U constant is used to specify the set value. Refer to the next page for an example of operation with the set value area number specified. 1) When the operation mode is switched to RUN or the power is turned ON in the RUN mode, the timer set value is transferred to the set value area "TS" with the same number. R0 TMX 5 U 30 TS 5 T5 Y111 30 2) When the timer execution condition changes from OFF to ON (i.e., rises), the timer set value is transferred from the set value area "TS" to the elapsed value area "TE" with the same number. (This is also true when the operation mode is switched to RUN while the execution condition is ON.) R0 TMX 5 U 30 TS 5 TE 5 T5 Y111 30 30 3) For each scan, the value in the elapsed value area "TE" decrements if the execution condition is ON. R0 TMX 5 U 30 TS 5 TE 5 T5 Y111 30 30 29 28 27 3-27 Basic Instructions 4) When the value in the elapsed value area "TE" becomes 0, the timer contact "T" with the same number turns ON. R0 TMX 5 U 30 TS 5 TE 5 T5 Y111 30 0 Regarding how to directly specify the set value area number to the timer set value · The following program directly sets the timer set value to the timer set value area. · Be sure to specify the same number as the timer number in [n] for the setting area "TS." · The above program with TS5 specified to the set value operates as follows: 1) When the execution condition X100 is ON, the data transfer instruction MV is executed to start decrementing with U30 set to TS5. 2) When the execution condition X101 turns ON, decrementing starts with 30 as the set value. X100 MV.UL U 30 TS 5 X101 TMX 5 TS 5 T5 Y110 · Even when the value in the set value area "TS" is changed while decrementing, the decrement operation continues with the value before change. · The new value will be used for the timer operation when the execution condition next changes from OFF to ON after the current subtraction operation is completed or interrupted. · The setting area "TS" is normally the non-hold type that is reset when the power is turned off or the operation mode is switched from RUN to PROG. 3-28 Basic Instructions Mechanism of timer operation (When the set value area number is specified directly) 1) When the execution condition of the high-level instruction is ON, the value is set in the set value area "TS." The following shows an example of using the MV instruction. X100 X101 MV.UL U 30 TS 5 TS 5 30 TMX 5 TS 5 T5 Y110 2) When the timer execution condition changes from OFF to ON (i.e., rises), the timer set value is transferred from the set value area "TS" to the elapsed value area "TE" with the same number. (This is also true when the operation mode is switched to RUN while the execution condition is ON.) X100 X101 MV.UL U 30 TS 5 TMX 5 TS 5 TS 5 30 TE 5 30 T5 Y110 3) For each scan, the value in the elapsed value area "TE" decrements if the execution condition is ON. X100 X101 T5 MV.UL U 30 TS 5 TS 5 30 TMX 5 TS 5 Y110 TE 5 30 29 28 27 3-29 Basic Instructions 4) When the value in the elapsed value area "TE" becomes 0, the timer contact "T" with the same number turns ON. X100 X101 MV.UL U 30 TS 5 TMX 5 TS 5 TS 5 30 TE 5 0 T5 Y110 Application example of timer instructions (serial connection of timers) Ladder diagram R0 TMX 0 U 30 TMX1 U 20 T0 Y110 T1 Y111 Time chart R0 T0 T1 Y110 3 s 2 s Y111 3-30 Basic Instructions Application example of timer instructions (parallel connection of timers) Ladder diagram R0 TMX 0 U 30 TMX1 U 20 T0 Y110 T1 Y111 Time chart R0 T0 3 s T1 2 s Y110 Y111 3-31 Basic Instructions Application example of timer instructions (When the set value area number is specified directly) <Example> Switching set values according to the condition Ladder diagram X101 X100 X100 X101 MV.UL U 50 MV.UL U 30 TS 5 TS 5 X102 T5 TMX 5 TS 5 Y130 Time chart X100 X101 X102 T5 5 s TS5 U0 U50 3 s U30 U50 3-32 Timer number and timer setting value combinations Timer No. Timer setting value Ladder diagram 1 Constant Constant X100 T5 TMX 5 U 30 Y110 Basic Instructions Description Setting both the timer number and timer setting value with a constant 2 Constant Device number R0 X100 T5 MV.UL U 30 TS 5 TMX 5 TS 5 Y110 Setting a constant for the timer number, and a device number for the timer setting value R0 3 Constant Device No. with Index modification R1 X100 T5 4 Timer number with index modification Device number R0 R1 X100 T5 MV.UL U 30 DT 5 MV.UL U 5 I0 TMX 5 I0DT 0 Y110 MV.UL U 30 DT 0 MV.UL U 5 I0 TMX I00 DT 0 Y110 (Note): Refer to "I0 to IE Index Register" in "2-6 Description of the memory area." Setting a constant for the timer number, and a device number with index modification for the timer setting value On FPWIN GR7, input the timer instruction in the following order: [TM/CT (F5)] [TMX (F1)][5][ENTER] [INDEX (F9)][I0 (F1)] [DT (F5)][0][ENTER] Setting a constant with index modification for the timer number, and a device number for the timer setting value On FPWIN GR7, input the timer instruction in the following order: [TM/CT (F5)][TMX (F1)] [INDEX (F9)][I0 (F1)][0] [ENTER] [DT (F5)][0][ENTER] 3-33 Basic Instructions TM16 (16-bit Timer) Ladder diagram R0 TM16X 5 n T5 U 30 S Y111 List of operands Operand Description n Timer number (Available range: 0 to 4095 *For the default memory configuration) S Timer setting value (Available range: U0 to U65535) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX n S Integer K U H Real number String Index modification SF DF " " Outline of operation · Unlike the TM instruction, the range available for the setting value [S] for this instruction is U0 to U65535. · The timer is the non-hold type that is reset when the power is turned off or the operation mode is switched from RUN to PROG. · When the execution condition is ON, the timer starts decrementing from the set time S. When the elapsed value reaches U0, the timer contact Tn (n is the timer contact number) turns ON. · When the execution condition turns OFF during the subtraction operation, the elapsed value is reset (cleared to zero). · The OT instruction can be written immediately after the timer coil. · The setting time of the timer is calculated as (timer unit) x (timer set value). "TM16S" is specified within the range from 0.00000 to 0.65535 seconds, in units of 0.00001 seconds. "TM16L" is specified within the range from 0.000 to 65.535 seconds, in units of 0.001 seconds. "TM16R" is specified within the range from 0.00 to 655.35 seconds, in units of 0.01 seconds. "TM16X" is specified within the range from 0.0 to 6553.5 seconds, in units of 0.1 seconds. "TM16Y" is specified within the range from 0 to 65535 seconds, in units of 1 seconds. Precautions during programming · The timer set value area TS and timer elapsed value area TE both occupy 32-bit areas. · When specifying a 16-bit device such as DT for the operand S of TM16 instruction, the area used is for 16-bit data. · Since decrementing occurs during an operation, create the program so that decrementing occurs once during a single scan time. If multiple operations occur during a single scan due to an interruption handler program or jump/loop instruction, or decrementing never occurs, the correct result will not be obtained. · When U0 is specified for the setting value, the timeout operation is performed when the instruction is executed and the timer contact T turns ON. 3-34 Basic Instructions · When using a timer instruction with an AND stack (ANS) instruction or pop stack (POPS) instruction, be sure to write the code correctly. (For details, refer to 19-8 Precautions for Programming.) Difference between TM and TM16 instructions TM instruction (When specifying operand S=16-bit device) 32-bit data U131073 (H20001) written in DT0 to DT1 is treated as the timer setting value. U131073 is set in the elapsed value area TE0 when the input of R0 rises. R0 TMX0 DT0 DT0 DT1 TE0 T0 Y111 U1 U2 U131073 TM16 instruction (When specifying operand S=16-bit device) 16-bit data U1 (H1) written in DT0 is treated as the timer setting value. U1 is set in the elapsed value area TE0 when the input of R0 rises. R0 TM16X 0 DT0 DT0 TE0 T0 Y111 U1 U1 TM instruction (When specifying operand S=constant) Constant U100 is set in the setting value area TS0 when compiling the program. The setting value area TS0 is set in the elapsed value area TE0 when the input of R0 rises. The setting range of a constant is U0 to U4294967295. R0 TS0 TMX0 U100 U100 T0 Y111 TE0 U100 TM16 instruction (When specifying operand S=constant) U100 is set in the setting value area TS0 when compiling the program. The setting value area TS0 is set in the elapsed value area TE0 when the input of R0 rises. The setting range of a constant is U0 to U65535. R0 TM16X 0 U100 TS0 U100 T0 Y111 TE0 U100 (Note): When a 32-bit value is written into the elapsed value area TE while the timer is being operated using an instruction such as MV instruction, the timer operates with the written 32-bit value. When a 32-bit value is written into the setting value area TS, the timer operates with the written 32-bit value. 3-35 Basic Instructions SPTM (Unsigned 32-bit Incremental Auxiliary Timer) Ladder diagram R0 R5 SPTM.UL DT10 DT5 S D List of operands Operand Description S Timer set value D Timer elapsed value Available devices (: Available) 16-bit device 32-bit device Operand TS TE WX WY WR WL WS SD DT LD UM WI WO CS CE IX *1 *2 Integer K U H Real number String Index modification SF DF " " *3 S D *1: CS cannot be specified in the first operand [S]. *2: CE cannot be specified in the second operand [D]. *3: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction operates as a 32-bit on-delay timer with 0.01 second resolution. · When the execution condition is ON, the timer increments in the area [D, D+1] where the elapsed time is specified. · When the elapsed value reaches the timer set value [S], the relay that is connected to the Timer instruction and the system relay SRD are turned ON. (These relays are OFF when the execution condition is OFF or when the timer is incrementing.) · The system relay SRD can also be used as a timer contact. Regarding the specification of timer time · The timer time is calculated as 0.01 x (timer set value). · The timer set value is specified within the range from U1 (H1) to U4294967295 (HFFFFFFFF), using a U constant. "SPTM" is specified within the range from 0.01 to 42949672.95 seconds, in units of 0.01 seconds. Example) When the set value is U500, the set time is 0.01 x 500 = 5 seconds. 3-36 Basic Instructions Example of operation When executed with U500 in the set value [S]: DT10 1) Timer operation starts when R0 turns ON. "0" is transferred to the elapsed value area: DT5. 2) When the value of the elapsed value area: DT5 reaches the value in the set value area: DT10 (U500), the system relay SRD and output coil R5 turn ON. 3) When R0 turns OFF, the timer operation stops and "0" is transferred to the elapsed value area: DT5. R0 R5 SRD DT10 500 500 DT5 0 Precautions for programming · Make sure that the operation memory areas used for other timer/counter instructions or high-level instructions are not used for the timer set and elapsed value areas. · Since incrementing occurs during an operation, create the program so that incrementing occurs once during a single scan time. If multiple operations occur during a single scan due to an interrupt handler program or jump/loop instruction, or incrementing never occurs, the correct result will not be obtained. 3-37 Basic Instructions Mechanism of auxiliary timer operation 1) When the internal relay changes from OFF to ON, "0" is transferred to the elapsed value area [D,D+1]. R0 R5 SPTM.UL DT10 DT20 SRD MV.SL DT30 DT40 0 DT20,DT21 0 2) For each scan, the value in the elapsed value area [D, D+1] increments if the internal relay is ON. R0 R5 SPTM.UL DT10 DT20 SRD MV.SL DT30 DT40 DT20,DT21 0 1 2 3 3) If the value for the elapsed value area [D, D+1] is equal to the value for [S,S+1], the relay used for the OT instruction and system relay SRD are ON. R0 R5 SPTM.UL DT10 DT20 SRD MV.SL DT30 DT40 DT20,DT21 500 3-38 Basic Instructions Precaution when using system relay SRD · When using multiple auxiliary timers with the SRD, be sure use SRD on the line following the auxiliary timer instruction. <Example> R0 SPTM.UL DT10 DT20 SRD Pair Y110 R1 SPTM.UL DT30 DT40 SRD Pair Y111 · Operation will be incorrect if code is written as follows: R0 SPTM.UL DT10 DT20 R1 SPTM.UL DT30 DT40 SRD SRD Y110 Y111 3-39 Basic Instructions CT (Down Counter) Ladder diagram X100 Count X101 Reset C100 n CT 100 U10 S Y131 List of operands Operand Description n Counter number S Counter set value Available devices (: Available) 16-bit device 32-bit device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS *1 TE CE IX n S *1: Only CS can be specified for CT instruction. Integer K U H Real number String Index modification SF DF " " Outline of operation · All counters are decremental preset counters. · When the reset input rises from OFF to ON, the value in the set value area "CS" is preset to the elapsed value area "CE." · When the reset input is ON, the elapsed value is reset to zero. · When the count input changes from OFF to ON, the counter decrements from the set value. When the elapsed value becomes 0, output to the counter contact is generated. · If the count input and the reset input turn ON simultaneously, the reset input will take precedence. · If the count input rises and the reset input falls simultaneously, the count input will be ignored and only preset is performed. · The OT instruction can be written immediately after the counter instruction. Regarding count value setting · The count value is specified within the setting range from U1 to 4294967295, using a decimal (U) constant. 3-40 Example of operation When counter number [n]=100, set value [S]=10 1) When X100 turns ON for 10 times, C100 turns ON and Y131 turns ON. 2) When X101 turns ON, the elapsed value is reset. X100 X101 10 times C100 Y131 Basic Instructions Precautions during programming · The counter set value area CS and counter elapsed value area CE both occupy 32-bit areas. This is also true when a device such as DT is used in the operand [S]. Be careful not to overwrite the areas with another program. · When using a counter instruction with an AND stack instruction or pop stack instruction, be sure to write the code correctly. Precaution on count input detection · The CT instruction detects rising from OFF to ON of the count input and decrements the set value. · While the count input remains ON, counting is performed at the leading edge only and not performed later. · The set value will not be decremented for the first scan if the count input is already ON when the operation mode is switched to RUN or the power is turned on in the RUN mode. RUN (Power on) Count input Instruction operation Not counted Counted · Be careful when using this instruction with an instruction that changes the order of instruction execution such as MC - MCE or JP - LBL (1 to 6, shown below), because the operation of the instruction may change depending on the timing of the instruction execution and count input. 1) MC - MCE instructions 2) JP - LBL instructions 3) LOOP - LBL instructions 4) CNDE instruction 5) Step ladder instructions 6) Subroutine instructions 3-41 Basic Instructions Mechanism of down counter operation · This is an example when the U constant is used to specify the set value. Refer to the next page for an example of operation with the set value area number specified. (This example assumes that 100 is set to the counter.) 1) When the operation mode is switched to RUN or the power is turned ON in the RUN mode, the counter set value is transferred to the set value area "CS" with the same number. X100 X101 C100 CT 100 U10 Y131 CS100 10 2) At the trailing edge of the reset input, the value in the set value area "CS" is preset to the elapsed value area "CE." X100 X101 C100 CT 100 U10 Y131 CS100 10 CE100 10 3) Whenever the count input X100 turns ON, the value in the elapsed value area "CE" is decremented. X100 X101 C100 CT 100 U10 Y131 CS100 10 CE100 10 9 8 3-42 Basic Instructions 4) When the value in the elapsed value area "CE" becomes 0, the counter contact "C" with the same number turns ON. X100 X101 C100 CT 100 U10 Y131 CS100 10 CE100 0 How to specify the set value area number directly to the down counter setting value · The above program with CS100 specified to the set value operates as follows: 1) When the execution condition X100 is ON, the data transfer instruction MV is executed to start decrementing with U30 set to CS100. 2) When the count input X101 is ON, decrementing starts from the set value 30. · Be sure to specify the same address as the counter number in [S] for the setting area "CS." X100 X101 MV.UL U50 CS100 CT 100 X102 CS100 C100 Y111 · Even when the value in the set value area "CS" is changed while decrementing, the decrement operation continues with the value before change. The new value will be used for the counter operation after the counter is reset and the counter input next changes from OFF to ON. 3-43 Basic Instructions Mechanism of down counter operation (When the set value area number is specified directly) 1) When the execution condition of the high-level instruction is ON, the value is set in the set value area "CS." The following shows an example of using the MV instruction. X100 X101 MV.UL U30 CS100 CT 100 CS100 30 X102 CS100 C100 Y111 2) At the trailing edge of the reset input, the value in the set value area "CS" is preset to the elapsed value area "CE." X100 X101 MV.UL U30 CS100 CT 100 CS100 30 CE100 30 X102 CS100 C100 Y111 3) Whenever the count input X101 turns ON, the value in the elapsed value area "CE" is decremented. X100 X101 X102 C100 MV.UL U30 CS100 CT 100 CS100 Y111 CS100 30 CE100 30 29 28 27 3-44 Basic Instructions 4) When the value in the elapsed value area "CE" becomes 0, the counter contact "C" with the same number turns ON. X100 MV.UL U30 CS100 X101 CT 100 CS100 30 CE100 0 X102 CS100 C100 Y111 3-45 Basic Instructions Application example of counter instructions (When the set value area number is specified directly) <Example> Switching set values according to the condition Ladder diagram X101 X100 MV.UL U50 CS100 X100 X101 MV.UL U30 CS100 X102 X103 C100 CT 100 CS100 Y130 Time chart X100 X101 X102 X103 C100 CS100 U0 50 times U50 3-46 Counter number and setting value combinations Counter No. Counter set value Ladder diagram X100 1 Constant Constant X101 C100 CT 100 U50 Y111 Basic Instructions Description Setting a constant for both the counter number and the counter setting value R0 2 Constant Device number X100 X101 C100 MV.UL U50 CS100 CT 100 CS100 Y111 Setting a constant for the counter number, and a device number for the counter setting value R0 R1 Device X100 3 Constant number with Index modification X101 C100 MV.UL U50 DT100 MV.UL U100 I0 CT 100 I0DT0 Y111 Setting a constant for the counter number, and a device number with index modification for the counter setting value On FPWIN GR7, input the counter instruction in the following order: [TM/CT (F5)] [CT (F6)] [1][0][0][ENTER] [INDEX (F9)][I0 (F1)] [DT (F5)][0][ENTER] R0 R1 Counter 4 number with Index modification Device number X100 X101 C100 MV.UL U50 DT0 MV.UL U100 I0 CT I00 DT0 Y111 (Note): Refer to "I0 to IE Index registers" in "I0 to IE Index registers." Setting a constant with index modification for the counter number, and a device number for the counter setting value On FPWIN GR7, input the counter instruction in the following order: [TM/CT (F5)] [CT (F6)] [INDEX (F9)][I0 (F1)] [0][ENTER] [DT (F5)][0][ENTER] 3-47 Basic Instructions CT16 (16-bit Counter) Ladder diagram X100 Count X101 Reset C100 n CT16- 100 U10 S Y131 List of operands Operand Description n Counter number (Available range: 4 to 1023 *For the default memory configuration) S Counter setting value (Available range: U0 to U65535) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX n S Integer K U H Real number String Index modification SF DF " " Outline of operation · Unlike the CT instruction, the range available for the setting value [S] for this instruction is U0 to U65535. · All counters are decremental preset counters. · When the reset input falls from OFF to ON, the value in the setting value area CS is preset to the elapsed value area CE. · When the reset input is ON, the elapsed value is reset (cleared to zero). When the count input changes from the OFF state to the ON state, the setting value is subtracted. When the elapsed value becomes U0, it is output to the counter contact. · If the count input and the reset input turn ON simultaneously, the reset input will take precedence. · If the count input rises and the reset input falls simultaneously, the count input will be ignored and only preset is performed. · The OT instruction can be written immediately after the counter instruction. Precautions during programming · The counter set value area CS and counter elapsed value area CE both occupy 32-bit areas. · When specifying a 16-bit device such as DT for the operand S of CT16 instruction, the area used is for 16-bit data. · When U0 is specified for the setting value, the count-up operation is performed when the instruction is executed and the counter contact C turns ON. 3-48 Basic Instructions Difference between CT and CT16 instructions CT instruction (When specifying operand S=16-bit device) 32-bit data U131073 (H20001) written in DT0 to DT1 is treated as the counter setting value. U131073 is set in the elapsed value area CE0 when the input of X101 falls. X100 X101 C0 CT0 DT0 DT0 DT0 U1 U1 CE0 U131073 Y131 CT16 instruction (When specifying operand S=16-bit device) 16-bit data U1 (H1) written in DT0 is treated as the counter setting value. U1 is set in the elapsed value area CE0 when the input of X101 falls. X100 X101 C0 CT160 DT0 DT0 CE0 U1 U1 Y131 (Note): When a 32-bit value is written into the elapsed value area CE while the counter is being operated using an instruction such as MV instruction, the timer operates with the written 32-bit value. 3-49 Basic Instructions CT instruction (When specifying operand S=constant) U100 is set in the setting value area CS0 when compiling the program. The setting value area CS0 is set in the elapsed value area CE0 when the input of X101 falls. The setting range of a constant is U0 to U4294967295. X100 X101 C0 CT0 U100 Y131 CS0 U100 CE0 U100 CT16 instruction (When specifying operand S=constant) U100 is set in the setting value area CS0 when compiling the program. The setting value area CS0 is set in the elapsed value area CE0 when the input of X101 falls. The setting range of a constant is U0 to U65535. X100 X101 C0 CT160 U100 Y131 CS0 U100 CE0 U100 (Note): When a 32-bit value is written into the elapsed value area CE while the counter is being operated using an instruction such as MV instruction, the timer operates with the written 32-bit value. When a 32-bit value is written into the setting value area CS, the timer operates with the written 32-bit value. 3-50 Basic Instructions UDC (Up/Down Counter) Ladder diagram R0 Up/Down n UDC 100 R1 Count U10 R2 Reset S CE100 =.SL U100 Y150 List of operands Operand Description n Counter number S Counter set value Available devices (: Available) 16-bit device 32-bit device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS *1 TE CE IX n S *1: Only CS can be specified. Integer K U H Real number String Index modification SF DF " " Outline of operation · This counter can increment (up count) or decrement (down count) depending on the ON/OFF state of the relay specified by the up/down input. · It increments (+1) when the up/down input is ON and decrements (-1) when it is OFF. The elapsed value is stored in the [CEn] area. · The preset value in [S] is transferred to [CEn] when the reset input changes from ON to OFF. · When the count input changes from OFF to ON, the counter starts counting from the value set in [CEn]. · When the reset input turns ON, the elapsed value in [CEn] will be cleared. · The count result can be judged by comparing the elapsed value in [CEn] with an arbitrary set value by the data comparison instruction. · Be sure to execute the data comparison instruction immediately after the UDC instruction. Regarding count value setting · The count value is specified within the range from U1 to 4294967295, using a decimal (U) constant. 3-51 Basic Instructions Example of operation 1) When the reset input R2 changes from ON to OFF, the set value: U100 is transferred to the elapsed value: CE100. This value is used as the target. 2) When R1 turns ON while R0 is OFF, 1 is subtracted from the elapsed value: CE100 (decremental counting). When R1 turns ON while R0 is ON, 1 is added to the elapsed value: CE100 (incremental counting). 3) The counter elapsed value: CE100 and U0 are compared, and if CE100=U0, the external output Y150 turns ON. R2 R1 R0 Y150 C100 10 CE100 0 CE100 3-52 Basic Instructions Precautions during programming · If a hold type memory area is specified as the elapsed value area, the elapsed value is treated in accordance with the held value. · Note that the set value is not automatically preset to the elapsed value area at the start of the operation. To preset the value, turn ON then OFF the reset input. · When using a UDC instruction with an AND stack (ANS) instruction or pop stack (POPS) instruction, be sure to write the code correctly. Precaution on count input detection · The UDC instruction detects rising from OFF to ON of the count input and increments or decrements the set value. · While the count input remains ON, counting is performed at the leading edge only and not performed later. · The set value will not be incremented or decremented for the first scan if the count input is already ON when the operation mode is switched to RUN or the power is turned on in the RUN mode. RUN (Power on) Count input Instruction operation Not counted Counted · Be careful when using this instruction with an instruction that changes the order of instruction execution such as MC - MCE or JP - LBL (1 to 6, shown below), because the operation of the instruction may change depending on the timing of the instruction execution and count input. 1) MC - MCE instructions 2) JP - LBL instructions 3) LOOP - LBL instructions 4) CNDE instruction 5) Step ladder instructions 6) Subroutine instructions 3-53 Basic Instructions SR (Shift Register) Ladder diagram X100 Data X101 Shift X102 Reset SR WR 3 D List of operands Operand Description D Shifted device Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX D Integer K U H Real number String Index modification SF DF " " 3-54 Basic Instructions Outline of operation · This instruction moves (i.e., shifts) the contents of the specified register WR (specified operation unit) to the left by one bit. 1) When the shift input turns ON (rises), shifts the contents of WR to the left by one bit. WR3 0000100010001100 WR3 0000100010001100? 2) Upon shifting, sets 1 or 0 to the blank bit (least significant bit) if the data input is ON or OFF, respectively. WR3 0000100010001100 WR3 00001000100011000 0 : Data = OFF 1 : Data = ON 3) When the reset input turns ON, the specified register contents will be cleared. WR3 0000100010001100 WR3 0000000000000000 3-55 Basic Instructions Example of operation 1) When X101 turns ON while X102 is OFF, the contents of WR3 (internal relays R30 to R3F) are shifted by 1 bit to the left. 2) In the bit that has become blank due to left shifting (R30), 1 is set when X100 is ON and 0 is set when X100 is OFF. 3) When X102 turns ON, the contents of WR3 are reset to 0. X100 X101 X102 R30 R31 R32 R33 R34 Precautions during programming · The data input, shift input, and reset input are required for the SR instruction. · When the reset input and the shift input turn ON simultaneously, the reset input takes precedence. Shift input Reset input Rn · Note that if a hold-type memory area is specified for the shift register, it will not be automatically reset upon power ON. · When using a shift register instruction with an AND stack (ANS) instruction or pop stack (POPS) instruction, be sure to write the code correctly. 3-56 Basic Instructions Precaution on shift input detection · The SR instruction detects rising from OFF to ON of the shift input and shift the register contents. · While the shift input remains ON, shifting is performed at the leading edge only and not performed later. · The register contents will not be shifted for the first scan if the shift input is already ON when the operation mode is switched to RUN or the power is turned on in the RUN mode. RUN (Power on) Shift input Instruction operation Not shifted Shifted · Be careful when using this instruction with an instruction that changes the order of instruction execution such as MC - MCE or JP - LBL (1 to 6, shown below), because the operation of the instruction may change depending on the timing of the instruction execution and shift input. 1) MC - MCE instructions 2) JP - LBL instructions 3) LOOP - LBL instructions 4) CNDE instruction 5) Step ladder instructions 6) Subroutine instructions Related instructions · The left/right shift register (LRSR) instruction is also provided in addition to this instruction for the shift register. You can also use the data shift or data rotate instruction to implement the same operation. 3-57 Basic Instructions LRSR (Left/Right Shift Register) Ladder diagram Direction R0 LRSR Data R1 D1 Shift R2 DT 0 D2 Reset R3 DT 9 List of operands Operand Description D1 Shift starting position D2 Shift ending position Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX D1 D2 Integer K U H Real number String Index modification SF DF " " Outline of operation · Left/right shift is a shift register which shifts one bit of the specified data area to the left (to the higher bit position) or to the right (to the lower bit position), depending on the ON/OFF state of the relay specified as the left/right shift input. · It shifts to the left or right when the left/right shift input is ON or OFF, respectively. · Specify the same area type for the variables [D1] and [D2]. Be sure that [D1] is equal to or smaller than [D2]. Operation of LRSR (left/right shift register) 1) When the shift input changes from OFF to ON (with the reset input OFF), shifts the contents of the area specified by [D1] and [D2] to the left or right by one bit. 2) Upon shifting, sets 1 or 0 to the bit (most significant bit or least significant bit) which has become blank due to shifting if the data input is ON or OFF, respectively. In addition, the bit pushed out due to shifting (the most significant bit for left shift and the least significant bit for right shift) is set in the system relay SR9 (carry flag). 3) When the reset input turns ON, the contents of the specified area will be cleared to zero. 3-58 Basic Instructions Operation diagram DT9 15 0 Left shift CY 15 0 DT0 15 0 R0 : ON R2 : OFF ON 15 0 Right shift DT9 15 0 15 0 R1 : ON: "1", OFF: "0" DT0 R0 : OFF 15 0 R2 : OFF ON CY 15 0 R1 : ON: "1", OFF: "0" Precautions during programming · The LRSR instruction detects rising from OFF to ON of the shift input and shift the register contents. While the shift input remains ON, shifting is performed at the rising edge only and not performed later. · The register contents will not be shifted for the first scan if the shift input is already ON when the operation mode is switched to RUN or the power is turned on in the RUN mode. RUN (Power on) Shift input Instruction operation Not shifted Shifted · Be careful when using this instruction with an instruction that changes the order of instruction execution such as MC - MCE or JP - LBL (1 to 6, shown below), because the operation of the instruction may change depending on the timing of the instruction execution and shift input. 1) MC - MCE instructions 2) JP - LBL instructions 3) LOOP - LBL instructions 4) CNDE instruction 5) Step ladder instructions 6) Subroutine instructions · When using an LRSR instruction with an AND stack (ANS) instruction or pop stack (POPS) instruction, be sure to write the code correctly. Flag operations Name Description SR7, SR8 (ER) SR9(CY) Turns ON when [D1] address > [D2] address. Turns ON when the value pushed out due to shifting is "1." 3-59 Basic Instructions MC (Master Control Relay) MCE (Master Control Relay End) Ladder diagram Execution condition X100 X101 MC Y131 Y131 X102 Y132 Y132 MCE Outline of operation · When the execution condition is ON, this instruction runs the program code between the MC and MCE instructions. · When the execution condition is OFF, the state of each input and output relay is as shown below. Type of instruction Operation OT All OFF KP SET State is held RST TM Reset CT Intermediate result is held SR Differential instructions Refer to Operation of differential instructions between MC and MCE. (Note 1) Other instructions Not executed (Note 1): The following items are included in differential instructions. 1) DF (leading edge differential) instruction 2) Count input for CT (counter) instruction 3) Count input for UDC (up-down counter) instruction 4) Shift input for SR (shift register) instruction 5) Shift input for LRSR (left and right shift register) instruction 6) Differential execution type high-level instruction (instruction specified by p and instruction name) 3-60 Basic Instructions Example of operation X100 Execution condition X101 Y131 X102 Y132 Operation of differential instructions between MC and MCE · If the differential instruction is used between MC and MCE, the output obtained differs depending on the execution condition of MC and the input timing of the differential instruction as shown below. X100 MC X101 DF Y110 MCE <Timing Chart 1> X100 Execution conditions X101 Y110 Last differential instruction execution Timing Chart 2 Since the execution condition X101 for the differential instruction has not changed from the last execution, no differential output is obtained. X100 Execution conditions X101 Y110 Last differential Since the execution condition X101 for the differential instruction execution instruction has changed from OFF to ON from the last execution, differential output is obtained. 3-61 Basic Instructions · If the same execution condition is specified for the MC and differential instructions, no output will be generated. If the output is necessary, be sure to write the differential instruction outside the range between MC and MCE. X100 X100 DF MC Y110 MCE X100 X100 R0 DF MC R0 MCE Y110 3-62 Basic Instructions Precautions for Programming · A pair of the MC and MCE instructions can be nested within another pair of the MC and MCE instructions. (Up to 30 levels of nesting are allowed for MC and MCE.) X100 MC X101 Y110 X102 X103 MC Y111 X104 X105 MC Y112 MCE MCE MCE · The program code will not be executed in following cases: 1) MC or MCE is missing in a pair. 2) The order of MC and MCE is reversed. X101 X100 MCE Y110 MC 3-63 Basic Instructions JP, LBL (Jump, Label) Ladder diagram X101 JP 1 n LBL 1 List of operands Operand Description n Label number (relative jump pointer to LBL) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U *1 H Real number String Index modification SF DF " " n *1: Can be specified only when the operation unit is an unsigned integer (US, UL). Outline of operation · When the execution condition is ON, this instruction jumps to the label with the specified number (LBL instruction). · The program continues running from the instruction after the target label. Example of operation · When the execution condition X101 is ON, the program jumps to the label 1. X101 Program JP 1 X101: ON Program Not executed Program LBL 1 3-64 Precautions during programming · The JP instruction specifying the same label number can be used more than once. X100 JP 1 R20 JP 1 X120 LOOP 1 DT 0 Basic Instructions LBL 1 · The LBL instruction specifying the same number can only be written once in a single program. · If the target label is not programmed, a syntax error will occur. · Note that if the label is written at an address before the JP instruction, the program cannot end scanning and a WDT error may occur. · The JP and LBL instructions cannot be used in the step ladder area (within the range from the SSTP to STPE instructions). · It is not possible to jump from the main program to a subprogram (subroutine or interruption program after the ED instruction), from a subprogram to the main program, or between subprograms. · Be careful when using an instruction which detects the leading edge of the execution condition and runs (1 - 6 below), including a differential instruction. 1) DF (leading edge differential) instruction 2) Count input for CT (counter) instruction 3) Count input for UDC (up-down counter) instruction 4) Shift input for SR (shift register) instruction 5) Shift input for LRSR (left and right shift register) instruction 6) Differential execution type high-level instruction (instruction specified by p and instruction name) 3-65 Basic Instructions Regarding operation of TM, CT, and SR instructions between JP and LBL instructions · If the LBL instruction is located at an address after the JP instruction, each instruction is processed as follows when the JP instruction is executed. JP 1 LBL 1 Jumps repeatedly when the execution condition is on. 1) TM instruction: Not counted. Note that time is not guaranteed if counting does not occur during a single scan. 2) CT instruction: Not counted even if the count input is ON. The elapsed value is held. 3) SR instruction: Not shifted even if the shift input is ON. The specified register contents are held. · If the LBL instruction is located at an address before the JP instruction, each instruction is processed as follows when the JP instruction is executed. LBL 1 JP 1 Executes repeatedly when the execution condition is on. 1) TM instruction: Time is not guaranteed because counting occurs several times during a single scan. 2) CT instruction: Operates normally if the count input does not change its state during the scan. 3) SR instruction: Operates normally if the shift input does not change its state during the scan. 3-66 Basic Instructions Operation of differential instruction between JP and LBL instructions If the differential instruction is used between JP and LBL, the output obtained differs depending on the execution condition of JP and the input timing of the differential instruction as shown below. X100 JP 1 X101 DF Y110 LBL 1 <Timing Chart 1> X100 X101 Y110 Final timing with no execution of the last JP instruction <Timing Chart 2> Since the execution condition X101 for the differential instruction has not changed from the final timing with no execution of the last JP instruction, no differential output is obtained. X100 X101 Y110 Final timing with no execution of the last JP instruction Since the execution condition X101 for the differential instruction has changed from OFF to ON from the final timing with no execution of the last JP instruction, differential output is obtained. · If the same execution condition is used for the JP and differential instructions, rising (or falling) of the execution condition for the differential instruction will not be detected. If the differential output is necessary, be sure to write the differential instruction outside the range between JP and LBL. 3-67 Basic Instructions X101 X101 DF/ X101 DF/ X101 JP 1 Y111 LBL 1 Y111 JP 1 LBL 1 3-68 Basic Instructions LOOP, LBL (LOOP, Label) Ladder diagram n X101 LOOP 1 DT 0 S List of operands Operand Description n Label number S Loop count Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX n S Integer K U H Real number String Index modification SF DF " " Outline of operation · If the condition is ON, 1 is subtracted from the value in [S]. If the result is not 0, the instruction jumps to the label with the specified number (LBL instruction). · The program continues running from the instruction after the target label. · The LOOP instruction specifies the number of times to execute the code. When the code has been executed for the number of times specified in [S], the program will not jump to the specified label even if the execution condition is met. X100 MV.US U 10 DT 0 LBL 1 X101 LOOP 1 DT 0 If DT0 = K5, jumps five times and stop jumping even if X101 is on. · If the value in the memory area specified in [S] is 0 from the first time, the program does not jump to the specified label but instead performs the next process. 3-69 Basic Instructions · The label is shared between the JP and LOOP instructions. The label can be used as the jump target for any number of times from any instructions. X100 JP 1 R20 JP 1 X120 LBL 1 LOOP 1 DT 0 · The LBL instruction specifying the same number can only be written once in a single program. · If the target label is not programmed, a syntax error will occur. Example of operation X101 LBL 2 LOOP 2 DT 0 1 is subtracted from the value stored in DT0. If the result is not 0, the instruction jumps to LBL2 and the code between LBL2 and LOOP2 is repeated. 3-70 Basic Instructions Regarding operation of TM, CT, and SR instructions between LOOP and LBL instructions · If the LBL instruction is located at an address after the LOOP instruction, each instruction is processed as follows when the LOOP instruction is executed. X100 LOOP 1 DT 0 LBL 1 Jumps repeatedly when the execution condition is on. 1) TM instruction: Not counted. Note that time is not guaranteed if counting does not occur during a single scan. 2) CT instruction: Not counted even if the count input is ON. The elapsed value is held. 3) SR instruction: Not shifted even if the shift input is ON. The specified register contents are held. · If the LBL instruction is located at an address before the LOOP instruction, each instruction is processed as follows when the LOOP instruction is executed. X100 LBL 1 LOOP 1 DT 0 Executes repeatedly when the execution condition is on. 1) TM instruction: Time is not guaranteed because counting occurs several times during a single scan. 2) CT instruction: Operates normally if the count input does not change its state during the scan. 3) SR instruction: Operates normally if the shift input does not change its state during the scan. 3-71 Basic Instructions Precautions during programming · When writing a label to an address before the LOOP instruction, pay attention to the following: 1) Be sure to write the instruction for setting the loop count before LBL - LOOP instructions. 2) Be sure to write the instructions repeated between the LBL and LOOP instructions so that they are executed with the same execution condition as the LOOP instruction. 3) While repeating the program code, a single scan may exceed the WDT monitor time limit and a WDT error may occur. · The LOOP and LBL instructions cannot be used in the step ladder area (within the range from the SSTP to STPE instructions). · It is not possible to jump from the main program to a subprogram (subroutine or interruption program after the ED instruction), from a subprogram to the main program, or between subprograms. · Be careful when using an instruction which detects the leading edge of the execution condition and runs (1 6 below), including a differential instruction. 1) DF (leading edge differential) instruction 2) Count input for CT (counter) instruction 3) Count input for UDC (up-down counter) instruction 4) Shift input for SR (shift register) instruction 5) Shift input for LRSR (left and right shift register) instruction 6) Differential execution type high-level instruction (instruction specified by p and instruction name) Flag operations Name Description SR7 SR8 (ER) ON when the value in [S] is negative (most significant bit is 1) 3-72 ED (End) Ladder diagram X100 X101 R0 R0 X102 R0 Y130 Basic Instructions ED Outline of operation · This instruction writes the ED instruction at the end of the regular program area. Normal program area ED Subroutine program · The program area is divided into the regular program area (main program) and the "subroutine" and "interruption program" areas (subprograms) by this instruction. · Be sure to write the subroutine and interruption program after the ED instruction. 3-73 Basic Instructions EDPB (End Program Block) Ladder diagram X100 X101 R3 R0 R0 X102 Y110 ED EDPB Outline of operation · This instruction indicates the end of PB (program block). 3-74 CNDE (Conditional End) Ladder diagram X100 X101 Y130 Y130 Execution condition X103 R0 X102 CNDE Y131 Basic Instructions Outline of operation · This instruction enables ending the operation of the program at a specified address. · When the execution condition turns ON, the program terminates operation and begins other processing such as I/O. Then the program returns to the starting address. · The process timing can be adjusted by beginning the process as soon as the necessary program scan finishes. · The CNDE instruction cannot be used in a subprogram (e.g., subroutine). It should be used in the main program area. · The CNDE instruction can be used for any number of times in the main program. · Be careful when using an instruction which detects the leading edge of the execution condition and runs (1 6 below), including a differential instruction. 1) DF (leading edge differential) instruction 2) Count input for CT (counter) instruction 3) Count input for UDC (up-down counter) instruction 4) Shift input for SR (shift register) instruction 5) Shift input for LRSR (left and right shift register) instruction 6) Differential execution type high-level instruction (instruction specified by p and instruction name) 3-75 Basic Instructions EJECT (Eject) Ladder diagram R0 R1 R2 Y100 EJECT Y101 Y102 Outline of operation · When creating and printing out program code with the tool software, a page break will be added where this instruction is inserted. · Similarly to the NOP instruction, no program processing will occur. Example of operation R0 Y100 Page n EJECT Page break is inserted R1 Y101 here. Page n+1 R2 Y102 3-76 SSTP (Start Step) / NSTL (Next Step) / CSTP (Clear Step) / STPE (Step End) Ladder diagram Output setting X101 Output setting R1 NSTL R1 SSTP Y110 X102 R2 NSTL R2 SSTP (Program) Y111 (Program) Output setting X103 R2 CSTP Basic Instructions STPE Available devices (: Available) Operand bit Bit device XYR L TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification 3-77 Basic Instructions Outline of operation · The NSTL instruction starts and executes a process which begins with the SSTP instruction with the specified number. · Program code between the SSTP instruction and the next SSTP instruction or the STPE instruction is handled as a single process. · This allows for easy implementation of sequence control, selective branch control, as well as parallel branch/join control. 1) Sequence control Sequentially switches and executes only the necessary processes. Process 1 Process 2 Process 3 Process 4 2) Selective branch control Selects and executes processes according to the condition. Process 1 Process 2 Process 3 Process 4 3) Parallel branch/join control Executes multiple processes simultaneously. When all the processes running simultaneously complete, next processes can be executed. Process 1 Process 2 Process 3 Process 4 3-78 Example of operation X101 R1 SSTP X102 R2 SSTP X103 (Program) (Program) X101 X102 X103 Process 1 (R1) Process 2 (R2) Start Stop Start Basic Instructions R1 NSTL Y110 R2 NSTL Y111 Starts the process 1 by NSTL. Starts the process 2 by NSTL. Process 1 R2 CSTP STPE Stops the process 2 by CSTP. Process 2 Indicates that process stopped. Stop Stop 3-79 Basic Instructions SSTP Start Step Instruction · This instruction indicates "Start of output number [n]." Be sure to write the "SSTP n" at the beginning of the program of the output number [n]. · Program code between "SSTP n" and the next "SSTP" or "STPE" is handled as the area with the output number [n]. · Processes with the same number cannot be defined. · The OUT instruction can be connected directly from the bus bar immediately after the SSTP instruction. · The SSTP instruction cannot be written in a subprogram (subroutine). · Program code between the first SSTP instruction and STPE instruction is referred to as a "step ladder area" and is controlled as a process. Other areas are referred to as "normal ladder areas." · There is a type of system relay which turns ON only for a single scan when a process with a step ladder starts. (SR15: Step ladder initial pulse relay) This relay can be used to perform a process only for a single scan after starting a process (e.g., resetting a counter). NSTL Next Step Instruction (Every Scan Execution Type) · The NSTL R instruction starts a process specified by the relay number [R]. · The execution condition of the Next Step instruction is the start condition of the process. · For the process that starts first, write the Next Step instruction in the normal ladder area. · The process can be started from the normal ladder area as well as a running process. · However, when a Next Step instruction which starts a process within another process is executed, the running process that includes this instruction will be automatically cleared, and the specified process will be started. CSTP Clear Step Instruction · When the CSTPn instruction is executed, the process specified by "n" is cleared. Use this instruction to clear the final process or each process running in parallel in parallel branch/join control. · The process can be cleared from the normal ladder area as well as a running process. · When clearing multiple processes, the ZRST instruction can be used. STPE Step End Instruction · This instruction indicates the end of the step ladder area. This should be always written at the end of the last described process. The final process is defined by the SSTP and STPE instructions. · Only one STPE instruction can be written in each main program. (It cannot be written in a subprogram such as a subroutine or interruption program.) 3-80 Basic Instructions Example (1) Sequential control of processes · This program repeats a process until its task completes, then moves to the next process. · Write an instruction to start the next process within the current process. When the start instruction is executed, the next process is started and the current process is cleared. · Processes need not be executed in the order of their numbers. It is even possible to start a previous process if necessary. X101 R1 SSTP X102 R2 SSTP (Program) R1 NSTL Y110 R2 NSTL Y111 Starts the process (process 1). Starts the next process (process 2). Process 1 X103 (Program) R2 CSTP Clears the process (process 2). Process 2 STPE X101 X102 X103 Y110 Y111 Process 1 Process 2 3-81 Basic Instructions Example (2) Selective branch control of processes · This program selects the next process to execute according to the task contents or result of the current process. Each process is repeated until its task completes. · Write an instruction to start the next process within the current process. The program selects the next process and moves to it according to the execution condition. X101 R1 SSTP X102 X103 R1 NSTL Y110 R2 NSTL R3 NSTL Starts the process (process 1). Process Starts the next process (process 2 or 3) according to the condition. R2 SSTP R3 SSTP Program Program Y111 Y112 Process Program Process STPE Program X101 X102 X103 Y110 Y111 Y112 Process 1 Process 2 3-82 Basic Instructions Example (3) Parallel branch/join control of processes · This program starts multiple processes simultaneously. When all of the branched processes complete their tasks, they join together and move to the next process. · Within a program in one process, write the instruction to move multiple processes in series for a single execution condition. · To join the processes, include the flags indicating the states of other processes in the move condition to the next process. When joining processes and starting the next process, clear any process not cleared yet. X101 R1 SSTP X102 R2 SSTP X103 R3 SSTP X104 (Program) (Program) R4 SSTP R5 SSTP X110 (Program) (Program) (Program) R1 NSTL Y110 R2 NSTL R4 NSTL Y111 R3 NSTL Y112 R5 NSTL R4 CSTP Y113 Y114 Starts the process (process 1). Process 1 Starts the next processes (processes 2 and 4) in parallel. Starts the next process (process 3). Process 2 Starts the next process (process 5). Process 3 Clears the process (process 4). Process 4 R1 NSTL Process 5 (Program) STPE 3-83 Basic Instructions X101 X102 X103 X104 X110 Y110 Y111 Process 1 Process 2 Process 1 Y112 Y113 Y114 Process 3 Process 4 Process 5 3-84 Basic Instructions Precautions during programming · Processes need not be written in the order of their numbers. · Note that the following instructions cannot be used in the step ladder area. 1) Jump instructions (JP and LBL) 2) Loop instructions (LOOP and LBL) 3) Master control instructions (MC and MCE) 4) Subroutine instructions (SBL and RET) 5) ED instruction 6) CNDE instruction Note) The CALL instruction can be used in the step ladder area. · In order to clear all processes at once, use the master control relay to program the code. · Processes need not be started in the order of their numbers. Multiple processes can be started simultaneously. · If the output of a process that is not started is forced to turn ON or OFF, the process will remain in that state even when enforcement is released until the process is started. Step ladder operation · The program in the normal ladder area and programs in processes started by the Next Step instruction (NSTL) are executed. Programs in processes not started are ignored. · When a process starts and the first scan is in progress, the step initial pulse relay (SR15) turns ON. It will turn OFF for the second and later scans. This can be used to reset a counter or shift register. Precaution on clearing process · When the Next Step instruction is executed within the program of a running process, the running process will be cleared automatically. The clearing will be done during the next scan. Therefore, two processes may be running simultaneously for a single scan when transiting between them. If there are two outputs which must not be ON at the same time, be sure to provide an interlock to prevent them from tuning ON simultaneously. If these outputs can turn ON simultaneously even when an interlock is provided by the program due to a delay in hardware response, take a counteraction on hardware to consider the delay. · When a process is cleared, the instructions used in the process will operate as shown in the following table. Type of instruction Operation OT All OFF KP SET State is held RST TM Reset CT Intermediate result is held SR Differential instructions Refer to Operation of differential instructions between MC and MCE. (Note 1) Other instructions Not executed (Note 1): The following items are included in differential instructions. 1) DF (leading edge differential) instruction 2) Count input for CT (counter) instruction 3) Count input for UDC (up-down counter) instruction 4) Shift input for SR (shift register) instruction 5) Shift input for LRSR (left and right shift register) instruction 6) Differential execution type high-level instruction (instruction specified by p and instruction name) 3-85 Basic Instructions ZRST (Block Clear) Ladder diagram X10F ZRST.bit Y101 Y108 D1 D2 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Process clear start number D2 Process clear end number Available devices (: Available) Operand D1 D2 Bit device XYRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification Outline of operation · When the ZRST instruction is executed, all the running processes within the range from the process [D1] and [D2] will be cleared. · It can also be used to reset (clear to zero) the range from the area (bit address) specified in [D1] to the area (bit address) specified in [D2]. Precautions during programming · Be sure that [D1] is smaller than [D2]. · This instruction can be executed from the normal ladder area as well as a running process. 3-86 Example of operation X101 Y101 SSTP Y102 SSTP (Program) (Program) Basic Instructions Y101 NSTL Y102 NSTL Y108 NSTL R10 Starts the process 1 (Y101). Starts the process 2 (Y102). Starts the process 8 (Y108). Process 1 R11 Process 2 Y108 SSTP X10F X101 X10F Process 1 (Y101) Process 2 (Y102) Process 8 (Y108) R18 (Program) Process 8 STPE ZRST Y101 Y108 Stops all processes from the process 1 (Y101) to process 8 (Y108). Stop Start Start Start 3-87 Basic Instructions Common Information for Subroutine Instructions Program configuration · Subroutine instructions are configured from a subroutine call instruction and a subroutine program. · Describe subroutine programs in subprogram areas, and use the SBL instruction and RET instruction to indicate the start and end positions of the subroutine program. · Subroutine call instructions can be described in either the main program area or a subprogram area (another subroutine program). Subroutine program ED SBL10 RET Main program area Subprogram area Types of call instructions · There are four types of subroutine call instructions as follows: CALL (local subroutine) FCALL (output OFF type local subroutine call) ECALL (subroutine call (with PB number specification)) EFCALL (forced output OFF type subroutine call (with PB number specification)) · Local subroutine call instructions (CALL, FCALL) start subroutine programs within the same PB. · Subroutine call instructions (ECALL, EFCALL) start subroutine programs for a specified PB number. Flow of the program process · When the execution condition is ON, the subroutine call instruction is executed to start the subroutine program beginning with the SBL instruction with the specified number. When the execution condition is OFF, nothing occurs. · When the subroutine program is processed up to the RET instruction, the program will return to the address next to the subroutine call instruction, and continue with processing of the program. X100 CALL n ED Subroutine program n SBL n RET When CALL n is executed, to are executed in order 3-88 SBL (Subroutine Label) RET (Subroutine Return) Ladder diagram X100 CALL 1 n ED SBL 1 Basic Instructions RET List of operands Operand Description n Subroutine program number Available data specification range: 0 to 65535/1 PB (It is recommended to specify sequentially from 0.) Outline of operation · When the execution condition is ON, the subroutine call instruction is executed to start the subroutine program beginning with the SBL instruction with the specified number. Precautions during programming · "Subroutine program n" represents the program code between the SBL n instruction and the RET instruction. Be sure to write it to an address which follows the ED instruction. · In the SBL instruction, specify the values of "n" sequentially from 0. · Subroutines can be nested in up to 16 levels. SBL 0 CALL 1 RET (Level 2) SBL 1 CALL 2 RET (Level 3) SBL 2 CALL 3 RET Call from within subroutine (Level 4) SBL 3 CALL 4 RET (Level 5) SBL 4 RET Example of 5 levels of nesting 3-89 Basic Instructions CALL (Local Subroutine Call) FCALL (Output OFF Type Local Subroutine Call) Ladder diagram X100 CALL 1 X100 n FCALL 1 n List of operands Operand Description n Local subroutine program number within the same PB Available data specification range: 0 to 65535 (It is recommended to specify sequentially from 0.) Outline of operation · When the execution condition is ON, the CALL/FCALL instruction is executed to start the local subroutine program beginning with the SBL instruction with the specified number. · When the subroutine program is processed up to the RET instruction, the program will return to the address next to the CALL/FCALL instruction in the main program, and continue with processing of the main program. Operation when execution condition of CALL/FCALL instruction is OFF · When the execution condition turns OFF, the operation of the current subroutine stops. (It is also true for calls from the master control or step ladder.) In this case, the instructions used in the subroutine will operate as shown below. Type of instruction CALL FCALL OT State is held All OFF. Different operation from the CALL instruction. KP SET State is held Same as on the left. RST Not counted. TM Note that time is not guaranteed if counting does not Reset. Different operation from the CALL instruction. occur during a single scan. CT Intermediate result is held SR Same as on the left. Differential instructions Operates in the same way as differential instructions used between MC and MCE. Refer to Operation of differential instructions between MC and MCE. Same as on the left. Other instructions Not executed Same as on the left. (Note 1): The following items are included in differential instructions. 1) DF (leading edge differential) instruction 2) Count input for CT (counter) instruction 3) Count input for UDC (up-down counter) instruction 4) Shift input for SR (shift register) instruction 5) Shift input for LRSR (left and right shift register) instruction 6) Differential execution type high-level instruction (instruction specified by p and instruction name) Precautions during programming · The CALL/FCALL instruction can be written in another subroutine program or step ladder, in addition to the main program. The CALL/FCALL instruction with the same number can be written repeatedly. 3-90 Basic Instructions · Note that if a subroutine is executed repeatedly, it will take more time for operations to be processed. Flag operations Name Description SR7 SR8 (ER) Turns ON when the 16th subroutine executes the CALL/FCALL instruction while subroutines are nested in 16 levels. 3-91 Basic Instructions ECALL (Subroutine Call (with PB No. Specification)) EFCALL (Forced Output OFF Type Subroutine Call (with PB No. Specification)) Ladder diagram X100 ECALL1 U2 n PBm X100 EFCALL1 U2 n PBm List of operands Operand Description n Subroutine number: 0 to 65535/1 PB PBm Target PB number: The number of PB where the subroutine specified by n is stored Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX PBm Integer K U H Real number String Index modification SF DF " " Outline of operation · When the execution condition is ON, the SBLn subroutine of PBm is called. · When the subroutine program is processed up to the RET instruction, the program will return to the address next to the ECALL/EFCALL instruction in the main program, and continue with processing of the main program. · The local device of the called PBm is used as the local device in the called subroutine. Example of operation PB PB1 program PB2 program Description Example of program X100 ECALL 1 U2 ED SBL 1 RET - Instructions between SBL and RET are called and executed when the ECALL instruction is executed. - When RET is executed, program returns to the calling ECALL instruction. 3-92 Basic Instructions Operation when execution condition of ECALL/EFCALL instruction is OFF · When the execution condition turns OFF, the operation of the current subroutine stops. (It is also true for calls from the master control or step ladder.) In this case, the instructions used in the subroutine will operate as shown below. Type of instruction ECALL EFCALL OT All OFF. Different operation from the ECALL instruction. KP State is held SET State is held RST Not counted. TM Note that time is not guaranteed if counting does not Reset. Different operation from the ECALL instruction. occur during a single scan. CT Intermediate result is held SR Same as on the left. Differential instructions Operates in the same way as differential instructions used between MC and MCE. Refer to Operation of differential instructions between MC and MCE. Same as on the left. Other instructions Not executed Same as on the left. (Note 1): The following items are included in differential instructions. 1) DF (leading edge differential) instruction 2) Count input for CT (counter) instruction 3) Count input for UDC (up-down counter) instruction 4) Shift input for SR (shift register) instruction 5) Shift input for LRSR (left and right shift register) instruction 6) Differential execution type high-level instruction (instruction specified by p and instruction name) Precautions during programming · The ECALL/EFCALL instruction can be written in another subroutine program or step ladder, in addition to the main program. The ECALL/EFCALL instruction with the same number can be written repeatedly. · Note that if a subroutine is executed repeatedly, it will take more time for operations to be processed. Flag operations Name Description SR7 SR8 (ER) Turns ON when the 16th subroutine executes the ECALL/EFCALL instruction while subroutines are nested in 16 levels. 3-93 Basic Instructions INTPG (Unit Interruption Program Start) IRET (Unit Interruption Program End) Ladder diagram n INTPG 11 IRET Outline of operation · These instructions are described in subprogram areas in the same PB to indicate the start and end positions of interruption program. · Activates the interruption program of a corresponding program number when the unit's interruption condition is met. · Returns to the main program by executing the IRET instruction. · To execute an interruption program, it is necessary to interrupt the CPU by the EI instruction and enable a unit to interrupt by the IMASK instruction. · The interruption activation request signal on the unit side will be held until the corresponding interruption program is executed or the unit interruption clear instruction "ICLR" instruction is executed. Main program area ED Interrupt program INTPG10 IRET Sub program area Specification of interruption program number [n] · Interruption program number n is specified in decimal by the combination of a slot number (1 to 16) and a bit number (0 to 7). · The allocation of the last one digit varies depending on units. · The interruption program numbers for a high-speed counter unit and multiple input/output unit are as shown below. 3-94 Basic Instructions · Comparison match flag of unit Slot 1 Slot 2 Corresponding interruption program No. Slot 3 ----- ----- Slot 15 Slot 16 CH0 Comparison match 0 flag INTPG 10 INTPG 20 INTPG 30 ----- ----- INTPG 150 INTPG 160 CH0 Comparison match 1 flag INTPG 11 INTPG 21 INTPG 31 ----- ----- INTPG 151 INTPG 161 CH1 Comparison match 0 flag INTPG 12 INTPG 22 INTPG 32 ----- ----- INTPG 152 INTPG 162 CH1 Comparison match 1 flag INTPG 13 INTPG 23 INTPG 33 ----- ----- INTPG 153 INTPG 163 CH2 Comparison match 0 flag INTPG 14 INTPG 24 INTPG 34 ----- ----- INTPG 154 INTPG 164 CH2 Comparison match 1 flag INTPG 15 INTPG 25 INTPG 35 ----- ----- INTPG 155 INTPG 165 CH3 Comparison match 0 flag INTPG 16 INTPG 26 INTPG 36 ----- ----- INTPG 156 INTPG 166 CH3 Comparison match 1 flag INTPG 17 INTPG 27 INTPG 37 ----- ----- INTPG 157 INTPG 167 (Note 1): Interruption program numbers are specified with slot numbers + (0 to 7). The numbers in the above table are for the slot 1. Example) The interruption program number corresponding to the CH1 comparison match 1 flag of the slot number 10 is INTPG103. Execution of interruption program · Executes the interruption program of a corresponding number when interruption occurs. Main program process INT program process INT input · When interruption is disabled, the interruption program will be executed by enabling it by the CPU unit interruption enable instruction "EI" and the unit interruption enable/disable instruction "IMASK." Main program process INT program process INT input Enable · If another interruption program is being executed, executes it after the completion of the running program. Main program process INT11 program process INT12 program process INT12 input 3-95 Basic Instructions Control when multiple interruptions have occurred simultaneously · The priority order when multiple interruptions have occurred simultaneously is as follows: Unit interruption: INTPG0 > 1 > 2 > ... > 7 > Fixed cycle execution type PB · If more than one interruption activation request is made from the unit, the process will be carried out from the smallest slot number or the smallest interruption program number. · If the interruption activation is requested on the completion of the process of interruption program, a higher-priority program will be searched again and the corresponding interruption program will be executed. · The interruption activation request signal on the unit side will be held until the corresponding interruption program is executed or the unit interruption clear instruction "ICLR" instruction is executed. Main program process INT11 program process INT12 program process INT13 program process INT11 input INT12 input INT13 input · If multiple interruptions occur during the execution of interruption program, interruptions will be preferentially executed from those with smaller program numbers after the completion of the running program. Main program process INT11 program process INT12 program process INT13 program process INT14 program process INT11 input INT12 input INT13 input INT14 input 3-96 Basic Instructions Waiting for and clearing the execution of interruption program · If multiple interruptions occur simultaneously, or a new interruption occurs during the execution of another interruption program, lower-priority interruptions will be in "waiting" state. They will be executed in order after the completion of other interruption programs. Main program process INT11 program process INT12 program process INT11 input INT12 input Waiting for execution · In the waiting state, there will be time difference between the occurrence of interruption and the execution of interruption program. In such a case, the interruption program in the waiting state can be cleared by the "ICLR" instruction as necessary. The cleared interruption program will not be executed. Executes ICLR (INT12 clear) Main program process INT11 program process INT12 program process INT11 input INT12 input 3-97 Basic Instructions Precautions during programming · Always use the INTPG n and IRET instructions in combination. A syntax error occurs if either "INTPG" instruction or "IRET" instruction is not used. · More than one INTPG instruction with the same number cannot be specified. · If a unit in which interruption occurs is not installed in a specified slot number, the no target unit error 10 is displayed and the mode cannot be switched to RUN. · Branching from the interruption program area (between INTPG and IRET) to other subprogram areas or main program area is not possible. · Subroutine programs cannot be written in interruption programs. INTPG10 SBL1 RET IRET · Interruption programs cannot be written in subroutine programs. SBL1 INTPG10 IRET RET · It is operable even one IRET instruction is used for multiple interruption programs INTPG. 3-98 Basic Instructions DI (CPU Interruption Disable) EI (CPU Interruption Enable) Ladder diagram R0 DF DI R1 DF EI Outline of operation DI · This instruction disables all interruption programs INTPG and the acceptance of interruption of fixed cycle execution type PB at the same time as the execution of the instruction. At this time, the unit in which interruption has occurred suspends the detected interruption. · Use the ICLR instruction to clear the interruption signals suspended by the unit while the interruption is disabled. · To disable or enable the interruption for each unit, unit's interruption detection function can be controlled using the IMASK instruction. EI · This instruction enables all permitted interruptions. · Restarts a fixed cycle execution type PB. Starts the execution of the PB after the elapse of the interval specified after the startup. · Also accepts the interruption permitted in the unit in which interruption occurs. · As interruption for the unit in which interruption occurs is disabled after RUN, it is necessary to enable the interruption of the unit by executing the IMASK instruction. · It is invalid even if the EI instruction is executed while the interruption is enabled. The interruption will stay enabled. 3-99 Basic Instructions IMASK (Unit Interruption Disable/Enable Setting) Ladder diagram R0 IMASK.US H1 U2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Control data specifying INTPG number to disable/enable the unit interruption: H0 to HFF D Slot number (U constant) or device number where slot number is stored Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction sets to enable or disable the interruption of the unit installed in the slot specified by [D] according to the data specified by [S]. Specification of [S] bit no. 15 8 7 0 00000000 Higher 8 bits 0: Fixed INTP G 7 INTPG 0 0: Disable 1: Enable Precautions during programming · To enable the interruption of the unit, the interruption to the CPU unit must be enabled using the El instruction. · When a unit in which interruption occurs is not installed in the specified slot, an operation error occurs. · When there is no definition of the interruption program (INTPG) corresponding to an enabled bit, the bit is not enabled. Zero is written. Flag operations Name Description SR7 SR8 (ER) ON in the case of out-of-range in indirect access (index modification) 3-100 Basic Instructions ICLR (Unit Interruption Clear) Ladder diagram R1 ICLR.US HFF00 U2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Control data specifying INTPG number to clear interruption: HFF00 to HFFFF D Slot number (U constant) or device number where slot number is stored Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction clears the interruption of the unit installed in the slot specified by [D] according to the data specified by [S]. Specification of [S] bit no. 15 8 7 0 11111111 Higher 8 bits 1: Fixed INTP G 7 INTPG 0 0: Clear 1: Not clear Precautions during programming · When a unit in which interruption occurs is not installed in the specified slot, an operation error occurs. · The suspension of the interruption of a bit on which the interruption is disabled is also cleared. Flag operations Name Description SR7 SR8 (ER) ON in the case of out-of-range in indirect access (index modification) 3-101 Basic Instructions STARTPG (PBn Execution Start) STOPPG (PBn Execution Stop) Ladder diagram R0 PBn STARTPG10 R1 STOPPG10 List of operands Operand Description PBn Target PB number (1 to 468) (Note): The maximum value for the PB number varies depending on the type of CPU unit and the settings for the program memory. Outline of operation · This instruction activates the waiting PBn when the execution condition of STARTPG PBn turns ON. · This instruction makes the active PBn be in waiting state when the execution condition of STOPPG PBn turns ON. · When switching PROG to RUN, operates in the default mode (start or wait). The start mode of PB is specified using the menu of tool software FPWIN GR7 for "Creating new program block (PB)" or "Changing PB attribute." The default is start. · At the time of rewriting during RUN, holds the PB start mode and does not reset it to the default setting. · A PB that is in the waiting state after startup clears the output in a single scan with the program block active relay OFF in order to change the state of each input and output relay to the state as shown below. Type of instruction OT KP SET RST TM CT SR Differential instructions Other instructions Operation All OFF State is held Reset Intermediate result is held Operates in the same way as differential instructions used between MC and MCE. Refer to Operation of differential instructions between MC and MCE. Not executed Operation of system relays (SR) SR State Waiting Active 1st scan Active 2nd and later scans ON at the start of PBn SR16 execution. - *2 ON OFF from the next scan. OFF OFF at the start of PBn SR17 execution. - *2 OFF ON ON from the next scan. SR1000 Program block active to SR1499 relay OFF ON ON *1: Indicates the state during the first scan after the active state is changed to the waiting state. *2: SR16 and SR17 indicates the states of other PBs because the target PBs are not active. Standby process 1st scan *1 OFF Waiting - *2 OFF OFF - *2 OFF 3-102 Basic Instructions Sample program Operation when the initial states are as follows: PB1: Active, PB2: Waiting, PB3: Active PB Example of program PB1 program X100 X100 (STARTPG 2) (STOPPG 2) PB2 program SR 10 R 100 Y 100 PB3 program SR 10 R 101 Y 101 Time chart PB1 Active PB2 Waiting Active Waiting PB3 Active Scan 1 Scan 2 Scan 3 Scan 4 Scan 5 Scan 6 PB1 PB3 PB1 PB3 PB1 PB2 PB3 PB1 PB2 PB3 PB1 PB2 PB3 PB1 PB3 X 100 R 100 R 101 Y 100 Y 101 SR16 SR17 SR1001 (1) (2) SR1002 SR1003 (Note 1): SR1001 to SR1003: Program block active relays of PB1 to PB3 (Note 2): (1) PB1 executes STARTPG instruction, (2) PB1 executes STOPPG instruction. (Note 3): PB2 clears the output in the 1st scan after the state is changed to waiting. (Program block active relay is OFF.) 3-103 Basic Instructions GPB (Global PB Number Setting) Ladder diagram PBn GPB 1000 List of operands Operand Description PBn Global PB number (1000 to 1999) Outline of operation · A fixed PB number can be used for the global PB number, even if the PB position is changed. · This instruction should be described at the beginning of a main program area. · This instruction sets an active PB number to a specified global PB number table in the preprocessing of operation (when switching PROG to RUN, during rewriting during RUN). · When multiple GPB instructions are described in the same PB, multiple global PB numbers are set for one PB. · The range of PB numbers that can be specified for instructions that use PB numbers (ECALL, EFCALL, LCWT, LC, STARTPG, and STOPPG) is as follows: PB number specification: 1 to 468 Global PB number specification: 1000 to 1999 · A syntax error occurs when a number (other than 1000 to 1999) that is out of the range of the settable global PB numbers is specified by the GPB instruction. · An operation error occurs when a global PB number that is not set is specified for an instruction that uses a PB number. Sample program Example 1) Example when using GPB PB1 declares the global PB number 1000 for own PB, and calls the subroutine for GPB1000 from PB2. PB PB1 program PB2 program Example of program (GPB 1000) ( ED ) (SBL 5) ( RET ) X100 ( ECALL5 U1000 ) ( ED ) Example 2) Example when not using GPB Calls the subroutine for PB1 from PB2. PB PB1 program PB2 program Example of program ( ED ) (SBL 5) ( RET ) X100 ( ECALL5 U1 ) ( ED ) 3-104 Basic Instructions COMOUT (Comment Out) / ENDCOM (Comment Out End) Ladder diagram X100 Y110 X100 COMOUT Y111 X100 ENDCOM Y112 Outline of operation This instruction comments out text between the COMOUT and ENDCOM instructions. Example of operation X100 Y110 Y111 Y112 3-105 Basic Instructions ST=, ST<>, ST>, ST>=, ST<, ST<= (Data Comparison (Start)) AN=, AN<>, AN>, AN>=, AN<, AN<= (Data Comparison (AND)) OR=, OR<>, OR>, OR>=, OR<, OR<= (Data Comparison (OR)) Ladder diagram S1 i S2 ST DT 0 >=. SS K 70 Y130 X100 S1 DT 0 i >=. SS S2 AN K 70 Y130 X100 S1 i S2 OR DT 0 >=. SS K 70 Y130 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Comparison data 1 S2 Comparison data 2 3-106 Basic Instructions Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is a signed integer (SS, SL). *5: Can be specified only when the operation unit is an unsigned integer (US, UL). *6: Can be specified only when the operation unit is an integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is a single-precision floating point real number (SF). *8: Can be specified only when the operation unit is a double-precision floating point real number (DF). Outline of operation Type of instruction Operation ST= ST<> ST> ST>= ST< ST<= Compares signed data specified in [S1] with signed data specified in [S2]. Begins a logic operation as a contact connected when the comparison result is in the specified state (such as =, <, or >). AN= AN<> AN> AN>= AN< AN<= Compares signed data specified in [S1] with signed data specified in [S2]. Connects in serial as a contact connected when the comparison result is in the specified state (such as =, <, or >). OR= OR<> OR> OR>= OR< OR<= Compares signed data specified in [S1] with signed data specified in [S2]. Connects in parallel as a contact connected when the comparison result is in the specified state (such as =, <, or >). Comparison result and operation Relationship Comparison between [S1] and [S2] [S1] < [S2] [S1] = [S2] [S1] > [S2] Instruction ST=,AN,OR= OFF ON OFF ST<>,AN<>,OR<> ON OFF ON ST>,AN>,OR> ST>=,AN>=,OR>= ST<>,AN<>,OR<> OFF OFF ON OFF ON OFF ON ON OFF ST<=,AN<=,OR<= ON ON OFF Note) "< >" represents "". ">=" represents "". "<=" represents "". 3-107 Basic Instructions Example of operation (1) Program operation for "ST >=" in ladder representation Data register DT0 value and K70 are compared and if DT0 > K70, the external output Y130 turns ON. DT0 70 40 10 Y130 ON OFF (2) Program operation for "AN >=" in ladder representation If the external output X100 is ON and the data register DT0 value and K70 are compared and if DT0 > K70, the external output Y130 turns ON. DT0 70 40 10 X100 ON OFF Y130 ON OFF (3) Program operation for "OR >=" in ladder representation If the external output X100 is ON or the data register DT0 value and K70 are compared and if DT0 > K70, the external output Y130 turns ON. DT0 70 40 10 X100 Y130 ON OFF ON OFF 3-108 Basic Instructions Precautions for Use · The ST=, ST<>, ST>, ST>=, ST<, ST<=, OR=, OR<>, OR>, OR>=, OR<, and OR<= instructions are initiated from the bus bar. · The AN=, AN<>, AN>, AN>=, AN<, AN<=, OR=, OR<>, OR>, OR>=, OR<, and OR<= instructions can be used in series. · Since BCD data is assumed to be a negative value during comparison if the most significant bit is 1, the comparison result may become incorrect. In such a case, use the BIN instruction to convert the data into binary before comparison. Flag operations Name Description SR7 SR8 (ER) ON if the specified address using the index modification exceeds a limit. 3-109 Basic Instructions 3-110 4 4 High-level Instructions (Data Comparison) Applicable Models: All Models High-level Instructions (Data Comparison) CMP (Data Compare) Ladder diagram R0 CMP.US DT0 DT1 i S1 S2 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Comparison data 1 (device address or constant) S2 Comparison data 2 (device address or constant) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], two pieces of data that are stored in two different areas that start from [S1] and [S2] respectively are compared. · The comparison result is output to the system relays SRA to SRC (assessment flags for comparison flags). 4-2 CMP (Data Compare) Process details Results of comparison flags (SR (system relays)) are as follows, based on relationship between [S1] and [S2]. Relationship between [S1] and [S2] Comparison flags (SR (system relays)) SRA SRB SRC > = < [S1] < [S2] OFF OFF ON [S1] = [S2] [S1] > [S2] OFF ON ON OFF OFF OFF Example 1) Operation unit: Unsigned 16 bits (US) (SRC(<) ON) [i]...US [S1]...DT0 [S2]...DT1 DT0 DT1 Hexadecimal H 6000 H 8500 Unsigned decimal K 24576 K 34048 Signed decimal K 24576 K -31488 Flag operations during execution SRA( > ) DT0 < DT1 OFF SRB( = ) OFF SRC( < ) ON Example 2) Operation unit: Signed 16 bits (SS) (SRA(>) ON) [i]...SS [S1]...DT0 [S2]...DT1 DT0 DT1 Hexadecimal H 6000 H 8500 Unsigned decimal K 24576 K 34048 Signed decimal K 24576 K -31488 Flag operations during execution SRA( > ) SRB( = ) SRC( < ) DT0 > DT1 ON OFF OFF Example 3) Operation unit: Unsigned 16 bits (US) (SRB(=) ON) [i]...US [S1]...DT0 [S2]...DT1 DT0 DT1 Hexadecimal H 1234 H 1234 Unsigned decimal K 4660 K 4660 Signed decimal K 4660 K 4660 Flag operations during execution SRA( > ) DT0 = DT1 OFF SRB( = ) ON SRC( < ) OFF 4-3 High-level Instructions (Data Comparison) Example 4) Operation unit: Signed 32 bits (SL) (SRC (<) ON) [i]...SL [S1]...I0 [S2]...TS0 I0 DT0DT1 Hexadecimal H 85000000 H 60000000 Unsigned decimal Signed decimal K 2231369728 K -2063597568 K 1610612736 K 1610612736 Flag operation when executed SRA( > ) I0 < TS0 OFF SRB( = ) OFF SRC( < ) ON Example 5) Operation unit: Single-precision floating point real number (SF) (SRA (>) ON) [i]...SF [S1]...DT0 [S2]...LD0 Decimal real number DT0DT1 SF 1.234E00 LD0LD1 SF -1.234E00 Flag operation when executed DT0DT1 > LD0LD1 SRA( > ) ON SRB( = ) OFF SRC( < ) OFF Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S1] or [S2] and the operation unit is real numbers (SF). SRA (>) SRB (=) Depending on the comparison result SRC (<) 4-4 WIN (Band Compare) WIN (Band Compare) Ladder diagram R0 WIN.US DT0 DT1 DT2 i S1 S2 S3 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Comparison data (device address or constant) S2 Lower limit (device address or constant) S3 Upper limit (device address or constant) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S1 S2 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S3 *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], [S1] (comparison data) is checked to determine if it is within the range between [S2] (lower limit) and [S3] (upper limit). · The comparison result is output to the system relays SRA to SRC (assessment flags for comparison flags). 4-5 High-level Instructions (Data Comparison) Process details Results of the flags (SR (system relays)) are as follows, based on relationship between [S1] and [S2] and [S3]. Relationship between [S1] and [S2] and [S3] [S1] < [S2] [S2] [S1] [S3] [S1] > [S3] Comparison flags (SR (system relays)) SRA SRB SRC > = < OFF OFF ON OFF ON OFF ON OFF OFF Example 1) Operation unit: Unsigned 16 bits (US) (SRB(=) ON) [i]...US [S1]...DT0 [S2]...DT1 [S3]...DT2 Hexadecimal Unsigned decimal Signed decimal DT0 H 8000 DT1 H 7000 DT2 H 9000 K 32768 K 28672 K 36864 K -32767 K 28672 K -28671 Flag operations during execution SRA( > ) DT1 < DT0 < DT2 OFF SRB( = ) ON SRC( < ) OFF Example 2) Operation unit: Unsigned 16 bits (SRC(<) ON) [i]...US [S1]...DT0 [S2]...DT1 [S3]...DT2 Hexadecimal Unsigned decimal Signed decimal DT0 H 6000 K 24576 K 24576 DT1 H 7000 K 28672 K 28672 DT2 H 9000 K 36864 K -28671 Flag operations during execution SRA( > ) DT0 < DT1 OFF SRB( = ) OFF SRC( < ) ON 4-6 WIN (Band Compare) Example 3) Operation unit: Signed 16 bits (SS) (operation error) [i]...SS [S1]...DT0 [S2]...DT1 [S3]...DT2 Hexadecimal Unsigned decimal Signed decimal DT0 H 6000 K 32768 K -32767 DT1 H 7000 K 28672 K 28672 DT2 H 9000 K 36864 K -28671 Flag operations during execution SRA( > ) DT1 > LD2 OFF SRB( = ) OFF SRC( < ) OFF * Operation error because of [S2] > [S3] (Set SR7 (latest error) and SR8 (hold error)) Example 4) Operation unit: Single-precision, floating-point real number (SF) (SRA(>) ON) [i]...SF [S1]...DT0 [S2]...LD0 [S3]...LD2 Value (real number decimal) DT0DT1 SF 8.000E + 02 LD0LD1 SF 5.000E + 02 LD2LD3 SF 7.000E + 02 Flag operations during execution DT0DT1 > LD2LD3 SRA( > ) ON SRB( = ) OFF SRC( < ) OFF Precautions during programming · In the case of a direct address and an index modification address, ensure that [S3] is equal to or larger than [S2]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [S2] is larger than [S3]. To be set when a non-real number is specified for [S1], [S2] or [S3], and the operation unit is real numbers (SF). SRA (>) SRB (=) Depending on the comparison result SRC (<) 4-7 High-level Instructions (Data Comparison) BCMP (Block Comparison) Ladder diagram R0 BCMP DT0 DT10 DT20 DT30 S1 S2 S3 S4 List of operands Operand Description S1 Area that stores control data, or the constant data S2 Number of data to be compared (device address or constant) (available range: 1 to 4096) S3 Starting address (device address) of comparison block 1 S4 Starting address (device address) of comparison block 2 Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3 S4 Integer K U H Real number String Index modification SF DF " " Outline of operation · Data in the area (comparison block 1) that is specified by [S3] is compared with data in the area (comparison block 2) that is specified by [S4]. · If the contents of both blocks match each other, the system relay SRB ("=" flag) turns ON. Specification of control data [S1] S1 Starting address of block 1 Starting address of block 2 0 From low byte From low byte 1 From high byte From low byte 2 From low byte From high byte 3 From high byte From high byte 4-8 BCMP (Block Comparison) Process details Example 1) Comparison between 5 bytes that start from a low byte in block 1 and 5 bytes that start from a low byte in block 2 [S1]...H0 [S2]...U5 [S3]...DT1 [S4]...DT10 SRB:ON Block 1 High Low DT0 H 00 H 00 DT1 H 31 H 30 DT2 H 33 H 32 DT3 H 35 H 34 DT10 DT11 DT12 DT13 Block 2 High Low H 31 H 30 H 33 H 32 H 35 H 34 H 37 H 36 Example 2) Comparison between 5 bytes that start from a high byte in block 1 and 5 bytes that start from a low byte in block 2 [S1]...H1 [S2]...U5 [S3]...DT1 [S4]...DT10 SRB:OFF Block 1 High Low DT0 H 00 H 00 DT1 H 31 H 30 DT2 H 33 H 32 DT3 H 35 H 34 DT10 DT11 DT12 DT13 Block 2 High Low H 31 H 30 H 33 H 33 H 35 H 37 H 34 H 36 Example 3) Comparison between 6 bytes that start from a high byte in block 1 and 6 bytes that starts from a low byte in block 2 [S1]...H1 [S2]...U6 [S3]...DT0 [S4]...DT10 SRB:ON Block 1 High Low DT0 H 30 H 00 DT1 H 32 H 31 DT2 H 34 H 33 DT3 H 00 H 35 DT10 DT11 DT12 DT13 Block 2 High Low H 31 H 30 H 33 H 35 H 32 H 34 H 37 H 36 Example 4) Comparison between 7 bytes that start from a high byte in block 1 and 7 bytes that starts from a high byte in block 2 [S1]...H3 [S2]...U7 [S3]...DT1 [S4]...DT10 SRB:ON Block 1 High Low DT0 H 00 H 00 DT1 H 31 H 30 DT2 H 33 H 32 DT3 H 35 H 34 DT4 H 37 H 36 DT5 H 39 H 38 DT10 DT11 DT12 DT13 DT14 Block 2 High Low H 31 H 30 H 33 H 32 H 35 H 34 H 37 H 36 H 39 H 38 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the comparison range is outside the accessible range. To be set when the control data is outside the range. To be set when the block length is outside the available range. SRB (=) To be set when the comparison blocks of [S3] and [S4] match. To be reset when the comparison blocks of [S3] and [S4] do not match. 4-9 High-level Instructions (Data Comparison) 4-10 5 5 High-level Instructions (Data Transfer) Applicable Models: All Models High-level Instructions (Data Transfer) MV (Data Transfer) Ladder diagram R0 MV.US DT2 DT3 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The source device address or the constant D Destination device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction transfers the operation unit data specified by [i] from the device address or the constant specified by [S] to the device address specified by [D]. [S] [D] 5-2 Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S] ...DT2 [D] ...DT3 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 4455 DT4 H 8899 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S] ...DT2 [D] ...DT8 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 55667788 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). MV (Data Transfer) 5-3 High-level Instructions (Data Transfer) MV/ (Inversion and Transfer) Ladder diagram R0 MV/.US DT2 DT3 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The source device address or the constant D Destination device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction logically inverts and transfers the specified operation unit data [i] from the device address or the constant specified by [S] to the device address specified by [D]. /[S] [D] BIN 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 HEX 0 4 D 2 BIN 1 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 HEX F B 2 D 5-4 MV/ (Inversion and Transfer) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S] ...DT2 [D] ...DT3 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H BBAA DT4 H 8899 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S] ...DT2 [D] ...DT8 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H AA998877 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). 5-5 High-level Instructions (Data Transfer) MV2 (2 Data Transfer) Ladder diagram R0 MV2.US DT 0 DT 2 DT 3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 The device address of the source 1 or the constant S2 The device address of the source 2 or the constant D Destination device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction transfers two data specified by [S1] and [S2] to the area starting from [D] all at once according to the operation unit specified by [i]. 5-6 MV2 (2 Data Transfer) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1] ...DT0 [S2] ...DT2 [D] ...DT3 DT0 DT1 DT2 DT3 DT4 H 0011 H 2233 H 4455 H 6677 H 8899 DT0 DT1 DT2 DT3 DT4 H 0011 H 2233 H 4455 H 0011 H 4455 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S1] ...DT10 [S2] ...DT20 [D] ...DT30 DT11-DT10 DT13-DT12 DT21-DT20 DT23-DT22 H 11223344 H 55667788 H CCDDEEFF H CCDDEEFF DT31-DT30 DT33-DT32 DT35-DT34 DT37-DT36 DT39-DT38 H 55667788 H CCDDEEFF H 00000000 H 00000000 H 00000000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when the transfer range is outside the accessible range. 5-7 High-level Instructions (Data Transfer) MV3 (3 Data Transfer) Ladder diagram R0 MV3.US DT0 DT2 DT4 DT10 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 The device address of the source 1 or the constant S2 The device address of the source 2 or the constant S3 The device address of the source 3 or the constant D Destination device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 S3 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction transfers three data specified by [S1], [S2] and [S3] to the area starting from [D] all at once according to the operation unit specified by [i]. 5-8 MV3 (3 Data Transfer) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1] ...DT0 [S2] ...DT2 [S3] ...DT4 [D] ...DT12 DT0 DT1 DT2 DT3 DT4 H 0011 H 2233 H 4455 H 6677 H 8899 DT0 DT1 DT2 DT3 DT4 H 0000 H 0000 H 0011 H 4455 H 8899 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S1] ...DT10 [S2] ...DT20 [S3] ...DT22 [D] ...DT30 DT11-DT10 DT13-DT12 H 55667788 H 11223344 DT21-DT20 H CCDDEEFF DT23-DT22 H 12345678 DT31-DT30 DT33-DT32 DT35-DT34 DT37-DT36 DT39-DT38 H 55667788 H CCDDEEFF H 12345678 H 00000000 H 00000000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when the transfer range is outside the accessible range. 5-9 High-level Instructions (Data Transfer) BKMV (Block Transfer) Ladder diagram R0 BKMV.US DT1 DT3 DT12 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting device address of source data S2 Ending device address of source data D Destination starting device address to transfer data Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction transfers data in the area specified by [S1] to [S2] to the area specified by [D] and subsequent areas all at once. Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT1 [S2]...DT3 [D]...DT12 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT10 DT11 DT12 DT13 DT14 H 0011 H 2233 H 2233 H 4455 H 6677 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S1]...DT2 [S2]...DT8 [D]...DT10 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 H 55667788 H 9900AABB H CCDDEEFF H 12345678 H 24680ACE 5-10 BKMV (Block Transfer) Precautions during programming · In the case of a direct address and index modification address, specify the same device for [S1] and [S2]. At the same time, specify [S2] to be equal to or larger than [S1]. · The data are transferred by operation unit, ending with the device containing [S2]. Example 1) Device address of [S2] comes to a low word (operation unit = 32 bits) [S1]...DT2 [S2]...DT6 [D]...DT12 DT1-DT0 DT3-DT2 DT5-DT4 DT7-DT6 DT9-DT8 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT11-DT10 DT13-DT12 DT15-DT14 DT17-DT16 DT19-DT18 H 11111111 H 55667788 H 9900AABB H CCDDEEFF H 55555555 Example 2) Device address of [S2] comes to a high word (operation unit = 32 bits) [S1]...DT2 [S2]...DT7 [D]...DT12 DT1-DT0 DT3-DT2 DT5-DT4 DT7-DT6 DT9-DT8 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT11-DT10 DT13-DT12 DT15-DT14 DT17-DT16 DT19-DT18 H 11111111 H 55667788 H 9900AABB H CCDDEEFF H 55555555 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the destination range is outside the accessible range. 5-11 High-level Instructions (Data Transfer) COPY (Block Copy) Ladder diagram R0 COPY.US DT1 DT12 DT14 i S D1 D2 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address or the constant of the source data D1 Starting device address of destination area D2 End device address of the destination area Available devices (: Available) Operand 16-bit device 32-bit device *1, *2 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " D1 D2 *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation This instruction copies data specified by [S] to the areas of [D1] to [D2]. Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S]...DT1 [D1]...DT12 [D2]...DT14 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT10 DT11 DT12 DT13 DT14 H 0011 H 2233 H 2233 H 2233 H 2233 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S]...DT6 [D1]...DT10 [D2]...DT16 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 H CCDDEEFF H CCDDEEFF H CCDDEEFF H CCDDEEFF H 24680ACE 5-12 COPY (Block Copy) Precautions during programming · In the case of a direct address and index modification address, specify the same device for [D1] and [D2]. At the same time, specify [D2] to be equal to or larger than [D1]. · The data are transferred by operation unit, ending with the device containing [D2]. Example 1) Device address of [D2] comes to a high word (operation unit = 32 bits) [S]...DT6 [D1]...DT10 [D2]...DT17 DT1-DT0 DT3-DT2 DT5-DT4 DT7-DT6 DT9-DT8 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT11-DT10 DT13-DT12 DT15-DT14 DT17-DT16 DT19-DT18 H CCDDEEFF H CCDDEEFF H CCDDEEFF H CCDDEEFF H 24680ACE Example 2) Device address of [D2] comes to a low word (operation unit = 32 bits) [S]...DT6 [D1]...DT10 [D2]...DT16 DT1-DT0 DT3-DT2 DT5-DT4 DT7-DT6 DT9-DT8 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT11-DT10 DT13-DT12 DT15-DT14 DT17-DT16 DT19-DT18 H CCDDEEFF H CCDDEEFF H CCDDEEFF H CCDDEEFF H 24680ACE Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when [D1] is larger than [D2]. 5-13 High-level Instructions (Data Transfer) BTM (Bit Block Transfer) Ladder diagram R0 BTM.BIT X1 X8 Y6 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting bit address of the source data S2 End bit address of the source data D Starting bit address of the data destination Available devices (: Available) Operand S1 S2 D Bit device XYR L TCP Specification of bit of word device Index modification E SR IN OT DT.n LD.n Outline of operation · This instruction performs bit transfer, from the area (bit address) specified by [S1] through the area (bit address) specified by [S2], to the area specified by [D]. Process details Example 1) Transfer X1 through X8 to Y6 through YD [S1]...X1 [S2]...X8 [D]...Y6 WX0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 WY0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 Example 2) Transfer X1 through X8 to YD through Y14 [S1]...X1 [S2]...X8 [D]...YD WX0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 WY1 WY0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 5-14 BTM (Bit Block Transfer) Precautions during programming · In the case of a direct address and index modification address, specify the same device for [S1] and [S2]. At the same time, specify [S2] to be equal to or larger than [S1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the destination range is outside the accessible range. 5-15 High-level Instructions (Data Transfer) DGT (Digit Data Transfer) Ladder diagram R0 DGT WX0 U1 U1 WY0 U1 S S1 n D D1 List of operands Operand Description S The device address or the constant of the source data S1 Transfer starting digit in the source (Available data range: 0 to 3) n Digits to be transferred (Available data range: 1 to 4) D The device address of the destination data D1 Transfer starting digit in the destination (Available data range: 0 to 3) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " S S1(*1) n(*1) D D1(*1) *1: To be handled as a 16-bit unsigned integer (US), regardless of operation unit. Outline of operation · This instruction transfers [n] digits from the [S1]th digit of the area specified by [S], to the [D1] digit of the 16-bit data specified by [D]. · Transfer starts with the 0th digit, 1st digit, 2nd digit, and 3rd digit by every four bits from the lower level. bit F E D C B A 9 8 7 6 5 4 3 2 1 0 Digit 3 Digit 2 Digit 1 Digit 0 5-16 Process details Example 1) Transfer from Digit 1 to Digit 1 [S]...WX0 [S1]...U1(H1) [n]...U1(H1) [D]...WY0 [D1]...U1(H1) X bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 Y bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 Example 2) Shift by one digit and transfer [S]...WX0 [S1]...U3(H3) [n]...U1(H1) [D]...WY0 [D1]...U0(H0) X bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 Y bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 Example 3) Transfer multiple digits in parallel [S]...WX0 [S1]...U2(H2) [n]...U2(H2) [D]...WY0 [D1]...U2(H2) X bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 Y bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 DGT (Digit Data Transfer) 5-17 High-level Instructions (Data Transfer) Example 4) Shift and transfer multiple digits [S]...WX0 [S1]...U0(H0) [n]...U2(H2) [D]...WY0 [D1]...U2(H2) X bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 Y bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 Example 5) Transfer four digits [S]...WX0 [S1]...U0(H0) [n]...U4(H4) [D]...WY0 [D1]...U1(H1) X bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 Y bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 1 0 0 1 1 1 0 0 0 0 1 1 0 1 1 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when the operands [S1], [n], and/or [D1] are out of the specified range. 5-18 RST (Reset) RST (Reset) Ladder diagram R0 RST.US DT1 i D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Target of reset Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 D *3 *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Only SD60/SD61 is permitted. Integer K U H Real number String Index modification SF DF " " Outline of operation · If the operation unit are 16 bits (US, SS) or 32 bits (UL, SL, SF), the area specified by [D] is reset (cleared to zero). Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [D]...DT1 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT0 H 0011 DT1 H 0000 DT2 H 4455 DT3 H 6677 DT4 H 8899 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [D]...DT6 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H 00000000 H 12345678 SF32000.00e+00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). 5-19 High-level Instructions (Data Transfer) ZRST (Block Clear) Ladder diagram R0 ZRST.bit Y1 Y8 i D1 D2 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting bit address of the reset data D2 End bit address of the reset data Available devices (: Available) Operand D1 D2 Bit device XYR L TCP Specification of bit of word device Index modification E SR IN OT DT.n LD.n Outline of operation · This instruction clears to zero (resets) from the area (bit address) specified by [D1] through the area (bit address) specified by [D2]. · This can also be used for a package clearance of processes that are starting up from Process [D1] to Process [D2] in the step ladder. 5-20 Process details Example 1) Reset Y1 through Y8 [D1]...Y1 [D2]...Y8 WY0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ZRST (Block Clear) WY0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 Example 2) Reset YD through Y14 [D1]...YD [D2]...Y14 WY1 WY0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 WY1 WY0 bit F E D C B A 9 8 7 6 5 4 3 2 1 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 Precautions during programming · In the case of a direct address and index modification address, specify the same device for [D1] and [D2]. At the same time, specify [D2] to be equal to or larger than [D1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when [D1] is larger than [D2]. 5-21 High-level Instructions (Data Transfer) BKEXT (16-bit Data Sign-extended Block Transfer) Ladder diagram R0 BKEXT.US DT0 DT2 DT3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 The starting address of the device storing the data that sign extension is performed. S2 The ending address of the device storing the data that sign extension is performed. D Destination starting device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction performs sign extension for device values in the area specified by [S1] to [S2], and transfers them to the device address specified by [D] and subsequent addresses. Process details Example 1) Operation unit: signed 16-bit (SS) [S1]...DT0 [S2]...DT3 [D]...DT10 DT0 DT1 DT2 DT3 DT4 -2(FFFEh) -1(FFFFh) 0(0000h) 1(0001h) DT10 DT11 DT12 DT13 DT14 DT15 DT18 DT19 DT16 DT17 -2(FFFFFFFEh) -1(FFFFFFFFh) 0(00000000h) 1(00000001h) 5-22 BKEXT (16-bit Data Sign-extended Block Transfer) Example 2) Operation unit: unsigned 16-bit (US) [S1]...DT0 [S2]...DT3 [D]...TS0 DT0 65534(FFFEh) DT1 65535(FFFFh) DT2 0(0000h) DT3 1(0001h) DT4 DT10 DT11 65534(0000FFFEh) DT12 DT13 65535(0000FFFFh) DT14 DT15 DT16 DT17 DT18 DT19 0(00000000h) 1(00000001h) Precautions during programming · In the case of a direct address and index modification address, specify the same device for [S1] and [S2]. At the same time, specify [S2] to be equal to or larger than [S1]. · The specified source area and destination area should not overlap each other. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the destination range is outside the accessible range. To be set when the ranges of the source area and the destination area overlap. 5-23 High-level Instructions (Data Transfer) BKMV16 (Block Transfer (32-bit Data to 16-bit Data)) Ladder diagram R0 BKMV16 CS1 CS3 DT10 S1 S2 D List of operands Operand Description S1 Starting device address of source data S2 Ending device address of source data D Destination starting device address to transfer data Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction transfers only one low word of data in the area specified by [S1] to [S2] to the area specified by [D] and subsequent areas all at once. Process details Example 1) When specifying TS for [S1] and [S2], and DT for [D] (transferring only lower one word) [S1]...TS1 [S2]...TS4 [D]...DT10 DT1-DT0 DT3-DT2 DT5-DT4 DT7-DT6 DT9-DT8 11223344h 00007788h 0000AABBh CCDDEEFFh 12345678h DT10 DT11 DT12 DT13 DT14 7788h AABBh EEFFh 5678h AAAAh Example 2) When specifying TS for [S1] and [S2], and LD for [D] (transferring only lower one word) [S1]...TS5 [S2]...TS7 [D]...LD20 TS4 11112222h TS5 00004444h TS6 55556666h TS7 77778888h TS8 9999AAAAh LD20 LD21 LD22 LD23 LD24 4444h 6666h 8888h 1234h 5678h Precautions during programming · In the case of a direct address and index modification address, specify the same device for [S1] and [S2]. At the same time, specify [S2] to be equal to or larger than [S1]. 5-24 BKMV16 (Block Transfer (32-bit Data to 16-bit Data)) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the destination range is outside the accessible range. 5-25 High-level Instructions (Data Transfer) XCH (Data Exchange) Ladder diagram R0 XCH.US DT2 DT3 i D1 D2 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Device address of exchanged data 1 D2 Device address of exchanged data 2 Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 D1 Integer K U H Real number String Index modification SF DF " " D2 *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) Outline of operation · This instruction exchanges the data of the device address specified by [D1] and the device address specified by [D2] according to the operation unit [i]. [D1] [D2] Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [D1]...DT2 [D2]...DT3 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT0 H 0011 DT1 H 2233 DT2 H 6677 DT3 H 4455 DT4 H 8899 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [D1]...DT2 [D2]...DT8 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 12345678 H 9900AABB H CCDDEEFF H 55667788 5-26 XCH (Data Exchange) Precautions during programming · Ensure that the ranges of the exchanged data do not overlap. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). 5-27 High-level Instructions (Data Transfer) SWAP (Exchange of High Bytes and Low Bytes) Ladder diagram R0 SWAP.US DT2 DT4 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Device address of the source where high bytes and low bytes should be exchanged D Device address of destination of the exchanged data Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction exchanges high bytes and low bytes of the device address specified by [S], and transfers the resulting data to the device address specified by [D]. Process details Example) Operation unit: 16 bits (US, SS) [i]...US,SS [S]...DT2 [D]...DT4 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 5544 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). 5-28 BSWAP (High /Low Byte in n Block Exchange) BSWAP (High /Low Byte in n Block Exchange) Ladder diagram R0 BSWAP DT1 U3 DT11 S n D List of operands Operand Description S The starting address of the device to exchange the high and low bytes n The number of words to exchange the high and low bytes D Device address of destination of the exchanged data Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " *1 n D *1: Only 16-bit devices can be modified. (Integer constants cannot be specified.) Outline of operation · This instruction exchanges the high byte and low byte for [n] words from the device address specified by [S], and transfers it to the area starting from [D]. · The maximum number of exchanged words is 65535. · When [n] is 0, no operation is performed. Process details Example) Operation unit: 16 bits (US, SS) [i]...US,SS [S]...DT1 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 [n]...K3 [D]...DT11 DT10 DT11 DT12 DT13 DT14 H 0011 H 3322 H 5544 H 7766 H 8899 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when the transfer range is outside the accessible range. 5-29 High-level Instructions (Data Transfer) LCWT (Specified PB Local Device Write) Ladder diagram R0 LCWT.US DT1 U3 U2 _WY10 i S n PBm D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of a source device n Number of written devices (Available range: 1 to 65535) PBm Destination PB number (Available range: 1 to Max. number of PB) D The starting address of a destination local device Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF " " *1 S n PBm D *1: Only 16-bit devices and 32-bit devices can be modified. (Integer constants cannot be specified.) *2: Index register (I0 to IE) Outline of operation · This instruction writes the data for [n] from the area specified by [S] to the area specified by [PBm]:[D] (local device) and subsequent areas all at once. · Either a global device or a local device (of the PB in which this instruction is executed) can also be specified for [S]. · For [D], specify a local device that is in the program block of the PB number specified for [PBm]. · Subroutine arguments can be specified by combining this instruction with the ECALL instruction. Refer to "Example of processing: Argument, return value operation of ECALL instruction." · Local devices of multiple PBs can be preset by one PB. Refer to "Example of processing: Presetting of specified PB local devices." 5-30 LCWT (Specified PB Local Device Write) Process details Example 1) When a global device is specified for [S] [S]...DT1 [n]...3 [PBm]...2 [D]..._WY10 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 PB2:_W Y8 PB2:_W Y9 PB2:_W Y10 PB2:_W Y11 PB2:_W Y12 H 0000 H 0000 H 2233 H 4455 H 6677 Example 2) When a local device is specified for [S] (Instruction is executed in PB5.) [S]..._LD10 [n]...2 [PBm]...3 [D]..._DT8 PB5:_LD9 PB5:_LD10 PB5:_LD11 PB5:_LD12 PB5:_LD13 H 8899 H AABB H CCDD H EEFF H FFEE PB3:_DT7 PB3:_DT8 PB3:_DT9 PB3:_DT10 PB3:_DT11 H 0000 H AABB H CCDD H 0000 H 0000 Flag operations Name Description To be set when an out-of-range value is specified for parameters. SR7 SR8 (ER) To be set when the device address specified by [S+n] exceeds the upper limit of the device. To be set when [PBm] exceeds the maximum PB number. To be set when [D] is specified for a global device. To be set when the device address specified by [PBm]:[D+n] exceeds the upper limit of the device. 5-31 High-level Instructions (Data Transfer) LCRD (Specified PB Local Device Read) Ladder diagram R0 LCRD.US U2 _WY10 U3 DT1 i PBm S n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description PBm Source PB number (Available range: 1 to Max. number of PB) S Starting address of source local device n Number of read devices (Available range: 1 to 65535) D Starting address of readout destination device Available devices (: Available) 16-bit 32-bit device device *1 Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF " " PBm S n D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) Outline of operation · This instruction reads the data for [n] from the area specified by [PBm]:[S] (local device) to the area specified by [D] and subsequent areas all at once. · For [S], specify a local device that is in the program block of the PB number specified for [PBm]. · Either a global device or a local device (of the PB in which this instruction is executed) can be specified for [D]. · Subroutine arguments can be specified by combining this instruction with the ECALL instruction. Refer to "Example of processing: Argument, return value operation of ECALL instruction." 5-32 LCRD (Specified PB Local Device Read) Process details Example 1) When a global device is specified for [D] [PBm]...2 [S]..._WY10 [n]...3 [D]...DT1 PB2:_W Y8 PB2:_W Y9 PB2:_W Y10 PB2:_W Y11 PB2:_W Y12 H 0000 H 0000 H 2233 H 4455 H 6677 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 Example 2) When a local device is specified for [D] (Instruction is executed in PB5.) [PBm]...3 [S]..._DT8 [n]...2 [D]..._LD10 PB3:_DT7 PB3:_DT8 PB3:_DT9 PB3:_DT10 PB3:_DT11 H 0000 H AABB H CCDD H 0000 H 0000 PB5:_LD9 PB5:_LD10 PB5:_LD11 PB5:_LD12 PB5:_LD13 H 8899 H AABB H CCDD H EEFF H FFEE Flag operations Name Description To be set when an out-of-range value is specified for parameters. SR7 SR8 (ER) To be set when [PBm] exceeds the maximum PB number. To be set when [S] is specified for a global device. To be set when the device address specified by [PBm]:[S+n] exceeds the upper limit of the device. To be set when the device address specified by [D+n] exceeds the upper limit of the device. 5-33 High-level Instructions (Data Transfer) Example of processing: Argument, return value operation of ECALL instruction The following example shows the operation in which the LCWT instruction is used to pass arguments to a subroutine in another PB and the LCRD instruction is used to receive return values. - This operation calls the subroutine SBL1 described in PB3 from PB1 to receive the results. - SBL1 calculates "Argument 1 + Argument 2 Return value" or "Argument 1 - Argument 2 Return value", depending on the condition of _WX0. PB1 R0 ECALL preprocessing Sets arguments and PB number DF MV.US U10 _DT10 Argument 1 MV.US U2 _DT11 Argument 2 MV.US H1 _WX2 Flag MV.US U3 _DT100 PB No. ECALL processing R1 Gives arguments to SBL, and acquires return values after execution. DF LCWT.US _DT10 U2 _DT100 _DT0 Argument 1 PB No. SBL argument 1 LCWT.US _WX2 Flag U1 _DT100 _WX0 PB No. SBL flag PB3 LCRD.US _DT100 PB No. ECALL 1 _DT100 PB No. _DT2 U1 _DT12 SBL return value Return value SBL 1 _X0 ADD.US _DT0 _DT1 _DT2 _X0 SBL SBL SBL return argument 1 argument 2 value SUB.US _DT0 SBL argument 1 _DT1 SBL argument 2 _DT2 SBL return value RET 5-34 LCRD (Specified PB Local Device Read) Example of processing: Presetting of specified PB local devices The following example shows how to initialize the local devices of PBs that are specified in one PB. - Executes the instruction in PB1, and sets to initialize devices to the local devices of PB2 to 4 collectively. PB1 Sets initial values to be preset. R0 DF MV.US U0 DT0 Initial value 0 MV.US U1 DT1 Initial value 1 MV.US U2 DT2 Initial value 2 MV.US Presets local devices of specified PBs. R1 (Specified PBs are PB2 to 4.) U3 DT3 Initial value 3 DF LCWT.US DT0 U4 U2 _DT0 Data amount:4 PB2 Local DT LCWT.US DT0 U4 U3 Data amount:4 PB3 _DT0 Local DT LCWT.US DT0 U4 U4 Data amount:4 PB4 _DT0 Local DT 5-35 High-level Instructions (Data Transfer) PUSHIX (Index Register Backup) Ladder diagram R0 PUSHIX.UL DT0 i D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Start of device address of the backup destination Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction backs up 15 data (30 words) of the index register value, starting with [D]. (I0 to IE) ([D] to [D] + 29) · The index register value to be saved does not change. · The "PUSHIX" instruction is used to back up the index register content before switching from the main program to the subprogram, in the case where index registers are used in subroutines or other subprograms. · Please use this in combination with the "POPIX" (Index Register Recovery) instruction. Process details Example) Specify DT0 for the 1st operand [D] I0 H 00112233 DT0 I1 H 44556677 DT2 I2 H 8899 AABB DT 4 IC H CCDDEEFF Backup DT24 ID H 12345678 DT26 IE H 90ABCDEF DT28 Before backup H 00000000 H 00000000 H 000 00000 H 00000000 H 00000000 H 00000000 After backup H 00112233 H 44556677 H 8899 AABB H CCDDEEFF H 12345678 H 90ABCDEF Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when the backup destination range is out of the accessible range. 5-36 POPIX (Index Register Recovery) POPIX (Index Register Recovery) Ladder diagram R0 POPIX.UL DT0 i S Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Start of device address of the recovery source Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction recovers 15 data (30 words) for the index register value, starting with [S]. ([S] to [S] + 29) (I0 to IE) · The "POPIX" instruction is used to recover the content that has been backed up using the "PUSHIX" (Index Register Backup) instruction, before switching from the subprogram to the main program, in the case where index registers are used in subroutines or other subprograms. · Please use this in combination with the "PUSHIX" (Index Register Backup) instruction. Process details Example) Specify DT0 for the 1st operand [S] DT0 DT2 DT 4 DT24 DT26 DT28 H 00112233 H 44556677 H 8899 AABB H CCDDEEFF H 12345678 H 90ABCDEF I0 I1 I2 Recovery IC ID IE Before recovery H 00000000 H 00000000 H 000 00000 H 00000000 H 00000000 H 00000000 After recovery H 00112233 H 44556677 H 8899 AABB H CCDDEEFF H 12345678 H 90ABCDEF Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when the recovery source range is out of the accessible range. 5-37 High-level Instructions (Data Transfer) 5-38 6 6 High-level Instructions (Arithmetic/Logic Operations) Applicable Models: All Models High-level Instructions (Arithmetic/Logic Operations) ADD (Addition) Ladder diagram R0 ADD.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S1 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction adds the values [S1] and [S2] according to the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] + [S2] [D] 6-2 ADD (Addition) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT1 DT0 K100 DT1 K110 DT2 K120 DT3 K130 DT4 K140 [S2]...DT2 [D]...DT4 DT0 K100 DT1 K110 DT2 K120 DT3 K130 DT4 K230 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S1]...DT2 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K500 K1000 K1500 K2000 K2500 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K3000 K1000 K1500 K2000 K2500 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S1] or [S2], and the operation unit is a real number (SF). 6-3 High-level Instructions (Arithmetic/Logic Operations) SUB (Subtraction) Ladder diagram R0 SUB.US DT2 DT1 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction subtracts the value [S2] from [S1] according to the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] - [S2] [D] 6-4 SUB (Subtraction) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT2 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 130 DT4 K 140 [S2]...DT1 [D]...DT4 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 130 DT4 K 10 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S1]...DT6 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K 500 K 1000 K 1500 K 2000 K 2500 [S2]...DT2 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K 1000 K 1000 K 1500 K 2000 K 2500 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S1] or [S2], and the operation unit is a real number (SF). 6-5 High-level Instructions (Arithmetic/Logic Operations) MUL (Multiplication) Ladder diagram R0 MUL.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction multiplies the values [S1] and [S2] according to the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] × [S2] ([D] to [D]+1) · The size of the area in which the operation result is stored varies depending on the operation unit. Operation unit US, SS UL, SL SF DF Calculation target data 16-bit × 16-bit 32-bit × 32-bit 32-bit × 32-bit 64-bit × 64-bit Calculation result 32-bit 64-bit 32-bit 64-bit Stored in a two-word area that starts with [D] Stored in a four-word area that starts with [D] Stored in a two-word area that starts with [D] Stored in a four-word area that starts with [D] 6-6 MUL (Multiplication) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT1 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 130 DT4 K 140 [S2]...DT2 [D]...DT3 DT0 K 100 DT1 K 110 DT2 K 120 DT3 DT4 K 13200 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT4 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K 500 K 1000 K 1500 K 2000 K 2500 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 K 3000000 DT4DT5 K 1500 DT6DT7 K 2000 DT8DT9 K 2500 Example 3) Operation unit: 32 bits (SF) [i]...SF DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 [S1]...DT4 K 500 K 1000 SF 1.0 SF 2.0 K 2500 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 SF 2.0 K 1500 K 1500 K 2000 K 2500 Example 4) Operation unit: 64 bits (DF) [i]...DF [S1]...DT2 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K 0 DF 123.4 DF 2.5 [S2]...DT6 [D]...DT10 DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 DF 308.5 K 0 K 0 K 0 Precautions during programming When the operation units are US, SS, UL, or SL, the area where the operation result is stored has twice the size of the operation unit. Allocate the memory area so that other areas will not be overwritten. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S1] or [S2], and the operation unit is a real number (SF). 6-7 High-level Instructions (Arithmetic/Logic Operations) MLCLIP (Saturation Multiplication) Ladder diagram R0 MLCLIP.US DT1 DT2 DT3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 Integer K *3 U *4 H Real number String Index modification SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction multiplies the values [S1] and [S2] according to the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] × [S2] [D] · As for the unsigned operation, if the result exceeds the operation unit, it is corrected to the maximum value. · As for the signed operation, if the result exceeds the operation unit, it is corrected to the maximum or minimum value. 6-8 MLCLIP (Saturation Multiplication) Process details Example 1) Operation unit: 16 bits (US, SS) Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...US,SS [S1]...DT1 [S2]...DT2 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 130 DT4 K 140 [D]...DT3 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 13200 DT4 K 10 [i]...UL,SL,SF [S1]...DT4 [S2]...DT6 [D]...DT0 DT0 K 500 DT2 K 1000 DT4 K 1500 DT6 K 2000 DT8 K 2500 DT0 K 3000000 DT2 K 1000 DT4 K 1500 DT6 K 2000 DT8 K 2500 Example 3) When the operation unit is unsigned 16-bit (US) and exceeds the maximum value [i]...US [S1]...DT1 [S2]...DT4 DT0 U 200 DT1 U 240 DT2 U 280 DT3 U 320 DT4 U 340 [D]...DT3 DT0 U 1 DT1 U 2 DT2 U 3 DT3 U 65535 DT4 U 10 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). SR9 (CY) To be set when the result is corrected, and cleared when it is not corrected. 6-9 High-level Instructions (Arithmetic/Logic Operations) DIV (Division) Ladder diagram R0 DIV.US DT2 DT1 DT3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction divides the value [S1] with [S2] according to the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] / [S2] Quotient ([D]) · The remainder is not output. If remainder is necessary, use the DIVMOD instruction. 6-10 DIV (Division) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT2 DT0 K 1 DT1 K 9 DT2 K 25 DT3 K 49 DT4 K 81 [S2]...DT1 [D]...DT3 DT0 DT1 DT2 DT3 DT4 K 1 K 9 K 25 K 2 K 81 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S1]...DT6 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K 1 K 9 K 25 K 49 K 81 [S2]...DT2 [D]...DT20 DT20DT21 K 5 DT22DT23 K 4 DT24DT25 K 0 DT26DT27 K 0 DT28DT29 K 0 Example 3) Operation unit: 64 bits (DF) [i]...DF DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 [S1]...DT6 K 0 DF 9.2 DF 50.6 [S2]...DT2 [D]...DT20 DT20DT21 DT22DT23 DT24DT25 DT26DT27 DT28DT29 DF 5.5 K 0 K 0 K 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S1] or [S2], and the operation unit is a real number (SF). To be set when '0' is specified for [S2]. 6-11 High-level Instructions (Arithmetic/Logic Operations) DIVMOD (Division (With a remainder)) Ladder diagram R0 DIVMOD.US DT2 DT1 DT3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 Integer K *3 U *4 H Real number String Index modification SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction divides the value [S1] with [S2] according to the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] / [S2] Quotient ([D]), Remainder ([D]+1) · For 16-bit operation, the remainder should be specified as [D+1]. For 32-bit operation, the remainder should be specified as [D+2, D+3]. 6-12 DIVMOD (Division (With a remainder)) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT2 [S2]...DT1 [D]...DT3 DT0 K 1 DT1 K 9 DT2 K 25 DT3 K 49 DT4 K 81 DT0 K 1 DT1 K 9 DT2 K 25 DT3 K 2 DT4 K 7 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 [S1]...DT6 K 1 K 9 K 25 K 49 K 81 [S2]...DT2 [D]...DT20 DT20DT21 K 5 DT22DT23 K 4 DT24DT25 K 0 DT26DT27 K 0 DT28DT29 K 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S1] or [S2], and the operation unit is a real number (SF). To be set when '0' is specified for [S2]. 6-13 High-level Instructions (Arithmetic/Logic Operations) DIVFP2 (Division (FP2 Compatible)) Ladder diagram R0 DIVFP2.US DT0 DT2 DT3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification *2 SF DF " " S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). Outline of operation · This instruction divides [S1] by the value of [S2], and stores the quotient in [D] and the remainder in the system data register (SD). · Calculation results are stored as follows according to the operation unit [i]. US, SS: (S1) / (S2) Quotient (D), Remainder (SD15) UL, SL: (S1+1, S1) / (S2+1, S2) Quotient (D+1, D), Remainder (SD16, SD15) · When an interrupt PB and interrupt program (INTPG) occur, SD15 and SD16 will be automatically removed and then returned. Therefore, SD15 and SD16 will not lose their contents being operated in the main program even if the main program is interrupted by other programs containing this command. But remember to complete using SD15 and SD16 by the end of the interrupt program. 6-14 DIVFP2 (Division (FP2 Compatible)) Process details Divide the calculation target data 1 by the target data 2, and set the calculation result data and remainder. Example 1) Operation unit: 16 bits (US, SS) [S1]...DT2 [S2]...DT1 [D]...DT3 DT0 K 1 DT1 K 9 DT2 K 25 DT3 K 49 DT0 K 1 DT1 K 9 DT2 K 25 DT3 K 2 SD15 K 0 SD15 K 7 Example 2) Operation unit: 32 bits (UL, SL) [S1]...DT6 [S2]...DT2 [D]...DT20 DT1-DT0 DT3-DT2 DT5-DT4 DT7-DT6 K 1 K 9 K 25 K 49 DT21-DT20 K 5 DT23-DT22 K 0 DT25-DT24 K 0 DT27-DT26 K 0 SD15 K 0 SD16 K 0 SD15 K 4 SD16 K 0 Precautions during programming When a division overflow occurs, the data is output as follows. (In the case of the minimum negative number/-1) Operation unit SS: Operation unit SL: [S1] = -32768(H8000) [D] = -32768(H8000) [S1+1, S1] = -2147483648(H80000000) [D+1, D] =2147483648(H80000000) [S2] = -1(HFFFF) [SD15] = 0(H0000) [S2+1, S2] = -1(HFFFFFFFF) [SD16, SD15] =0(H00000000) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when '0' is specified for [S2]. 6-15 High-level Instructions (Arithmetic/Logic Operations) INC (Increment) Ladder diagram R0 INC.US DT1 i D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) Outline of operation · This instruction adds 1 to the value of [D] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [D] + 1 [D] Process details Example 1) Operation unit: 16 bits (US, SS) Integer K U H Real number String Index modification SF DF " " [i]...US,SS [D]...DT1 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 130 DT0 K 100 DT1 K 111 DT2 K 120 DT3 K 130 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [D]...DT2 DT0DT1 DT2DT3 DT4DT5 DT6DT7 K 500 K 1000 K 1500 K 2000 DT0DT1 DT2DT3 DT4DT5 DT6DT7 K 500 K 1001 K 1500 K 2000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [D], and the operation unit is a real number (SF). 6-16 DEC (Decrement) DEC (Decrement) Ladder diagram R0 DEC.US DT1 i D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Calculation target data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) Integer K U H Outline of operation · This instruction subtracts 1 from the value of [D] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [D] - 1 [D] Process details Example 1) Operation unit: 16 bits (US, SS) Real number String Index modification SF DF " " [i]...US,SS [D]...DT1 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 130 DT0 K 100 DT1 K 109 DT2 K 120 DT3 K 130 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [D]...DT2 DT0DT1 DT2DT3 DT4DT5 DT6DT7 K 500 K 1000 K 1500 K 2000 DT0DT1 DT2DT3 DT4DT5 DT6DT7 K 500 K 999 K 1500 K 2000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [D], and the operation unit is a real number (SF). 6-17 High-level Instructions (Arithmetic/Logic Operations) BCDADD (BCD Data Addition) Ladder diagram R0 BCDADD.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) (Available data: H0 to H9 for each digit) S2 Calculation target data 2 (device address or constant) (Available data: H0 to H9 for each digit) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified. (Integer constants, real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction adds the BCD data for [S1] and [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] + [S2] [D] 6-18 BCDADD (BCD Data Addition) Process details Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT1 [S2]...DT2 [D]...DT4 DT0 H 0500 DT1 H 0510 DT2 H 0520 DT3 H 0530 DT4 H 0540 DT0 H 0500 DT1 H 0510 DT2 H 0520 DT3 H 0530 DT4 H 1030 Example 2) Operation unit: 32 bits (UL) [i]...UL [D1]...DT4 [D2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 00005000 H 00005500 H 00006000 H 00006500 H 00007000 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 Example 3) Operation unit: 16 bits (US) [i]...US [S1]...DT1 [S2]...DT4 [D]...DT3 H 00012500 H 00005500 H 00006000 H 00006500 H 00007000 DT0 H 5000 DT1 H 6000 DT2 H 7000 DT3 H 8000 DT4 H 9000 DT0 H 5000 DT1 H 6000 DT2 H 7000 DT3 H 5000 DT4 H 9000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when data other than BCD are specified for the calculation target data [S1] or [S2]. 6-19 High-level Instructions (Arithmetic/Logic Operations) BCDSUB (BCD Data Subtraction) Ladder diagram R0 BCDSUB.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) (Available data: H0 to H9 for each digit) S2 Calculation target data 2 (device address or constant) (Available data: H0 to H9 for each digit) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S1 Integer K U H Real number String Index modification *2 SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified. (Integer constants, real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction subtracts the BCD data for [S1] from [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] - [S2] [D] 6-20 BCDSUB (BCD Data Subtraction) Process details Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT1 [S2]...DT2 [D]...DT4 DT0 H 0540 DT0 DT1 H 0530 DT1 DT2 H 0520 DT2 DT3 H 0510 DT3 DT4 H 0500 DT4 Example 2) Operation unit: 32 bits (UL) H 0540 H 0530 H 0520 H 0510 H 0010 [i]...UL [D1]...DT4 [D2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 00020000 H 00019500 H 00019000 H 00018500 H 00018000 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 00000500 H 00019500 H 00019000 H 00018500 H 00018000 Example 3) Operation unit: 16 bits (US) [i]...US [S1]...DT1 [S2]...DT4 [D]...DT3 DT0 H 1000 DT1 H 2000 DT2 H 3000 DT3 H 4000 DT4 H 5000 DT0 H 1000 DT1 H 2000 DT2 H 3000 DT3 H 7000 DT4 H 5000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when data other than BCD are specified for the calculation target data [S1] or [S2]. 6-21 High-level Instructions (Arithmetic/Logic Operations) BCDMUL (BCD Data Multiplication) Ladder diagram R0 BCDMUL.US DT1 DT2 DT3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) (Available data: H0 to H9 for each digit) S2 Calculation target data 2 (device address or constant) (Available data: H0 to H9 for each digit) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S1 Integer K U H Real number String Index modification *2 SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified. (Integer constants, real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction multiplies the BCD data for [S1] and [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] × [S2] ([D], [D]+1) · The unit size of the operation result output in [D] is twice as large as the operation unit. 6-22 BCDMUL (BCD Data Multiplication) Process details Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT1 [S2]...DT2 [D]...DT3 DT0 H 0500 DT1 H 0510 DT2 H 0520 DT3 H 0530 DT4 H 0540 DT0 H 0500 DT1 H 0510 DT2 H 0520 DT3 DT4 H 00265200 Example 2) Operation unit: 32 bits (UL) [i]...UL [S1]...DT4 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 00005000 H 00005500 H 00006000 H 00006500 H 00007000 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 0000000039000000 H 00006000 H 00006500 H 00007000 Precautions during programming If the ending area of the operation device is specified for [D], the memory for the subsequent device may be overwritten by an area twice the size of the operation unit. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when data other than BCD are specified for the calculation target data [S1] or [S2]. 6-23 High-level Instructions (Arithmetic/Logic Operations) BCDDIV (BCD Data Division) Ladder diagram R0 BCDDIV.US DT1 DT2 DT3 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) (Available data: H0 to H9 for each digit) S2 Calculation target data 2 (device address or constant) (Available data: H0 to H9 for each digit) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified. (Integer constants, real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction divides [S1] with the BCD data for [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] / [S2] Quotient ([D]), Remainder ([D]+1) · The remainder is stored in ([D]+1). 6-24 BCDDIV (BCD Data Division) Process details Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT1 [S2]...DT2 [D]...DT3 DT0 H 0064 DT1 H 0049 DT2 H 0025 DT3 H 0009 DT4 H 0001 DT0 H 0064 DT1 H 0049 DT2 H 0025 DT3 H 0001 DT4 H 0024 Example 2) Operation unit: 32 bits (UL) [i]...UL [S1]...DT4 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11111100 H 22222200 H 33333300 H 00001000 H 44444400 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 00033333 H 00000300 H 33333300 H 00001000 H 44444400 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when '0' is specified for [S2]. To be set when data other than BCD are specified for the calculation target data [S1] or [S2]. 6-25 High-level Instructions (Arithmetic/Logic Operations) BCDINC (BCD Data Increment) Ladder diagram R0 BCDINC.US DT0 i D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Calculation target data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified. (Integer constants, real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction adds 1 to the BCD data of [D] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [D] + 1 [D] Process details Example 1) Operation unit: 16 bits (US) [i]...US [D]...DT0 DT0 H 0100 DT1 H 0200 DT2 H 0300 DT3 H 0400 DT0 H 0101 DT1 H 0200 DT2 H 0300 DT3 H 0400 Example 2) Operation unit: 32 bits (UL) [i]...UL [D]...DT2 DT0DT1 DT2DT3 DT4DT5 DT6DT7 H 01000000 H 01999999 H 03000000 H 04000000 DT0DT1 DT2DT3 DT4DT5 DT6DT7 H 01000000 H 02000000 H 03000000 H 04000000 6-26 BCDINC (BCD Data Increment) Example 3) Operation unit: 16 bits (US) [i]...US [D]...DT0 DT0 H 9999 DT1 H 0200 DT2 H 0300 DT3 H 0400 DT0 H 0000 DT1 H 0200 DT2 H 0300 DT3 H 0400 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when data other than BCD are specified for the calculation target data [D]. 6-27 High-level Instructions (Arithmetic/Logic Operations) BCDDEC (BCD Data Decrement) Ladder diagram R0 BCDDEC.US DT0 i D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Calculation target data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified. (Integer constants, real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction subtracts 1 from the BCD data of [D] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [D] - 1 [D] Process details Example 1) Operation unit: 16 bits (US) [i]...US [D]...DT0 DT0 H 0100 DT0 DT1 H 0200 DT1 DT2 H 0300 DT2 DT3 H 0400 DT3 Example 2) Operation unit: 32 bits (UL) [i]...UL [D]...DT2 H 0099 H 0200 H 0300 H 0400 DT0DT1 DT2DT3 DT4DT5 DT6DT7 H 01000000 H 02000000 H 03000000 H 04000000 DT0DT1 DT2DT3 DT4DT5 DT6DT7 H 01000000 H 01999999 H 03000000 H 04000000 6-28 BCDDEC (BCD Data Decrement) Example 3) Operation unit: 16 bits (US) [i]...US [D]...DT0 DT0 H 0000 DT1 H 0200 DT2 H 0300 DT3 H 0400 DT0 H 9999 DT1 H 0200 DT2 H 0300 DT3 H 0400 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when data other than BCD are specified for the calculation target data [D]. 6-29 High-level Instructions (Arithmetic/Logic Operations) AND (Logical Conjunction) Ladder diagram R0 AND.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 Integer K *3 U *4 H Real number String Index modification SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction calculates the logical conjunction for [S1] and [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] [S2] [D] Logical conjunction (AND) [S1] bit [S2] bit AND 0 0 0 0 1 0 1 0 0 1 1 1 6-30 AND (Logical Conjunction) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT1 [S2]...DT2 [D]...DT4 DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H 90AB DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H 5600 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT2 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 12345678 H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H A0A0A0A0 H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 6-31 High-level Instructions (Arithmetic/Logic Operations) OR (Logical Disjunction) Ladder diagram R0 OR.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 Integer K *3 U *4 H Real number String Index modification SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction calculates the logical disjunction for [S1] and [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. [S1] [S2] [D] Logical disjunction (OR) [S1] bit [S2] bit OR 0 0 0 0 1 1 1 0 1 1 1 1 6-32 Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT1 [S2]...DT2 [D]...DT4 DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H 90AB DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H FF78 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT2 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 12345678 H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H FAFAFAFA H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). OR (Logical Disjunction) 6-33 High-level Instructions (Arithmetic/Logic Operations) XOR (Exclusive OR) Ladder diagram R0 XOR.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 Integer K *3 U *4 H Real number String Index modification SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction calculates the exclusive OR for [S1] and [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. { [S1] /[S2] } { /[S1] [S2] } [D] Exclusive OR (XOR) [S1] bit [S2] bit 0 0 Exclusive OR 0 0 1 1 1 0 1 1 1 0 6-34 Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT1 [S2]...DT2 [D]...DT4 DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H 90AB DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H A978 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT2 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 12345678 H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 5A5A5A5A H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). XOR (Exclusive OR) 6-35 High-level Instructions (Arithmetic/Logic Operations) XNR (Exclusive NOR) Ladder diagram R0 XNR.US DT1 DT2 DT4 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Calculation target data 1 (device address or constant) S2 Calculation target data 2 (device address or constant) D Calculation result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 Integer K *3 U *4 H Real number String Index modification SF DF " " S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction calculates the exclusive NOR for [S1] and [S2] by the operation unit [i]. · The calculation result is stored in the address starting with [D]. { [S1] [S2] } { /[S1] /[S2] } [D] Exclusive NOR (XNR) [S1] bit [S2] bit 0 0 Exclusive NOR 1 0 1 0 1 0 0 1 1 1 6-36 Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT1 [S2]...DT2 [D]...DT4 DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H 90AB DT0 H 1234 DT1 H FF00 DT2 H 5678 DT3 H 00FF DT4 H 5687 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT2 [S2]...DT6 [D]...DT0 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 12345678 H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H A5A5A5A5 H F0F0F0F0 H 0F0F0F0F H AAAAAAAA H 5AA5A55A Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). XNR (Exclusive NOR) 6-37 High-level Instructions (Arithmetic/Logic Operations) COMB (Combination) Ladder diagram R0 COMB.US DT0 DT1 DT2 DT4 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Combined data 1 (device address or constant) S2 Combined data 2 (device address or constant) S3 Combination mask data (device address or constant) D Combination result data (device address) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S1 Integer K *3 U *4 H Real number String Index modification SF DF " " S2 S3 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction combines the data for [S1] and [S2] by the operation unit [i] and the mask data stored in [S3]. · The calculation result is stored in the address starting with [D]. · When the mask data specified for [S3] is ON for the bit, the combination starts from [S1]. When it is OFF, the combination starts from [S2]. { [S1] [S3] } { [S2] /[S3] } [D] 6-38 Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0 [S2]...DT1 [S3]...DT2 [D]...DT4 DT0 H 1234 DT1 H 5678 DT2 H FF00 DT3 H 00FF DT4 H 90AB DT0 H 1234 DT1 H 5678 DT2 H FF00 DT3 H 00FF DT4 H 1278 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT0 [S2]...DT2 [S3]...DT6 [D]...DT8 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 12345678 H 90ABCDEF H 0F0F0F0F H F0F0F0F0 H 5AA5A55A DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 12345678 H 90ABCDEF H 0F0F0F0F H F0F0F0F0 H 103B5D7F Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). COMB (Combination) 6-39 High-level Instructions (Arithmetic/Logic Operations) 6-40 7 7 High-level Instructions (Data Conversion) Applicable Models: All Models High-level Instructions (Data Conversion) INV (Data Inversion) Ladder diagram R0 INV.US DT0 i D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Device address where the data to be inverted are stored Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction logically inverts the device address value specified by [D]. /[D] [D] Process details Example 1) Operation unit: 16 bits (US, SS) Example 2) Operation unit: 32 bits (UL, SL) [i]...US,SS [D]...DT2 [i]...UL,SL [D]...DT2 DT0 H 0011 DT1 H 2233 DT2 H 4455 DT3 H 6677 DT4 H 8899 DT0 H 0011 DT1 H 2233 DT2 H BBAA DT3 H 6677 DT4 H 8899 DT0DT1 H 11223344 DT2DT3 H 55667788 DT4DT5 H 9900AABB DT6DT7 H CCDDEEFF DT8DT9 H 12345678 DT0DT1 H 11223344 DT2DT3 H AA998877 DT4DT5 H 9900AABB DT6DT7 H CCDDEEFF DT8DT9 H 12345678 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 7-2 NEG (Sign Inversion) NEG (Sign Inversion) Ladder diagram R0 NEG.SS DT2 DT3 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data whose sign is to be inverted are stored, or the constant D Storage device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S Integer K U H Real number String Index modification *2 SF DF " " D *1: Cannot be specified when the operation unit is 16-bit integer (SS). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction calculates two's complement for the device address value or the constant specified by [S], to invert the sign of the data. · The calculation result is stored in the device address specified by [D]. Process details Example 1) Operation unit: 16 bits (SS) Example 2) Operation unit: 32 bits (SL) [i]...SS [S]...DT2 [D]...DT3 [i]...SL [S]...DT2 [D]...DT8 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K 130 DT4 K 140 DT0 K 100 DT1 K 110 DT2 K 120 DT3 K -120 DT4 K 140 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K 500 K 1000 K 1500 K 2000 K 2500 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K 500 K 1000 K 1500 K 2000 K -1000 Precautions during programming · The result should be the minimum negative value if it has been specified. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 7-3 High-level Instructions (Data Conversion) ABS (Absolute Value) Ladder diagram R0 ABS.US DT1 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data for taking an absolute value are stored, or the constant D Storage device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K *4 U *5 H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction takes the absolute value of the device address or the constant specified by [S], and stores it in the device address specified by [D]. Process details Example 1) Operation unit: Signed 16 bits (SS) Example 2) Operation unit: Signed 32 bits (SL) [i]...SS [S]...DT1 [D]...DT2 [i]...SL [S]...DT2 [D]...DT4 DT0 K-100 DT1 K-110 DT2 K-120 DT3 K-130 DT4 K-140 DT0 K-100 DT1 K-110 DT2 K110 DT3 K-130 DT4 K-140 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K-500 K-1000 K-1500 K-2000 K-2500 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 K-500 K-1000 K1000 K-2000 K-2500 Precautions during programming · The same value for unsigned integers (US, UL) is stored. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the minimum negative value is specified for [S]. 7-4 EXT (Sign Extension) EXT (Sign Extension) Ladder diagram R0 EXT.US DT0 DT1 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data for sign extension are stored, or the constant D Storage device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K *4 U *5 H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction performs sign extension of a value of the device address or the constant specified by [S], and stores it in the device address specified by [D]. Process details Example 1) Operation unit: Signed 16 bits (SS) [i]...SS [S]...DT0 [D]...DT0 DT0 K -2(H FFFE) DT1 K 0(H 0000) DT0DT1 K-2(H FFFFFFFE) Example 2) Operation unit: Unsigned 16 bits (US) [i]...US [S]...DT0 [D]...DT0 DT0 H FFFE DT1 H 1234 DT0DT1 H 0000FFFFE Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 7-5 High-level Instructions (Data Conversion) BCD (Conversion: BCD Data) Ladder diagram R0 BCD.US DT0 DT1 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the binary data to be converted is stored, or the constant D Device address to store the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction converts the device address value or the constant specified by [S] from binary data to BCD data, and stores the result in the device specified by [D]. Process details Example 1) Operation unit: 16 bits (US) [i]...US [S]...DT0 [D]...DT10 DT0 H 0010 (K 16) DT1 DT10 DT11 H 0016 Example 2) Operation unit: 32 bits (UL) [i]...UL [S]...DT0 [D]...DT10 DT0 H 614E (K 12345678) DT1 H 00BC DT2 DT10 DT11 DT12 H 5678 H 1234 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the binary data exceed the BCD-convertible range. (Example: When US exceeds K 9999 or UL exceeds K 99999999) 7-6 BIN (Conversion: BCD BIN) BIN (Conversion: BCD BIN) Ladder diagram R0 BIN.US DT0 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the BCD data to be converted is stored, or the constant D Device address to store the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction converts the device address value or the constant specified by [S] from BCD data to binary data, and stores the result in the device address specified by [D]. Process details Example 1) Operation unit: 16 bits (US) [i]...US [S]...DT0 [D]...DT10 DT10 DT11 H 0016 DT0 H 0010 (K 16) DT1 Example 2) Operation unit: 32 bits (UL) [i]...UL [S]...DT0 [D]...DT10 DT10 H 5678 DT0 DT11 H 1234 DT1 DT12 DT2 H 614E (K 12345678) H 00BC Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [S] is not BCD data. 7-7 High-level Instructions (Data Conversion) DECO (Decoding) Ladder diagram R0 DECO DT1 DT2 DT3 S n D List of operands Operand Description S The device address where the data for decoding are stored, or the constant n The device address where the control data (specification of the conversion starting bit, specification of the conversion-enabled bit length) are stored, or the constant D Storage device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S n D *1: Only 16-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction decodes a value of the device address or the constant specified by [S], and stores the result in the device address specified by [D]. · The target part to be decoded is specified with the control data of [n]. · The required length of the device address for storing the result depends on the length of the data before decoding. Specification of control data [N] 15 12 11 8 7 4 3 0 n: 0000 0000 Ignore the bits indicated with ''. nH (Specify the conversion start bit) Bit 0: H0 Bit 15: HF nL (Specify the conversionenabled bit length) 1 bit: H1 8 bits: H8 7-8 DECO (Decoding) Example of conversion Data to be converted Decoded result (16 bits) 0000 0000 0000 0000 0001 0001 0000 0000 0000 0010 0010 0000 0000 0000 0100 0011 0000 0000 0000 1000 0100 0000 0000 0001 0000 0101 0000 0000 0010 0000 0110 0000 0000 0100 0000 0111 0000 0000 1000 0000 Data to be converted 1000 1001 1010 1011 1100 1101 1110 1111 Decoded result (16 bits) 0000 0001 0000 0000 0000 0010 0000 0000 0000 0100 0000 0000 0000 1000 0000 0000 0001 0000 0000 0000 0010 0000 0000 0000 0100 0000 0000 0000 1000 0000 0000 0000 Specification of nL and length of operation result nL value Conversion-enabled bit length Occupancy length of the Enabled bit length of the decoded result decoded result 1 1 word 2 2 1 word 4 3 1 word 8 4 1 word 16 5 2 words 32 6 4 words 64 7 8 words 128 8 16 words 256 Value other than the enabled bit length in [D] 0 0 0 - Process details Example) Decode 4 bits from Bit 4 [S]...DT1 [n]...H 0404 [D]...DT2 * Store the result of decoding the specified portion ("0111"=7) into the 16-bit (24-bit) device address starting with DT2. * The 16-bit area starting with DT2 turns ON, while the other bits become '0'. 15 40 DT1 0000 0000 0111 0000 15 7 0 DT2 0000 0000 1000 0000 4 bits 16 bits Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the conversion-enabled bit length "nL" is not in the following range: 1 nL 8. To be set when the sum of the conversion starting bit number (nH) and the conversion-enabled bit length (nL) is not in the following range: 1 "nH + nL" 16. To be set if, when the decoded result is stored in the device address specified by [D], it exceeds the area. 7-9 High-level Instructions (Data Conversion) SEGT (7-Segment Decoding) Ladder diagram R0 SEGT.US DT0 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data for decoding are stored, or the constant D Storage device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S D *1: Only 16-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction converts the device address value or a constant specified by [S] to 7-segment data in 4 digits, and stores it to an address of 2 words beginning with [D]. Process details Example) H ABCD is stored in [S] [S]...DT0 [D]...DT10 DT0 H ABCD DT10 0011 1001 0101 1110 DT11 0111 0111 0111 1100 Precautions during programming · If an unsigned constant U is specified for [S], it should be converted as HEX data. 7-10 SEGT (7-Segment Decoding) Notation and corresponding data Value 1-digit data to be converted [S] 1-digit data for 7-segment notation [D] g f edcba 0 00 0 0 0 0 1 1 1 1 1 1 7-segment notation 1 00 0 1 0 0 0 0 0 1 1 0 2 00 1 0 0 1 0 1 1 0 1 1 3 00 1 1 0 1 0 0 1 1 1 1 4 01 0 0 0 1 1 0 0 1 1 0 5 01 0 1 0 1 1 0 1 1 0 1 6 01 1 0 0 1 1 1 1 1 0 1 7 01 1 1 0 0 1 0 0 1 1 1 a f b g 8 10 0 0 0 1 1 1 1 1 1 1 9 10 0 1 0 1 1 0 1 1 1 1 A 10 1 0 0 1 1 1 0 1 1 1 e c d B 10 1 1 0 1 1 1 1 1 0 0 C 11 0 0 0 0 1 1 1 0 0 1 D 11 0 1 0 1 0 1 1 1 1 0 E 11 1 0 0 1 1 1 1 0 0 1 F 11 1 1 0 1 1 1 0 0 0 1 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set if, when the conversion result is stored in the device address specified by [D], it exceeds the area. 7-11 High-level Instructions (Data Conversion) ENCO (Encoding) Ladder diagram R0 ENCO DT10 DT15 DT20 S n D List of operands Operand Description S The device address where the data for encoding are stored, or the constant n The device address where control data (specification of the result output start bit, and specification of the conversion-enabled bit length) are stored, or the constant D Storage device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S n D *1: Only 16-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction encodes a part of a device address value or a constant specified by [S], and stores the result to the device address specified by [D]. · The target part to be encoded is specified with the control data of [n]. · When several bits are ON in the part to be encoded, the uppermost bit is effective. · Encode the content for 2nL bits, starting with the device address specified by [S]. The encoded result is stored as a decimal number within 8 bits from the bit specified by "nH". · In the device address specified by [D], portions other than the one storing the conversion result should be 0 (should be set to 0). Specification of control data [N] 15 12 11 8 7 4 3 0 n: 0000 0000 Ignore the bits indicated with ''. nH (Specify the result output start bit) Bit 0: H0 Bit 15: HF nL (Specify the conversionenabled bit length) 21 bits: H1 28 bits: H8 7-12 ENCO (Encoding) Example of conversion Data to be converted (16 bits) 0000 0000 0000 0001 0000 0000 0000 0010 0000 0000 0000 0100 0000 0000 0000 1000 0000 0000 0001 0000 0000 0000 0010 0000 0000 0000 0100 0000 0000 0000 1000 0000 Encoded result 0000 0001 0010 0011 0100 0101 0110 0111 Specification of nL and length of result nL value Conversion-enabled bit length 1 2 2 4 3 8 (1 byte) 4 16 (1 bytes) Process details Data to be converted (16 bits) 0000 0001 0000 0000 0000 0010 0000 0000 0000 0100 0000 0000 0000 1000 0000 0000 0001 0000 0000 0000 0010 0000 0000 0000 0100 0000 0000 0000 1000 0000 0000 0000 Encoded result 1000 1001 1010 1011 1100 1101 1110 1111 nL value 5 6 7 8 Conversion-enabled bit length 32 (2 bytes) 64 (4 bytes) 128 (8 bytes) 256 (16 bytes) Example) [S]...DT10 [n]...H 0005 [D]...DT20 DGT S , S1 , n , D , D1 Transfer [n] digits from the [S1]th digit of the area specified by [S], to the [D1] digit of the 16-bit data specified by [D]. Transfer starts with the 0th digit, 1st digit, 2nd digit, and 3rd digit by every four bits from the lower level. Conversion-enabled bits are DT10 to DT11 (32 bits from DT10). The bit numbers that are ON in these two-word area are stored in a decimal form from Bit 0 of DT20. DT10 0000 0001 0000 0000 DT11 0000 0000 0000 0000 Bit 8, counted from the lowest bit of DT10, is ON. DT20 0000 0000 0000 1000 Store H8 in DT20. Precautions during programming · If an unsigned constant U is specified for [S], it should be converted as Hex data. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the conversion-enabled bit length (nL) is not in the following range: 1 nL 8. To be set (for consistency) when the sum of the result output starting bit number "nH" and the conversion-enabled bit length "nL" is not in the following range: 1 nH + nL 16. To be set when the data to be encoded is all "0". 7-13 High-level Instructions (Data Conversion) UNIT (Digit Unification) Ladder diagram R0 UNIT.US DT10 U3 DT20 i S n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data to be unified are stored, or the constant (data format: unsigned 16-bit integer) n The device address where the number of data to be unified is stored, or the constant (data format: unsigned 16-bit integer) D Storage device address (data format: according to the operation unit) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S n D *1: Only 16-bit devices, and integer constants can be modified. (32-bit devices, real number constants, and character constants cannot be specified.) Outline of operation · The lower 4 bits of the 16-bit data for [n] words starting with [S] are combined into 16-bit data. · The available data amount specified by [n] is 0 to 4. No operation needed if [n]=0. · The other portions of [D] are padded with "0". Process details [i]...US [S]...DT10 [n]...U3 [D]...DT20 DT10 DT11 DT12 1512 118 0000 0000 0000 0000 0000 0000 74 0000 0000 0000 30 0001 0010 0100 DT20 1512 118 74 30 0000 0100 0010 0001 Padded with '0'. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n], the number of data to be unified, is out of the specified range. 7-14 DIST (Digit Disintegration) DIST (Digit Disintegration) Ladder diagram R0 DIST.US DT10 U4 DT20 i S n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data to be broken down stored, or the constant (data format: according to the operation unit) n The device address where the number of points into which the data is broken down is stored, or the constant (data format: unsigned 16-bit integer) D Storage device address (data format: unsigned 16-bit integer) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S n D *1: Only 16-bit devices, and integer constants can be modified. (32-bit devices, real number constants, and character constants cannot be specified.) Outline of operation · 16-bit device specified by [S] is broken down into 16-bit data by 4 bits. (The available range for [n], the number into which the data is broken down, is 0 to 4.) · No operation needed if [n]=0. Process details Example) Operation unit: 16 bits (US) [i]...US [S]...DT10 [n]...U4 [D]...DT20 DT10 1512 118 74 30 0100 0011 0001 0000 DT20 DT21 DT22 DT23 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 0011 0100 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n], the number into which the data is broken down, is out of the specified range. To be set when, if data equivalent to [n] are transferred from the address specified by [D], it exceeds the device address. 7-15 High-level Instructions (Data Conversion) BUNI (Byte Data Unification) Ladder diagram R0 BUNI DT10 U2 DT20 i S n D List of operands Operand Description S The device address where the data to be unified are stored, or the constant (data format: unsigned 16-bit integer) The device address where the number of data to be unified is stored, or the constant (data format: unsigned 16-bit n integer) Available range: 0 to 65535 D Storage device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF " " *1 S n D *1: Only 16-bit devices, and integer constants can be modified. (32-bit devices, real number constants, and character constants cannot be specified.) *2: Index register (I0 to IE) Outline of operation · The target of this instruction is data of [n] words that begins with [S]. · The lower 1 byte of each word data is combined. · The combined data is stored in a device area of [n] bytes that starts with [D]. · No operation needed if [n]=0. · When [n] is an odd number, the value of the uppermost/highest byte of the storage device area is 0. 7-16 Process details Example 1) [S]...DT10 [n]...U2 [D]...DT20 DT10 DT11 158 00000000 00000000 70 00010001 00010010 DT20 158 70 00010010 00010001 BUNI (Byte Data Unification) Example 2) [S]...DT10 [n]...U3 [D]...DT20 DT10 DT11 DT12 158 00000000 00000000 00000000 70 00010001 00010010 00010011 DT21 3124 2316 00000000 00010011 DT20 158 70 00010010 00010001 Padded with "0". Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n], the number of data to be unified, is out of the specified range. 7-17 High-level Instructions (Data Conversion) BDIS (Byte Data Disintegration) Ladder diagram R0 BDIS DT10 U2 DT20 i S n D List of operands Operand Description S The device address where the data to be broken down are stored, or the constant n The device address where the number of points into which the data is broken down is stored, or the constant D Storage device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S n Integer K U H Real number String Index modification SF DF " " *1 D *1: Only 16-bit devices, and integer constants can be modified. (32-bit devices, real number constants, and character constants cannot be specified.) *2: Index register (I0 to IE) Outline of operation · The target of this instruction is data of [n] words that begins with [S]. · Each word data is broken down into single bytes. · The broken down data is stored in a 2 × [n]-word device area that starts with [D]. · It stores one byte for each word. · No operation needed if [n]=0. 7-18 BDIS (Byte Data Disintegration) Process details Example 1) [S]...DT10 [n]...U2 [D]...DT20 DT10 158 70 00010010 00010001 DT20 00000000 DT21 00000000 00010001 00010010 Example 2) [S]...DT10 [n]...U4 [D]...DT20 DT11 3124 2316 00010010 00010011 DT10 158 70 00010010 00010011 DT20 DT21 DT22 DT23 00000000 00000000 00000000 00000000 00010011 00010010 00010011 00010010 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n], the number into which the data is broken down, is out of the specified range. To be set when, if data equivalent to [n] are transferred from the address specified by [D], it exceeds the device address. 7-19 High-level Instructions (Data Conversion) GRY (Conversion: Binary Gray Code) Ladder diagram R0 GRY.US DT0 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data for conversion are stored, or the constant D Storage device address (Note): For gray codes, refer to the "Correspondence Table: BIN / Gray Code." Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (US). *2: Only 16-bit devices, and integer constants can be modified. (32-bit devices, real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction converts a value of the device address or the constant specified by [S] to gray code, and stores it in the device address specified by [D]. Process details Example 1) Operation unit: 16 bits (US) [i]...US [S]...DT0 [D]...DT10 DT0 0000000000011000 DT10 0000000000010100 Example 2) Operation unit: 32 bits (UL) [i]...UL [S]...DT0 [D]...DT10 DT0, DT1 00000000000000000000000000011111 DT10, DT11 00000000000000000000000000010000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 7-20 Correspondence Table: DEC / BIN / Gray Code Decimal Binary 0 0000 0000 0000 0000 1 0000 0000 0000 0001 2 0000 0000 0000 0010 3 0000 0000 0000 0011 4 0000 0000 0000 0100 5 0000 0000 0000 0101 6 0000 0000 0000 0110 7 0000 0000 0000 0111 8 0000 0000 0000 1000 9 0000 0000 0000 1001 10 0000 0000 0000 1010 11 0000 0000 0000 1011 12 0000 0000 0000 1100 13 0000 0000 0000 1101 14 0000 0000 0000 1110 15 0000 0000 0000 1111 16 0000 0000 0001 0000 17 0000 0000 0001 0001 18 0000 0000 0001 0010 19 0000 0000 0001 0011 20 0000 0000 0001 0100 21 0000 0000 0001 0101 22 0000 0000 0001 0110 23 0000 0000 0001 0111 24 0000 0000 0001 1000 25 0000 0000 0001 1001 26 0000 0000 0001 1010 27 0000 0000 0001 1011 28 0000 0000 0001 1100 29 0000 0000 0001 1101 30 0000 0000 0001 1110 31 0000 0000 0001 1111 32 0000 0000 0010 0000 - - 63 0000 0000 0010 1111 64 0000 0000 0100 1111 - - 255 0000 00001111 1111 GRY (Conversion: Binary Gray Code) Gray code 0000 0000 0000 0000 0000 0000 0000 0001 0000 0000 0000 0011 0000 0000 0000 0010 0000 0000 0000 0110 0000 0000 0000 0111 0000 0000 0000 0101 0000 0000 0000 0100 0000 0000 0000 1100 0000 0000 0000 1101 0000 0000 0000 1111 0000 0000 0000 1110 0000 0000 0000 1010 0000 0000 0000 1011 0000 0000 0000 1001 0000 0000 0000 1000 0000 0000 0001 1000 0000 0000 0001 1001 0000 0000 0001 1011 0000 0000 0001 1010 0000 0000 0001 1110 0000 0000 0001 1111 0000 0000 0001 1101 0000 0000 0001 1100 0000 0000 0001 0100 0000 0000 0001 0101 0000 0000 0001 0111 0000 0000 0001 0110 0000 0000 0001 0010 0000 0000 0001 0011 0000 0000 0001 0001 0000 0000 0001 0000 0000 0000 0011 0000 0000 0000 0010 0000 0000 0000 0110 0000 0000 0000 1000 0000 7-21 High-level Instructions (Data Conversion) GBIN (Conversion: Gray Code BIN) Ladder diagram R0 GBIN.US DT0 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data for conversion are stored, or the constant D Storage device address (Note): For gray codes, refer to the "Correspondence Table: BIN / Gray Code." Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (US). *2: Only 16-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction converts the gray code of a value of the device address or the constant specified by [S] to binary data, and stores it in the device address specified by [D]. 7-22 Process details Example 1) Operation unit: 16 bits (US) [i]...US [S]...DT0 [D]...DT10 DT0 0000000000010100 DT10 0000000000011000 GBIN (Conversion: Gray Code BIN) Example 2) Operation unit: 32 bits (UL) [i]...UL [S]...DT0 [D]...DT10 DT0DT1 00000000000000000000000000010000 DT10DT11 00000000000000000000000000011111 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 7-23 High-level Instructions (Data Conversion) COLM (Conversion: Bit Line Bit Column) Ladder diagram R0 COLM.US DT1 U10 DT10 i S n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address where the data for conversion are stored, or the constant n The device address where the specification for the bit position is stored, or the constant (available data range: 0 to 15) D Starting address of the device whose bit column is rewritten Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification *1 SF DF " " n D *1: Only 16-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · 16 bit data rows specified by [S] are transferred to [n] bit data columns in the 16 word area specified by [D]. · Portions other than the specified bit column are not changed. 7-24 COLM (Conversion: Bit Line Bit Column) Process details Example) Operation unit: 16 bits (US) [i]...US [S]...DT1 [n]...U10 [D]...DT10 15 0 DT0 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 1 15 10 0 DT10 1 0 0 1 1 0 1 1 1 0 0 0 1 0 1 DT25 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the specification for the bit position [n] is not in the following range: 0 n 15. To be set if, when the conversion result is stored in the device address specified by [D], it exceeds the area. 7-25 High-level Instructions (Data Conversion) LINE (Conversion: Bit Column Bit Line) Ladder diagram R0 LINE.US DT1 U10 DT10 i S n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device whose bit column is read. n The device address where the specification for the bit position is stored, or the constant (available data range: 0 to 15) D Storage device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S n D *1: Only 16-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · The [n]-bit column data, in the 16-word device area specified by [S], are transferred to the 16-bit data specified by [D]. 7-26 LINE (Conversion: Bit Column Bit Line) Process details Example) Operation unit: 16 bits (US) [i]...US [S]...DT1 [n]...U10 [D]...DT20 15 10 0 DT0 1 0 0 1 1 0 1 1 1 0 0 0 1 0 1 DT15 0 15 0 DT20 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 1 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the specification for the bit position [n] is not in the following range: 0 n 15. To be set when the conversion range specified by [S] exceeds the device address. 7-27 High-level Instructions (Data Conversion) 7-28 8 8 High-level Instructions (Data Shift and Rotation) Applicable Models: All Models High-level Instructions (Data Shift and Rotation) SHR (Right Shift for n Bits) Ladder diagram R0 SHR.US DT0 K4 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be shifted is stored n The device address where the number of shift bits is stored, or the constant Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K *4 U *5 H Real number String Index modification *2 SF DF " " D n *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction shifts the data specified by [D] to the right (to the low bit position), by the data amount specified by [n] (decimal). · Once the data is shifted, [n] bits are filled with 0 from the uppermost/highest bit. The data from the lowest to the [n]th bit is stored in SR9 (CY). · Only the lower 8 bits in data are available for [n]. The shift data amount should be specified between 0 and 255 bits. 8-2 SHR (Right Shift for n Bits) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [D]...DT0 [n]...K4 1512 118 74 30 DT0 1010 0110 1100 1011 DT0 0000 1010 0110 1100 SR9(CY) Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [D]...DT2 [n]...K8 3128 2724 2320 1916 1512 118 74 30 DT2DT3 1110 1101 1001 0011 1010 0110 1100 1011 DT2DT3 0000 0000 1110 1101 1001 0011 1010 0110 SR9(CY) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). SR9 (CY) To be reset if the [n] (no. of shift bits) is larger than the operation unit. In other cases, data in the [n]th bit from the least significant bit are to be set. 8-3 High-level Instructions (Data Shift and Rotation) SHL (Left Shift for n Bits) Ladder diagram R0 SHL.US DT0 K4 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be shifted is stored n The device address where the number of shift bits is stored, or the constant Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 D Integer K *4 U *5 H Real number String Index modification *2 SF DF " " n *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction shifts the data specified by [D] to the left (to the high bit position), by the data amount specified by [n] (decimal). · Once the data is shifted, [n] bits are filled with 0 from the least significant bit. The data from the highest to the [n]th bit is stored in SR9 (CY). · Only the lower 8 bits in data are available for [n]. The shift data amount should be specified between 0 and 255 bits. 8-4 SHL (Left Shift for n Bits) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [D]...DT0 [n]...K4 1512 118 74 DT0 1010 0110 1100 30 1011 DT0 SR9(CY) 0110 1100 1011 0000 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [D]...DT2 [n]...K8 3128 2724 2320 1916 1512 118 74 30 DT2DT3 1110 1101 1001 0011 1010 0110 1100 1011 DT2DT3 1001 SR9(CY) 0011 1010 1010 1100 1011 0000 0000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). SR9 (CY) To be reset if the [n] (no. of shift bits) is larger than the operation unit. In other cases, data in the [n]th bit from the most significant bit are to be set. 8-5 High-level Instructions (Data Shift and Rotation) BSR (Right Shift for n Digits) Ladder diagram R0 BSR.US DT0 K1 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be shifted is stored n The device address where the number of shift digits is stored, or the constant Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 D Integer K *4 U *5 H Real number String Index modification *2 SF DF " " n *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction shifts the data specified by [D] to the right (to the low bit position) for [n] digits (4 bits) (specified in decimal). · Once the data is shifted, [n] digits are filled with 0 from the highest bit before shifting the data. · Only the lower 8 bits in data are available for [n]. · If the operation unit is 16 bits (US, SS), the amount of shift is specified between 1 to 4 digits. · If the operation unit is 32 bits (UL, SL), the amount of shift is specified between 1 to 8 digits. 8-6 BSR (Right Shift for n Digits) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [D]...DT0 [n]...K1 1512 118 74 30 DT0 1010 0110 1100 1011 DT0 0000 1010 0110 1100 Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [D]...DT2 [n]...K2 3128 2724 2320 1916 1512 118 DT2DT3 1110 1101 1001 0011 1010 0110 74 1100 30 1011 DT2DT3 0000 0000 1110 1101 1001 0011 1010 0110 Precautions during programming The digit data that have been shifted out are cleared. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 8-7 High-level Instructions (Data Shift and Rotation) BSL (Left Shift for n Digits) Ladder diagram R0 BSL.US DT0 K1 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be shifted is stored n The device address where the number of shift digits is stored, or the constant Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 D Integer K *4 U *5 H Real number String Index modification *2 SF DF " " n *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction shifts the data specified by [D] to the right (to the low bit position) for [n] digits (4 bits) (specified in decimal). · Once the data is shifted, [n] digits are filled with 0 from the highest bit before shifting the data. · Only the lower 8 bits in data are available for [n]. · If the operation unit is 16 bits (US, SS), the amount of shift is specified between 1 to 4 digits. · If the operation unit is 32 bits (UL, SL), the amount of shift is specified between 1 to 8 digits. 8-8 BSL (Left Shift for n Digits) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [D]...DT0 [n]...K1 1512 118 74 30 DT0 1010 0110 1100 1011 DT0 0110 1100 1011 0000 Example 2) Operation unit: 32 bits (UL, SL) [i]...US,SL [D]...DT2 [n]...K2 3128 2724 2320 1916 1512 118 DT2DT3 1110 1101 1001 0011 1010 0110 74 1100 30 1011 DT2DT3 1001 0011 1010 0110 1100 1011 0000 0000 Precautions during programming The digit data that have been shifted out are cleared. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 8-9 High-level Instructions (Data Shift and Rotation) BITR (Right Shift of Multiple Devices for n Bits) Ladder diagram R0 BITR.bit R4 R27 U3 i D1 D2 n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the devices to be shifted (data format: according to the operation unit) D2 End address of the devices to be shifted (data format: according to the operation unit) n The device address where the number of shift bits is stored, or the constant Available bit devices (: Available) Operand D1 D2 Bit device X Y R L T C P E SR IN OT Specification of bit of word device DT.n LD.n Index modification Available word devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification *1 SF DF " " n *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction shifts the range from [D1] to [D2] to the right by [n] bits. · The starting address of the bit is specified by [D1], and the end address by [D2]. · Once the data is shifted, the pre-shift lower [n] bits of [D1] vanish. The post-shift higher [n] bits of [D2] are padded with 0. · The setting range of [n] is from 0 to 65535 (0 to 15 for CPU units older than Version 4.32). When [n] is 0, no shift takes place. Process details Example) Shift R4 through R27 by 3 bits [D1]...R4 [D2]...R27 [n]...U3 WR2 WR1 WR0 1512 118 74 30 1512 118 74 30 1512 118 74 30 0001 0010 0011 0100 0101 0110 0111 1000 1010 1010 1011 1100 0001 0010 0000 0110 1000 1010 1100 Not Not shifted shifted The shifted bits are padded with 0. 1111 0001 0011 0101 1100 Not shifted 8-10 BITR (Right Shift of Multiple Devices for n Bits) Precautions during programming · In the case of a direct address and index modification address, specify the same device for [D1] and [D2]. At the same time, specify [D2] to be greater than or equal to [D1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. To be set when [n] is greater than or equal to 16. 8-11 High-level Instructions (Data Shift and Rotation) BITL (Left Shift of Multiple Devices for n Bits) Ladder diagram R0 BITL.bit R4 R27 U3 i D1 D2 n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the devices to be shifted (data format: according to the operation unit) D2 End address of the devices to be shifted (data format: according to the operation unit) n The device address where the number of shift bits is stored, or the constant Available bit devices (: Available) Operand D1 D2 Bit device X Y R L T C P E SR IN OT Specification of bit of word device DT.n LD.n Index modification Available word devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 n *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction shifts the range from [D1] to [D2] to the left by [n] bits. · The starting address of the bit is specified by [D1], and the end address by [D2]. · Once the data is shifted, the pre-shift higher [n] bits of [D1] vanish. The post-shift lower [n] bits of [D2] are padded with 0. · The setting range of [n] is from 0 to 65535 (0 to 15 for CPU units older than Version 4.32). When [n] is 0, no shift takes place. Process details Example) Shift R4 through R27 by 3 bits [D1]...R4 [D2]...R27 [n]...U3 WR2 WR1 WR0 1512 118 74 30 1512 118 74 30 1512 118 74 30 0001 0010 0011 0100 0101 0110 0111 1000 1010 1010 1011 1100 0001 0010 1010 Not Not shifted shifted 0010 1011 0011 1100 0100 1101 0101 1000 1100 The shifted bits are padded with 0. Not shifted 8-12 BITL (Left Shift of Multiple Devices for n Bits) Precautions during programming · In the case of a direct address and index modification address, specify the same device for [D1] and [D2]. At the same time, specify [D2] to be greater than or equal to [D1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. To be set when [n] is greater than or equal to 16. 8-13 High-level Instructions (Data Shift and Rotation) WSHR (Right Shift of Block Area for n Words) Ladder diagram R0 WSHR.US DT1 DT7 U3 i D1 D2 n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the shift target D2 End address of the shift target n Number of words to be shifted to the right (Available data range: 0 to 255 words) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *2 U *3 H Real number String Index modification SF DF " " *1 D1 D2 n *1: Only 16-bit devices, and integer constants can be modified (real number constants, and character constants cannot be specified). *2: Can be specified only when the operation unit is signed integer (SS). *3: Can be specified only when the operation unit is unsigned integer (US). Outline of operation · This instruction shifts the area from the address specified by [D1] to the address specified by [D2] to the right by [n] words. · The area from the starting address to the end address of the shift target is shifted to the right by the specified number of shift words. · The specified number of shift words vanishes from the starting address. The specified number of shift words in the end address is padded with H0. · If the specified number of shift words is larger than the shift target range, the entire shift target range is padded with H0000. 8-14 WSHR (Right Shift of Block Area for n Words) Process details Example 1) Operation unit: 16 bits (US) [i]...US [D1]...DT1 [D2]...DT7 [n]...U3 DT9 DT8 DT7 DT6 DT5 5678 1234 EEFF CCDD AABB DT4 8899 DT3 6677 DT2 4455 DT1 2233 DT0 0011 (HEX) DT9 5678 DT8 1234 DT7 DT6 DT5 DT4 DT3 DT2 0000 0000 0000 EEFF CCDD AABB The shifted bits are padded with H 0000. DT1 8899 DT0 0011 (HEX) Example 2) Operation unit: 16 bits (SS) [i]...SS [D1]...DT1 [D2]...DT7 [n]...K2 DT9 DT8 DT7 DT6 DT5 DT4 5678 1234 EEFF CCDD AABB 8899 DT3 6677 DT2 4455 DT1 2233 DT0 0011 (HEX) DT9 5678 DT8 1234 DT7 DT6 DT5 DT4 DT3 DT2 0000 0000 EEFF CCDD AABB 8899 The shifted bits are padded with H 0000. DT1 6677 DT0 0011 (HEX) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. To be set when [n] (specified number of shift words) is out of the available range. 8-15 High-level Instructions (Data Shift and Rotation) WSHL (Left Shift of Block Area for n Words) Ladder diagram R0 WSHL.US DT0 DT6 U3 i D1 D2 n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the shift target D2 End address of the shift target n Number of words to be shifted to the left (Available data range: 0 to 255 words) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *2 U *3 H Real number String Index modification SF DF " " *1 D1 D2 n *1: Only 16-bit devices, and integer constants can be modified (real number constants, and character constants cannot be specified). *2: Can be specified only when the operation unit is signed integer (SS). *3: Can be specified only when the operation unit is unsigned integer (US). Outline of operation · This instruction shifts the area from the address specified by [D1] to the address specified by [D2] to the left by [n] words. · The area from the starting address to the end address of the shift target is shifted to the left by the specified number of shift words. · The specified number of shift words vanishes from the end address. The specified number of shift words in the starting address is padded with H0. · If the specified number of shift words is larger than the shift target range, the entire shift target range is padded with H0000. 8-16 WSHL (Left Shift of Block Area for n Words) Process details Example 1) Operation unit: 16 bits (US) [i]...US [D1]...DT0 [D2]...DT6 [n]...U3 DT9 DT8 DT7 DT6 DT5 DT4 5678 1234 EEFF CCDD AABB 8899 DT3 6677 DT2 4455 DT1 2233 DT0 0011 (HEX) DT9 5678 DT8 DT7 1234 EEFF DT6 6677 DT5 4455 DT4 2233 DT3 0011 DT2 DT1 DT0 0000 0000 0000 (HEX) The shifted bits are padded with H 0000. Example 2) Operation unit: 16 bits (SS) [i]...SS [D1]...DT1 [D2]...DT6 [n]...K2 DT9 DT8 DT7 DT6 DT5 5678 1234 EEFF CCDD AABB DT4 8899 DT3 6677 DT2 4455 DT1 2233 DT0 0011 (HEX) DT9 5678 DT8 DT7 1234 EEFF DT6 8899 DT5 6677 DT4 4455 DT3 2233 DT2 DT1 DT0 0000 0000 0011 (HEX) The shifted bits are padded with H 0000. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. To be set when [n] (specified number of shift words) is out of the available range. 8-17 High-level Instructions (Data Shift and Rotation) WBSR (Right Shift of Block Area for n Digits) Ladder diagram R0 WBSR.US DT1 DT7 U3 i D1 D2 n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the shift target D2 End address of the shift target n Number of digits to be shifted to the right (Available data range: 0 to 255 digits) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *2 U *3 H Real number String Index modification SF DF " " *1 D1 D2 n *1: Only 16-bit devices, and integer constants can be modified (real number constants, and character constants cannot be specified). *2: Can be specified only when the operation unit is signed integer (SS). *3: Can be specified only when the operation unit is unsigned integer (US). Outline of operation · This instruction shifts the area from the address specified by [D1] to the address specified by [D2] to the right by [n] digits. · The area from the starting address to the end address of the shift target is shifted to the right by the specified number of shift digits. · The specified number of shift digits vanishes from the starting address. The specified number of shift digits in the end address is padded with H0. · If the specified number of shift digits is larger than the shift target range, the entire shift target range is padded with H0000. 8-18 WBSR (Right Shift of Block Area for n Digits) Process details Example 1) Operation unit: 16 bits (US) [i]...US [D1]...DT1 [D2]...DT7 [n]...U3 DT9 DT8 DT7 DT6 DT5 DT4 5678 1234 EEFF CCDD AABB 8899 DT3 6677 DT2 4455 DT1 2233 DT0 0011 (HEX) DT9 DT8 DT7 DT6 DT5 DT4 DT3 DT2 DT1 DT0 5678 1234 000E EFFC CDDA ABB8 8996 6774 4552 0011 (HEX) The shifted digits are padded with H0 Example 2) Operation unit: 16 bits (SS) [i]...SS [D1]...DT1 [D2]...DT7 [n]...K5 DT9 DT8 DT7 DT6 DT5 DT4 DT3 DT2 5678 1234 EEFF CCDD AABB 8899 6677 4455 DT1 2233 DT0 0011 (HEX) DT9 DT8 DT7 DT6 DT5 DT4 DT3 DT2 DT1 DT0 5678 1234 0000 0EEF FCCD DAAB B889 9667 7445 0011 (HEX) The shifted digits are padded with H0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. To be set when [n] (specified number of shift digits) is out of the available range. 8-19 High-level Instructions (Data Shift and Rotation) WBSL (Left Shift of Block Area for n Digits) Ladder diagram R0 WBSL.US DT1 DT7 U3 i D1 D2 n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the shift target D2 End address of the shift target n Number of digits to be shifted to the left (Available data range: 0 to 255 digits) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *2 U *3 H Real number String Index modification SF DF " " *1 D1 D2 n *1: Only 16-bit devices, and integer constants can be modified (real number constants, and character constants cannot be specified). *2: Can be specified only when the operation unit is signed integer (SS). *3: Can be specified only when the operation unit is unsigned integer (US). Outline of operation · This instruction shifts the area from the address specified by [D1] to the address specified by [D2] to the left by [n] digits. · The area from the starting address to the end address of the shift target is shifted to the left by the specified number of shift digits. · The specified number of shift digits vanishes from the end address. The specified number of shift digits in the starting address is padded with H0. · If the specified number of shift digits is larger than the shift target range, the entire shift target range is padded with H0000. 8-20 WBSL (Left Shift of Block Area for n Digits) Process details Example 1) Operation unit: 16 bits (US) [i]...US DT9 5678 [D1]...DT1 [D2]...DT7 [n]...U3 DT8 DT7 DT6 DT5 DT4 1234 EEFF CCDD AABB 8899 DT3 6677 DT2 4455 DT1 2233 DT0 0011 (HEX) DT9 DT8 DT7 DT6 DT5 DT4 DT3 DT2 DT1 DT0 5678 1234 FCCD DAAB B889 9667 7445 5223 3000 0011 (HEX) Example 2) Operation unit: 16 bits (SS) [i]...SS [D1]...DT1 [D2]...DT7 [n]...K5 DT9 DT8 DT7 DT6 DT5 DT4 5678 1234 EEFF CCDD AABB 8899 DT3 6677 The shifted digits are padded with H0 DT2 DT1 DT0 4455 2233 0011 (HEX) DT9 DT8 DT7 DT6 DT5 DT4 DT3 DT2 DT1 DT0 5678 1234 CDDA ABB8 8996 6774 4552 2330 0000 0011 (HEX) The shifted digits are padded with H0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. To be set when [n] (specified number of shift digits) is out of the available range. 8-21 High-level Instructions (Data Shift and Rotation) ROR (Right Rotation of Data) Ladder diagram R0 ROR.US DT0 U4 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be rotated is stored n The device address where the number of rotation bits is stored, or the constant (Available data range: 0 to 255) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX D Integer K U H Real number String Index modification *2 SF DF " " n *1 Cannot be specified when the operation unit is 16-bit integer (US). *2 Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction rotates the data specified by [D] to the right (to the low bit position), by the number of bits specified by [n] (decimal specification). · Only the lower 8 bits in data are available for [n]. The rotation amount is specified between 0 and 255 bits. · (Rotation amount - 1) bits are output to SR9 (CY). · When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 16, the rotation amount is regarded as 0, and this instruction is not executed. · When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 32, the rotation amount is regarded as 0, and this instruction is not executed. 8-22 ROR (Right Rotation of Data) Process details Example 1) Operation unit: 16 bits (US) [i]...US [D]...DT0 [n]...U4 1512 118 DT0 1010 0110 74 1100 DT0 1011 1010 0110 30 1011 1100 CY 1 Output bit 3 of the pre-operation data to CY (Output bit 15 of the post-operation data to CY) Example 2) Operation unit: 32 bits (UL) [i]...UL [D]...DT2 [n]...U8 3128 2724 2320 1916 1512 118 DT2DT3 1110 1101 1001 0011 1010 0110 DT2DT3 1100 1011 1110 1101 1001 0011 74 1100 1010 30 1011 0110 CY 1 Output bit 7 of the pre-operation data to CY (Output bit 31 of the post-operation data to CY) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). SR9 (CY) (Rotation amount - 1) bits of the pre-operation data are output. When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 16, the number of rotations is regarded as 0, and no change occurs. When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 32, the rotation amount is regarded as 0, and no change occurs. 8-23 High-level Instructions (Data Shift and Rotation) ROL (Left Rotation of Data) Ladder diagram R0 ROL.US DT0 U4 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be rotated is stored n The device address where the number of rotation bits is stored, or the constant (Available data range: 0 to 255) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification *2 SF DF " " D n *1: Cannot be specified when the operation unit is 16-bit integer (US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction rotates the data specified by [D] to the left (to the high bit position), by the number of bits specified by [n] (decimal specification). · Only the lower 8 bits in data are available for [n]. The rotation amount is specified between 0 and 255 bits. · (Bit length of the operation unit - rotation amount) bits are output to SR9 (CY). · When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 16, the rotation amount is regarded as 0, and this instruction is not executed. · When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 32, the rotation amount is regarded as 0, and this instruction is not executed. 8-24 ROL (Left Rotation of Data) Process details Example 1) Operation unit: 16 bits (US) [i]...US [D]...DT0 [n]...U4 1512 118 DT0 1010 0110 DT0 0110 1100 74 1100 1011 30 1011 1010 CY 0 Output bit 12 of the pre-operation data to CY (Output bit 0 of the post-operation data to CY) Example 2) Operation unit: 32 bits (UL) [i]...UL [D]...DT2 [n]...U8 3128 2724 2320 1916 1512 118 DT2DT3 1110 1101 1001 0011 1010 0110 DT2DT3 1001 0011 1010 0110 1100 1011 74 1100 1110 30 1011 1101 CY 1 Output bit 24 of the pre-operation data to CY (Output bit 0 of the post-operation data to CY) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). SR9 (CY) (Bit length of the operation unit - rotation amount) bits of the pre-operation data are output. When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 16, the number of rotations is regarded as 0, and no change occurs. When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 32, the rotation amount is regarded as 0, and no change occurs. 8-25 High-level Instructions (Data Shift and Rotation) RCR (Right Rotation of Data with Carry-Flag Data) Ladder diagram R0 RCR.US DT0 U4 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be rotated is stored n The device address where the number of rotation bits is stored, or the constant (Available data range: 0 to 255) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification *2 SF DF " " D n *1: Cannot be specified when the operation unit is 16-bit integer (US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction rotates the data specified by [D] to the right (to the low bit position), by the number of bits specified by [n] (decimal specification), with SR9 (CY). · Only the lower 8 bits in data are available for [n]. The rotation amount is specified between 0 and 255 bits. · (Rotation amount - 1) bits are output to SR9 (CY). · When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 17, the rotation amount is regarded as 0, and this instruction is not executed. · When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 33, the rotation amount is regarded as 0, and this instruction is not executed. 8-26 RCR (Right Rotation of Data with Carry-Flag Data) Process details Example 1) Operation unit: 16 bits (US) [i]...US [D]...DT0 [n]...U4 CY...0 1512 118 DT0 1010 0110 DT0 0110 1010 74 1100 0110 30 CY 1011 0 1100 1 Output bit 3 of the pre-operation data to CY Output CY of the pre-operation data to bit 12 Example 2) Operation unit: 32 bits (UL) [i]...UL [D]...DT2 [n]...U8 CY...0 3128 2724 2320 1916 1512 118 DT2DT3 1110 1101 1001 0011 1010 0110 DT2DT3 1001 0110 1110 1101 1001 0011 74 1100 1010 30 CY 1011 0 0110 1 Output bit 7 of the pre-operation data to CY Output CY of the pre-operation data to bit 24 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). SR9 (CY) (Rotation amount - 1) bits of the pre-operation data are output. When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 17, the rotation amount is regarded as 0, and no change occurs. When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 33, the rotation amount is regarded as 0, and no change occurs. 8-27 High-level Instructions (Data Shift and Rotation) RCL (Left Rotation of Data with Carry-Flag Data) Ladder diagram R0 RCL.US DT0 K4 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D The device address where the data to be rotated is stored n The device address where the number of rotation bits is stored, or the constant (Available data range: 0 to 255) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification *2 SF DF " " D n *1: Cannot be specified when the operation unit is 16-bit integer (US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction rotates the data specified by [D] to the left (to the high bit position), by the number of bits specified by [n] (decimal specification), with SR9 (CY). · Only the lower 8 bits in data are available for [n]. The rotation amount is specified between 0 and 255 bits. · (Bit length of the operation unit - rotation amount) bits are output to SR9 (CY). · When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 17, the rotation amount is regarded as 0, and this instruction is not executed. · When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 33, the rotation amount is regarded as 0, and this instruction is not executed. 8-28 RCL (Left Rotation of Data with Carry-Flag Data) Process details Example 1) Operation unit: 16 bits (US) [i]...US [D]...DT0 [n]...K4 CY...0 1512 118 DT0 1010 0110 DT0 0110 1100 74 1100 1011 30 1011 0101 CY 0 0 Output bit 12 of the pre-operation data to CY Output CY of the pre-operation data to bit 3 Example 2) Operation unit: 32 bits (UL) [i]...UL [D]...DT2 [n]...K8 CY...0 3128 2724 2320 1916 1512 118 DT2DT3 1110 1101 1001 0011 1010 0110 74 1100 30 1011 CY 0 DT2DT3 1001 0011 1010 0110 1100 1011 0111 0110 1 Output bit 24 of the pre-operation data to CY Output CY of the pre-operation data to bit 7 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). SR9 (CY) (Bit length of the operation unit - rotation amount) bits of the pre-operation data are output. When the operation unit is 16 bits (US), if [n] is either 0 or a multiple of 17, the rotation amount is regarded as 0, and no change occurs. When the operation unit is 32 bits (UL), if [n] is either 0 or a multiple of 33, the rotation amount is regarded as 0, and no change occurs. 8-29 High-level Instructions (Data Shift and Rotation) CMPR (Data Table Shift-Out and Compress) Ladder diagram R0 CMPR.US DT1 DT7 DT10 i D1 D2 D3 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the buffer D2 End address of the buffer D3 Device address to store the read data Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *1 Integer K U H Real number String Index modification SF DF " " D1 D2 D3 *1: Index register (I0 to IE) Outline of operation · According to the operation unit [i], the instruction transfers [D2] to [D3], and compresses the areas specified by [D1] to [D2]. (Except the data transferred to [D3] at the time of compression) · The data in the specified area, excluding 0, are allocated in descending order from the higher address of the specified area, and the remaining area is cleared to zero. Example of data table shift-out and compress when DT10, DT17 and DT20 are respectively specified for [D1], [D2] and [D3]. [D1] DT10 1 DT11 0 DT12 3 DT13 0 DT14 5 DT15 0 DT16 7 [D2] DT17 8 DT10 0 [D1] DT11 0 DT12 0 DT13 0 DT14 1 DT15 3 DT16 5 DT17 7 [D2] DT20 8 [D3] 8-30 CMPR (Data Table Shift-Out and Compress) Process details 1) The buffer end is transferred to read data. 2) The data are compressed, excluding the data containing buffer end. Example) Operation unit: 16 bits (US, SS) (executed twice) [i]...US,SS [D1]...DT1 [D2]...DT7 [D3]...DT10 First execution DT0 H 1 DT1 H 0 DT2 H 3 DT3 H 0 DT4 H 5 DT5 H 0 DT6 H 7 DT7 H 8 DT8 H 8 Compression DT0 H 0 DT1 H 0 DT2 H 0 DT3 H 0 DT4 H 1 DT5 H 3 DT6 H 5 DT7 H 7 DT8 H 9 Second execution DT0 H 0 DT0 H 0 DT1 H 0 DT1 H 0 DT2 H 0 DT2 H 0 DT3 H 0 Compression DT3 H 0 DT4 H 1 DT4 H 0 DT5 H 3 DT5 H 1 DT6 H 5 DT6 H 3 DT7 H 7 DT7 H 5 DT8 H 9 DT8 H 9 DT10 H 8 Read data move DT10 H 7 Read data move Precautions during programming · In the case of a direct address and index modification address, specify the same device for [D1] and [D2]. At the same time, specify [D2] to be greater than or equal to [D1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. 8-31 High-level Instructions (Data Shift and Rotation) CMPW (Data Table Shift-In and Compress) Ladder diagram R0 CMPW.US DT10 DT0 DT7 i S D1 D2 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Write data D1 Starting address of the buffer D2 End address of the buffer Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K *3 U *4 H Real number String Index modification SF DF " " *1 S D1 D2 *1: Only 16-bit devices, and integer constants can be modified. *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS). *4: Can be specified only when the operation unit is unsigned integer (US). Outline of operation · According to the operation unit of [n], the instruction transfers [S] to [D1], and compresses the areas specified by [D1] to [D2]. · The data in the specified area, excluding 0, are allocated in descending order from the higher address of the specified area, and the remaining area is cleared to zero. Example of data table shift-out and compress when DT10, DT17 and DT20 are respectively specified for [D1], [D2] and [D3]. DT10 1 DT11 0 DT12 3 DT13 0 DT14 5 DT15 0 DT16 7 DT17 0 DT10 0 DT11 0 DT12 0 DT13 0 DT14 9 DT15 3 DT16 5 DT17 7 DT20 9 8-32 CMPW (Data Table Shift-In and Compress) Process details 1) The write data are transferred to the buffer start. (The starting data are overwritten.) 2) The data are compressed in the range from buffer start to buffer end. Example) Operation unit: 16 bits (US, SS) (executed twice) [i]...US,SS [S]...DT10 [D1]...DT0 [D2]...DT7 First execution DT10 9 Second execution DT10 16 Write data move Write data move DT0 1 DT0 0 DT1 0 DT1 0 DT2 3 DT2 0 DT3 0 DT3 0 DT4 5 DT4 9 DT5 0 DT5 3 DT6 7 DT6 5 DT7 0 DT7 7 DT8 9 Compression DT8 9 DT0 0 DT0 0 DT1 0 DT1 0 DT2 DT3 0 DT2 0 0 Compression DT3 16 DT4 9 DT4 9 DT5 3 DT5 3 DT6 5 DT6 5 DT7 7 DT7 7 DT8 9 DT8 9 Precautions during programming · In the case of a direct address and index modification address, specify the same device for [D1] and [D2]. At the same time, specify [D2] to be greater than or equal to [D1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [D1] is larger than [D2]. 8-33 High-level Instructions (Data Shift and Rotation) DEFBUF (Buffer Definition) Ladder diagram R0 DEFBUF.US K128 DT10 i n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description n The device address which specifies the buffer size, or the constant (available data range: 1 to 4096) D Starting device address of the data buffer Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 n D *1: Only 16-bit devices, and integer constants can be modified. *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Integer K *3 U *4 H Real number String Index modification SF DF " " *1 Outline of operation · According to the operation unit [i], the instruction defines the data buffer to be for [n] data starting from the [D] area. · From ([D]+1) (usable size) to ([D]+3) (write pointer) are initialized (cleared to zero). Format of data buffer (FIFO buffer) [D] [D]+1 [D]+2 [D]+3 Buffer size Stored data amount Reading pointer Writing pointer Size of the data buffer area Stored data amount (by operation unit) Relative number from [D]+4 Relative number from [D]+4 Default: [n] (buffer size) Default: H 0000 Default: H 0000 Default: H 0000 Data buffer area * The data buffer area is not cleared. Format of data buffer (LIFO buffer) [S] [S]+1 [S]+2 [S]+3 Buffer size Stored data amount Fixed to 0 LIFO pointer Size of the data buffer area Stored data amount (by operation unit) Fixed to 0 Relative number from [D]+4 Default: [n] (buffer size) Default: H 0000 Default: H 0000 Default: H 0000 Data buffer area * The data buffer area is not cleared. 8-34 DEFBUF (Buffer Definition) Process details 1) [n] (buffer size) is specified in [D] (buffer start). 2) The range from ([D]+1) (stored data amount) to ([D]+3) (writing pointer) is cleared to zero. Example) Operation unit: 16 bits (US, SS) [i]...US,SS [n]...K 128(U 128) [D]...DT0 DT0 K 0 DT1 K 1 DT2 K 2 DT3 K 3 DT4 K 4 DT5 K 5 DT6 K 6 DT7 K 7 DT8 K 8 DT0 K 128 DT1 K 0 DT2 K 0 DT3 K 0 DT4 K 4 DT5 K 5 DT6 K 6 DT7 K 7 DT8 K 8 (Buffer size) (Stored data amount) (Reading pointer) (Writing pointer) Related instructions · FIFR (Read data from the 16- or 32-bit data buffer (First-In-First-Out)) · BUFW (Write data in the 16- or 32-bit data buffer) · LIFR (Read data from the 16- or 32-bit data buffer (Last-In-First-Out)) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n] (buffer size) is out of the available range. To be set when the range [D] (buffer start) + [n] (buffer size) is out of the available range. 8-35 High-level Instructions (Data Shift and Rotation) FIFR (Data Read (First-In-First-Out)) Ladder diagram R0 FIFR.US DT0 DT20 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting device address of the data buffer D Device address of the read data Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K U H Real number String Index modification SF DF " " *1 D *1: Only 16-bit devices, and integer constants can be modified. *2: Index register (I0 to IE) Outline of operation · This instruction reads data from the FIFO buffer specified by [S], and sets it to [D]. (In the [S] buffer area, it is necessary to define buffer first using the DEFBUF instruction.) · Pre-execution buffer consistency check (An operation error occurs in the following cases.) 1) [S] (buffer size) > 4096, or [S] (buffer size) = 0 2) [S]+1 (stored data amount) = 0 3) [S]+1 (stored data amount) > [S] (buffer size) 4) [S]+2 (read pointer) > [S] (buffer size) 5) Buffer area exceeds the upper limit of the specified device. · According to the operation unit [i], the data of the area specified by "[S]+2" (read pointer) are set to [D]. · "[S]+2" (read pointer) is incremented (+1). · After incrementing (+1), if "[S]+2" (read pointer) is [S] (buffer size), 0 is set to "[S]+2" (read pointer). · "[S]+1" (stored data amount) is decremented (-1). Format of data buffer (FIFO buffer) [S] [S]+1 [S]+2 [S]+3 Buffer size Stored data amount Reading pointer Writing pointer Size of the data buffer area Stored data amount (by operation unit) Relative number from [S]+4 Relative number from [S]+4 Data buffer area Process details 1) Set the area specified by ([S]+2) (read pointer) to [D] (read data). 2) Increment (+1) "[S]+2" (read pointer). 3) Decrement (-1) "[S]+1" (stored data amount). 8-36 FIFR (Data Read (First-In-First-Out)) Example) Operation unit: 16 bits (US, SS) [i]...US,SS [S]...DT0 [D]...DT20 [S] DT0 [S]+1 DT1 [S]+2 DT2 [S]+3 DT3 [S]+4 DT4 [S]+5 DT5 [S]+6 DT6 [S]+7 DT7 [S]+8 DT8 K 5 K 4 K 0 K 4 H 101 H 102 H 103 H 104 H 105 (Buffer size) (Stored data amount) (Reading pointer) (Writing pointer) (0th) (1st) (2nd) (3rd) (4th) [S] DT0 [S]+1 DT1 [S]+2 DT2 [S]+3 DT3 [S]+4 DT4 [S]+5 DT5 [S]+6 DT6 [S]+7 DT7 [S]+8 DT8 K 5 K 3 K 1 K 4 H 101 H 102 H 103 H 104 H 105 (Buffer size) (Stored data amount) Decrement (-1) (Reading pointer) Increment (+1) (Writing pointer) (0th) (1st) (2nd) (3rd) (4th) DT20 H 20 DT20 H 101 Because [S]+2 (reading pointer) points at 0, transfer 0th data in the buffer to D. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when [S] (buffer size) is larger than 4096, or [S] (buffer size) is 0. To be set when "[S]+1" (stored data amount) is 0. To be set when "[S]+1" (stored data amount) is larger than [S] (buffer size). To be set when "[S] +2" (read pointer) is greater than or equal to [S] (buffer size). To be set when the buffer area exceeds the upper limit of a specified device. 8-37 High-level Instructions (Data Shift and Rotation) BUFW (Data Write) Ladder diagram R0 BUFW.US DT20 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address of the write data, or the constant D Starting device address of the data buffer Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K *3 U *4 H Real number String Index modification SF DF " " *1 D *1: Only 16-bit devices, and integer constants can be modified. *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction sets the data specified by [S] to the buffer specified by [D]. (In the [D] buffer area, it is necessary to define buffer first using the DEFBUF instruction.) · Pre-execution buffer consistency check (An operation error occurs in the following cases.) 1) [D] (buffer size) > 4096, or [D] (buffer size) = 0 2) [D]+1 (stored data amount) [D] (buffer size) 3) [D]+3 (write pointer) [D] (buffer size) 4) Buffer area exceeds the upper limit of the specified device. · According to the operation unit [i], [S] is set to the area specified by "[D]+3" (write pointer). · "[D]+3" (write pointer) is incremented (+1). · After incrementing (+1), if "[D]+3" (write pointer) is [S] (buffer size), · 0 is set to "[D]+3" (write pointer). · "[S]+1" (stored data amount) is incremented (+1). Format of data buffer (FIFO) [D] [D]+1 [D]+2 [D]+3 Buffer size Stored data amount Reading pointer Writing pointer Size of the data buffer area Stored data amount (by operation unit) Relative number from [D]+4 Relative number from [D]+4 Data buffer area 8-38 BUFW (Data Write) Process details 1) Set [S] (write data) to the area specified by "[D]+3" (write pointer). 2) Increment (+1) "[D]+3" (write pointer). 3) Increment (+1) "[D]+1" (stored data amount). Example) 16 bits (US, SS) [i]...US,SS [S]...DT20 [D]...DT0 [D] DT0 5 (Buffer size) [D] DT0 5 (Buffer size) [D]+1 DT1 3 (Stored data amount) [D]+1 DT1 4 (Stored data amount) Increment (+1) [D]+2 DT2 0 (Reading pointer) [D]+2 DT2 0 (Reading pointer) [D]+3 DT3 3 (Writing pointer) [D]+3 DT3 4 (Writing pointer) Increment (+1) [D]+4 DT4 101 (0th) [D]+4 DT4 101 (0th) [D]+5 DT5 102 (1st) [D]+5 DT5 102 (1st) [D]+6 DT6 103 (2nd) [D]+6 DT6 103 (2nd) [D]+7 DT7 104 (3rd) [D]+7 DT7 201 (3rd) [D]+8 DT8 105 (4th) [D]+8 DT8 105 (4th) Because [D]+3 (writing pointer) points at 3, [S] is transferred to the 3rd area of the buffer. DT20 201 DT20 201 Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when [D] (buffer size) is larger than 4096, or [D] (buffer size) is 0. To be set when [D] +1 (stored data amount) is greater than or equal to [D] (buffer size). To be set when [D] +3 (write pointer) is greater than or equal to [D] (buffer size). To be set when the buffer area exceeds the upper limit of a specified device. 8-39 High-level Instructions (Data Shift and Rotation) LIFR (Data Read (Last-In-First-Out)) Ladder diagram R0 LIFR.US DT0 DT20 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting device address of the data buffer D Device address of the read data Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S D *1: Only 16-bit devices, and integer constants can be modified. *2: Index register (I0 to IE) Integer K U H Real number String Index modification SF DF " " *1 Outline of operation · This instruction reads data from LIFO buffer specified by [S], and sets it to [D]. (In the [S] buffer area, it is necessary to define buffer first using the DEFBUF instruction.) · Pre-execution buffer consistency check (An operation error occurs in the following cases.) 1) [S] (buffer size) > 4096, or [S] (buffer size) = 0 2) [S]+1 (stored data amount) = 0 3) [S]+2 0 4) [S]+1 (stored data amount) > [S] (buffer size) 5) [S] + 3 (LIFO pointer) [S] (buffer size) 6) Buffer area exceeds the upper limit of the specified device. · If "[S]+3" (LIFO pointer) is 0, set [S] (buffer size) to "[S]+3" (LIFO pointer). · "[S]+3" (LIFO pointer) is decremented (-1). · According to the operation unit [i], the data of the area specified by "[S]+3" (LIFO pointer) are set to [D]. · "[S]+1" (stored data amount) is decremented (-1). Format of data buffer (LIFO) [S] [S]+1 [S]+2 [S]+3 Buffer size Stored data amount Fixed to 0 LIFO pointer Size of the data buffer area Stored data amount (by operation unit) Fixed to 0 Relative number from [S]+4 Data buffer area 8-40 LIFR (Data Read (Last-In-First-Out)) Process details 1) Decrement (-1) "[S]+3" (LIFO pointer). 2) Set the data of the area specified by "[S]+3" (LIFO pointer) to [D] (read data). 3) Decrement (-1) "[S]+1" (stored data amount). Example) 16 bits (US, SS) [i]...US,SS [S]...DT0 [D]...DT20 [S] DT0 [S]+1 DT1 [S]+2 DT2 [S]+3 DT3 [S]+4 DT4 [S]+5 DT5 [S]+6 DT6 [S]+7 DT7 [S]+8 DT8 K 5 K 4 K 0 K 4 H 101 H 102 H 103 H 104 H 105 (Buffer size) [S] DT0 (Stored data amount) [S]+1 DT1 - [S]+2 DT2 (LIFO pointer) [S]+3 DT3 (0th) [S]+4 DT4 (1st) [S]+5 DT5 (2nd) [S]+6 DT6 (3rd) [S]+7 DT7 (4th) [S]+8 DT8 K 5 K 3 K 0 K 3 H 101 H 102 H 103 H 104 H 105 (Buffer size) (Stored data amount) Decrement (-1) - (LIFO pointer) (0th) (1st) Decrement (-1) (2nd) (3rd) (4th) DT20 H 10 DT20 H 104 Because [S]+3 (LIFO pointer) points at 3, transfer 3rd data in the buffer to [D]. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when [S] (buffer size) is larger than 4096, or [S] (buffer size) is 0. SR7 SR8 (ER) To be set when "[S]+1" (stored data amount) is 0. To be set when "[S]+2" is other than 0. To be set when "[S]+1" (stored data amount) is larger than [S] (buffer size). To be set when [S] +3 (LIFO pointer) is greater than or equal to [S] (buffer size). To be set when the buffer area exceeds the upper limit of a specified device. 8-41 High-level Instructions (Data Shift and Rotation) DEFRBUF (Ring Buffer Definition) Ladder diagram R0 DEFRBUF U4 DT0 n D List of operands Operand Description n Device address storing the buffer size or the constant (available range: 1 to 30000) D Starting device address of a ring buffer Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX n D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction defines a ring buffer that has storage areas for a total value and a moving average value, and creates a ring buffer for [n] data in the area that starts with [D]. · 16-bit integer values can be stored in the buffer. · Use the RBUFW instruction to write data into a ring buffer that is defined by this instruction. · When the number of stored data reaches the buffer size, the next data is written from the beginning of the ring buffer and the previous values are overwritten. Structure of ring buffer Name Data type [D] Buffer size Unsigned 16-bit integer [D+1] [D+2] [D+3] [D+4] [D+5] Number of stored data Unsigned 16-bit integer Total value Signed 32-bit integer Moving average value Single-precision floating point real number (32-bit) [D+6] Write pointer [D+7] ---[D+7+n-1] Buffer data Area Unsigned 16-bit integer Unsigned 16-bit integer Signed 16-bit integer Description The size of the ring buffer area is stored when the DEFRBUF instruction is executed. The amount of data that is stored in the buffer data area is stored. The value is reset to 0 when the DEFRBUF instruction is executed. The total value of the stored data is stored. The value is reset to 0 when the DEFRBUF instruction is executed. The moving average value of the stored data is stored as a single-precision floating point real number. The value is reset to 0 when the DEFRBUF instruction is executed. The relative number from [D+7] is stored. The value is reset to 0 when the DEFRBUF instruction is executed. The value is incremented when data is written by the RBUFW instruction. The value returns to 0 when the RBUFW instruction is executed at the end of the data area. Data is written by the RBUFW instruction. 8-42 DEFRBUF (Ring Buffer Definition) Process details 1) [n] (buffer size) is specified in [D] (buffer start). 2) The range from ([D+1]) (stored data amount) to ([D+6]) (write pointer) is cleared to zero. Example) n=U4, D=DT0 DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 K 0 K 1 K 2 K 3 K 4 K 5 K 6 K 7 K 8 K 9 K 10 DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 U 4 Buffer size U 0 Stored data amount K 0 Total SF 0.0 Average U 0 Write pointer K 5 K 6 K 7 K 8 Precautions during programming · When this instruction is executed, data in the ring buffer area is not cleared. Use a data transfer instruction or other instructions to reset the area, if necessary. · Do not use other instructions than the RBUFW instruction to write data into the ring buffer. If other instructions are used, the correctness of the total value and the moving average value is not guaranteed. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n] (buffer size) is out of the available range. To be set when the range of [D (the beginning of a buffer) + n (buffer size)] is out of the accessible range. 8-43 High-level Instructions (Data Shift and Rotation) RBUFW (Write to Ring Buffer, Calculation of Total Value and Moving Average Value) Ladder diagram R0 RBUFW.US DT20 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S The device address storing written data, or the constant D Starting device address of a ring buffer Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D *1: Can be specified only when the operation unit is signed integer (SS). *2: Can be specified only when the operation unit is unsigned integer (US). Integer K U H *1 *2 Real number String Index modification SF DF " " Outline of operation · This instruction writes data to the buffer data area of the ring buffer that is defined by the DEFRBUF instruction, and calculates the total value and the moving average value. · This instruction writes the data specified by [S] to the buffer data area of the ring buffer that starts from [D]. · This instruction stores the total value of the data in [D+2, D+3] and the moving average value in [D+4, D+5]. · [D+1] (stored data amount) and [D+6] (write pointer) are incremented (+1). · After incrementing, if [D+6] (write pointer) is equal to [D] (buffer size), [D+6] (write pointer) is set to 0. When this instruction is executed the next time, the data is overwritten from the beginning of the ring buffer area. However, the area [D+1] for the stored data amount is not changed. Precautions during programming · According to the operation unit [i], set the value of [S] that is written to the buffer data area. 8-44 RBUFW (Write to Ring Buffer, Calculation of Total Value and Moving Average Value) Process details Example 1) When data is written once by the RBUFW instruction with the buffer size of 5 [S]...DT20 [D]...DT0 [D] DT0 [D+1] DT1 [D+2] DT2 [D+3] DT3 [D+4] DT4 [D+5] DT5 [D+6] DT6 [D+7] DT7 [D+8] DT8 [D+9] DT9 [D+10] DT10 [D+11] DT11 U 5 U 0 K 0 SF 0.0 U 0 K 1 K 1 K 3 K 2 K 5 [D] DT0 U 5 [D+1] DT1 U 1 [D+2] DT2 [D+3] DT3 K 33 [D+4] DT4 [D+5] DT5 SF 3.30E+01 [D+6] DT6 U 1 [D+7] DT7 K 33 [D+8] DT8 K 1 [D+9] DT9 K 3 [D+10] DT10 K 2 [D+11] DT11 K 5 Buffer size Amount of stored data Total value Moving average value Write pointer 0th First Second Third Fourth [S] DT20 K 33 Example 2) When data is written five times by the RBUFW instruction with the buffer size of 5 [S]...DT20 [D]...DT0 [D] DT0 U 5 [D+1] DT1 U 4 [D+2] DT2 [D+3] DT3 K 206 [D+4] DT4 [D+5] DT5 SF 5.15E+01 [D+6] DT6 U 4 [D+7] DT7 K 33 [D+8] DT8 K 67 [D+9] DT9 K 54 [D+10] DT10 K 52 [D+11] DT11 K 5 [D] DT0 U 5 [D+1] DT1 U 5 [D+2] DT2 [D+3] DT3 K 261 [D+4] DT4 [D+5] DT5 SF 5.22E+01 [D+6] DT6 U 0 [D+7] DT7 K 33 [D+8] DT8 K 67 [D+9] DT9 K 54 [D+10] DT10 K 52 [D+11] DT11 K 55 Buffer size Amount of stored data Total value Moving average value Write pointer 0th First Second Third Fourth [S] DT20 K 55 Example 3) When data is written six times by the RBUFW instruction with the buffer size of 5 [S]...DT20 [D]...DT0 [D] DT0 U 5 [D+1] DT1 U 5 [D+2] DT2 [D+3] DT3 K 261 [D+4] DT4 [D+5] DT5 SF 5.22E+01 [D+6] DT6 U 0 [D+7] DT7 K 33 [D+8] DT8 K 67 [D+9] DT9 K 54 [D+10] DT10 K 52 [D+11] DT11 K 55 [D] DT0 U 5 [D+1] DT1 U 5 [D+2] DT2 [D+3] DT3 K 298 [D+4] DT4 [D+5] DT5 SF 5.96E+01 [D+6] DT6 U 1 [D+7] DT7 K 70 [D+8] DT8 K 67 [D+9] DT9 K 54 [D+10] DT10 K 52 [D+11] DT11 K 55 Buffer size Amount of stored data Total value Moving average value Write pointer 0th First Second Third Fourth [S] DT20 K 70 8-45 High-level Instructions (Data Shift and Rotation) Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when [D] (buffer size) is larger than 30000, or [D] (buffer size) is 0. To be set when [D+1] (stored data amount) is larger than [D] (buffer size). To be set when [D+6] (write pointer) is greater than or equal to [D] (buffer size). To be set when the buffer area exceeds the upper limit of a specified device. 8-46 9 9 High-level Instructions (Bit Manipulation) Applicable Models: All Models High-level Instructions (Bit Manipulation) BTS (16-bit Data Specified Bit Set) Ladder diagram R0 BTS.US DT1 U7 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Device address of target data n Bit number (device address or constant) (available range: 0 to 15) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 D n *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction turns ON (1) the [n]th bit in the area specified by [D]. · Other bits except the bit specified by [n] do not change. · This instruction specifies [n] within the range of U0 to U15. Process details The [n]th bit of the target data is set. Example 1) Specifying a constant for the bit number [D]...DT0 [n]...U7 Bits F E D C B A 9 8 7 6 5 4 3 2 1 0 DT0 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 Bits F E D C B A 9 8 7 6 5 4 3 2 1 0 DT0 0 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 Example 2) Specifying a device for the bit number [D]...DT1 [n]...DT0 F E D C B A 9 8 7 6 5 4 3 2 1 0 DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 U8 DT1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 DT1 0 1 0 1 1 0 0 1 0 1 1 1 0 0 0 0 9-2 BTS (16-bit Data Specified Bit Set) Precautions during programming The conventional models (such as FP2 or FP2SH) operate with only the lower four bits as valid even when the specified operand [n] is out of the available range. For FP7, an operation error occurs when the specified value is out of the range. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n] is out of the range. 9-3 High-level Instructions (Bit Manipulation) BTR (16-bit Data Specified Bit Reset) Ladder diagram R0 BTR.US DT1 U7 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Device address of target data n Bit number (device address or constant) (available range: 0 to 15) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 D n *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction turns OFF (0) the [n]th bit in the area specified by [D]. · Other bits except the bit specified by [n] do not change. · This instruction specifies [n] within the range of U0 to U15. Process details Example 1) Specifying a constant for the bit number [D]...DT0 [n]...U4 F E D C B A 9 8 7 6 5 4 3 2 1 0 DT0 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 DT0 0 1 0 1 1 0 0 0 0 1 1 0 0 0 0 0 Example 2) Specifying a device for the bit number [D]...DT1 [n]...DT0 Bits F E D C B A 9 8 7 6 5 4 3 2 1 0 DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 U5 DT1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 Bits F E D C B A 9 8 7 6 5 4 3 2 1 0 DT1 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 0 9-4 BTR (16-bit Data Specified Bit Reset) Precautions during programming The conventional models (such as FP2 or FP2SH) operate with only the lower four bits as valid even when the specified operand [n] is out of the available range. For FP7, an operation error occurs when the specified value is out of the range. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n] is out of the range. 9-5 High-level Instructions (Bit Manipulation) BTI (Bit Inversion) Ladder diagram R0 BTI.US DT0 U7 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Inversion target data (device address) n Bit number (device address or constant) (available data range: 0 to 15) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K U H Real number String Index modification SF DF " " *1 D *1: Only 16-bit devices and integer constants can be modified. *2: Index register (I0 to IE) Outline of operation · This instruction inverts the [n]th bit in the area specified by [D] according to the operation unit of [i]. Process details Example) Operation unit: 16 bits (US) [i]...US [D]...DT0 [n]...U7 <Invert Bit 7> DT0 Bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 DT0 Bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n] is out of the range. 9-6 BTT (Bit Test) BTT (Bit Test) Ladder diagram R0 BTT.US DT0 U3 i D n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D Test target data (device address) n Bit number (device address or constant) (available data range: 0 to 15) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX D n Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction tests the [n]th bit in the area specified by [D] (ON/OFF judgment) according to the operation unit [i], and outputs the result to SRB(=). State of the specified bit ON (1) OFF (0) SRB (= flag) OFF (0) ON (1) Process details Example 1 Operation unit: 16 bits (US) (SRB is OFF) [i]...US [D]...DT0 [n]...U3 DT0 Bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 0 1 1 0 0 0 0 1 1 1 1 0 0 0 Flag operation during execution State of the specified bit SRB() ON(1) OFF(0) Example 2) Operation unit: 16 bits (US) (SRB is ON) [i]...US [D]...DT0 [n]...U3 DT0 Bit F E D C B A 9 8 7 6 5 4 3 2 1 0 BIN 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 Flag operation during execution State of the specified bit SRB() OFF(0) ON(1) Flag operations Name Description SR7, SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [n] is out of the range. SRB (=) To be set when the test bit (Bit [n]) is '0'. To be reset when the test bit (Bit [n]) is '1'. 9-7 High-level Instructions (Bit Manipulation) STC (Carry-Flag Set) Ladder diagram R0 Outline of operation This instruction turns ON SR9 (CY). Flag operations Name Description SR9 (CY) To be set after this instruction is executed. STC 9-8 CLC (Carry-Flag Reset) Ladder diagram R0 Outline of operation This instruction turns OFF SR9 (CY). Flag operations Name Description SR9 (CY) To be reset after this instruction is executed. CLC (Carry-Flag Reset) CLC 9-9 High-level Instructions (Bit Manipulation) 9-10 10 10 High-Level Instruction (Data Processing Control) Applicable Models: All Models High-Level Instruction (Data Processing Control) SRC (Data Search) Ladder diagram R0 SRC.US DT10 DT20 DT30 DT40 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Device address where the search data is stored, or the constant (data format: according to the operation unit) S2 Starting position of the search range (data format: according to the operation unit) S3 End position of the search range (data format: according to the operation unit) D Device address to store the search result (data format: unsigned 32-bit integer) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S1 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S2 S3 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction searches the range specified by [S2] and [S3] for the search data specified by [S1]. · The search result is given in the data format of unsigned 32-bit integer, and stored as follows. 16-bit device [D], [D]+1 [D]+2[D]+3 32-bit device [D] [D]+1 Description of output Store the number of data with the same value in a decimal form Store the position of the first matching data (relative position with the first data as '0') · The maximum amount of data that can be specified is 30000. · Search is executed from [S2] to [S3]. 10-2 Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT10 [S2]...DT20 [S3]...DT40 [D]...DT100 <Search data> DT10 H 1234 <Search range> DT20 DT21 DT22 DT23 H 1211 H 12FF H 1234 H FFF Relative position 0 1 2 3 SRC (Data Search) DT38 DT39 DT40 H 1234 H 6677 H 1234 <Area specified by D> DT100DT101 K 3 DT102DT103 K 2 18 19 20 The amount of search data is set for DT100DT101 The relative position of the first match is set for DT102DT103 ([D] , [D]+1) ([D]+2 , [D]+3) Example 2) Operation unit: 32 bits (UL, SL, SF) [i]...UL,SL,SF [S1]...DT0 [S2]...DT10 [S3]...DT90 [D]...DT100 <Search data> DT0DT1 H 11223344 <Search range> DT10DT11 H 11111111 DT12DT13 H CCDDEEFF DT14DT15 H 9900AABB DT16DT17 H 11223344 Relative position 0 1 2 3 DT86DT87 H 55667788 38 DT88DT89 H 11223344 39 DT90DT91 H CCDDEEFF 40 The amount of search data is set for DT100DT101 The relative position of the first match is set for DT102DT103 <Area specified by D> DT100DT101 K 2 DT102DT103 K 3 ([D] ,[D]+1) ([D]+2,[D]+3) 10-3 High-Level Instruction (Data Processing Control) Precautions during programming · The end position of the search range is the device that contains [S3]. Example) When the operation unit is specified as 32 bits, the search range becomes the same whether a higher or lower address is specified for the [S3] device address. [S2]...DT2 [S3]...DT6 [S2]...DT2 [S3]...DT6 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Search targets DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Search targets Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range values in indirect access (index modification). To be set when [S2] is larger than [S3]. To be set when the [S2] area and the [S3] area differ. 10-4 BCU (ON Bits Count) BCU (ON Bits Count) Ladder diagram R0 BCU.US DT10 DT20 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Target device address or the constant (data format: according to the operation unit) D Device address to store the result (data format: unsigned 16-bit integer) Available devices (: Available) 16-bit 32-bit device device *1 Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *2 S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This function counts the number of ON bits (bits whose value is 1) in the data specified by [S], and stores the result in the device address specified by [D]. · The result is stored as an unsigned 16-bit integer. Process details Example 1) Operation units: 16 bits (US) [i]...US [S1]...DT10 [D]...DT20 1512 118 74 30 DT10 0000 0001 0011 0101 DT20 5 Example 2) Operation units: 32 bits (UL) (specify a 16-bit device for [S]) [i]...UL [S1]...DT10 [D]...DT20 1512 118 DT10 0000 0001 DT11 1110 0100 74 0011 0101 30 0101 0100 DT20 12 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 10-5 High-Level Instruction (Data Processing Control) MAX (Acquiring the Maximum Value) Ladder diagram R0 MAX.US DT10 DT20 DT100 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting position of the search range for the maximum value (data format: according to the operation unit) S2 End position of the search range for the maximum value (data format: according to the operation unit) D Device address to store the result of the search for the maximum value (data format: according to the operation unit) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · The range of the device areas specified by [S1] and [S2] is searched for the maximum value. · The resulting value is stored in the device area specified by [D], and the relative address value from [S1] is stored in [n]. · The relative address storage position ([D]+[n]) varies with the operation unit. · The maximum amount of data that can be specified is 30000. · [D] is in the following format according to the operation unit. Operation unit Device size Result storage area 16 bits (US, SS) 16 bits [D] 32 bits Not available [D+1] to [D+2] Not available 32 bits (UL, SL, SF) 16 bits [D] to [D+1] 32 bits [D] [D+2] to [D+3] [D+1] 64 bits (DF) 16 bits [D] to [D+3] 32 bits [D] to [D+1] [D+4] to [D+5] [D+2] Output content Stores the maximum value. Position of the first detected maximum value; Relative position with the start of [S1] as 0. 10-6 MAX (Acquiring the Maximum Value) Process details Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT10 [S2]...DT20 [D]...DT100 <Max. value search range> DT10 DT11 DT12 DT13 H 1211 H 0101 H 3412 H 1234 Relative position 0 1 2 3 <Output result> DT100 H 3412 * Unsigned 16-bit integer ([D] ) DT18 H 0101 8 DT101DT102 U 2 ([D]+1 , [D]+2) DT19 H 3412 9 DT20 H 1234 10 * Unsigned 32-bit integer Example 2) Operation unit: 16 bits (SS) [i]...SS [S1]...DT10 [S2]...DT20 [D]...DT100 <Max. value search range> DT10 DT11 DT12 DT13 K 10 K -12 K 32 K 0 Relative position 0 1 2 3 <Output result> DT100 K 32 * Signed 16-bit integer ([D] ) DT18 DT19 DT20 K 5 K -33 K -21 8 DT101DT102 U 2 ([D]+1 , [D]+2) 9 10 * Unsigned 32-bit integer 10-7 High-Level Instruction (Data Processing Control) Example 3) Operation unit: 32 bits (UL) (specify a 32-bit device) [i]...UL [S1]...TS10 [S2]...TS50 [D]...TS100 <Max. value search range> Relative position <Output result> TS10 TS11 TS12 TS13 H 11111111 H CCDDEEFF H 9900AABB H 1234 0 1 2 3 TS100 H FFFFFFFF * Unsigned 32-bit integer ([D] ) TS48 TS49 TS50 H 55667788 H FFFFFFFF H 9900AABB 38 39 40 TS101 U 39 ([D]+1) * Unsigned 32-bit integer Example 4) Operation unit: 32 bits (SL) (specify a 32-bit device) [i]...SL [S1]...TS10 [S2]...TS50 [D]...TS100 <Max. value search range> Relative position <Output result> TS10 TS11 TS12 TS13 K 200 K -100 K 100 K 0 0 1 2 3 TS100 K 300 * Signed 16-bit integer ([D] ) TS48 TS49 TS50 K 300 K -300 K -400 38 39 40 TS101 U 38 ([D]+1) * Unsigned 32-bit integer Example 5) Operation unit: 32 bits (UL) (specify a 16-bit device) [i]...UL [S1]...DT10 [S2]...DT30 [D]...DT100 <Max. value search range> Relative position <Output result> DT10DT11 DT12DT13 DT14DT15 DT16DT17 H 1234FFFF H 789A3456 H 9900AABB H 12345678 0 DT100DT101 H AAAA0000 1 2 * Unsigned 32-bit integer 3 ([D] , [D]+1 ) DT26DT27 DT28DT29 DT30DT31 H 55667788 H 9900AABB H AAAA0000 8 9 DT102DT103 U 10 ([D]+2 , [D]+3) * Unsigned 32-bit integer 10 10-8 MAX (Acquiring the Maximum Value) Example 6) Operation unit: 32 bits (SL) (specify a 16-bit device) [i]...SL [S1]...DT10 [S2]...DT30 [D]...DT100 <Max. value search range> DT10DT11 DT12DT13 DT14DT15 DT16DT17 K -10 K -20 K 100 K 0 Relative position <Output result> 0 DT100DT101 K 200 1 2 * Signed 32-bit integer 3 ([D] , [D]+1 ) DT26DT27 DT28DT29 DT30DT31 K 200 K -300 K -400 DT102DT103 U 8 ([D]+2 , [D]+3) 8 * Unsigned 32-bit integer 9 10 Example 7) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S1]...DT10 [S2]...DT90 [D]...DT100 <Max. value search range> Relative position <Output result> DT10DT11 DT12DT13 DT14DT15 DT16DT17 SF 1.11 SF 3.33 SF 2.22 SF 4.44 0 DT100DT101 SF 5.55 ([D] , [D]+1 ) 1 2 3 * Single precision floating point real number (32 bits) DT86DT87 DT88DT89 DT90DT91 SF 5.55 SF 1.11 SF 3.33 38 DT102DT103 U 38 ([D]+2 , [D]+3) 39 * Unsigned 32-bit integer 40 Precautions during programming · The end position of the search range for the maximum value is the device that contains [S2]. Example) When the operation unit is specified as 32 bits, the max. value search range becomes the same whether a higher or lower address is specified for the [S2] device address. [S1]...DT2 [S2]...DT6 [S1]...DT2 [S2]...DT7 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Max. value search range DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Max. value search range · Data is overwritten if [D] (search result for maximum value) is specified within the search range for the maximum value. Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the [S1] device and the [S2] device differ. 10-9 High-Level Instruction (Data Processing Control) MIN (Acquiring the Minimum Value) Ladder diagram R0 MIN.US DT10 DT20 DT100 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting position of the search range for the minimum value (data format: according to the operation unit) S2 End position of the search range for the minimum value (data format: according to the operation unit) D Device address to store the result of the search for the minimum value (data format: according to the operation unit) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · The range of the device areas specified by [S1] and [S2] is searched for the minimum value. The resulting value is stored in the device area specified by [D], and the relative address value from [S1] is stored in [D]+[n]. · The relative address storage position ([D]+[n]) varies with the operation unit. · The maximum amount of data that can be specified is 30,000. · [D] is in the following format according to the operation unit. Operation unit Device size Result storage area 16 bits (US, SS) 16 bits [D] 32 bits Not available [D+1] to [D+2] Not available 32 bits (UL, SL, SF) 16 bits [D] to [D+1] 32 bits [D] [D+2] to [D+3] [D+1] 64 bits (DF) 16 bits [D] to [D+3] 32 bits [D] to [D+1] [D+4] to [D+5] [D+2] Output content Stores the minimum value Position of the first detected maximum value; Relative position with the start of [S1] as 0. 10-10 MIN (Acquiring the Minimum Value) Process details Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT10 [S2]...DT20 [D]...DT100 <Min. value search range> DT10 DT11 DT12 DT13 H 1211 H 0101 H 3412 H 1234 Relative position 0 1 2 3 <Output result> DT100 H 0101 * Unsigned 16-bit integer ([D] ) DT18 H 0101 8 DT19 H 3412 9 DT20 H 1234 10 DT101DT102 U 1 ([D]+1 , [D]+2) * Unsigned 32-bit integer Example 2) Operation unit: 16 bits (SS) [i]...SS [S1]...DT10 [S2]...DT20 [D]...DT100 <Max. value search range> Relative position DT10 DT11 DT12 DT13 K 10 K -12 K 32 K 0 0 1 2 3 <Output result> DT100 K -33 * Signed 16-bit integer ([D] ) DT18 DT19 DT20 K 5 K -33 K -21 8 DT101DT102 U 9 ([D]+1 , [D]+2) 9 10 * Unsigned 32-bit integer 10-11 High-Level Instruction (Data Processing Control) Example 3) Operation unit: 32 bits (UL) (specify a 32-bit device) [i]...UL [S1]...TS10 [S2]...TS50 [D]...TS100 <Min. value search range> Relative position <Output result> TS10 H 11111111 0 TS11 H CCDDEEFF 1 TS12 H 9900AABB 2 TS13 H 12345678 3 TS100 H 11111111 * Unsigned 32-bit integer ([D] ) TS48 H 55667788 38 TS49 H FFFFFFFF 39 TS50 H 9900AABB 40 TS101 U0 ([D]+1) * Unsigned 32-bit integer Example 4) Operation unit: 32 bits (SL) (specify a 32-bit device) [i]...SL [S1]...TS10 [S2]...TS50 [D]...TS100 <Max. value search range> TS10 TS11 TS12 TS13 K 200 K -100 K 100 K 0 Relative position 0 1 2 3 <Output result> TS100 K -400 * Signed 16-bit integer ([D] ) TS48 TS49 TS50 K 300 K -300 K -400 TS101 U 40 ([D]+1) 38 * Unsigned 32-bit integer 39 40 Example 5) Operation unit: 32 bits (UL) (specify a 16-bit device) [i]...UL [S1]...DT10 [S2]...DT30 [D]...DT100 <Max. value search range> Relative position <Output result> DT10DT11 DT12DT13 DT14DT15 DT16DT17 H 1234FFFF H 789A3456 H 9900AABB H 12345678 0 DT100DT101 H 121112FF 1 2 * Unsigned 32-bit integer 3 ([D] , [D]+1 ) DT26DT27 DT28DT29 DT30DT31 H 121112FF H 9900AABB H AAAA0000 8 9 DT102DT103 U 8 ([D]+2 , [D]+3) * Unsigned 32-bit integer 10 10-12 MIN (Acquiring the Minimum Value) Example 6) Operation unit: 32 bits (SL) (specify a 16-bit device) [i]...SL [S1]...DT10 [S2]...DT30 [D]...DT100 <Max. value search range> Relative position <Output result> DT10DT11 DT12DT13 DT14DT15 DT16DT17 K -10 K -20 K 100 K -500 0 DT100DT101 K -500 1 2 * Signed 32-bit integer 3 ([D] , [D]+1 ) DT26DT27 DT28DT29 DT30DT31 K 200 K -300 K -400 DT102 , DT103 U 3 ([D]+2 , [D]+3) 8 * Unsigned 32-bit integer 9 10 Example 7) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S1]...DT10 [S2]...DT90 [D]...DT100 <Min. value search range> Relative position <Output result> DT10DT11 DT12DT13 DT14DT15 DT16DT17 SF 1.11 SF 3.33 SF 2.22 SF 4.44 0 DT100DT101 SF 1.11 ([D] , [D]+1 ) 1 * Single precision floating point real 2 number (32 bits) 3 DT86DT87 SF 5.55 38 DT102DT103 U 0 ([D]+2 , [D]+3) DT88DT89 SF 1.11 39 * Unsigned 32-bit integer DT90DT91 SF 3.33 40 Precautions during programming · The end position of the search range for the minimum value is the device that contains [S2]. Example) When the operation unit is specified as 32 bits, the min. value search range becomes the same whether a higher or lower address is specified for the [S2] device address. [S1]...DT2 [S2]...DT6 [S1]...DT2 [S2]...DT7 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Min. value search range DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Min. value search range · Data is overwritten if [D] (search result for minimum value) is specified within the search range for the maximum value. Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the [S1] device and the [S2] device differ. 10-13 High-Level Instruction (Data Processing Control) MEAN (Acquiring the Total and the Mean Value) Ladder diagram R0 MEAN.US DT10 DT14 DT100 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting position of the target area (data format: according to the operation unit) S2 End position of the target area (data format: according to the operation unit) D Device address to store the result (data format: according to the operation unit) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S1 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction stores the total and mean values within the device areas specified by [S1] and [S2] in the device area specified by [D]. · The storage position of the total and the mean values, with [D] as the starting address, varies with the operation unit. · The total value uses twice the area size of the operation unit, and the mean value uses the same area size as the operation unit. Note that, in the case of floating point real number (SF), the total value also uses the same area size as the operation units. · The maximum amount of data that can be specified is 30,000. · When the operation unit is US, SS, UL or SL, the mean value is given as an integer rounding the first decimal point down. · [D] is in the following format according to the operation unit. Operation unit Device size Result storage area 16 bits (US, SS) 16 bits [D] to [D+1] [D+2] 32 bits Not available Not available 32 bits (UL, SL) 16 bits [D] to [D+3] [D+4] to [D+5] 32 bits [D] to [D+1] [D+2] 32 bits (SF) 16 bits [D] to [D+1] [D+2] to [D+3] 32 bits [D] [D+1] 64 bits (DF) 16 bits [D] to [D+3] [D+4] to [D+7] 32 bits [D] to [D+1] [D+2] to [D+3] Output content Total value Mean value 10-14 MEAN (Acquiring the Total and the Mean Value) Process details Example 1) Operation unit: 16 bits (US) Total value is given in 32-bit data, and the mean value is given in 16-bit data. [i]...US [S1]...DT10 [S2]...DT14 [D]...DT100 <Total/mean calculation range> <Output result> DT10 DT11 DT12 DT13 DT14 Value H 1111 H 5555 H 7777 H AAAA H FFFF Value DT100DT101 H 00028886 * Unsigned 32-bit integer Total value ([D] and [D]+1) Value DT102 H 81B4 Mean value ([D]+2) * Unsigned 16-bit integer Example 2) Operation unit: 16 bits (SS) Total value is given in 32-bit data, and the mean value is given in 16-bit data. [i]...SS [S1]...DT10 [S2]...DT14 [D]...DT100 <Total/mean calculation range> <Output result> DT10 DT11 DT12 DT13 DT14 Value K 11 K -33 K 44 K 55 K -22 Value DT100DT101 K -55 * Signed 32-bit integer Total value ([D] and [D]+1) DT102 Value K 11 Mean value ([D]+2) * Signed 16-bit integer Example 3) Operation unit: 32 bits (UL) (specify a 32-bit device) Total value is given in 64-bit data, and the mean value is given in 32-bit data. [i]...UL [S1]...TS10 [S2]...TS14 [D]...TS100 <Total/mean calculation range> <Output result> TS10 TS11 TS12 TS13 TS14 Value H 00000000 H 22222222 H 33333333 H 44444444 H 55555555 Value TS100TS101 H EEEEEEEE * Unsigned 64-bit integer Total value ([D] and [D]+1) Value TS102 H 2FC962FC Mean value ([D]+2) * Unsigned 32-bit integer 10-15 High-Level Instruction (Data Processing Control) Example 4) Operation unit: 32 bits (SL) (specify a 32-bit device) Total value is given in 64-bit data, and the mean value is given in 32-bit data. [i]...SL [S1]...TS10 [S2]...TS14 [D]...TS100 <Total/mean calculation range> <Output result> TS10 TS11 TS12 TS13 TS14 Value K 1000 K 2000 K -3000 K -4000 K -5000 Value TS100TS101 K -9000 * Signed 64-bit integer Total value ([D] and [D]+1) TS102 Value K -1800 Mean value ([D]+2) * Signed 32-bit integer Example 5) Operation unit: 32 bits (UL) (specify a 16-bit device) Total value is given in 64-bit data, and the mean value is given in 32-bit data. [i]...UL [S1]...DT10 [S2]...DT14 [D]...DT100 <Total/mean calculation range> <Output result> Value DT10DT11 H 11110000 DT12DT13 H 33332222 DT14DT15 H 55554444 DT16DT17 H 77776666 Value DT100-DT103 H 11110CCCC * Unsigned 64-bit integer Total value ([D] to [D]+3) Value DT104DT105 H 44443333 * Unsigned 32-bit integer Mean value ([D]+4, [D]+5) Example 6) Operation unit: 32 bits (SL) (specify a 16-bit device) Total value is given in 64-bit data, and the mean value is given in 32-bit data. [i]...SL [S1]...DT10 [S2]...DT16 [D]...DT100 <Total/mean calculation range> <Output result> DT10DT11 DT12DT13 DT14DT15 DT16DT17 Value K -100 K 600 K 500 K -200 Value DT100DT103 K 800 * Signed 64-bit integer Total value ([D] to [D]+3) DT104DT105 Value K 200 * Signed 32-bit integer Mean value ([D]+4, [D]+5) 10-16 MEAN (Acquiring the Total and the Mean Value) Example 7) Operation unit: Single-precision, floating-point real number (SF) (specify a 16-bit device) Total value is given in 32-bit data, and the mean value is given in 32-bit data. [i]...SF [S1]...DT10 [S2]...DT24 [D]...DT100 <Total/mean calculation range> <Output result> DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 DT20DT21 DT22DT23 DT24DT25 Value SF 3.33E+00 SF 1.11E+00 SF 4.44E+00 SF 5.55E+00 SF 2.22E+00 SF 1.11E+00 SF 3.33E+00 SF 5.55E+00 DT100DT101 Value SF 2.66E+01 * Single precision floating point real number (32 bits) Total value ([D] and [D]+1) Value DT102DT103 SF 3.33E+00 Mean value * Single precision floating point ([D]+2, [D]+3) real number (32 bits) Precautions during programming · The end position of the total and the mean calculation range is the device that contains [S2]. Example) When the operation unit is 32 bits, the calculation range is the same whether a device number of higher level or lower level is specified. [S1]...DT2 [S2]...DT6 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Total/mean calculation range [S1]...DT2 [S2]...DT7 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Total/mean calculation range · Data is overwritten if [D] (total and mean calculation results) is specified within the total and the mean calculation range. Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the [S1] device and the [S2] device differ. 10-17 High-Level Instruction (Data Processing Control) SORT (Sort) Ladder diagram R0 SORT.US DT10 DT19 U0 i S1 S2 S3 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting position of the target area (data format: according to the operation unit) S2 End position of the target area (data format: according to the operation unit) S3 Sort condition (data format: unsigned 16-bit integer) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 S2 S3 *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · Data in the range from the area specified by [S1] to the area specified by [S2] are sorted in ascending order or in descending order, according to the sort conditions specified by [S3]. · Available sort conditions for [S3] are as follows. U0: Ascending order U1: Descending order 10-18 Process details Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT10 [S2]...DT19 [S3]...U0 (Ascending order) <Before sort> DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 H 0123 H 1111 H 3210 H 2222 H 3333 H 0000 H 3210 H 4321 H 3333 H 5432 <After sort> DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 H 0000 H 0123 H 1111 H 2222 H 3210 H 3210 H 3333 H 3333 H 4321 H 5432 Example 2) Operation unit: 16 bits (SS) [i]...SS [S1]...DT10 [S2]...DT19 [S3]...U1 (Descending order) <Before sort> DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 K 300 K10 K 3 K -1 K 1000 K -30 K 100 K 30 K 1 K -3 <After sort> DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 K 1000 K 300 K 100 K 30 K 10 K 3 K 1 K -1 K -3 K 30 Example 3) Operation unit: 32 bits (UL) [i]...UL [S1]...DT10 [S2]...DT19 [S3]...U0 (Ascending order) <Before sort> DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 H 22220000 H 11113333 H 55550000 H 22222222 H 11114444 <After sort> DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 H 11113333 H 11114444 H 22220000 H 22222222 H 55550000 Example 4) Operation unit: 32 bits (SL) [i]...SL [S1]...DT10 [S2]...DT19 [S3]...U1 (Descending order) <Before sort> DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 K 11 K 33 K 55 K 22 K 44 <After sort> DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 K 55 K 44 K 33 K 22 K 11 SORT (Sort) 10-19 High-Level Instruction (Data Processing Control) Example 5) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S1]...DT10 [S2]...DT19 [S3]...U1 (Descending order) <Before sort> DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 SF 3.33 SF 11.11 SF 2.22 SF 1111.1 SF 4.44 <After sort> DT10DT11 DT12DT13 DT14DT15 DT16DT17 DT18DT19 SF 1111.1 SF 11.11 SF 4.44 SF 3.33 SF 2.22 Precautions during programming · It must be noted that, since the time for data comparison increases in proportion to the square of the number of data, the sorting process can take long time when there is a large amount of data to be sorted. · During sort execution, data in [S1] to [S2] are sorted in sequence according to the sort conditions. · The end position of the sort range is the device that contains [S2]. Example) When the operation unit is 32 bits, the sort range is the same whether a device number of higher level or lower level is specified. [S1]...DT2 [S2]...DT6 [S1]...DT2 [S2]...DT7 DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Sort targets DT0DT1 DT2DT3 DT4DT5 DT6DT7 DT8DT9 H 11223344 H 55667788 H 9900AABB H CCDDEEFF H 12345678 Sort targets Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when [S1] is larger than [S2]. To be set when the [S1] device and the [S2] device differ. 10-20 SCAL (Linearization) SCAL (Linearization) Ladder diagram R0 SCAL.US DT10 DT20 DT100 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Data equivalent to the input value X, or the area to store it (data format: according to the operation unit) S2 Starting address of the data table used for scaling (linearization) (data format: according to the operation unit) D Area to store the output result Y (data format: according to the operation unit) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S1 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S2 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · The data specified by [S1] are scaled according to the data table specified by [S2]. The result is stored in the device area specified by [D]. 10-21 High-Level Instruction (Data Processing Control) Process details · Regardless of the operation unit, the output value Y for [D], corresponding to the input value X for [S1], is calculated. · In response to the information of input value X specified by [S1], the information of output value Y is calculated according to the [S2] data table. The result is stored into the [D] area. Output value (x3, y3) (xn, yn) (xn-1, yn-1) Y = [D] (x2, y2) (x1, y1) X = [S1] Input value Structure of data table [S2] · The number for data table "n" (setting range: 2 to 256) is determined by the value [n] specified for the starting address of the data table [S2]. n is 16-bit data, regardless of the operation unit. · Scaling data (x1 to xn, y1 to yn) is stored from [S2]+1. Depending on the operation unit, the data table occupies 16 bits (1 word), 32 bits (2 words), or 64 bits (4 words). · The structure of data table [S2] that is used for scaling (linearization) is shown below. [S2] n Number for the data table (Available range: 2 to 256) Operation unit: 16 bits (1-word data) [S2+1] x1 [S2+2] x2 x1 to xn [S2+n-1] [S2+n] [S2+n+1] [S2+n+2] xn-1 xn y1 y2 y1 to yn [S2+2n-1] yn-1 [S2+2n] yn Operation unit: 32 bits (2-word data) [S2+1] [S2+2] x1 [S2+3] [S2+4] x2 x1 to xn [S2+2n-1] xn [S2+2n] [S2+2n+1] [S2+2n+2] y1 [S2+2n+3] y2 [S2+2n+4] y1 to yn [S2+4n-1] yn [S2+4n] Operation unit: 64 bits (4-word data) [S2+1] [S2+2] [S2+3] x1 [S2+4] x1 to xn [S2+4n-3] [S2+4n-2] xn [S2+4n-1] [S2+4n] [S2+4n+1] [S2+4n+2] y1 [S2+4n+3] [S2+4n+4] y1 to yn [S2+8n-3] [S2+8n-2] yn [S2+8n-1] [S2+8n] 10-22 SCAL (Linearization) Precautions during programming · For data in the data table [S2], ensure that Xn-1 is smaller than Xn. · When X([S1]) is smaller than x1 ], Y([D]) equals y1. · When X([S1]) is larger than xn, Y([D]) equals yn. · The maximum value for [n] that indicates the number of data in the data table [S2] is 256. Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when [n] which indicates the number of data in the data table [S2] is smaller than 2 or larger than 256. To be set when data in the data table [S2] exceeds the area. To be set when Xn is not in ascending order. 10-23 High-Level Instruction (Data Processing Control) STDDEV (Acquiring the Variance and Standard Deviation) Ladder diagram R0 STDDEV.US DT10 U5 DT100 i S n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Specify the starting position of a target area (data format: according to the operation unit). n Specify the number of target data (data format: unsigned 16-bit integer). D Specify the device address to store results. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U *2 H *3 Real number String Index modification SF DF " " *1 S n D *1: Only 16-bit devices, and integer constants can be modified (real number constants, and character constants cannot be specified). *2: Can be specified only when the operation unit is unsigned integer (US). *3: Can be specified only when the operation unit is integer (US, SS). Outline of operation · This instruction stores the variance and standard deviation within the range of the device areas specified by [S] and [n] into the device area specified by [D]. · The maximum amount of data that can be specified is 30000. · The result [D] is output as single-precision real numbers. 16-bit device [D], [D]+1 [D]+2, [D]+3 Output content Stores variance. Stores standard deviation. 10-24 STDDEV (Acquiring the Variance and Standard Deviation) Process details Method for calculating variance and standard deviation (Conditions) N data x1, x2,...xn 1. Mean value m = x1 + x2 + + x n N 2. Variance 2 = ( 1x- m 2 + )( 2x- m 2 + ) + ( nx- m 2 N 3. Standard deviation = 2 Example 1) When the operation unit is 16 bits (US) [S]...DT10 [n]...U5 [D]...DT100 <Calculation range> DT10 U 2 DT11 U 4 DT12 U 5 DT13 U 6 DT14 U 8 <Output result> DT100 DT101 SF 4.00E+00 Variance * Single-precision real number (32-bit) DT102 DT103 SF 2.00E+00 Standard deviation * Single-precision real number (32-bit) The following results are stored. - Variance of S to S+4 is stored in (D, D+1). - Standard deviation of S to S+4 is stored in (D+2, D+3). Example 2) When the operation unit is 16 bits (SS) [S]...DT10 [n]...U5 [D]...DT100 <Calculation range> DT10 DT11 DT12 DT13 DT14 K 16 K -20 K 32 K -35 K -12 <Output result> DT100 DT101 SF 5.9536E+02 Variance * Single-precision real number (32-bit) DT102 DT103 SF 2.4400E+01 Standard deviation * Single-precision real number (32-bit) The following results are stored. - Variance of S to S+4 is stored in (D, D+1). - Standard deviation of S to S+4 is stored in (D+2, D+3). Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when [S+n] exceeds the device address. To be set when the result storage area exceeds the device address. To be set when the specified ranges of [S1] and [D] overlap. 10-25 High-Level Instruction (Data Processing Control) EVENTC (Instruction to Count the Number of Events) Ladder diagram R0 EVENTC.UL WX0 DT0 U 8 DT100 i S1 S2 n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting address of the counting starting position S2 Starting address of the working area for counting n Number of bits to be counted D Starting device address to store the count result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 S2 n D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction counts the number of ONs for [n] bits from the device specified by [S1]. · During the counting operation, a data area that is equal to n/16 words from the device specified in [S2] is used. · The operation result is stored in the area of [n]*2 words that start with [D]. · The working area with the starting address specified by [S2] needs the following number of words: [(Number of bits to be counted - 1)/16] + 1 Rounded down to the nearest integer · The number of bits to be counted that is specified by [n] is 1 to 65535. However, this range must not exceed the device area. 10-26 EVENTC (Instruction to Count the Number of Events) Process details Example 1) Carry out counting for 8 points from WX0 [i]...UL [S1]...WX0 [S2]...DT0 [S1] WX0 Targeted bits: 8 bits from X0 to X7 [S2] DT0 Working area for counting [D] DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 DT20 DT21 DT22 DT23 DT24 DT25 X0 counted value X1 counted value X2 counted value X3 counted value X4 counted value X5 counted value X6 counted value X7 counted value [n]...U 8 1 2 3 4 5 6 7 8 [D]...DT10 10-27 High-Level Instruction (Data Processing Control) Example 2) Carry out counting for 17 points from WX0 [i]...UL [S1]...WX0 [S2]...DT0 [S1] WX0 WX1 Targeted bits: 17 bits from X0 to X10 [S2] DT0 DT1 Working area for counting [D] DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 DT20 DT21 DT22 DT23 DT24 DT25 X0 counted value X1 counted value X2 counted value X3 counted value X4 counted value X5 counted value X6 counted value X7 counted value [n]...U 17 1 2 3 4 5 6 7 8 [D]...DT10 DT38 DT39 XE counted value 15 DT40 DT41 XF counted value 16 DT42 DT43 X10 counted value 17 Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when either the count target area, the count working area, or the count result storage area exceeds the device area. 10-28 EVENTT (Instruction to Count the Time of Events) EVENTT (Instruction to Count the Time of Events) Ladder diagram R0 EVENTT.UL WX0 DT0 U 8 DT100 i S1 S2 n D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting address of the counting starting position S2 Starting address of the working area for counting n Number of bits to be counted D Starting device address to store the count result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 S2 n D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · This instruction counts the time of ONs for [n] bits from the device specified by [S1]. · The count result is stored in the area of [n]*2 words starting with [D]. · The working area with the starting address specified by [S2] needs the following number of words: [(Number of bits to be counted - 1)/16] + 1 Rounded down to the nearest integer · The number of bits to be counted that is specified by [n] is 1 to 65535. However, this range must not exceed the device area. 10-29 High-Level Instruction (Data Processing Control) Process details Example 1) Carry out counting for 8 points from WX0 [i]...UL [S1]...WX0 [S2]...DT0 [S1] WX0 Targeted bits: 8 bits from X0 to X7 [S2] DT0 Working area for counting [D] DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 DT20 DT21 DT22 DT23 DT24 DT25 X0 counted value X1 counted value X2 counted value X3 counted value X4 counted value X5 counted value X6 counted value X7 counted value [n]...U 8 1 2 3 4 5 6 7 8 [D]...DT10 10-30 EVENTT (Instruction to Count the Time of Events) Example 2) Carry out counting for 17 points from WX0 [i]...UL [S1]...WX0 [S2]...DT0 [S1] WX0 WX1 Targeted bits: 17 bits from X0 to X10 [S2] DT0 DT1 Working area for counting [D] DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 DT20 DT21 DT22 DT23 DT24 DT25 X0 counted value X1 counted value X2 counted value X3 counted value X4 counted value X5 counted value X6 counted value X7 counted value [n]...U 17 1 2 3 4 5 6 7 8 [D]...DT10 DT38 DT39 XE counted value 15 DT40 DT41 XF counted value 16 DT42 DT43 X10 counted value 17 Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). When one of the count target area, the count working area or the count result storage area exceeds the device area. 10-31 High-Level Instruction (Data Processing Control) PID (PID Operation) Ladder diagram R0 PID List of operands Operand Description S Starting number of the PID operation parameter area (30 words) DT 0 S Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " Outline of operation · PID operation is carried out to retain the process value PV stored in [S+2], in consistency with the set point value SP specified by [S+1]. · The operation result is stored, as a manipulated value [MV], in the area specified by [S+3]. · Methods for PID operation (derivative-first / proportional-plus-derivative-first, reverse operation / forward operation) and coefficients used for PID operation (proportional gain, integral time, derivative time), as well as the types and interval of operation, are set to the parameter table [S] to [S+29]. Types of PID operation Items Description Reverse operation / forward operation Select the upward/downward direction of output in the case of change to the process. Specify "reverse operation" if output is increased when the process value decreases (e.g. heating). Specify "forward operation" if output is increased when the process value increases (e.g. cooling). Derivative-first PID / proportional-plus-derivative-first PID Derivative-first PID: Usually, when the set point value is changed, the output variation becomes larger but it converges faster. Proportional-plus-derivative-first PID: Usually, when the set point value is changed, the output variation becomes smaller but it converges slower. Auto-tuning By measuring process response, the respective optimal values for Kp, Ti and Td as PID parameters are measured. When auto-tuning is executed, the estimated results are reflected in the parameter area upon completion. 10-32 PID (PID Operation) Setting of the parameter table [S] [S+1] [S+2] [S+3] [S+4] [S+5] [S+6] [S+7] [S+8] [S+9] [S+10] [S+11] [S+29] Control mode Set point value (SP) Process value (PV) Manipulated value (MV) MV lower limit MV upper limit Proportional gain (Kp) Time integral (Ti) Time derivative (Td) Control interval (Ts) Auto-tuning progress PID operation work area Setting of parameters: [S] to [S+29] Operand Parameter name Setting range Setting method Auto-tuning is OFF H0: Derivative-first, reverse operation H0 to H3 H1: Derivative-first, forward operation H2: Proportional-plus-derivative-first, reverse operation [S] Control mode H3: Proportional-plus-derivative-first, forward operation Auto-tuning is ON H8000: Derivative-first, reverse operation H8000 to H8003 H8001: Derivative-first, forward operation H8002: Proportional-plus-derivative-first, reverse operation H8003: Proportional-plus-derivative-first, forward operation [S+1] Set point value (SP) K0 to K10000 Specify the target value for process control amount in the following range. [S+2] Process value (PV) K0 to K10000 Input the current value for process control amount using an A/D converter, etc. [S+3] Output value (MV) K0 to K10000 PID operation result is stored. Output the value using a D/A converter, etc. [S+4] [S+5] Output lower limit value Output upper limit value K0 to K9999 K1 to K10000 Specify the range of manipulated value (MV). The value of the specified range is output. [S+6] Proportional gain (Kp) K1 to K9999 (0.1 to 999.9) Specify the coefficient to be used for PID operation. Actual proportional gain is obtained by multiplying the set point value by 0.1. (Note 1) [S+7] Integral time (Ti) K1 to K30000 (0.1 to 3000 s) Specify the coefficient to be used for PID operation. Actual integral time is obtained by multiplying the set point value by 0.1. The integral operation is not executed if 0 is specified. (Note 1) [S+8] Control interval (Td) K0 to K10000 (0 to 1000 s) Specify the coefficient to be used for PID operation. Actual derivative time is obtained by multiplying the set point value by 0.1. The integral operation is not executed if 0 is specified. (Note 1) [S+9] Control interval (Ts) K1 to K6000 (0.01 to 60.0 s) Specify the interval to execute PID operation. Actual control interval is obtained by multiplying the set point value by 0.01. [S+10] Auto-tuning progress K0 to K5 When auto-tuning is specified in the control mode, this indicates the progress of auto-tuning. Starting with the default [0], a value between K1 and K5 is stored in accordance with the progress. After auto-tuning is completed, the value returns to the default. [S+11] to [S+29] PID operation work area - This work area is used by the system program for operation. (Note 1): If auto-tuning is specified in the control mode, automatic adjustment is carried out, and the set point value is rewritten. 10-33 High-Level Instruction (Data Processing Control) Precautions during programming · The parameter table requires an area of 30 words, including the work area for operation. Ensure that this area value is not rewritten by other instructions. · Error is not detected even if the parameter table exceeds the area. Ensure to specify a number at least 30 words before the final number for [S]. · Ensure that the area is not exceeded by index modification. Error is not detected even if the area is exceeded. · As indicated below, the system does not operate correctly if two or more PID instructions specifying the same table are described in the program. Even if execution conditions are not met, PID instructions operate internally using the specified table. In such cases, set the table to differing addresses. Example: X0 PID DT0 X0 PID DT0 Precautions during auto-tuning · Auto-tuning may not be executable depending on the process. In that case, the system returns to the original parameter operation. · After auto-tuning is completed, the control mode [S] area is automatically rewritten from H 8000 through H 8003 to H 0 through H 3. Ensure that this is not rewritten again by your program, etc. · After auto-tuning is completed, the respective optimal values are stored for proportional gain [Kp], integral time [Ti], and derivative time [Td]. Before execution, it is necessary to specify appropriate values (e.g. lower limits) within the respective setting ranges. · After auto-tuning is complete, store optimal values for proportional gain [Kp], integral time [Ti], and derivative time [Td]. Ensure that the stored values are not rewritten. · During auto-tuning, the values for Kp, Ti and Td are calculated by measuring changes to process values (PVs) when manipulated values (MVs) are set to the upper limits, as well as changes to process values (PVs) when manipulated values (MVs) are set to the lower limits, so that process values (PVs) will be increased or decreased in accordance with the respective set point values (SPs). · Changes to manipulated values (MVs) of auto-tuning are completed in three sessions (upper limit output lower limit output - upper limit output) in the fewest times possible. If the auto-tuning progress does not change from 0 after multiple sessions, shorten the control interval Ts and retry auto-tuning. 10-34 PID (PID Operation) Overview of PID control (1) Proportional operation Control operation that generates an output that is proportional to the input. Setting signal SV + Deviation e Kp Measurement signal PV Output MV Kp=2 e MV 2 1 1 Kp=1 0.5 0 t 0 t Kp=0.5 · Control amount is retained at a specified level. · Offset (steady-state deviation) remains. · The larger the Kp is, the stronger proportional operation occurs. (2) Integral operation Control operation that generates an output that is proportional to the input integral time. Setting signal SV + mi=1/Ti edt e Deviation e Integral Measurement signal PV mi Output mi · In combination with proportional operation or proportional plus derivative operation, this removes the generated offset. · The smaller the Ti is, the stronger integral operation occurs. 10-35 High-Level Instruction (Data Processing Control) (3) Derivative operation Control operation that generates an output that is proportional to the input value for the time derivative. Setting signal SV + mD=TD de dt e Deviation e Differential Measurement signal PV mD Output mD · In accordance with the proceeding characteristics of derivative operations, process-delaying characteristics reduce negative influence on controls. · The larger the Td is, the stronger the derivative operation is. · Since pure derivative operation may become temporarily disabled due to noise input, etc., and cause negative influence on the operating terminal, inexact derivation is executed. e mD (4) PID operation A PID operation is a combination of proportional, integral, and derivative operations. Setting signal SV + Deviation e Measurement signal PV + Integral + + Derivative Kp Output MV · When the parameters are optimally adjusted, a PID control can quickly control and maintain a quantity at a target value. Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when a parameter is out of the setting range. 10-36 EZPID (PID Operation: PWM Output Available) EZPID (PID Operation: PWM Output Available) Ladder diagram R0 EZPID WR1 WX10 DT100 DT0 S1 S2 S3 S4 List of operands Operand Description S1 1-word area for setting control data that determine methods for auto-tuning and output S2 1-word area for inputting the process value (PV) S3 4-word area for setting the set point value (SV), proportional gain (Kp), integral time (Ti), and derivative time (Td). 30-word area comprising the following: S4 storage area for the manipulated value (MV), control interval (Ts), control mode, setting area for parameters related to auto-tuning, and operation work area Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3 S4 Integer K U H Real number String Index modification SF DF " " Outline of operation · PID operation is carried out to retain the process value (PV) stored in [S+2], in consistency with the set point value (SP) specified by [S3]. · The operation result is stored, as a manipulated value (MV), in the area specified by [S4]. If an OUT instruction is described immediately after this instruction, PWM output (ON-OFF output) can be gained, proportionate to the manipulated value. · Set the parameters used for PID operation (proportional gain, integral time, and derivative time) to [S3+1] to [S3+3]. The auto-tuning function for automatically calculating these values is also available. · To change the method for PID operation (derivative-first operation/proportional-plus-derivative-first operation, reverse operation/forward operation) or the control interval Ts, etc., set them to the area [S4] to [S4+9]. Types of PID operation Items Description Reverse operation/forward operation Select the upward/downward direction of output in the case of change to the process. Specify "reverse operation" if output is increased when the process value decreases (e.g. heating). Specify "forward operation" if output is increased when the process value increases (e.g. cooling). Derivative-first PID /proportional-plus-derivative-first PID Derivative-first PID: Usually, when the set point value is changed, the output variation becomes larger but it converges faster. Proportional-plus-derivative-first PID: Usually, when the set point value is changed, the output variation becomes smaller but it converges slower. Auto-tuning By measuring process response, the respective optimal values for Kp, Ti and Td as PID parameters are measured. When auto-tuning is executed, the estimated results are reflected in the parameter area upon completion. (Note 1): By default, controls are carried out in reverse operation, derivative-first. To change operation methods, change values in the [S4+5] area before the second execution of EZPID instruction. (Note 2): To execute auto-tuning, configure the setting in the area of control data [S1]. 10-37 High-Level Instruction (Data Processing Control) Setting of parameters [S1] to [S3] Operand Parameter name Setting range Setting method Bit 0 Bit 0 = 1 (ON): Bit 0 = 0 (OFF): Auto-tuning request is issued. After auto-tuning is completed, this is reset when the EZPID instruction is executed. Reset this bit when auto-tuning is canceled. PID control is executed. Bit 1 When auto-tuning is completed correctly, bit 1 is set to 1 (ON). Bit 1 is reset to 0 (OFF) at the start of instruction execution. Specify whether the [S4] manipulated value (MV) should be cleared when OFF is larger than ON in the execution condition for the instruction. Bit 2 Bit 2 = 0 (OFF): Clear the manipulated value (MV) at the time of execution of the previous instruction. [S1] Control data Bit 2 = 1 (ON): Retain the manipulated value (MV) at the time of execution of the previous instruction. Select a method for outputting the result of PID operation. Bit 3 Bit 3 = 0 (OFF): PWM output Bit 3 = 1 (ON): Analog output Specify the range (maximum value and minimum value) for internal calculation of the manipulated value (MV). Bit 4 Bit 4 = 0 (OFF): Use +20% and -20% of difference between the output upper limit and the output lower limit Bit 4 = 1 (ON): Use the output upper limit and the output lower limit Bit F to Bit 5 Bits 5 to F are reserved bits. Use them as 0. [S2] Process value K -30000 (PV) to K 30000 Input the current value for process control amount using an analog input unit, etc. It is also possible to directly specify the input data area WXn of the analog input unit. [S3] Set point value (SP) K -30000 to K 30000 Set a target value for process control amount. Set the value using an instruction or an external device (e.g. display). [S3+1] [S3+2] [S3+3] Proportional gain (Kp) Integral Time (Ti) Derivative Time (Td) U1 to U9999 (0.1 to 999.9) U0 to U30000 (0 to 3000 s) U0 to U10000 (0 to 1000 s) Specify parameters used for PID operation. Each parameter is obtained by multiplying the set point value by 0.1. When auto-tuning is executed, the relevant data are stored upon its completion. (Note 1): It is recommended to allocate the [S1] area to a non-hold type operation memory area (WR) where a bit operation is available. (Note 2): It is recommended to allocate the [S2] area to a non-hold type operation memory area. (Note 3): It is recommended to allocate the [S3] through [S3+3] areas to a hold type operation memory area. (Note 4): If the [S3+1] through [S3+3] areas are all "0" when the EZPID instruction is started up, operation is continued with the settings where proportional gain (Kp) is 1, integral time (Ti) is 0, and derivative time (Td) is 0. 10-38 EZPID (PID Operation: PWM Output Available) Setting of parameters [S4] to [S4+29] Operand Parameter name Default Setting range [S4] Manipulated value (MV) K0 K -10000 to K 10000 Setting method The result of PID operation is stored. If PWM output is selected in bit 3 of [S1], calculation is carried out in the range 0 to 10000, as the duty ratio (0 to 100%) of PWM output. If analog output is selected in bit 3 of [S1], the value given by the following formula is stored. (Output upper limit - Output lower limit) x Internal calculated value / 10000 + Lower limit Use the user program to convert the stored value into the range of the analog output unit. [S4+1] [S4+2] Output lower limit K0 Output upper limit K10000 K-10000 lower limit < upper limit K 10000 Specify the range of manipulated value (MV). The value of the specified range is output. [S4+3] 100% output zone U0 (0%) U0 to U80 (0% to 80%) Specify the level of process value (PV), as percentage to set point value, above which PID control should be initiated. Until the specified process value (PV) is reached, the manipulated value (MV) is retained at 100%. If the process value (PV) is smaller than the set point value (SP), this shortens time until reaching the set point value (SP). When the set point value is U80, the output level is retained at 100% until the process value (PV) reaches 80% of the set point value (SP). Once the 80% is exceeded, PID control is initiated. If the set point value is K0 (default), PID control is executed from the beginning. [S4+4] Control interval (Ts) U100 (1s) U1 to U6000 (0.01 to 60.0 s) Specify the interval to execute PID operation. Actual control interval is obtained by multiplying the set point value by 0.01. [S4+5] Control mode U0 (derivativefirst, reverse operation) U0 to U3 U0: Derivative-first, reverse operation U1: Derivative-first, forward operation U2: Proportional-plus-derivative-first, reverse operation U3: Proportional-plus-derivative-first, forward operation [S4+6] Auto-tuning bias value U0 U0 In order to control overheating during auto-tuning, specify difference between the set point value during auto-tuning and the actual set point value. (Note 3) [S4+7] [S4+8] [S4+9] Auto-tuning proportional gain (Kp) correction coefficient Auto-tuning integral time (Ti) correction coefficient Auto-tuning derivative time (Td) correction coefficient U125 (125%) U200 (200%) U100 (100%) U50 to U500 (50 to 500%) U50 to U500 (50 to 500%) U50 to U500 (50 to 500%) By setting coefficients listed on the left and executing auto-tuning, parameter values obtained through auto-tuning are multiplied by the respective coefficients, and stored in the parameter setting areas [S3+1] through [S3+3]. Example) If U200 is set to [S4+7], the value given as 200% of the proportional gain Kp, obtained through auto-tuning, is set to [S3+1]. This indicates the progress of auto-tuning. Starting with the [S4+10] Auto-tuning progress U0 U0 to U5 default [0], a value between U1 and U5 is stored in accordance with the progress. After auto-tuning is completed, the value returns to U0. [S4+11] ~[S4+29] PID operation work area K0 - This work area is used by the system program for operation. Ensure that this is not overwritten by your program. (Note 1): By default, the [S4] manipulated value (MV) is cleared when the EZPID instruction is started up. If it is necessary to retain the value from the previous execution, set 1 to bit 2 of the operand [S1] before execution of the EZPID instruction. (Note 2): The areas [S4+1] through [S4+29] should be preset to default when the EZPID instruction is started up. (Note 3): For details of the auto-tuning bias value, see "Setting of auto-tuning bias value [S4+6]." 10-39 High-Level Instruction (Data Processing Control) Sample program (PWM output) · In this sample, PWM output by PID operation is carried out after setting proportional gain (Kp), integral time (Ti), and derivative time (Td) through auto-tuning. R0 DF R10 SET [S1] WR1 bit1 Request auto-tuning R1 Y180 EZPID instruction EZPID WR1 WX10 DT100 DT0 execution · Set the set point value (SP) to the operand [S3] area, using an instruction or a display. · Using an instruction or a display, set bit 0 (auto-tuning request flag) of [S1]. Subsequently, switch the execution condition for the EZPID instruction to ON to initiate the auto-tuning operation. · Once auto-tuning is completed correctly, parameters Kp, Ti and Td are set to the operand [S3+1] through [S3+3] areas. At this time, bit 0 (auto-tuning request flag) of the operand [S1] is reset to OFF, and bit 1 (auto-tuning completion flag) of the operand [S1] is switched ON. · If the execution condition for the EZPID instruction is ON, PID control and PWM output are initiated in the following scan. · The value (K0 to K10000) of the manipulated value (MV) of the operand [S4] is converted into a duty ratio from 0 to 100%, and PWM output is performed. · The operand [S4] through [S4+29] areas are preset to default when the execution condition for the EZPID instruction is switched on. If the [S4] manipulated value (MV) should not be cleared, set 1 to bit 2 of [S1] before executing the EZPID instruction. · If the execution condition of the EZPID instruction is switched OFF during PID control, PWM output Y180 is also turned OFF. At this time, the value of the manipulated value (MV) of operand [S4] is retained. Interval and duty ratio of PWM output · The duty of PWM is determined by the ratio of the manipulated value (MV), stored in [S4], to K0 through K10000. · If the manipulated value (MV) is K0, PWM output is always OFF. If the MV is K10000, PWM output is always ON. · The PWM output interval is determined by the control interval value specified by the operand [S4+4]. By default, the interval is set at 1 second. Sample program (change of control conditions) · By default, the following control conditions are used for operation: 1) Operation interval Ts: 1 second; 2) Control method: derivative-first, reverse operation (heating) · In order to modify the control conditions, change values of the operands [S4+1] through [S4+9] using the MV instruction, etc. · Carry out modifications between two executions of the EZPID instruction. [Example] Switch to proportional plus derivative control mode and carry out PWM output. R1 Y180 EZPID WR1 WX10 DT100 DT0 EZPID instruction execution R1 MV.US U2 DT5 [S4+5] DT5 Control mode 10-40 EZPID (PID Operation: PWM Output Available) Sample program (analog output) [Example] In analog output, change the output upper limit [S4+2] to K4000, and the control interval [S4+4] to K1000 (10 seconds). R2 DF R0 DF R13 SET R10 SET [S1] WR1 bit3 Select an analog output [S1] WR1 bit0 Request auto-tuning R1 EZPID WR1 WX10 DT100 DT0 R1 DF MV.SS K4000 DT2 EZPID instruction execution [S4+2] DT2 Output upper limit [S4+4] DT4 MV.US U1000 DT4 Control interval: 10 R1 seconds MV.SS DT0 WY18 [S4] DT0WY18 Output value (MV) Analog output unit · In order to use analog output, set 1 to bit 3 of the operand [S1]. · The output lower limit [S4+1] and the output upper limit [S4+2] should be set according to the output range of the analog output unit. · The value of the control interval (Ts): [S4+4] should be modified according to the input updating interval (normally 0.1 seconds or more) of the analog input unit. Example) If the value of [S4+4] is K10, Ts is 100 ms. · Modify other parameters such as the control mode as necessary. · The manipulated value (MV) stored in the operand [S4] is transferred to the digital value output area WY that corresponds to the manipulated value of the analog output unit. · In the manipulated value (MV) of [S4], the output internal calculated value (K0 to K10000) is converted by the following formula, and stored. Conversion formula: (Output upper limit - Output lower limit) x (Internal calculated value) / 10000 + (Output lower limit) · If [S4] is allocated to a hold type area, the manipulated value (MV) is retained even if the execution condition of the EZPID instruction is switched OFF. · OUT is not necessary after EZPID instruction using analog output. Additionally, PWM is output OFF in this situation. 10-41 High-Level Instruction (Data Processing Control) Setting of auto-tuning bias value [S4+6] · If it is necessary to control output during auto-tuning (e.g. prevent overheating), set, as an bias value, the difference between the actual set point value (SP) during PID control operation and the set point value (SP') during auto-tuning. · In the case of reverse operation (heating), (SP) is equal to or larger than (SP') and the difference thereof is given as the bias value. · In the case of forward operation (cooling), (SP) is equal to or larger than (SP') and the difference thereof is given as the bias value. · Even if auto-tuning is started up, with the process value (PV) located near the set point value (SP), auto-tuning is executed using the set point value (SP') adjusted with the bias value. Temperature Set point value (SP) (SP') Auto-tuning offset value Auto-tuning in reverse operation Temperature Auto-tuning PID control Calculate Kp, Ti and Td Time (SP') Set point value (SP) Auto-tuning offset value Auto-tuning in forward operation Auto-tuning PID control Calculate Kp, Ti and Td Time 10-42 EZPID (PID Operation: PWM Output Available) Precautions during programming · The operand [S4] through [S4+29] areas are initialized when the execution condition is switched on. If values other than default are to be used, set them using the MV instruction, etc. · PID operation instructions are always internally calculating operation intervals, PWM output timings, etc. Ensure that the operation instructions are carried out only once in every scan. Ensure that they are not executed in a subroutine or an interrupt program. At the same time, it is not possible to describe multiple EZPID instructions specifying the same operand. · Do not switch off the execution conditions during PID operation. It will disable PID operation. · When multiple targets are to be controlled, and if the PWM output span is not to be synchronized, then use different startup timings by adjusting the launch times of startup conditions, etc. · The system does not operate correctly if two or more PID instructions specifying the same table are described in the program. Even if execution conditions are not met, PID instructions operate internally using the specified table. In such cases, set the table to differing addresses. · Ensure that the work area for PID operation is not rewritten by other instructions. · Error is not detected even if the parameter table exceeds the area. Ensure to specify a number at least 30 words before the final number of each device (such as the data register) when specifying the [S4] area. Also ensure that the area is not exceeded by index modification. Error is not detected even if the area is exceeded. · Execution conditions vary immediately after the EZPID instruction, just like PWM output. Therefore, the system does not operate correctly if the subsequent instructions are described. R1 Y180 EZPID WR1 WX10 DT100 DT0 MV.US U2 DT5 R1 Y180 EZPID WR1 WX10 DT100 DT0 R1 MV.US U2 DT5 10-43 High-Level Instruction (Data Processing Control) Precautions during auto-tuning · Auto-tuning may not be executable depending on the process. In that case, the system returns to the original parameter operation. · After auto-tuning is completed, the respective optimal values are stored for proportional gain [Kp], integral time [Ti], and derivative time [Td]. Before execution, it is necessary to specify appropriate values (e.g. lower limits) within the respective setting ranges. · After auto-tuning is complete, store optimal values for proportional gain [Kp], integral time [Ti], and derivative time [Td]. Ensure that the stored values are not rewritten. · During auto-tuning, the output values for Kp, Ti and Td are calculated by measuring changes to process values (PVs) when manipulated values (MVs) are set to the upper limits, as well as changes to process values (PVs) when manipulated values (MVs) are set to the lower limits, so that process values (PVs) will be increased or decreased in accordance with the respective set point values (SPs). · Changes to manipulated values (MVs) of auto-tuning are completed in three sessions (upper limit output lower limit output - upper limit output) in the fewest times possible. If the auto-tuning progress does not change from 0 after multiple sessions, shorten the control interval Ts and retry auto-tuning. Operation actions · [S4] through [S4+29] are initialized when the execution condition is switched on. · If the parameters for proportional gain [Kp], integral time [Ti], and derivative time [Td] are all 0 at the start of PID operation, they are initialized to [Kp]=1, [Ti]=0 and [Td]=0 respectively, and operation is continued. · When the auto-tuning request signal is switched on, bit 1 of [S1] (auto-tuning completion flag) and [S4+10] (auto-tuning completion code) are cleared. · Set point values for auto-tuning are operated with the value of the set point value (SP) minus the bias value as the target value. · After auto-tuning is correctly completed, values are stored for the calculated Kp, Ti and Td multiplied by the correction coefficients specified by [S4+7] through [S4+9]. · After auto-tuning is correctly completed, bit 1 of [S1] (auto-tuning completion flag) and the auto-tuning completion code are stored in [S4+10]. If unsuccessful, the parameters for proportional gain [Kp], integral time [Ti], and derivative time [Td] are not updated. · When bit 3 of [S1] is 0 (PWM output), output is carried out in the range from 0 to 10000, with the duty given by the conversion formula: (Upper limit - Lower limit) x Internal calculated value / 10000. · When bit 3 of [S1] is 1 (analog output), the internal calculated value is output in the range from 0 to 10000, converted by the following formula, and set to the operand [S4] as the manipulated value (MV). Conversion formula: (Upper limit - Lower limit) x Internal calculated value / 10000 + Lower limit Flag operations Name Description SR7 SR8 (ER) To be set when the following parameters are out of the setting range: [S2]: process value (PV); [S3]: set point value (SP); [S3]+1: KP; [S3]+2: TI; [S3]+3: TD; and [S4]+4 through [S4]+9. To be set when an area specified by [S3] or [S4] exceeds the upper limit of the specified operation device. To be set in the case of out-of-range in indirect access (index modification). 10-44 DTR (Data Revision Detection) DTR (Data Revision Detection) Ladder diagram R0 DTR.US DT0 DT1 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Device address to detect revision of a data value D Device address to store the data value from the previous execution Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation If data in the device address specified by [S] has been changed from the values in the previous execution, SR9 (CY) is switched to ON. Process details Example 1) When the operation unit is 16-bit (US, SS) [i]...US,SS [S]...DT0 [D]...DT1 DT0 H 0011 DT1 H 2233 CY 0 DT0 H 0011 DT1 H 0011 CY 1 Example 2) When the operation unit is 32-bit (UL, SL, SF) [i]...UL,SL,SF [S]...DT0 [D]...DT2 DT0DT1 DT2DT3 CY H 11223344 H 11223344 1 DT0DT1 DT2DT3 CY H 11223344 H 11223344 0 Precautions during programming · Even when the operation unit is SF or DF, only data changes are checked. Type check for non-real numbers is not executed. 10-45 High-Level Instruction (Data Processing Control) Flag operations Name Description SR7 SR8 (ER) SR9(CY) To be set in case of out-of-range in indirect access (index modification). To be set when the value of [S] differs from the value of [D]. To be reset when the value of [S] equals the value of [D]. 10-46 RAMP (Ramp Output) RAMP (Ramp Output) Ladder diagram R0 RAMP.US DT0 DT1 DT2 DT10 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Device address where the default is stored, or constant S2 Device address where the target value is stored, or constant S3 Device address that stores the time width, or the constant (data available range: 1 to 30000) D Output storage device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 S1 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S2 S3 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · Scaling is carried out from the output default value, output target value, and output time (in ms) specified by [S1], [S2], and [S3], and linear output is executed in accordance with the time elapsed from the execution start. 10-47 High-Level Instruction (Data Processing Control) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0K1000 [S2]...DT1K5000 [S3]...DT2K400 [D]...DT10 Execution condition ON OFF DT10 (Output value) 5000 (target value) When the execution condition is switched on, the data are initialized. 1000 (default value) 0 400 ms (time elapsed) 400 700 1100 Time (ms) Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT0K5000 [S2]...DT1K1000 [S3]...DT2K400 [D]...DT10 Execution condition ON OFF DT10 (Output value) 5000 (default value) When the execution condition is switched on, the data are initialized. 1000 (target value) 0 400 ms (time elapsed) 400 700 1100 Time (ms) Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when the output time width specified by [S3] is out of the accessible range. 10-48 LIMT (Upper and Lower Limit Control) LIMT (Upper and Lower Limit Control) Ladder diagram R0 LIMT.US DT0 DT1 DT2 DT10 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Device address where the lower limit is stored, or lower limit data S2 Device address where the upper limit is stored, or upper limit data S3 Device address where the input value is stored, or the input value data D Output storage device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 S3 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · The output value, to be stored in the device address specified by [D], is controlled based on whether or not the input value specified by [S3] falls within the range bounded by the upper and lower limits set in [S1] and [S2]. · Output values are defined as follows: Lower limit [S1] > Input value [S3] Upper limit [S2] < Input value [S3] Lower limit [S1] Input value [S3] Upper limit [S2] Lower limit [S1] Output value [D] Upper limit [S2] Output value [D] Input value [S3] Output value [D] 10-49 High-Level Instruction (Data Processing Control) · For control by the upper limit only, the minimum value for the relevant operation unit is specified as the lower limit [S1]. · For control by the lower limit only, the maximum value for the relevant operation unit is specified as the upper limit [S1]. Min. value Max. value US 0 65535 SS -32768 32767 UL 0 4294967295 SL SF -2147483648 Negative infinite 2147483647 Positive infinite Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0 [S2]...DT1 [S3]...DT2 [D]...DT10 DT0 K 100 DT1 K 1000 DT2 K 500 DT10 K 0 Example 2) Operation unit: 32 bits (UL, SL) DT0 DT1 DT2 DT10 [i]...UL,SL [S1]...DT0 [S2]...DT2 [S3]...DT4 K 100 K 1000 K 500 K 500 [D]...DT10 DT0DT1 DT2DT3 DT4DT5 K 100 K 1000 K 90 DT0DT1 DT2DT3 DT4DT5 K 100 K 1000 K 90 DT10DT11 K 0 DT10DT11 K 100 Example 3) Operation units: Single precision floating-point real number (SF) [i]...SF [S1]...DT0 [S2]...DT4 [S3]...DT8 [D]...DT50 DT0DT1 DT4DT5 DT8DT9 SF 1.00E02 SF 1.00E03 SF 2.00E03 DT0DT1 DT4DT5 DT8DT9 SF 1.00E02 SF 1.00E03 SF 2.00E03 DT50DT51 SF 0.00E00 DT50DT51 SF 1.00E03 Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when [S1] is larger than [S2]. 10-50 BAND (Deadband Control) BAND (Deadband Control) Ladder diagram R0 BAND.SS DT0 DT1 DT2 DT10 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Device address where the lower limit is stored, or lower limit data S2 Device address where the upper limit is stored, or upper limit data S3 Device address where the input value is stored, or the input value data D Output storage device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K *4 U H *5 Real number String Index modification SF DF *6 *7 " " *2 S1 S2 S3 D *1: Cannot be specified when the operation unit is 16-bit integer (SS). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is integer (US, SS, UL, SL). *6: Can be specified only when the operation unit is single-precision floating point real number (SF). *7: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · The output value, to be stored in the device address specified by [D], is controlled based on whether or not the input value specified by [S3] falls within the range bounded by the upper and lower limits set in [S1] and [S2]. · The output value [D] stores the following data. Lower limit [S1] > Input value [S3] Upper limit [S2] < Input value [S3] Lower limit [S1] Input value [S3] Upper limit [S2] Input value [S3] - Lower limit [S1] Output value [D] Input value [S3] - Upper limit [S2] Output value [D] 0 Output value [D] 10-51 High-Level Instruction (Data Processing Control) Process details Example 1) Operation unit: 16 bits (SS) [i]...SS [S1]...DT0 [S2]...DT1 [S3]...DT2 [D]...DT10 DT0 K 100 DT1 K 1000 DT2 K 1100 DT0 K 100 DT1 K 1000 DT2 K 500 DT10 K 100 DT10 K 0 Example 2) Operation unit: 32 bits (SL) [i]...SL [S1]...DT0 [S2]...DT2 [S3]...DT4 [D]...DT10 DT0DT1 DT2DT3 DT4DT5 K 100 K 1000 K 1100 DT0DT1 DT2DT3 DT4DT5 K 100 K 1000 K 90 DT10DT11 K 100 DT10DT11 K -10 Example 3) Operation unit: Single-precision floating point real number (SF) [i]...SF [S1]...DT0 [S2]...DT2 [S3]...DT4 [D]...DT10 DT0DT1 DT2DT3 DT4DT5 SF 1.00E02 SF 1.00E03 SF 1.10E03 DT0DT1 DT2DT3 DT4DT5 SF 1.00E02 SF 1.00E03 SF 3.00E03 DT10DT11 SF 1.00E02 DT10DT11 SF 2.00E03 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [S1] is larger than [S2]. 10-52 ZONE (Zone Control) ZONE (Zone Control) Ladder diagram R0 ZONE.US DT0 DT1 DT2 DT10 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Device address that stores the negative bias value at input, or bias value data S2 Device address that stores the positive bias value at input, or bias value data S3 Device address where the input value is stored, or the input value data D Output storage device address Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H *4 *5 *6 Real number String Index modification SF DF *7 *8 " " *2 S1 S2 S3 D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) *4: Can be specified only when the operation unit is signed integer (SS, SL). *5: Can be specified only when the operation unit is unsigned integer (US, UL). *6: Can be specified only when the operation unit is integer (US, SS, UL, SL). *7: Can be specified only when the operation unit is single-precision floating point real number (SF). *8: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · The bias value specified by [S1] or [S2] is added to the input value specified by [S3]. The resulting value is stored in the device address specified by [D]. · Output values are defined as follows: Input value [S3] < 0 Input value [S3] = 0 Input value [S3] > 0 Input value [S3] + Negative bias value [S1] Output value [D] 0 Output value [D] Input value [S3] + Positive bias value [S2] Output value [D] 10-53 High-Level Instruction (Data Processing Control) Process details Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0 [S2]...DT1 [S3]...DT2 [D]...DT10 DT0 K -100 DT1 K 1000 DT2 K 0 DT0 K -100 DT1 K 1000 DT2 K 500 DT10 K 0 DT10 Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT0 [S2]...DT2 [S3]...DT4 K 1500 [D]...DT10 DT0DT1 DT2DT3 DT4DT5 K -100 K 1000 K 1 DT0DT1 DT2DT3 DT4DT5 K -100 K 1000 K -300 DT10DT11 K 1001 DT10DT11 K -400 Example 3) Operation units: Single precision floating point real number (SF) [i]...SF [S1]...DT0 [S2]...DT4 [S3]...DT8 [D]...DT50 DT0DT1 DT4DT5 DT8DT9 SF -1.00E02 SF 1.00E02 SF 1.00E00 DT0DT1 DT4DT5 DT8DT9 SF -1.00E02 SF 1.00E02 SF 0.00E00 DT50DT51 SF 1.01E02 DT50DT51 SF 0.00E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 10-54 FILTR (Time Constant Processing) FILTR (Time Constant Processing) Ladder diagram R0 FILTR WX0 DT0 DT1 WR1 S1 S2 S3 D List of operands Operand Description S1 Filtering targeted data (device address) S2 Filtering targeted bit (device address or constant) (data available range: H0000 to HFFFF) S3 Filtering time (device address or constant) (data available range: 0 to 30000, in ms) D Filtering result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3 Integer K U H Real number String Index modification SF DF " " *1 D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) Outline of operation · Among data specified by [S1], bits specified by [S2] with the value 0 are directly output, and those with the value 1 are filtered and output. · Filtering is carried out for the targeted bits within the time specified by [S3] (in 0 to 30000 ms). The result is output to the area specified by [D]. · When the execution condition is switched on, all input bits specified by [S1] are directly output without conditions. · It is possible that a delay of up to one scan may be caused in the filtering time. 10-55 High-Level Instruction (Data Processing Control) Process details Among targeted data, specified bits with the value 0 are directly output, and those with the value 1 are filtered and output. Filtering is carried out within the specified time and the result is output. Default conditions Operand [S1] [S2] [S3] [D] Description Targeted data Targeted bit Filtering time Processing result Device Setting value WX0 DT0 DT1 WR1 H FFFF H FF00 K500 H 0000 WX0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 WR1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Execution condition switched on (all input bits are directly output unconditionally) Operand Description Device Setting value [S1] Targeted data WX0 [S2] Targeted bit DT0 [S3] Filtering time DT1 [D] Processing result WR1 H FFFF H FF00 K500 H FFFF WX0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 WR1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Filtering targeted data change (only untargeted bits are output) Operand Description Device Setting value [S1] Targeted data WX0 [S2] Targeted bit DT0 [S3] Filtering time DT1 [D] Processing result WR1 H 0F0F H FF00 K500 H FF0F WX0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 WR1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 Filter processing time elapse (targeted bits are output) Operand Description Device Setting value [S1] Targeted data WX0 [S2] Targeted bit DT0 [S3] Filtering time DT1 [D] Processing result WR1 H 0F0F H FF00 K500 H 0F0F WX0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 WR1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 : Filtering targeted data change (only untargeted bits are output) Operand Description Device Setting value [S1] Targeted data WX0 [S2] Targeted bit DT0 [S3] Filtering time DT1 [D] Processing result WR1 H 0000 H FF00 K500 H 0F00 WX0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 WR1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Filtering targeted data change before filter processing time elapse (only untargeted bits are output) Operand Description Device Setting value [S1] Targeted data WX0 [S2] Targeted bit DT0 [S3] Filtering time DT1 [D] Processing result WR1 H FFFF H FF00 K500 H 0FFF WX0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 WR1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 : Filter processing time elapse (targeted bits are output) Operand Description Device Setting value [S1] Targeted data WX0 H FFFF WX0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [S2] Targeted bit DT0 H FF00 [S3] Filtering time DT1 K500 [D] Processing result WR1 H FFFF WR1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10-56 FILTR (Time Constant Processing) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the filtering time [S3] is out of the range. 10-57 High-Level Instruction (Data Processing Control) 10-58 11 11 High-level Instructions (Real Number) Applicable Models: All Models High-level Instructions (Real Number) SIN (Sine Operation) Ladder diagram R0 SIN.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: radian) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], SIN for the angle data (units: radian) stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. SIN([S]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30° radian for [S]) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 DT12DT13 DT14DT15 Angle 30° 60° 90° Value (radians) SF 5.235988E01 SF 1.047198E00 SF 1.570796E00 DT0DT1 DT2DT3 DT4DT5 Value SF 0.000000E00 SF 5.000000E01 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-2 COS (Cosine Operation) COS (Cosine Operation) Ladder diagram R0 COS.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: radian) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], COS for the angle data (units: radian) stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. COS([S]) (D) Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30° radian for [S]) [i]...SF [S]...DT10 [D]...DT2 Angle Value (radians) DT10DT11 30° SF 5.235988E01 DT12DT13 60° SF 1.047198E00 DT14DT15 90° SF 1.570796E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 8.660254E01 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-3 High-level Instructions (Real Number) TAN (Tangent Operation) Ladder diagram R0 TAN.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: radian) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], TAN for the angle data (units: radian) stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. TAN([S]) (D) Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30° radian for [S]) [i]...SF [S]...DT10 [D]...DT2 Angle DT10DT11 30° DT12DT13 60° DT14DT15 90° Value (radians) SF 5.235988E01 SF 1.047198E00 SF 1.570796E00 DT0DT1 DT2DT3 DT4DT5 Value SF 0.000000E00 SF 5.773503E01 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-4 ASIN (Arcsine Operation) ASIN (Arcsine Operation) Ladder diagram R0 ASIN.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (SIN value) (data available range: -1.0 to +1.0) D Calculation result (device address) (units: radian) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], ASIN (arcsine) for the SIN value stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. ASIN([S]) (D) Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 15° SIN value for [S]) [i]...SF [S]...DT10 [D]...DT2 Angle Value (radians) DT10DT11 15° SF2.588190E01 DT12DT13 30° SF1.047198E00 DT14DT15 45° SF1.570796E00 Value DT0DT1 SF0.000000E00 DT2DT3 SF2.617994E01 DT4DT5 SF0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). To be set when [S] (angle data) is out of the accessible range. 11-5 High-level Instructions (Real Number) ACOS (Arccosine Operation) Ladder diagram R0 ACOS.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (COS value) (data available range: -1.0 to +1.0) D Calculation result (device address) (units: radian) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], ACOS (arccosine) for the COS value stored in [S] is calculated. ACOS([S]) (D) Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 15° COS value for [S]) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 DT12DT13 DT14DT15 Angle Value (radians) 15 SF9.659258E01 30 SF1.047198E00 45 SF1.570796E00 DT0DT1 DT2DT3 DT4DT5 Value SF0.000000E00 SF2.617994E01 SF0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). To be set when [S] (angle data) is out of the accessible range. 11-6 ATAN (Arctangent Operation) ATAN (Arctangent Operation) Ladder diagram R0 ATAN.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (TAN value) D Calculation result (device address) (units: radian) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], ATAN (arctangent) for the TAN value stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. ATAN([S]) (D) Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 15° TAN value for [S]) [i]...SF [S]...DT10 [D]...DT2 Angle Value (radians) DT10DT11 15° SF 2.679392E01 DT12DT13 30° SF 1.047198E00 DT14DT15 45° SF 1.570796E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 2.617994E01 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-7 High-level Instructions (Real Number) ATAN2 (Conversion: Coordinate Data Angle Radian) Ladder diagram R0 ATAN2.SF DT10 DT12 DT2 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Dividend of angle data (device address or constant) (Y coordinate) S2 Angle data divisor (device address or constant) (X coordinate) D Calculation result (device address) (units: radian) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S1 S2 D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], ATAN (units: radian) is calculated from the Y coordinate specified by [S1] and the X coordinate specified by [S2]. · The calculation result is stored in the area starting with [D]. ATAN2([S1], [S2]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 1.0 for [S1] (Y coordinate) and [S2] (X coordinate)) [i]...SF [S1]...DT10 [S2]...DT12 [D]...DT2 Value DT10DT11 SF 1.000000E00 DT12DT13 SF 1.000000E00 DT14DT15 SF 0.000000E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 7.853982E01 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S1] (Y coordinate) or [S2] (X coordinate). To be set when 0.0 is specified for [S1] (Y coordinate) and 0.0 for [S2] (X coordinate). 11-8 SINH (Hyperbolic Sine Operation) SINH (Hyperbolic Sine Operation) Ladder diagram R0 SINH.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: radian) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], SINH (hyperbolic sine) for the angle data (units: radian) stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. SINH([S]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30° radian for [S]) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 DT12DT13 DT14DT15 Angle Value (radians) 30° SF 5.235988E01 60° SF 1.047198E00 90° SF 1.570796E00 DT0DT1 DT2DT3 DT4DT5 Value SF 0.000000E00 SF 5.478535E01 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-9 High-level Instructions (Real Number) COSH (Hyperbolic Cosine Operation) Ladder diagram R0 COSH.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: radian) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], COSH (hyperbolic cosine) for the angle data (units: radian) stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. COSH([S]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30° radian for [S]) [i]...SF [S]...DT10 [D]...DT2 Angle Value (radians) DT10DT11 30° SF 5.235988E01 DT12DT13 60° SF 1.047198E00 DT14DT15 90° SF 1.570796E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 1.140238E00 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-10 TANH (Hyperbolic Tangent Operation) TANH (Hyperbolic Tangent Operation) Ladder diagram R0 TANH.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: radian) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], TANH (hyperbolic tangent) for the angle data (units: radian) stored in [S] is calculated. · The calculation result is stored in the area starting with [D]. TANH([S]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30° radian for [S]) [i]...SF [S]...DT10 [D]...DT2 Angle DT10DT11 30° DT12DT13 60° DT14DT15 90° Value (radians) SF 5.235988E01 SF 1.047198E00 SF 1.570796E00 DT0DT1 DT2DT3 DT4DT5 Value SF 0.000000E00 SF 4.804728E01 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-11 High-level Instructions (Real Number) EXP (Exponential Operation) Ladder diagram R0 EXP.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) (real number value) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], the EXP (exponent) is calculated for the real number value stored in the area starting with [S]. · The calculation result is stored in the area starting with [D]. EXP([S]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S]...DT10 [D]...DT2 Value (radians) DT10DT11 SF 3.000000E00 DT12DT13 SF 4.000000E00 DT14DT15 SF 5.000000E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 2.008554E01 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (calculation target data). 11-12 LN (Natural Logarithmic Operation) LN (Natural Logarithmic Operation) Ladder diagram R0 LN.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) (real number value) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], LN (natural logarithm) for the real number value stored in the area starting with [S] is calculated. · The calculation result is stored in the area starting with [D]. LN([S]) [D] Process details · LN (calculation target data) is calculated, and set for the calculation result. Example) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S]...DT10 [D]...DT2 Value (radians) DT10DT11 SF 3.000000E00 DT12DT13 SF 4.000000E00 DT14DT15 SF 5.000000E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 1.098612E00 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (calculation target data). To be set when a value that is 0.0 or less is specified for [S] (calculation target data). 11-13 High-level Instructions (Real Number) LOG (Common Logarithmic Operation) Ladder diagram R0 LOG.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) (real number value) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], LOG (common logarithm) for the real number value stored in the area starting with [S] is calculated. · The calculation result is stored in the area starting with [D]. LOG([S]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S]...DT10 [D]...DT2 Value (radians) DT10DT11 SF 3.000000E00 DT12DT13 SF 4.000000E00 DT14DT15 SF 5.000000E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 4.771213E01 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (calculation target data). To be set when a value that is 0.0 or less is specified for [S] (calculation target data). 11-14 PWR (Power Operation) PWR (Power Operation) Ladder diagram R0 PWR.SF DT10 DT12 DT2 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Data to be powered (device address or constant) (real number value) S2 Powering data (device address or constant) (real number value) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], the real number value stored in the area starting with [S1] is powered by the real number value stored in the area starting with [S2]. · The calculation result is stored in the area starting with [D]. [S1] [S2] [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S1]...DT10 [S2]...DT12 [D]...DT2 Value (radians) DT10DT11 SF 3.000000E00 DT12DT13 SF 4.000000E00 DT14DT15 SF 5.000000E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 8.100000E01 DT4DT5 SF 0.000000E00 Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when a non-real number is specified for [S1] (data to be powered) or [S2] (powering data). To be set when 0.0 is specified for [S1] (data to be powered) and a value that is 0.0 or less is specified for [S2] (powering data). To be set when a negative value is specified for [S1] (data to be powered) and a non-integer value is specified for [S2] (powering data). 11-15 High-level Instructions (Real Number) SQR (Square Root Operation) Ladder diagram R0 SQR.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) (real number value) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], square root for the real number value stored in the area starting with [S] is calculated. · The calculation result is stored in the area starting with [D]. SQR([S]) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 DT12DT13 DT14DT15 Value (radians) SF 3.000000E00 SF 4.000000E00 SF 5.000000E00 Value DT0DT1 SF 0.000000E00 DT2DT3 SF 1.732051E00 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (calculation target data). To be set when a negative value is specified for [S] (calculation target data). 11-16 RAD (Conversion: Degrees Radian) RAD (Conversion: Degrees Radian) Ladder diagram R0 RAD.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: degrees) D Angle data (device address) (units: radian) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], angle data (units: degrees), stored in the area starting with [S], are converted into angle data (units: radian). · The calculation result is stored in the area starting with [D]. [S] × ( / 180 ) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30 (degrees) for [S]) [i]...SF [S]...DT10 [D]...DT2 Value (degrees) DT10DT11 SF 3.000000E+01 DT12DT13 SF 6.000000E01 DT14DT15 SF 9.000000E01 Value (radians) DT0DT1 SF 0.000000E00 DT2DT3 SF 5.235988E01 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-17 High-level Instructions (Real Number) DEG (Conversion: Radian Degrees) Ladder diagram R0 DEG.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Angle data (device address or constant) (units: radian) D Angle data (device address) (units: degrees) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], angle data (units: radian), stored in the area starting with [S], are converted into angle data (units: degrees). · The calculation result is stored in the area starting with [D]. [S] × ( 180 / ) [D] Process details Example) Operation unit: Single-precision, floating-point real number (SF) (Designate 30° radian for [S]) [i]...SF [S]...DT10 [D]...DT2 Angle Value (radians) DT10DT11 30° SF 5.235988E01 DT12DT13 60° SF 1.047198E00 DT14DT15 90° SF 1.570796E00 Value (degrees) DT0DT1 SF 0.000000E00 DT2DT3 SF 3.000000E+01 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S] (angle data). 11-18 FINT (Floating Point Real Number Data - Rounding the First Decimal Point Down) FINT (Floating Point Real Number Data - Rounding the First Decimal Point Down) Ladder diagram R0 FINT.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K U H Real number String Index modification SF DF *3 *4 " " *1 D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], the real number value stored in the area starting with [S] is processed and rounded the first decimal point down. · The calculation result is stored in the area starting with [D]. Process details Example 1) Operation unit: Single-precision, floating-point real number (SF) (positive real number) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF 1.234560E02 DT12DT13 SF 3.456780E02 DT14DT15 SF 5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF 1.230000E02 DT4DT5 SF 0.000000E00 Example 2) Operation unit: Single-precision, floating-point real number (SF) (negative value) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF -1.234560E02 DT12DT13 SF -3.456780E02 DT14DT15 SF -5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF -1.240000E02 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. 11-19 High-level Instructions (Real Number) FRINT (Floating Point Real Number Data - Rounding the First Decimal Point Off) Ladder diagram R0 FRINT.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K U H Real number String Index modification SF DF *3 *4 " " *1 D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], the real number value stored in the area starting with [S] is processed and rounded the first decimal point off. · The calculation result is stored in the area starting with [D]. Process details Example 1) Operation unit: Single-precision, floating-point real number (SF) (positive real number) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF 1.234560E02 DT12DT13 SF 3.456780E02 DT14DT15 SF 5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF 1.230000E02 DT4DT5 SF 0.000000E00 Example 2) Operation unit: Single-precision, floating-point real number (SF) (negative value) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF -1.234560E02 DT12DT13 SF -3.456780E02 DT14DT15 SF -5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF -1.230000E02 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. 11-20 FNEG (Floating Point Real Number Data - Sign Changes (Negative/Positive Conversion)) FNEG (Floating Point Real Number Data - Sign Changes (Negative/Positive Conversion)) Ladder diagram R0 FNEG.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K U H Real number String Index modification SF DF *3 *4 " " *1 D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], the sign (negative or positive) of the real number value stored in the area starting with [S] is inverted. · The calculation result is stored in the area starting with [D]. Process details Example 1) Operation unit: Single-precision, floating-point real number (SF) (positive real number) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF 1.234560E02 DT12DT13 SF 3.456780E02 DT14DT15 SF 5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF -1.234560E02 DT4DT5 SF 0.000000E00 Example 2) Operation unit: Single-precision, floating-point real number (SF) (negative value) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF -1.234560E02 DT12DT13 SF -3.456780E02 DT14DT15 SF -5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF 1.234560E02 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. 11-21 High-level Instructions (Real Number) FABS (Floating Point Real Number Data - Absolute Value) Ladder diagram R0 FABS.SF DT10 DT2 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Calculation target data (device address or constant) D Calculation result (device address) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K U H Real number String Index modification SF DF *3 *4 " " *1 D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · According to the operation unit [i], the absolute value of the real number value stored in the area starting with [S] is calculated. · The calculation result is stored in the area starting with [D]. Process details Example 1) Operation unit: Single-precision, floating-point real number (SF) (positive real number) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF 1.234560E02 DT12DT13 SF 3.456780E02 DT14DT15 SF 5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF 1.234560E02 DT4DT5 SF 0.000000E00 Example 2) Operation unit: Single-precision, floating-point real number (SF) (negative value) [i]...SF [S]...DT10 [D]...DT2 DT10DT11 SF -1.234560E02 DT12DT13 SF -3.456780E02 DT14DT15 SF -5.678900E02 DT0DT1 SF 0.000000E00 DT2DT3 SF 1.234560E02 DT4DT5 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. 11-22 STOD (Conversion: Single-precision Real Number Data Double-precision Real Number) STOD (Conversion: Single-precision Real Number Data Double-precision Real Number) Ladder diagram R0 STOD.SF DT0 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device where the target data to be converted is stored or the constant (data format: single-precision real number data) D Starting address of the device where conversion results are stored (data format: double-precision real number data) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF " " *1 S D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) Outline of operation · This instruction converts the single-precision floating point real number stored in the area starting with [S] to a double-precision floating point real number. · The conversion result is stored in the area starting with [D]. Example of processing [S]...DT10 [D]...DT20 DT10DT11 DT12DT13 DT14DT15 -123.456789 345.678000 567.890000 DT20DT23 -123.45678900000 DT24DT27 0.00000000000 DT28DT31 0.00000000000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. 11-23 High-level Instructions (Real Number) DTOS (Conversion: Double-precision Real Number Data Single-precision Real Number) Ladder diagram R0 DTOS.DF DT0 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device where the target data to be converted is stored or the constant (data format: double-precision real number data) D Starting address of the device where conversion results are stored (data format: single-precision real number data) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 S Integer K U H Real number String Index modification SF DF *3 " " *1 D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction converts the double-precision floating point real number stored in the area starting with [S] to a single-precision floating point real number. · The conversion result is stored in the area starting with [D]. Example of processing [S]...DT20 [D]...DT10 DT20DT23 -123.45678901234 DT24DT27 0.00000000000 DT28DT31 0.00000000000 DT10DT11 DT12DT13 DT14DT15 -123.4568 345.678000 567.890000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. 11-24 DISF (Separation of Mantissa and Exponent of Single-precision or Double-precision Real Number Data) DISF (Separation of Mantissa and Exponent of Single-precision or Double-precision Real Number Data) Ladder diagram R0 DISF.SF DT10 DT2 DT4 i S D1 D2 Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device where the target data to be separated is stored or the constant (data format: according to the operation unit) D1 Starting address of the device where mantissa is stored (data format: according to the operation unit) Range (common to SF and DF): 0.5 or more, and less than 1.0 as absolute value) D2 Starting address of the device where exponent is stored (data format: signed 32-bit integer) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF *3 *4 " " *1 S D1 D2 *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is single-precision floating point real number (SF). *4: Can be specified only when the operation unit is double-precision floating point real number (DF). Outline of operation · This instruction separates the floating point real number data stored in the area starting with [S] into mantissa and exponent according to the operation unit [i]. · The mantissa is stored in the area starting with [D1] and the exponent in the area starting with [D2]. 11-25 High-level Instructions (Real Number) Example of conversion Example 1) Operation units: Single-precision real number (SF) (positive real number) [i]...SF [S]...DT10 [D1]...DT2 [D2]...DT4 DT10DT11 7.000000 * 7.0 = 0.875 x (the cube of 2) DT0DT1 DT2DT3 DT4DT5 0.000000 0.875000 3 (Mantissa) (Exponent) Example 2) Operation units: Double-precision real number (DF) (positive real number) [i]...DF [S]...DT4 [D1]...DT20 [D2]...DT28 DT4DT7 40.00000000000 * 40.0 = 0.6250 x (the sixth power of 2) DT20DT23 DT24DT27 DT28DT29 0.62500000000 0.00000000000 6 (Mantissa) (Exponent) Example 3) Operation units: Single-precision real number (SF) (negative real number) [i]...SF [S]...DT10 [D1]...DT2 [D2]...DT4 DT10DT11 -7.000000 * -7.0 = (-0.875) x (the cube of 2) DT0DT1 DT2DT3 DT4DT5 0.000000 -0.875000 3 (Mantissa) (Exponent) Example 4) Operation units: Double-precision real number (DF) (negative real number) [i]...DF [S]...DT4 [D1]...DT20 [D2]...DT28 DT10DT11 -40.00000000000 * -40.0 = (-0.6250) x (the sixth power of 2) DT20DT23 -0.62500000000 (Mantissa) DT24DT27 0.00000000000 DT28DT29 6 (Exponent) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. 11-26 UNIF (Combining of Mantissa and Exponent, and Conversion of Single-precision or Double-precision Real Number) UNIF (Combining of Mantissa and Exponent, and Conversion of Single-precision or Double-precision Real Number) Ladder diagram R0 UNIF.SF DT2 DT4 DT10 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting address of the device where mantissa is stored (data format: according to the operation unit) Range (common to SF and DF): 0.5 or more, and less than 1.0 as absolute value) Starting address of the device where exponent is stored (data format: signed 32-bit integer) S2 Range (for SF): -126 to 127 Range (for DF): -1022 to 1023 D Starting address of the device where combined data is stored (data format: according to the operation unit) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H Real number String Index modification SF DF " " *1 S1 S2 D *1: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *2: Index register (I0 to IE) Outline of operation · This instruction combines the data of mantissa and exponent stored in the areas starting with [S1] and [S2] according to the operation unit [i]. · The conversion result is stored in the area starting with [D]. 11-27 High-level Instructions (Real Number) Example of conversion Example 1) Operation units: Single-precision real number (SF) (positive real number) [S1]...DT2 [S2]...DT4 [D]...DT10 DT0DT1 (Mantissa) DT2DT3 (Exponent) DT4DT5 0.000000 0.875000 3 DT10DT11 7.000000 * 7.0 = 0.875 x (the cube of 2) Example 2) Operation units: Double-precision real number (DF) (positive real number) [S1]...DT20 [S2]...DT28 [D]...DT4 (Mantissa) DT20DT23 DT24DT27 (Exponent) DT28DT29 0.62500000000 0.00000000000 6 DT4DT7 40.00000000000 * 40.0 = 0.6250 x (the sixth power of 2) Example 3) Operation units: Single-precision real number (SF) (negative real number) [S1]...DT2 [S2]...DT4 [D]...DT10 DT0DT1 (Mantissa) DT2DT3 (Exponent) DT4DT5 0.000000 -0.875000 3 DT10DT11 -7.000000 * -7.0 = (-0.875) x (the cube of 2) Example 4) Operation units: Double-precision real number (DF) (negative real number) [S1]...DT20 [S2]...DT28 [D]...DT4 (Mantissa) DT20DT23 DT24DT27 (Exponent) DT28DT29 -0.62500000000 0.00000000000 6 DT4DT7 -40.00000000000 * -40.0 = (-0.6250) x (the sixth power of 2) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when an out-of-range value is specified for [S1] (mantissa). To be set when an out-of-range value is specified for [S2] (exponent). 11-28 FLT (Conversion: Integer Floating Point Real Number Data) FLT (Conversion: Integer Floating Point Real Number Data) Ladder diagram R0 FLT.US DT0 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Conversion target data (device address or constant (data format: according to the operation unit)) D Conversion result (device address (data format: single-precision floating point real number data) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K U H *3 *4 Real number String Index modification SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · According to the operation unit [i], the integer value stored in the area starting with [S] is converted into a single-precision floating point real number value. · The calculation result is stored in the area starting with [D]. 11-29 High-level Instructions (Real Number) Process details Example 1) Unsigned 16 bits (US) [i]...US [S]...DT0 [D]...DT10 DT0 U 123 DT1 U 456 DT2 U 789 DT10DT11 DT12DT13 DT14DT15 SF 1.230000E02 SF 0.000000E00 SF 0.000000E00 Example 2) Signed 16 bits (SS) (positive value) [i]...SS [S]...DT20 [D]...DT10 DT20 DT21 DT22 K 123 K 456 K 789 DT10DT11 DT12DT13 DT14DT15 SF 1.230000E02 SF 0.000000E00 SF 0.000000E00 Example 3) Signed 16 bits (SS) (negative value) [i]...SS [S]...DT20 [D]...DT10 DT20 DT21 DT22 K -123 K -456 K -789 DT10DT11 SF -1.230000E02 DT12DT13 SF 3.456780E02 DT14DT15 SF 5.678900E02 Example 4) Unsigned 32 bits (UL) [i]...UL [S]...DT0 [D]...DT10 DT0DT1 DT2DT3 DT4DT5 U 12345 U 67890 U 13579 DT10DT11 SF 1.234500E04 DT12DT13 SF 0.000000E00 DT14DT15 SF 0.000000E00 Example 5) Signed 32 bits (SL) (positive value) [i]...SL [S]...DT20 [D]...DT10 DT20DT21 DT22DT23 DT24DT25 K 12345 K 67890 K 13579 DT10DT11 DT12DT13 DT14DT15 SF 1.234500E04 SF 0.000000E00 SF 0.000000E00 Example 6) Signed 32 bits (SL) (negative value) [i]...SL [S]...DT20 [D]...DT10 DT20DT21 DT22DT23 DT24DT25 K -12345 K -67890 K -13579 DT10DT11 SF -1.234500E04 DT12DT13 SF 0.000000E00 DT14DT15 SF 0.000000E00 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 11-30 DFLT (Conversion: Integer Double-precision Real Number Data) DFLT (Conversion: Integer Double-precision Real Number Data) Ladder diagram R0 DFLT.US DT20 DT10 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device where the target data to be converted is stored or the constant (data format: according to the operation unit) D Starting address of the device where conversion results are stored (data format: double-precision real number data) Available devices (: Available) 16-bit 32-bit device device*1 Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *2 Integer K *3 U *4 H Real number String Index modification SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Index register (I0 to IE) *3: Can be specified only when the operation unit is signed integer (SS, SL). *4: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction converts the integer data stored in the area starting with [S] to a double-precision floating point real number. · The conversion result is stored in the area starting with [D]. Example of conversion Example 1) Unsigned 16 bits (US) [i]...US [S] ...DT0 [D] ...DT10 DT0 123 DT1 456 DT2 789 DT10DT13 123.00000000000 DT14DT17 0.000000 DT18DT21 0.000000 Example 2) Signed 16 bits (SS) (positive value) [i]...SS [S] ...DT0 [D] ...DT10 DT0 123 DT1 456 DT2 789 DT10DT13 123.00000000000 DT14DT17 0.000000 DT18DT21 0.000000 11-31 High-level Instructions (Real Number) Example 3) Signed 16 bits (SS) (negative value) [i]...SS [S] ...DT0 [D] ...DT10 DT0 -123 DT1 -456 DT2 -789 DT10DT13 -123.00000000000 DT14DT17 0.000000 DT18DT21 0.000000 Example 4) Unsigned 32 bits (UL) [i]...UL [S] ...DT0 [D] ...DT10 DT0DT1 DT2DT3 DT4DT5 12345 67890 13579 DT10DT13 12345.00000000000 DT14DT17 0.000000 DT18DT21 0.000000 Example 5) Signed 32 bits (SL) (positive value) [i]...SL [S] ...DT0 [D] ...DT10 DT0DT1 DT2DT3 DT4DT5 12345 67890 13579 DT10DT13 12345.00000000000 DT14DT17 0.000000 DT18DT21 0.000000 Example 6) Signed 32 bits (SL) (negative value) [i]...SL [S] ...DT0 [D] ...DT10 DT0DT1 DT2DT3 DT4DT5 -12345 -67890 -13579 DT10DT13 -12345.00000000000 DT14DT17 0.000000 DT18DT21 0.000000 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 11-32 INT (Conversion: Floating Point Real Number Data Integer (Round Down)) INT (Conversion: Floating Point Real Number Data Integer (Round Down)) Ladder diagram R0 INT.US DT10 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Conversion target data (device address or constant (data format: according to the operation unit)) D Conversion target data (device address or constant (data format: according to the operation unit)) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *3: Index register (I0 to IE) Outline of operation · According to the operation unit [i], the single-precision floating point real number value, which is stored in the area starting with [S], is converted into an integer value (the largest possible integer without exceeding the data). · The calculation result is stored in the area starting with [D]. · The data setting ranges for conversion target data [S] by operation units are indicated below. Operation unit US SS UL SL Min. value 0.00 -32,768.00 0.00 -2,147,483,648.00 Max. value 65,535.99 32,767.99 4,294,967,295.99 2,147,483,647.99 11-33 High-level Instructions (Real Number) Process details Example 1) Unsigned 16 bits (US) (positive value) [i]...US [S]...DT10 [D]...DT0 DT10DT11 SF 2.345670E02 DT0 DT12DT13 SF 3.456780E02 DT1 DT14DT15 SF 4.567890E02 DT2 U 234 U 0 U 0 Example 2) Unsigned 16 bits (US) (negative value) [i]...US [S]...DT10 [D]...DT0 DT10DT11 SF -2.345670E02 DT12DT13 SF -3.456780E02 DT14DT15 SF -4.567890E02 DT0 U 0 DT1 U 0 DT2 U 0 * Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. Example 3) Signed 16 bits (SS) (positive value) [i]...SS [S]...DT10 [D]...DT20 DT10DT11 DT12DT13 DT14DT15 SF 2.345670E02 SF 3.456780E02 SF 4.567890E02 DT20 DT21 DT22 K 234 K 0 K 0 Example 4) Signed 16 bits (SS) (negative value) [i]...SS [S]...DT10 [D]...DT20 DT10DT11 SF -2.345670E02 DT12DT13 SF -3.456780E02 DT14DT15 SF -4.567890E02 DT20 DT21 DT22 K -235 K 0 K 0 Example 5) Unsigned 32 bits (UL) (positive value) [i]...UL [S]...DT10 [D]...DT0 DT10DT11 SF 1.234567E05 DT12DT13 SF 2.468000E02 DT14DT15 SF 1.357000E02 DT0DT1 DT2DT3 DT4DT5 U 123456 K 0 K 0 11-34 INT (Conversion: Floating Point Real Number Data Integer (Round Down)) Example 6) Unsigned 32 bits (UL) (negative value) [i]...UL [S]...DT10 [D]...DT0 DT10DT11 SF -1.234567E05 DT0DT1 U 0 DT12DT13 SF -2.468000E02 DT2DT3 U 0 DT14DT15 SF -1.357000E02 DT4DT5 U 0 * Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. Example 7) Signed 32 bits (SL) (positive value) [i]...SL [S]...DT10 [D]...DT20 DT10DT11 SF 1.234567E05 DT12DT13 SF 2.468000E02 DT14DT15 SF 1.357000E02 DT20DT21 DT22DT23 DT24DT25 K 123456 K 0 K 0 Example 8) Signed 32 bits (SL) (negative value) [i]...SL [S]...DT10 [D]...DT20 DT10DT11 SF -1.234567E05 DT12DT13 SF -2.468000E02 DT14DT15 SF -1.357000E02 DT20DT21 DT22DT23 DT24DT25 K -12346 K 0 K 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. To be set when an out-of-range value is specified for [S] (conversion target data). 11-35 High-level Instructions (Real Number) DINT (Conversion: Double-precision Real Number Data Integer (Round Down)) Ladder diagram R0 DINT.US DT10 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device where the target data to be converted is stored or the constant (data format: double-precision real number data) D Starting address of the device where conversion results are stored (data format: according to the operation unit) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction converts the double-precision floating point real number data stored in the area starting with [S] to an integer (the largest possible integer without exceeding the real number). · The conversion result is stored in the area starting with [D]. · The data setting ranges for conversion target data [S] by operation units are indicated below. Operation unit US SS UL SL Min. value 0.00 -32,768.00 0.00 -2,147,483,648.00 Max. value 65,535.99 32,767.99 4,294,967,295.99 2,147,483,647.99 11-36 DINT (Conversion: Double-precision Real Number Data Integer (Round Down)) Example of processing Example 1) Unsigned 16 bits (US) (positive value) [i]...US [S] ...DT10 [D] ...DT0 DT10DT13 234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 234 DT1 0 DT2 0 Example 2) Unsigned 16 bits (US) (negative value) Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. [i]...US [S] ...DT10 [D] ...DT0 DT10DT13 -234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 0 DT1 0 DT2 0 Example 3) Signed 16 bits (SS) (positive value) [i]...SS [S] ...DT10 [D] ...DT0 DT10DT13 234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 234 DT1 0 DT2 0 Example 4) Signed 16 bits (SS) (negative value) [i]...SS [S] ...DT10 [D] ...DT0 DT10DT13 -234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 -235 DT1 0 DT2 0 11-37 High-level Instructions (Real Number) Example 5) Unsigned 32 bits (UL) (positive value) [i]...UL [S] ...DT10 [D] ...DT0 DT10DT13 123456.78900000000 DT14DT17 246.80000000000 DT18DT21 135.70000000000 DT0DT1 DT2DT3 DT4DT5 123456 0 0 Example 6) Unsigned 32 bits (UL) (negative value) Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. [i]...UL [S] ...DT10 [D] ...DT0 DT10DT13 -12345.78900000000 DT0DT1 0 DT14DT17 -246.80000000000 DT2DT3 0 DT18DT21 -135.70000000000 DT4DT5 0 Example 7) Signed 32 bits (SL) (positive value) [i]...SL [S] ...DT0 [D] ...DT20 DT0DT3 123456.78900000000 DT4DT7 246.80000000000 DT8DT11 135.70000000000 DT20DT21 DT22DT23 DT24DT25 Example 8) Signed 32 bits (SL) (negative value) 123456 0 0 [i]...SL [S] ...DT0 [D] ...DT20 DT0DT3 -12345.78900000000 DT4DT7 -246.80000000000 DT8DT11 -135.70000000000 DT20DT21 DT22DT23 DT24DT25 -12346 0 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. To be set when an out-of-range value is specified for [S] (conversion target data). 11-38 FIX (Conversion: Floating Point Real Number Data Integer (Round Decimal Digits)) FIX (Conversion: Floating Point Real Number Data Integer (Round Decimal Digits)) Ladder diagram R0 FIX.US DT10 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Conversion target data (device address or constant (data format: according to the operation unit)) D Conversion target data (device address or constant (data format: according to the operation unit)) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified (real number constants cannot be specified). *3: Index register (I0 to IE) Outline of operation · According to the operation unit [i], the single-precision floating point real number value, which is stored in the area starting with [S], is converted to an integer value (rounding the first decimal point down). · The calculation result is stored in the area starting with [D]. · The data setting ranges for conversion target data [S] by operation units are indicated below. Operation unit US SS UL SL Min. value 0.00 -32,768.00 0.00 -2,147,483,648.00 Max. value 65,535.99 32,767.99 4,294,967,295.99 2,147,483,647.99 11-39 High-level Instructions (Real Number) Process details Example 1) Unsigned 16 bits (US) (positive value) [i]...US [S]...DT10 [D]...DT0 DT10DT11 SF 2.345670E02 DT12DT13 SF 3.456780E02 DT14DT15 SF 4.567890E02 DT0 U 234 DT1 U 0 DT2 U 0 Example 2) Unsigned 16 bits (US) (negative value) [i]...US [S]...DT10 [D]...DT0 DT10DT11 SF -2.345670E02 DT12DT13 SF -3.456780E02 DT0 U 0 DT1 U 0 DT14DT15 SF -4.567890E02 DT2 U 0 * Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. Example 3) Signed 16 bits (SS) (positive value) [i]...SS [S]...DT10 [D]...DT0 DT10DT11 SF 2.345670E02 DT12DT13 SF 3.456780E02 DT14DT15 SF 4.567890E02 DT0 K 234 DT1 K0 DT2 K0 Example 4) Signed 16 bits (SS) (negative value) [i]...SS [S]...DT10 [D]...DT0 DT10DT11 SF -2.345670E02 DT12DT13 SF -3.456780E02 DT14DT15 SF -4.567890E02 Example 5) Unsigned 32 bits (UL) (positive value) [i]...UL [S]...DT10 [D]...DT0 DT10DT11 SF 1.234567E05 DT12DT13 SF 2.468000E02 DT14DT15 SF 1.357000E02 DT0 DT1 DT2 DT0DT1 DT2DT3 DT4DT5 K -234 K 0 K 0 U 123456 U 0 U 0 11-40 FIX (Conversion: Floating Point Real Number Data Integer (Round Decimal Digits)) Example 6) Unsigned 32 bits (UL) (negative value) [i]...UL [S]...DT10 [D]...DT0 DT10DT11 SF -1.234567E05 DT0DT1 U 0 DT12DT13 SF -2.468000E02 DT2DT3 U 0 DT14DT15 SF -1.357000E02 DT4DT5 U 0 * Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. Example 7) Signed 32 bits (SL) (positive value) [i]...SL [S]...DT10 [D]...DT20 DT10DT11 SF 1.234567E05 DT12DT13 SF 2.468000E02 DT14DT15 SF 1.357000E02 DT20DT21 DT22DT23 DT24DT25 K 123456 K 0 K 0 Example 8) Signed 32 bits (SL) (negative value) [i]...SL [S]...DT10 [D]...DT20 DT10DT11 SF -1.234567E05 DT12DT13 SF -2.468000E02 DT14DT15 SF -1.357000E02 DT20DT21 DT22DT23 DT24DT25 K -12345 K 0 K 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. To be set when an out-of-range value is specified for [S] (conversion target data). 11-41 High-level Instructions (Real Number) DFIX (Conversion: Double-precision Real Number Data Integer (Round Decimal Digits)) Ladder diagram R0 DFIX.US DT10 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device where the target data to be converted is stored or the constant (data format: double-precision real number data) D Starting address of the device where conversion results are stored (data format: according to the operation unit) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction converts the double-precision floating point real number data stored in the area starting with [S] to an integer (rounding the first decimal point down). · The conversion result is stored in the area starting with [D]. · The data setting ranges for conversion target data [S] by operation units are indicated below. Operation unit US SS UL SL Min. value 0.00 -32,768.00 0.00 -2,147,483,648.00 Max. value 65,535.99 32,767.99 4,294,967,295.99 2,147,483,647.99 11-42 DFIX (Conversion: Double-precision Real Number Data Integer (Round Decimal Digits)) Example of conversion Example 1) Unsigned 16 bits (US) (positive value) [i]...US [S] ...DT10 [D] ...DT0 DT10DT13 234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 234 DT1 0 DT2 0 Example 2) Unsigned 16 bits (US) (negative value) Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. [i]...US [S] ...DT10 [D] ...DT0 DT10DT13 -234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 0 DT1 0 DT2 0 Example 3) Signed 16 bits (SS) (positive value) [i]...SS [S] ...DT10 [D] ...DT0 DT10DT13 234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 234 DT1 0 DT2 0 Example 4) Signed 16 bits (SS) (negative value) [i]...SS [S] ...DT10 [D] ...DT0 DT10DT13 -234.56700000000 DT14DT17 345.67800000000 DT18DT21 456.78900000000 DT0 -234 DT1 0 DT2 0 11-43 High-level Instructions (Real Number) Example 5) Unsigned 32 bits (UL) (positive value) [i]...UL [S] ...DT10 [D] ...DT0 DT10DT13 123456.78900000000 DT14DT17 246.80000000000 DT18DT21 135.70000000000 DT0DT1 DT2DT3 DT4DT5 123456 0 0 Example 6) Unsigned 32 bits (UL) (negative value) Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. [i]...UL [S] ...DT10 [D] ...DT0 DT10DT13 -12345.78900000000 DT0DT1 0 DT14DT17 -246.80000000000 DT2DT3 0 DT18DT21 -135.70000000000 DT4DT5 0 Example 7) Signed 32 bits (SL) (positive value) [i]...SL [S] ...DT0 [D] ...DT20 DT0DT3 123456.78900000000 DT4DT7 246.80000000000 DT8DT11 135.70000000000 DT20DT21 DT22DT23 DT24DT25 Example 8) Signed 32 bits (SL) (negative value) 123456 0 0 [i]...SL [S] ...DT0 [D] ...DT20 DT0DT3 -12345.78900000000 DT4DT7 -246.80000000000 DT8DT11 -135.70000000000 DT20DT21 DT22DT23 DT24DT25 -12345 0 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. To be set when an out-of-range value is specified for [S] (conversion target data). 11-44 ROFF (Conversion: Floating Point Real Number Data Integer (Round to the Nearest Unit)) ROFF (Conversion: Floating Point Real Number Data Integer (Round to the Nearest Unit)) Ladder diagram R0 ROFF.US DT10 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Conversion target data (device address or constant (data format: according to the operation unit)) D Conversion target data (device address or constant (data format: according to the operation unit)) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, and 32-bit devices can be modified (real number constants, and character constants cannot be specified). *3: Index register (I0 to IE) Outline of operation · According to the operation unit [i], the single-precision floating point real number value, which is stored in the area starting with [S], is converted to an integer value (rounding the first decimal point off). · The calculation result is stored in the area starting with [D]. · The data setting ranges for conversion target data [S] by operation units are indicated below. · The data setting ranges for conversion target data [S] by operation units are indicated below. Operation unit US SS UL SL Min. value 0.00 -32,768.49 0.00 -2,147,483,648.49 Max. value 65,535.49 32,767.49 4,294,967,295.49 2,147,483,647.49 11-45 High-level Instructions (Real Number) Process details Example 1) Unsigned 16 bits (US) (positive value) [i]...US [S]...DT10 [D]...DT0 DT10DT11 DT12DT13 DT14DT15 SF 2.345670E02 SF 3.456780E02 SF 4.567890E02 DT0 U 235 DT1 U 0 DT2 U 0 Example 2) Unsigned 16 bits (US) (negative value) [i]...US [S]...DT10 [D]...DT0 DT10DT11 DT12DT13 DT14DT15 SF -2.345670E02 SF -3.456780E02 SF -4.567890E02 DT0 U 0 DT1 U 0 DT2 U 0 * Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. Example 3) Coded 16 bits (SS) (positive value) [i]...SS [S]...DT10 [D]...DT0 DT10DT11 DT12DT13 DT14DT15 SF 2.345670E02 SF 3.456780E02 SF 4.567890E02 DT0 K 235 DT1 K 0 DT2 K 0 Example 4) Coded 16 bits (SS) (negative value) [i]...SS [S]...DT10 [D]...DT0 DT10DT11 DT12DT13 DT14DT15 SF -2.345670E02 SF -3.456780E02 SF -4.567890E02 DT0 K -235 DT1 K 0 DT2 K 0 Example 5) Unsigned 32 bits (UL) (positive value) [i]...UL [S]...DT10 [D]...DT0 DT10DT11 DT12DT13 DT14DT15 SF 1.234567E05 SF 2.468000E02 SF 1.357000E02 DT0DT1 DT2DT3 DT4DT5 U 123457 U 0 U 0 11-46 ROFF (Conversion: Floating Point Real Number Data Integer (Round to the Nearest Unit)) Example 6) Unsigned 32 bits (UL) (negative value) [i]...UL [S]...DT10 [D]...DT0 DT10DT11 SF -1.234567E05 DT12DT13 SF -2.468000E02 DT14DT15 SF -1.357000E02 DT0DT1 U 0 DT2DT3 U 0 DT4DT5 U 0 * Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. Example 7) Coded 32 bits (SL) (positive value) [i]...SL [S]...DT10 [D]...DT20 DT10DT11 SF 1.234567E05 DT12DT13 SF 2.468000E02 DT14DT15 SF 1.357000E02 DT20DT21 DT22DT23 DT24DT25 K 123457 K 0 K 0 Example 8) Coded 32 bits (SL) (negative value) [i]...SL [S]...DT10 [D]...DT20 DT10DT11 SF -1.234567E05 DT12DT13 SF -2.468000E02 DT14DT15 SF -1.357000E02 DT20DT21 DT22DT23 DT24DT25 K -123457 K 0 K 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. To be set when an out-of-range value is specified for [S] (conversion target data). 11-47 High-level Instructions (Real Number) DROFF (Conversion: Double-precision Real Number Integer (Round to the Nearest Unit)) Ladder diagram R0 DROFF.US DT10 DT0 i S D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the device where the target data to be converted is stored or the constant (data format: double-precision real number data) D Starting address of the device where the target data to be converted is stored or the constant (data format: according to the operation unit) Available devices (: Available) Operand 16-bit device 32-bit device *1 WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX *3 Integer K U H Real number String Index modification *2 SF DF " " S D *1: Cannot be specified when the operation unit is 16-bit integer (SS, US). *2: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants and character constants cannot be specified.) *3: Index register (I0 to IE) Outline of operation · This instruction converts the double-precision floating point real number data stored in the area starting with [S] to an integer (rounding the first decimal point off). · The conversion result is stored in the area starting with [D]. · The data setting ranges for conversion target data [S] by operation units are indicated below. Operation unit US SS UL SL Min. value 0.00 -32,768.49 0.00 -2,147,483,648.49 Max. value 65,535.49 32,767.49 4,294,967,295.49 2,147,483,647.49 11-48 DROFF (Conversion: Double-precision Real Number Integer (Round to the Nearest Unit)) Example of processing Example 1) Unsigned 16 bits (US) (positive value) [i]...US [S] ...DT10 [D] ...DT0 DT10DT13 123.45600000000 DT14DT17 234.56700000000 DT18DT21 345.67800000000 DT0 123 DT1 0 DT2 0 Example 2) Unsigned 16 bits (US) (negative value) Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. [i]...US [S] ...DT10 [D] ...DT0 DT10DT13 -123.45600000000 DT14DT17 -234.56700000000 DT18DT21 -345.67800000000 DT0 0 DT1 0 DT2 0 Example 3) Signed 16 bits (SS) (positive value) [i]...SS [S] ...DT10 [D] ...DT0 DT10DT13 123.45600000000 DT14DT17 234.56700000000 DT18DT21 345.67800000000 DT0 123 DT1 0 DT2 0 Example 4) Signed 16 bits (SS) (negative value) [i]...SS [S] ...DT10 [D] ...DT0 DT10DT13 -123.45600000000 DT14DT17 -234.56700000000 DT18DT21 -345.67800000000 DT0 -123 DT1 0 DT2 0 11-49 High-level Instructions (Real Number) Example 5) Unsigned 32 bits (UL) (positive value) [i]...UL [S] ...DT10 [D] ...DT0 DT10DT13 123456.45670000000 DT14DT17 246.80000000000 DT18DT21 135.70000000000 DT0DT1 DT2DT3 DT4DT5 123456 0 0 Example 6) Unsigned 32 bits (UL) (negative value) Operation error occurs if an unsigned integer is specified for the operation unit and a negative value is converted. [i]...UL [S] ...DT10 [D] ...DT0 DT10DT13 -12345.43200000000 DT0DT1 0 DT14DT17 -246.80000000000 DT2DT3 0 DT18DT21 -135.70000000000 DT4DT5 0 Example 7) Signed 32 bits (SL) (positive value) [i]...SL [S] ...DT0 [D] ...DT20 DT0DT3 123456.456700000000 DT4DT7 246.80000000000 DT8DT11 135.70000000000 DT20DT21 DT22DT23 DT24DT25 Example 8) Signed 32 bits (SL) (negative value) 123456 0 0 [i]...SL [S] ...DT0 [D] ...DT20 DT0DT3 -12345.43200000000 DT4DT7 -246.80000000000 DT8DT11 -135.70000000000 DT20DT21 DT22DT23 DT24DT25 -12345 0 0 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when a non-real number is specified for [S]. To be set when an out-of-range value is specified for [S] (conversion target data). 11-50 12 12 High-level Instructions (Time) Applicable Models: All Models High-level Instructions (Time) HMSS (Conversion: Time Data (Hours, Minutes and Seconds) Seconds Data) Ladder diagram R0 HMSS DT0 DT10 S D List of operands Operand Description S Starting device address of time data (available data range: 0 to 9999 (hours), 0 to 59 (minutes), 0 to 59 (seconds)) D Device address of seconds data (Note): For details of time data, refer to "19-2 Clock and Time Data." Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · Time data comprised of 1 word for hours, 1 word for minutes and 1 word for seconds, which is stored in the area starting with [S], is converted into a 2-word integer data representing seconds. · The calculation result is stored in the area starting with [D]. Process details Example) Convert 3 hours, 54 minutes and 19 seconds [S]...DT0 [D]...DT10 * 1 word * 2 words DT0 K 3 (hours) DT1 K 54 (minutes) Convert DT2 K 19 (seconds) DT10DT11 K 14059 (seconds) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the time data range is exceeded. 12-2 SHMS (Conversion: Seconds Data Time Data (Hours, Minutes and Seconds)) SHMS (Conversion: Seconds Data Time Data (Hours, Minutes and Seconds)) Ladder diagram R0 SHMS DT0 DT10 S D List of operands Operand Description S Device address of seconds data (available data range: 0 to 35,999,999) D Starting device address of time data (Note): For details of time data, refer to "19-2 Clock and Time Data." Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · 2-word integer data representing seconds, which is stored in the area starting with [S], is converted into time data comprised of 1 word for hours, 1 word for minutes and 1 word for seconds. · The calculation result is stored in the area starting with [D]. Process details Example) Convert 12,345 seconds [S]...DT0 [D]...DT10 * 2 words DT0DT1 K 12345 (seconds) Convert * 1 word DT10 DT11 DT12 K 3 K 25 K 45 (hours) (minutes) (seconds) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the seconds data range is exceeded. 12-3 High-level Instructions (Time) CADD (Clock Addition) Ladder diagram R0 CADD DT0 DT10 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of clock data S2 Starting device address of time data D Starting device address of addition result (Note): For details of clock data and time data, refer to "19-2 Clock and Time Data." Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · Time data (hours, minutes and seconds), stored in the area starting with [S2], are added to the clock data (year, month, day, hours, minutes and seconds), stored in the area starting with [S1]. · The calculation result is stored in the area starting with [D]. · This operation takes leap years into account. Process details Example) Add 20 hours, 23 minutes and 45 seconds to 08:54:19, January 1, 2012 [S1]...DT0 [S2]...DT10 [D]...DT20 DT0 K 12 (year) DT1 K 1 (month) DT2 K 1 (day) DT3 K 8 (hours) DT10 K 20 (hours) DT4 K 54 (minutes) DT11 K 23 (minutes) DT5 K 19 (seconds) DT12 K 45 (seconds) DT20 DT21 DT22 DT23 DT24 DT25 K 12 K 1 K 2 K 5 K 18 K 4 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the clock data range and/or the time data range is exceeded. To be set when the addition result is out of the accessible range. (year) (month) (day) (hours) (minutes) (seconds) 12-4 CSUB (Clock Subtraction) CSUB (Clock Subtraction) Ladder diagram R0 CSUB DT0 DT10 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of clock data S2 Starting device address of time data D Starting device address of subtraction result (Note): For details of clock data and time data, refer to "19-2 Clock and Time Data." Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · Time data (hours, minutes and seconds), stored in the area starting with [S2], are subtracted from the clock data (year, month, day, hours, minutes and seconds), stored in the area starting with [S1]. · The calculation result is stored in the area starting with [D]. · This operation takes leap years into account. Process details Example) Subtract 20 hours, 23 minutes and 45 seconds from 08:54:19, January 1, 2012 [S1]...DT0 [S2]...DT10 [D]...DT20 DT0 K 12 (year) DT1 K 1 (month) DT2 DT3 K 1 K 8 (day) (hours) DT10 K 20 (hours) DT4 K 54 (minutes) DT11 K 23 (minutes) DT5 K 19 (seconds) DT12 K 45 (seconds) DT20 DT21 DT22 DT23 DT24 DT25 K 11 K 12 K 31 K 12 K 30 K 34 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the clock data range and/or the time data range is exceeded. To be set when the subtraction result is out of the accessible range. (year) (month) (day) (hours) (minutes) (seconds) 12-5 High-level Instructions (Time) TMSEC (Calculation: Clock Data Seconds Data from the Base Time) Ladder diagram R0 TMSEC DT0 DT10 S D List of operands Operand Description S Starting device address of clock data (available data range: 2000/1/1 00:00:00 to 2099/12/31 23:59:59) D Device address of seconds data from the base time (Note): For details of clock data, refer to "19-2 Clock and Time Data." Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · From the clock data (year, month, day, hours, minutes and seconds) stored in the area starting with [S], time elapsed from the base time is calculated. · The calculation result is stored in the area starting with [D]. · The base time is 2001/1/1 00:00:00. Process details Example) Calculate seconds data against the base time, from 08:54:19, January 1, 2012 [S]...DT0 [D]...DT10 * 1 word * 2 words DT0 K 12 (year) DT1 K 1 (month) DT2 K 1 (day) DT3 K 8 (hours) DT4 K 54 (minutes) DT5 K 19 (seconds) DT10DT11 K 347100859 (Source seconds data) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the clock data range is exceeded. 12-6 SECTM (Calculation: Seconds Data from the Base Time Clock Data) SECTM (Calculation: Seconds Data from the Base Time Clock Data) Ladder diagram R0 SECTM DT0 DT10 S D List of operands Operand Description S Device address of seconds data from the base time D Starting device address of clock data (available data range: 2000/1/1 00:00:00 to 2099/12/31 23:59:59) (Note): For details of clock data, refer to "19-2 Clock and Time Data." Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " D Outline of operation · From the time elapsed from the base time, stored in the area starting with [S], clock data (year, month, day, hours, minutes and seconds) is calculated. · The calculation result is stored in the area starting with [D]. · The base time is 2001/1/1 00:00:00. Process details Example) Calculate data from 1,325,408,059 seconds [S]...DT0 [D]...DT10 * 2 words DT0DT1 K 347100859 (Source seconds data) * 1 word DT10 DT11 DT12 DT13 DT14 DT15 K 12 K 1 K 1 K 8 K 54 K 19 (year) (month) (day) (hours) (minutes) (seconds) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the clock data range is exceeded. 12-7 High-level Instructions (Time) TIMEWT (Setting of Clock/Calendar) Ladder diagram R0 TIMEWT DT0 S List of operands Operand Description S Starting device address of clock data (Note): Only this instruction comprises 7 words in total, including day of week. For details of clock data, refer to "19-2 Clock and Time Data." Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " S Outline of operation · The clock data (year, month, day, hours, minutes and seconds), stored in the area starting with [S], is set as RTC data for the CPU unit. · The range of clock data that can be set for the calendar timer of the FP7 CPU unit is as follows: 2000/1/1 00:00:00 to 2099/12/31 23:59:59 Process details Example) Specify 08:54:19, January 1, 2012 [S]...DT0 * 1 word DT0 K 12 (year) DT1 K 1 (month) DT2 K 1 (day) DT3 K 8 (hours) Update DT4 K 54 (minutes) DT5 K 19 (seconds) DT6 K 0 (day of week) K 12 K 1 K 1 K 8 K 54 K 19 K 0 (year) (month) (day) (hours) (minutes) (seconds) (day of week) Day-of-week data 0 Sun 1 Mon 2 Tue 3 Wed 4 Thu 5 Fri 6 Sat Precautions during programming · Consistency of the day of week data with the date is not checked. 12-8 TIMEWT (Setting of Clock/Calendar) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the clock data range is exceeded. To be set when the day of week range is exceeded. 12-9 High-level Instructions (Time) SUMMER (Daylight Saving Time Acquisition) Ladder diagram R0 SUMMER DT0 DT2 DT3 DT4 S1 S2 S3 D List of operands Operand Description Starting address of the device that stores clock data when daylight saving time starts (Specify the clock data in the standard time.) * The formats of the clock data of S1/S2 are the following four words. Word S1 Sx + 0 Month Sx + 1 Day Sx + 2 Hour Sx + 3 Minute Starting address of the device that stores clock data when daylight saving time ends (Specify the clock data in the daylight saving time.) * The formats of the clock data of S1/S2 are the following four words. Word S2 Sx + 0 Month Sx + 1 Day Sx + 2 Hour Sx + 3 Minute S3 Time difference within the daylight saving time period (Unit: minute) Available range: 0 to 180 (minutes) * The following eight words are the formats for the enable/disable + clock data of D. Word D + 0 Enable/Disable D + 1 Year D + 2 Month D D + 3 Day D + 4 Hour D + 5 Minute D + 6 Second D + 7 Day of the week Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3 D Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction is used to acquire the time in daylight saving time. 12-10 SUMMER (Daylight Saving Time Acquisition) Process details · During the period specified by [S1] and [S2], clock data is corrected by [S3] (time difference), and the corrected clock data is set in the area that starts with [D]. · If the clock data is within the specified period, "1" is set in [D], the clock data is corrected, and the corrected clock data is set in the area from [D+1] to [D+7]. · If the clock data is outside of the specified period, "0" is set in [D], and the clock data is set in the area from [D+1] to [D+7] without being corrected. 12-11 High-level Instructions (Time) Setting example When the daylight saving time period is from 02:00 on March 8 to 01:59 on November 1, and 60 minutes is specified for the time difference [S1]...DT0 [S2]...DT10 [S3]...DT20 [D]...DT100 [S1] (Time to start daylight saving time) [S2] (Time to end daylight saving time) [S3] (Time difference: in minutes) DT0 DT1 DT2 DT3 DT10 DT11 DT12 DT13 DT20 Description Month Day Hour Minute Month Day Hour Minute Time difference Value 3 8 2 0 11 1 1 59 60 Example 1) When the actual time is 01:23:45 on August 31 Because the time is within the specified period, the clock data is corrected and stored. SD50 SD51 SD52 SD53 SD54 SD55 SD56 Description Year Month Day Hour Minute Second Day of the week Value 15 8 31 1 23 45 1 DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 Description Flag Year Month Day Hour Minute Second Day of the week Value 1 (Enabled) 15 8 31 2 23 45 1 Example 2) When the actual time is 06:07:08 on November 20 Because the time is outside of the specified period, the data is not corrected. SD50 SD51 SD52 SD53 SD54 SD55 SD56 Description Year Month Day Hour Minute Second Day of the week Value 15 11 20 6 7 8 5 DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 Description Flag Year Month Day Hour Minute Second Day of the week Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [S1] or [S2] (clock data) is out of the range. To be set when [S3] (time difference) is out of the range. Value 0 (Disabled) 15 11 20 6 7 8 5 12-12 13 13 High-level Instructions (Special) Applicable Models: All Models High-level Instructions (Special) LOGST (Logging Trace Start Request) Ladder diagram R0 LOGST.US U0 i n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description n Logging trace number requested to start Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *1 U *2 H Real number String Index modification SF DF " " *3 n *1: Can be specified only when the operation unit is signed integer (SS). *2: Can be specified only when the operation unit is unsigned integer (US). *3: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction requests to start the logging trace function for the number specified by [n]. · There is no problem even if the logging trace start request is made while the logging trace is being started or the logging trace start is being processed. · The logging trace is set using the configuration menu of the tool software FPWIN GR7. · For setting the logging trace to be automatically started, or starting it with the tool software FPWIN GR7, there is no need to execute the LOGST instruction. Flag operations Name Description SR7 SR8 (ER) To be set when a request by a communication command has been accepted (logging trace start/logging trace stop/logging trace registration). To be set when the logging trace stop has been requested. To be set in case of out-of-range in indirect access (index modification). 13-2 LOGED (Logging Trace Stop Request) LOGED (Logging Trace Stop Request) Ladder diagram R0 LOGED.US U0 i n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description n Logging trace number requested to stop Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *1 U *2 H Real number String Index modification SF DF " " *3 n *1: Can be specified only when the operation unit is signed integer (SS). *2: Can be specified only when the operation unit is unsigned integer (US). *3: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction requests to stop the logging trace function for the number specified by [n]. · There is no problem even if the logging trace stop request is made while the logging trace is being stopped or the logging trace stop is being processed. · For stopping the logging trace with the tool software FPWIN GR7, there is no need to execute the LOGED instruction. · In case of the trace function, when the trace condition set with the tool software FPWIN GR7 (memory buffer full or bit device ON) is not met, the trace operation will not be completed. Flag operations Name Description SR7 SR8 (ER) To be set when a request by a communication command has been accepted (logging trace start/logging trace stop/logging trace registration). To be set when the logging trace start has been requested. To be set in case of out-of-range in indirect access (index modification). 13-3 High-level Instructions (Special) SMPL (Sampling Trace) Ladder diagram R0 SMPL.US U0 i n Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description n Logging trace number for which data is stored Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *1 U *2 H Real number String Index modification SF DF " " *3 n *1: Can be specified only when the operation unit is signed integer (SS). *2: Can be specified only when the operation unit is unsigned integer (US). *3: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction performs data logging for the logging trace with the number specified by [n]. · The logging trace is set using the configuration menu of the tool software FPWIN GR7. · The SMPL instruction is used for setting the trigger condition to start data logging with a user program. There is no need to execute the SMPL instruction when setting the trigger condition for starting logging to bit device, cycle or time with the tool software FPWIN GR7. · To execute the trace for every scan, set the execution condition so that the trace is always executed. Flag operations Name Description SR7 SR8 (ER) To be set when the data logging condition of logging trace number is set to other than "Instruction". To be set in case of out-of-range in indirect access (index modification). To be set when the logging trace stops. 13-4 OPHST (Operation History Start Request) OPHST (Operation History Start Request) Ladder diagram R0 OPHST U0 S Available operation units No operation unit List of operands Operand Description S Operation history group number for which startup is requested (0 to 7) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " Outline of operation · Startup for operation histories is requested using the group number specified by [S]. · Even if startup is requested while operation histories are being started, no problem will occur. (No processing) Flag operations Name Description SR7 SR8 (ER) To be set when a startup request is issued to any group without registered operation histories. To be set in case of out-of-range in indirect access (index modification). To be set when an out-of-range value is specified for [S]. 13-5 High-level Instructions (Special) OPHED (Operation History End Request) Ladder diagram R0 OPHED U0 S Available operation units No operation unit List of operands Operand Description S Operation history group number for which stoppage is requested (0 to 7) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " Outline of operation · Stoppage for operation histories is requested using the group number specified by [S]. · Even if stoppage is requested while operation histories are stopped, no problem will occur. (No processing) Flag operations Name Description SR7 SR8 (ER) To be set when a startup request is issued to any group whose operation histories have not been registered. The bit is set when an out-of-range error occurs at the time of indirect access (index modification). To be set when an out-of-range value is specified for [S]. 13-6 OPHCLR (Operation History Clearing) OPHCLR (Operation History Clearing) Ladder diagram R0 OPHCLR U0 S Available operation units No operation unit List of operands Operand Description S Operation history group number for which initialization is to be performed (0 to 7) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " Outline of operation · Operation histories are initialized using the group number specified by [S]. · After initialization is completed, the number of write operations in operation histories becomes zero. · If the power is turned off while operation histories are being initialized, initialization may not be performed correctly. Flag operations Name Description SR7 SR8 (ER) To be set when a startup request is issued to any group without registered operation histories. To be set in case of out-of-range in indirect access (index modification). To be set when an out-of-range value is specified for [S]. 13-7 High-level Instructions (Special) OPHSAVE (Operation History Save to SD Card) Ladder diagram R0 OPHSAVE U0 U0 U0 U0 S1 S2 S3 S4 Available operation units No operation unit List of operands Operand Description S1 Group number whose operation histories are output to SD card (0 to 7) S2 Order in which operation histories are output to SD card (0: Ascending order of occurrence time, 1: Descending order of occurrence time) S3 Language number for which operation histories are output to SD card (0 to 3) * You cannot specify any number greater than the number of each language supported in the operation history configuration. S4 Operation after output to SD card (0: Nothing, 1: Operation histories clearing) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3 S4 Integer K U H Real number String Index modification SF DF " " Outline of operation · The operation histories of the group number specified by [S1] are output to the SD card in the order specified by [S2] (ascending or descending order of occurrence time). · [S3] specifies the language number for which operation histories are to be output to SD card. · After output, operation histories can be deleted according to the operation specified by [S4]. · The number of files to be output is set for each group as the number of managed generations (up to 128 files) in the operation history configuration. Any files exceeding the maximum limit will be deleted in chronological order (starting from the oldest file). Example of output files: OPH0 OpeHis0(180619_112345).csv OpeHis0(180619_113412).csv OpeHis0(180619_114630).csv · · · OPH7 OpeHis7(180620_112345).csv · · · OpeHis7(180624_114630).csv Output file directories are named for each group, as below. \OPHx\ x: Group number Output files are named as below. OpeHisx(YYMMDD_HHMMSS).csv x: Group number YYMMDD: File creation date (year/month/day) HHMMSS: File creation time (hour/minute/second) · The OPHSAVE instruction cannot be executed while the SD memory card access instruction is being executed. 13-8 OPHSAVE (Operation History Save to SD Card) Flag operations Name SD memory card access instruction in progress (SR3A) SD memory card access instruction execution completed (SR3B) SD memory card access instruction execution result (SR3C) SR7 SR8 (ER) Description The flag turns ON when the instruction starts being executed. The flag turns OFF when the instruction finishes being executed. The flag turns OFF when the instruction starts being executed. The flag turns ON when the instruction finishes being executed. The flag notifies the execution result when the instruction finishes being executed. Normal completion: 0, Abnormal completion: 1 The flag is set when an out-of-range value is specified for S1. The flag is set when an out-of-range value is specified for S2. The flag is set when an out-of-range value is specified for S3. The flag is set when an out-of-range value is specified for S4. The flag is set when a group without registered operation histories is specified. The flag is set when an out-of-range error occurs at the time of indirect access (index modification). 13-9 High-level Instructions (Special) ERR (Self-Diagnostic Error Code Set) Ladder diagram R0 ERR.US U i Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description n Specify a self-diagnostic error code. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX n Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction sets an error code with the user program. · A self-diagnostic error code specified by [n] is stored in the self-diagnostic abnormality code register (SD0), and the self-diagnosis error occurrence flag (SR0) is set. · It is also possible to describe multiple ERR instructions that set the same error code. Setting of a self-diagnostic error code [n] · n (self-diagnostic error code) can be set within the range from U1000 to U2999. [n] U 1000 to 1999 U 2000 to 2999 Operation when an error occurs Operation stop Continue operation · When the ERR instruction is executed with n (self-diagnostic error code) set to U0, self-diagnostic errors that have an error code 80 or higher can be cleared. [n] Operation U0 Self-diagnostic errors are cleared. The system relays (SR), system data (SD), and system monitors (SM) that are shown on the next page are also cleared at the same time. 13-10 ERR (Self-Diagnostic Error Code Set) · When self-diagnostic errors are cleared, the following system relays (SR), system data (SD), and system monitors (SM) are also cleared at the same time. Device No. SR0 SR2 SR3 SR4 SR7 SR8 SR22 SR23 SR24 SR25 SR26 Application Operation error detection (Latest) Unit error occurrence Unit warning occurrence Unit verification error occurrence Operation error detection (Hold) Operation error detection (Latest) RTC data error Power supply unit service lifetime warning RTC backup battery voltage drop hold RTC backup battery voltage drop real SNTP time updating failure Device No. SD0 SD2 SD3 SD4 SD7 SD8 SD9 SD10 SD11 SD12 Application Self-diagnostic error code Error occurrence slot number Warning occurrence slot number Verify error occurrence slot number Hold operation error occurrence address (PB number) Hold operation error occurrence address (32-bit lower address) Hold operation error occurrence address (32-bit upper address) Latest operation error occurrence address (PB number) Latest operation error occurrence address (32-bit lower address) Latest operation error occurrence address (32-bit upper address) Flag operations Name Description SR7 SR8 (ER) To be set when the error code [n] is out of the range. 13-11 High-level Instructions (Special) WDTRES (Watchdog Timer Reset) Ladder diagram R0 WDTRES Outline of operation The watchdog timer is reset. Flag operations No change occurs. 13-12 SCOPY (System Area Copy) SCOPY (System Area Copy) Ladder diagram R0 SCOPY U0 U0 U4 DT10 S1 S2 S3 D List of operands Operand Description S1 Always zero (Device address storing the system area number to be copied or constant) S2 The device address storing the starting number of system area or constant S3 The device address storing the terminating number of system area or constant D The starting device address of destination area Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3 D Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction copies data in the areas specified by [S1], [S2], and [S3] to the area specified by [D]. Process details Example 1) When [S2] and [S3] are within the system monitor area [S1]...U0 [S2]...U0 [S3]...U4 [D]...DT0 SM0 SM1 SM2 SM3 SM4 H 0011 H 2233 H 4455 H 6677 H 8899 DT10 DT11 DT12 DT13 DT14 H 0011 H 2233 H 4455 H 6677 H 1234 Example 2) When [S3] exceeds the upper limit of the system monitor area (when the upper limit of the system monitor area is 371) [S1]...U0 [S2]...U0 [S3]...U400 [D]...DT0 SM0 SM1 SM2 SM3 SM4 SM 5 SM367 SM368 SM369 SM370 SM371 H 0011 H 2233 H 4455 H 6677 H 8899 H AA BB H CCDD H EEFF H FFEE H DDCC H BBAA DT0 DT1 DT2 DT3 DT4 DT 5 DT367 DT368 DT369 DT370 DT371 DT372 DT373 H 0011 H 2233 H 4455 H 6677 H 8899 H AA BB H CCDD H EEFF H FFEE H DDCC H BBAA H 0000 H 0000 13-13 High-level Instructions (Special) Precautions during programming · [S1] is always zero. An operation error occurs when numbers other than zero are specified. · Specify [S3] to be larger than [S2]. · When [S3] exceeds the upper limit of the system area, an operation error does not occur. The area from [S2] to the upper limit of the system area is copied. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when [S1] is other than 0. To be set when [S2] is larger than [S3]. To be set when [S2] is out of the accessible range. To be set when the destination range is outside the accessible range. 13-14 GETSTNO (Acquiring Starting Word Number of Specified Slot) GETSTNO (Acquiring Starting Word Number of Specified Slot) Ladder diagram R0 GETSTNO U1 DT10 S D List of operands Operand Description S Specify the starting address of the device that stores the slot number or a constant. D Specify the starting address of a readout destination device. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction reads the starting word number of the slot specified by [S] and sets it in [D]. Precautions during programming · An operation error occurs when a slot number without unit registration is specified when an I/O map has been registered. · An operation error occurs when the number of a slot in which no unit is installed is specified when no I/O map has been registered. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when an out-of-range value is specified for [S] (slot number). To be set when a slot number (S) without unit registration is specified when an I/O map has been registered. To be set when a slot number (S) without an installed unit is specified when no I/O map has been registered. 13-15 High-level Instructions (Special) POSSET (Setting of Positioning Starting Table) Ladder diagram R0 POSSET U 3 U 1 U 50 S1 S2 S3 List of operands Operand Description S1 Slot number where the positioning unit is attached (unsigned 16-bit integer) S2 Axis number to start up the positioning table (unsigned 16-bit integer); 1 to 4: Axis 1 to 4; 8: Virtual axis S3 Table number to start up the position control (unsigned 16-bit integer); 1 to 600, 10001 to 10100 (Note): If a value out of the available range is set as the starting table number, the positioning unit gives an error notification. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " S1 S2 S3 Outline of operation · It is described right before the program which starts positioning and the positioning data table to be started is set. · For the axis number of the positioning units specified by [S1] and [S2], the data table specified by [S3] is set. · Data for the positioning data table should be set using Configurator PM7 in the tool software FPWIN GR7, or a user program. · Positioning parameters should be set in the configuration menu of the tool software FPWIN GR7. Example of program X100 X104 X160 Ready Tool 1st axis error positioning operation R2 ( DF ) Positioning control start R2 R10 X118 ( DF ) Positioning control start Operation 1st axis enabled flag BUSY R10 Operation enabled flag POSSET U1 U1 Slot Axis number number U1 Table number Y110 Positioning start for 1st axis Operation enabled condition Specify slot number, axis number, and table number. Positioning startup Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the slot number and/or the axis number is out of the available range. 13-16 PSTRD (Acquiring Axis Status) PSTRD (Acquiring Axis Status) Ladder diagram R0 PSTRD U 3 U 1 DT10 S1 S2 D List of operands Operand Description S1 Slot number where the positioning unit is attached (unsigned 16-bit integer) S2 Axis number to read the axis status information (unsigned 16-bit integer); 1 to 4: Axis 1 to 4; 8: Virtual axis D Device address to store the axis status information (unsigned 16-bit integer) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · For the axis number of the positioning units specified by [S1] and [S2], the main flag status is acquired as the axis status. · The acquired information is converted into integer values in hexadecimal format, in accordance with the relevant allocation, and stored in the area specified by [D]. Type of axis status information Status information Description Tool operation Turned ON in the case of tool operation using Configurator PM, regardless of the specified axis. Error annunciation Turned ON when an error occurs in the specified axis. Warning annunciation Turned ON when a warning occurs in the specified axis. BUSY Turned ON when the specified axis is operating. Operation done Turned ON when the specified axis has completed operation. Home return done Turned ON when the specified axis has completed home return. 13-17 High-level Instructions (Special) Allocation of axis status information to be stored in [D] bit Status information Axis 1 Axis 2 Axis 3 0 Tool operation X4 X4 X4 1 Error annunciation X60 X61 X62 2 Warning annunciation X68 X69 X6A Axis 4 X4 X63 X6B Virtual axis X4 X67 X6F 3 BUSY X18 X19 X1A X1B X1F 4 Operation done X20 X21 X22 X23 X27 5 Home return done X28 X29 X2A X2B X2F (Note 1): The I/O numbers in the above table show relative addresses based on the base word number. The I/O numbers actually used vary according to the slot number where the unit is installed and the starting word number. Example) The tool operation flag is X104 for slot number 1 if the starting word is number 10. Example of processing Axis status information for the first axis of the positioning unit attached to slot number 3 is read. bit Status information 0 Tool operation 1 Error annunciation 2 Warning annunciation 3 BUSY 4 Operation done 5 Home return done Axis 1 Value IN4 0 IN60 0 IN68 0 IN18 1 IN20 0 IN28 0 Value DT10 H 0008 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the slot number and/or the axis number is out of the available range. 13-18 PERRD (Acquiring Error/Warning in the Positioning Unit) PERRD (Acquiring Error/Warning in the Positioning Unit) Ladder diagram R0 PERRD U 1 U 3 DT0 S1 S2 D List of operands Operand Description S1 Slot number where the positioning unit is attached (unsigned 16-bit integer) S2 Axis number to read the error/warning information (unsigned 16-bit integer); 1 to 4: Axis 1 to 4; 8: Virtual axis D Device address to store the error/warning code (unsigned 16-bit integer) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · For the axis number of the positioning units specified by [S1] and [S2], the error codes and warning codes stored in each annunciation buffer 1 are acquired. · The error codes are stored in the area specified by [D], and warning codes in the area specified by [D+1]. Example of processing · Error codes and warning codes for the third axis of the positioning unit attached to the slot number 1 are read. Classification Error information Warning information Name Three-axis error code Alarm buffer 1 Three-axis warning code Alarm buffer 1 UM (Hex) UM 0015A Value H 4022 UM 001E2 H B010 Storage location [D]......DT0 H 4022 [D+1]...DT1 H B010 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the slot number and/or the axis number is out of the available range. To be set when the destination range is outside the accessible range. 13-19 High-level Instructions (Special) Error code/warning code annunciation buffers Name Axis 1 Unit memory number (HEX) Axis 2 Axis 3 Axis 4 Number of occurrences of errors UM00129 UM00139 UM00149 UM00159 Error code annunciation buffer 1 UM0012A UM0012B UM0013A UM0013B UM0014A UM0014B UM0015A UM0015B Error code annunciation buffer 2 UM0012C UM0012D UM0013C UM0013D UM0014C UM0014D UM0015C UM0015D Error code annunciation buffer 3 UM0012E UM0012F UM0013E UM0013F UM0014E UM0014F UM0015E UM0015F Error code annunciation buffer 4 UM00130 UM00131 UM00140 UM00141 UM00150 UM00151 UM00160 UM00161 Error code annunciation buffer 5 UM00132 UM00133 UM00142 UM00143 UM00152 UM00153 UM00162 UM00163 Error code annunciation buffer 6 UM00134 UM00135 UM00144 UM00145 UM00154 UM00155 UM00164 UM00165 Error code annunciation buffer 7 UM00136 UM00137 UM00146 UM00147 UM00156 UM00157 UM00166 UM00167 Number of occurrences of warnings UM001C1 UM001D1 UM001E1 UM001F1 Warning code annunciation buffer 1 UM001C2 UM001C3 UM001D2 UM001D3 UM001E2 UM001E3 UM001F2 UM001F3 Warning code annunciation buffer 2 UM001C4 UM001C5 UM001D4 UM001D5 UM001E4 UM001E5 UM001F4 UM001F5 Warning code annunciation buffer 3 UM001C6 UM001C7 UM001D6 UM001D7 UM001E6 UM001E7 UM001F6 UM001F7 Warning code annunciation buffer 4 UM001C8 UM001C9 UM001D8 UM001D9 UM001E8 UM001E9 UM001F8 UM001F9 Warning code annunciation buffer 5 UM001CA UM001CB UM001DA UM001DB UM001EA UM001EB UM001FA UM001FB Warning code annunciation buffer 6 UM001CC UM001CD UM001DC UM001DD UM001EC UM001ED UM001FC UM001FD Warning code annunciation buffer 7 UM001CE UM001CF UM001DE UM001DF UM001EE UM001EF UM001FE UM001FF Virtual axis UM00199 UM0019A UM0019B UM0019C UM0019D UM0019E UM0019F UM001A0 UM001A1 UM001A2 UM001A3 UM001A4 UM001A5 UM001A6 UM001A7 UM00231 UM00232 UM00233 UM00234 UM00235 UM00236 UM00237 UM00238 UM00239 UM0023A UM0023B UM0023C UM0023D UM0023E UM0023F 13-20 UCLR (Error/Warning Clear) UCLR (Error/Warning Clear) Ladder diagram R UCLR U 5 S List of operands Operand Description S Specify the slot number (unsigned 16-bit integer) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S *1: Only 16-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction clears the errors/warnings for the unit installed in the slot number specified by [S]. · The UCLR instruction can clear the errors/warnings for the following units: High-speed counter unit, positioning unit, pulse output unit, motion control unit, serial communication unit Example of program Example) Clear an error/warning in the unit attached to Slot No.5 [S]...U5 R UCLR U 5 S Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the slot number and/or the axis number is out of the available range. 13-21 High-level Instructions (Special) 13-22 14 14 High-level Instructions (Strings) Applicable Models: All Models High-level Instructions (Strings) BCC (Block Check Code Calculation) Ladder diagram R0 BCC.SS H2 DT0 U12 DT6 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 The area that stores the data specifying a calculation method, or the constant S2 Starting address of the area that stores the targeted data S3 The area that stores the length (number of bytes) of the targeted data, or the constant D Area that stores the calculation result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 Integer K U H *1 *2 *3 Real number String Index modification SF DF " " S3(*4) D *1: Can be specified only when the operation unit is signed integer (SS). *2: Can be specified only when the operation unit is unsigned integer (US). *3: Can be specified only when the operation unit is integer (US, SS). *4: 16-bit unsigned integers, regardless of operation unit. Outline of operation · This instruction calculates the block check code (BCC). · The block check code (BCC) for the targeted data, which is the number of bytes specified by [S3] starting from the calculation start position specified by [S2], is calculated with the calculation method specified by [S1]. · The calculation result is stored according to the conversion method specified by [S1], starting from the storage position specified by [D] and [S1]. 14-2 BCC (Block Check Code Calculation) Specification of control data [S1] As indicated below, calculation should be H carried out as specified, for every eight bits. Specify a calculation method 0: Addition 1: Subtraction % 0 1 H 25 H 30 H 31 00100101 (a) 00110000 (b) 00110001 (c) 2: Exclusive OR # H 23 00100011 (d) Calculation start position (bytes R H 52 01010010 (e) from [S2]) 0 to F Storage start position (bytes from [D]) (a) 0 to F (b) (c) Data to be converted (d) (e) 0: Binary data (1 byte) 1: ASCII code (2 bytes) Specified calculation [S3] = K0 [S3] = K1 [S3] = K2 XOR 14-3 High-level Instructions (Strings) Example of conversion · Calculate the block check code (BCC) for a message to be sent "%01#RCSX0000", and append the result to the message. Example 1) Operation unit: 16 bits (SS) / Calculation method: Exclusive OR; Data to be converted: ASCII code [BCC.SS H1002 , DT0 , U12 , DT6 ] [S1] Exclusive OR [S2] Start of the targeted data [S3] Length of the targeted data [D] Calculation result (characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 0000 BCC (characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 4431 D1 Example 2) Operation unit: 16 bits (US) / Calculation method: Addition; Data to be converted: ASCII code [BCC.US H1000 , DT0 , HC , DT6 ] [S1] Addition [S2] Start of the targeted data [S3] Length of the targeted data [D] Calculation result (characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 0000 BCC (characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 3941 9A Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). 14-4 CRC (CRC Code Calculation) CRC (CRC Code Calculation) Ladder diagram R0 CRC.US H1 DT0 HC DT6 i S1 S2 S3 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 The area that stores the data specifying a calculation method, or the constant S2 Starting address of the area that stores the targeted data S3 The area that stores the length (number of bytes) of the targeted data, or the constant D Area that stores the calculation result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3(*4) D *1: Can be specified only when the operation unit is signed integer (SS). *2: Can be specified only when the operation unit is unsigned integer (US). *3: Can be specified only when the operation unit is integer (US, SS). *4: 16-bit unsigned integers, regardless of operation unit. Integer K U H *1 *2 *3 Real number String Index modification SF DF " " Outline of operation · This instruction calculates block check code (BCC) using the CRC (16-bit CRC code) calculation method. · The block check code (BCC) for the targeted data, which is the number of bytes specified by [S3] starting from the calculation start position specified by [S2], is calculated with the CRC calculation method which is specified by [S1]. · The calculation result is stored according to the conversion method specified by [S1], starting from the storage position specified by [D] and [S1]. CRC calculation · Apply a specified calculation method to every 16 bits as follows. · The calculation should be carried out using the following generating polynomial. (This is the same calculation method as MODBUS-RTU.) 14-5 High-level Instructions (Strings) Generating polynomial (CRC-16) X 16 + X 15 + X 2 + 1 X 16 + X 12 + X 5 + 1 %0 H 2530 0010 0101 0011 0000 (a) 1# H 3123 0011 0001 0010 0011 (b) RC H 5243 0101 0010 0100 0011 (c) Specified calculation (a) [S1]= K0 CRC-16 (b) [S1]= K1 CCITT (c) Specification of control data [S1] H 0: Fixed Storage starting position (Number of bytes from [D]) 0 to F Calculation starting position (Number of bytes from [S2]) 0 to F Specification of the calculation method Setting value CRC type Default Shift method XOR of operation result 0 CRC-16 FFFFH 1 CCITT Right shift 2 CRC-16 0000H 3 CCITT 0000H 4 CRC-16 FFFFH 5 CCITT Left shift 6 CRC-16 0000H 7 CCITT (Note) (Note) (Note) (Note) (Note) (Note) 8 CRC-16 FFFFH 9 CCITT Right shift A CRC-16 0000H B CCITT FFFFH C CRC-16 FFFFH D CCITT Left shift E CRC-16 0000H F CCITT (Note) (Note) (Note) (Note) (Note) (Note) (Note) (Note) (Note): Can be used with CPU units CPS4*/CPS3* Ver.4.32 or later, CPS2* Ver.1.32 or later 14-6 CRC (CRC Code Calculation) Example of conversion Calculate the block check code for a message to be sent "%01#RCSX0000", and append the result to the message. Example 1) Operation unit: 16 bits (SS) / Calculation method: CRC-16; Initial value = FFFFH; Right shift; XOR = 0000H [CRC.SS H 0 , DT0 , U12 , DT6 ] [S1] CRC-16 [S2] Header of target data [S3] Length of target data (12 bytes) [D] Calculation result (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 0000 CRC (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 2E0A Example 2) Operation unit: 16 bits (US) / Calculation method: CRC-16; Initial value = FFFFH; Right shift; XOR = 0000H [CRC.US H 1 , DT0 , U12 , DT6 ] [S1] CRCITT [S2] Header of target data [S3] Length of target data (12 bytes) [D] Calculation result (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 0000 CRCITT (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H A02E Example 3) Operation unit: 16 bits (SS) / Calculation method: CRC-16; Initial value = 0000H; Right shift; XOR = 0000H [CRC.SS H 2 , DT0 , U12 , DT6 ] [S1] CRC16 [S2] Header of target data [S3] Length of target data (12 bytes) [D] Calculation result (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 0000 CRC (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 2C6E 14-7 High-level Instructions (Strings) Example 4) Operation unit: 16 bits (US) / Calculation method: CRCITT; Initial value = FFFFH; Left shift; XOR = 0000H [CRC.US H 5 , DT0 , U12 , DT6 ] [S1] CRCITT [S2] Header of target data [S3] Length of target data (12 bytes) [D] Calculation result (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 0000 CRCITT (Characters) DT0 H 3025 0% DT1 H 2331 #1 DT2 H 4352 CR DT3 H 5853 XS DT4 H 3030 00 DT5 H 3030 00 DT6 H 6194 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set in the case that the length of the target data for [S3] is 0. To be set in the case that the control data specified by [S1] is out of the specified range. To be set when [S2 + calculation starting position + S3] exceeds the [S2] area. To be set when the address specified by [D + storage starting position] exceeds the [D] area. 14-8 HEXA (Conversion: HEX Hexadecimal ASCII) HEXA (Conversion: HEX Hexadecimal ASCII) Ladder diagram R0 HEXA.US DT0 DT2 DT10 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting number of the area that stores a hexadecimal figure S2 The area that stores the length (number of bytes) to be converted, or the constant D Starting number of the area that stores the ASCII code as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H *2 *3 *4 Real number String Index modification SF DF " " *1 S1 S2 D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) *2: Can be specified only when the operation unit is signed integer (SS, SL). *3: Can be specified only when the operation unit is unsigned integer (US, UL). *4: Can be specified only when the operation unit is integer (US, SS, UL, SL). Outline of operation · This instruction converts a hexadecimal figure into an ASCII code. · The hexadecimal numerical data stored in the area specified by [S1] is converted into an ASCII code and stored in the area specified by [D]. · The number of bytes specified by [S2] is to be converted. · The result (ASCII code) should have twice the size of the source data. 14-9 High-level Instructions (Strings) Example of conversion Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0 [S2]...DT1 [D]...DT10 [S1]...DT0 H ABCD [S2]...DT1 H 0002 DT2 [D] DT10 DT11 DT12 DT13 DT14 (characters) H 4443 DC H 4241 BA Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT0 [S2]...DT1 [D]...DT10 [S1]...DT0 [S2]...DT1 DT2 DT3 H ABCD H 0002 H 0000 [D] DT10 DT11 DT12 DT13 DT14 (characters) H 4443 DC H 4241 BA Example 3) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0 [S2]...DT2 [D]...DT10 [S1]...DT0 DT1 [S2]...DT2 DT3 H 1234 H 5678 H 0004 [D] DT10 DT11 DT12 DT13 DT14 (characters) H 3433 43 H 3231 21 H 3837 87 H 3635 65 Precautions during programming · The two characters that comprise 1 byte are stored in the opposite order following conversion. · Conversion is carried out with 2 bytes as one unit. [S1] [S1+1] Hexadecimal data [D+1] [D] [D+3] [D+2] Conversion result Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the number of bytes specified by [S2] exceeds the area of the conversion range. To be set when the conversion result exceeds the area. To be set when [S2] is specified as '0' or a negative value. 14-10 AHEX (Conversion: Hexadecimal ASCII HEX) AHEX (Conversion: Hexadecimal ASCII HEX) Ladder diagram R0 AHEX.US DT0 DT4 DT10 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting number of the area that stores an ASCII code S2 The area that stores the number of ASCII codes (number of characters) to be converted, or the constant D Starting number of the area that stores the hexadecimal figure as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K *1 U *2 H Real number String Index modification SF DF " " S1 S2 D *1: Can be specified only when the operation unit is signed integer (SS, SL). *2: Can be specified only when the operation unit is unsigned integer (US, UL). Outline of operation · This instruction converts the ASCII code string into a hexadecimal figure. · The ASCII code stored in the area specified by [S1] is converted into a hexadecimal figure and stored in the area specified by [D]. · The number of ASCII codes (number of characters) to be converted is specified by [S2]. · The conversion result is stored in bytes. · If the number of characters to be converted is an odd number, Bits 0 to 3 of the final data (bytes) of the conversion result are padded with '0'. Example of conversion Example 1) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0 [S2]...DT2 [D]...DT10 [S1]...DT0 DT1 [S2]...DT2 DT3 (characters) H 4241 BA H 4443 DC H 0004 [D] DT10 DT11 DT12 DT13 DT14 H CDAB 14-11 High-level Instructions (Strings) Example 2) Operation unit: 32 bits (UL, SL) [i]...UL,SL [S1]...DT0 [S2]...DT2 [D]...DT10 [S1]...DT0 DT1 [S2]...DT2 DT3 DT4 (characters) H 4241 BA H 4443 DC H 0004 H 0000 [D] DT10 DT11 DT12 DT13 DT14 H CDAB Example 3) Operation unit: 16 bits (US, SS) [i]...US,SS [S1]...DT0 [S2]...DT4 [D]...DT10 (characters) [S1]...DT0 H 3231 21 DT1 H 3433 43 DT2 H 3635 65 DT3 H 3837 87 [S2]...DT4 H 0008 DT5 [D] DT10 DT11 DT12 DT13 DT14 H 3412 H 7856 Example 4) Operation unit: 16 bits (US, SS); No. of characters to be converted is an odd number [i]...US,SS [S1]...DT0 [S2]...DT4 [D]...DT10 (characters) [S1]...DT0 H 3231 21 DT1 H 3433 43 DT2 H 3635 65 DT3 H 3837 87 [S2]...DT4 H 0007 DT5 [D] DT10 DT11 DT12 DT13 DT14 H 3412 H 7056 Precautions during programming · Two characters of ASCII code are converted into two 1-byte numerical digits. In this process, higher-level characters and lower-level characters are exchanged. · Conversion is carried out with four characters as one unit. [+3] [+2] 4 4 4 3 ASCII string [+1] 4 2 [1] 4 1 [D] CD AB Conversion result (hexadecimal) Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the number of characters specified by [S2] exceeds the area of the conversion range. To be set when the conversion result exceeds the area. To be set when [S2] is specified as '0' or a negative value. To be set when the ASCII codes specified by [S1] contains character codes other than 0 to F. 14-12 BCDA (Conversion: BCD Decimal ASCII) BCDA (Conversion: BCD Decimal ASCII) Ladder diagram R0 BCDA.US DT0 DT2 DT10 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting number of the area that stores a BCD figure S2 The area that stores the data that express data size to be converted or conversion direction, or the constant D Starting number of the area that stores the ASCII code as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 S2 D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) Outline of operation · This instruction converts up to 8-digit BCD data into an ASCII code string. · The BCD figure stored in the area specified by [S1] is converted into ASCII codes. · The conversion result is stored in the area starting with [D]. · The BCD data size (number of bytes) to be converted, and the conversion direction, are specified by [S2]. · The conversion result (ASCII code) should have twice the size of the source data. · The maximum value of the data size to be converted varies with the operation unit. (US: 2 bytes, UL: 4 bytes) · Because data size to be converted is specified by bytes, it is possible to convert only low bytes of 1-word data. 14-13 High-level Instructions (Strings) Setting conversion data size and conversion direction [S2] Specify the value with a four-digit H constant. H 00 Data size to be converted 1 to 4 bytes (US: 1 to 2 bytes, UL: 1 to 4 bytes) Conversion direction 0: Forward direction 1: Reverse direction Example of conversion Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT0 [S2]...DT1 [D]...DT10 Forward direction, two bytes [D] (characters) [S1]...DT0 H 1234 DT10 H 3433 43 [S2]...DT1 H 0002 DT11 H 3231 21 DT2 DT12 Example 2) Operation unit: 16 bits (US) [i]...US [S1]...DT0 [S2]...DT1 [D]...DT10 Reverse direction, two bytes [D] (characters) [S1]...DT0 H 1234 [S2]...DT1 H 1002 DT2 DT10 H 3231 21 DT11 H 3433 43 DT12 Example 3) Operation unit: 32 bits (UL) [i]...UL [S1]...DT0 [S2]...DT2 [D]...DT10 Forward direction, four bytes [D] (characters) [S1]...DT0 H 5678 DT10 H 3837 87 DT1 H 1234 DT11 H 3635 65 [S2]...DT2 H 0004 DT12 H 3433 43 DT3 DT13 H 3231 21 Example 4) Operation unit: 32 bits (UL) [i]...UL [S1]...DT0 [S2]...DT2 [D]...DT10 [S1]...DT0 DT1 [S2]...DT2 DT3 H 5678 H 1234 H 1004 Reverse direction, four bytes [D] (characters) DT10 H 3231 21 DT11 H 3433 43 DT12 H 3635 65 DT13 H 3837 87 14-14 BCDA (Conversion: BCD Decimal ASCII) Precautions during programming · The two characters that comprise 1 byte are stored in the opposite order following conversion. · Conversion is carried out with 2 bytes as one unit. [Forward direction] [+1] [1] BCD [D+3] [D+2] [D+1] ASCII Code [D] [Reverse direction] [+1] [1] BCD [D+3] [D+2] [D+1] ASCII Code [D] Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the data specified by [S1] contain non-BCD data. SR7 SR8 (ER) To be set when the number of bytes specified by [S2] exceeds the [S1] area. To be set when the conversion result exceeds the area. To be set when [S2] is specified as '0'. To be set when the conversion direction of [S2] is out of the range. To be set when the conversion data size of [S2] is out of the range. 14-15 High-level Instructions (Strings) ABCD (Conversion: Decimal ASCII BCD) Ladder diagram R0 ABCD.US DT0 DT4 DT10 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting number of the area that stores an ASCII code S2 The area that stores the data that express the number of ASCII codes to be converted and conversion direction, or the constant D Starting number of the area that stores the BCD figure as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 S2 D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Character constants cannot be specified.) Outline of operation · This instruction converts up to 8-character ASCII code string into BCD data. · The ASCII code stored in the area specified by [S1] is converted into BCD data and stored in the area specified by [D]. · The number of ASCII codes (number of characters) to be converted and conversion direction are specified by [S2]. · The resulting BCD data should have half the size of the source ASCII code string. · The maximum value of the data size to be converted varies with the operation unit. (US: 4 characters, UL: 8 characters) · Because data size to be converted is specified by bytes, it is possible to convert only lower bytes of 1-word data. · If the data size to be converted is an odd number, bits of the final data of the conversion result are padded with '0'. i) Bits 0 to 3 are padded with '0'. (Forward direction) ii) Bits 4 to 7 are padded with '0'. (Reverse direction) 14-16 ABCD (Conversion: Decimal ASCII BCD) Setting conversion data size and conversion direction [S2] Specify the setting in a 4-digit BCD (H constant), according to the following format. H0 Size of data to be converted 1 to 16 words Conversion direction 0: Forward direction 1: Reverse direction Example of conversion Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT0 [D]...DT10 [S1]...DT0 DT1 [S2]...DT2 DT3 DT4 [S2]...DT2 (Characters) H 3231 21 H 3433 43 H 0004 Forward direction/ 4 characters [D] DT10 H 3412 DT11 DT12 DT13 DT14 Example 2) Operation unit: 16 bits (US) [i]...US [S1]...DT0 [D]...DT10 [S1]...DT0 DT1 [S2]...DT2 DT3 DT4 [S2]...DT2 (Characters) H 3231 21 H 3433 43 H 1004 Reverse direction/ 4 characters [D] DT10 H 1234 DT11 DT12 DT13 DT14 Example 3) Operation unit: 32 bits (UL) [i]...UL [S1]...DT0 [D]...DT10 [S1]...DT0 DT1 DT2 DT3 [S2]...DT4 [S2]...DT4 (Characters) H 3231 21 H 3433 43 H 3635 65 H 3837 87 H 0008 Forward direction/ 8 characters [D] DT10 H 3412 DT11 H 7856 DT12 DT13 14-17 High-level Instructions (Strings) Example 4) Operation unit: 32 bits (UL) [i]...UL [S1]...DT0 [D]...DT10 [S1]...DT0 DT1 DT2 DT3 [S2]...DT4 [S2]...DT4 (Characters) H 3231 21 H 3433 43 H 3635 65 H 3837 87 H 1008 Reverse direction/ 8 characters [D] DT10 H 5678 DT11 H 1234 DT12 DT13 Example 5) Operation unit: 32 bits (UL) [i]...UL [S1]...DT0 [D]...DT10 [S1]...DT0 DT1 DT2 DT3 [S2]...DT4 [S2]...DT4 (Characters) H 3231 21 H 3433 43 H 3635 65 H 3837 87 H 1007 Reverse direction/ 7 characters [D] DT10 H 4567 DT11 H 0123 DT12 DT13 Precautions during programming · The two characters that comprise 1 byte are stored in the opposite order following conversion. · Conversion is carried out with 2 bytes as one unit. [Forward direction] [S1+3] [S1+2] ASCII Code [S1+1] [S1] [D+1] [D] BCD [Reverse direction] [S1+3] [S1+2] ASCII Code [S1+1] [S1] [D+1] [D] BCD Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the ASCII codes specified by [S1] contain data other than 0 to 9. SR7 SR8 (ER) To be set when the number of bytes specified by [S2] exceeds the [S1] area. To be set when the conversion result exceeds the area. To be set when [S2] is specified as '0'. To be set when the conversion direction of [S2] is out of the range. To be set when the conversion data size of [S2] is out of the range. 14-18 BINA (Conversion: BIN Decimal ASCII) BINA (Conversion: BIN Decimal ASCII) Ladder diagram R0 BINA.US DT0 DT2 DT10 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 The area that stores the BIN data that express a decimal figure, or the constant S2 The area that stores the number of bytes of the area to store the conversion result, or the constant D Starting number of the area that stores the ASCII code as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 Integer K U H *2 *3 *4 Real number String Index modification SF DF " " *1 S2 D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) *2: Can be specified only when the operation unit is signed integer (SS, SL). *3: Can be specified only when the operation unit is unsigned integer (US, UL). *4: Can be specified only when the operation unit is integer (US, SS, UL, SL). Outline of operation · This instruction converts BIN data that expresses a decimal figure into an ASCII code string. · The BIN data expressed as a decimal figure specified by [S1] is converted into an ASCII code and stored in the area specified by [D]. · The starting position of the storage area is specified by [D], and the size by [S2]. · If the number of bytes of the resulting ASCII code (including the negative sign) is larger than the number of bytes specified by [S2], an operation error occurs. · For [S2], specify the number of digits for the conversion target including the sign. 14-19 High-level Instructions (Strings) Example of conversion Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT0 [S2]...DT1 [D]...DT10 [S1]...DT0 H FF9C (U 65436) [S2]...DT1 H 0006 [D] DT10 DT11 DT12 (characters) H 3620 6 H 3435 4 5 H 3633 6 3 DT0: H FF9C (U 65436) DT10 to DT12: " 65436" Example 2) Operation unit: 16 bits (SS) [i]...SS [S1]...DT0 [S2]...DT1 [D]...DT10 [S1]...DT0 H FF9C K -100) [S2]...DT1 H 0006 [D] DT10 DT11 DT12 (characters) H 2020 H 312D 1 H 3030 0 0 DT0: H FF9C (K -100) DT10 to DT12: " -100" Example 3) Operation unit: 32 bits (UL) [i]...UL [S1]...DT0 [S2]...DT2 [D]...DT10 [S1]...DT0 H FF9C DT1 H FFFF [S2]...DT2 H 000A [D] DT10 DT11 DT12 DT13 DT14 (characters) H 3234 2 4 H 3439 4 9 H 3639 6 9 H 3137 1 7 H 3639 6 9 DT0: H FFFF FF9C (U 4294967196) DT10 to DT14: " 4294967196" Example 4) Operation unit: 32 bits (SL) [i]...SL [S1]...DT0 [S2]...DT2 [D]...DT10 [S1]...DT0 H FF9C DT1 H FFFF [S2]...DT2 H 000A [D] DT10 DT11 DT12 DT13 DT14 (characters) H 2020 H 2020 H 2020 H 312D 1 H 3030 0 0 DT0: H FFFF FF9C (K -100) DT10 to DT14: " -100" Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the number of bytes specified by [S2] exceeds the [D] area. To be set when the conversion result exceeds the area. To be set when the resulting number of bytes exceeds the number of bytes specified by [S2]. 14-20 ABIN (Conversion: Decimal ASCII BIN) ABIN (Conversion: Decimal ASCII BIN) Ladder diagram R0 ABIN.US DT0 DT5 DT10 i S1 S2 D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Starting number of the area that stores the ASCII code to be converted S2 The area that stores the number of bytes to be converted, or the constant D Area that stores the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H *2 *3 *4 Real number String Index modification SF DF " " *1 S1 S2(*5) D *1: Only 16-bit devices, 32-bit devices, and integer constants can be modified. (Real number constants, and character constants cannot be specified.) *2: Can be specified only when the operation unit is signed integer (SS, SL). *3: Can be specified only when the operation unit is unsigned integer (US, UL). *4: Can be specified only when the operation unit is integer (US, SS, UL, SL). *5: To be handled as a 16-bit integer (US, SS), regardless of operation unit. Outline of operation · This instruction converts the ASCII code string into BIN data that express a decimal figure. · The ASCII code that express a decimal figure equivalent to the number of bytes (i.e. number of characters) specified by [S2], starting from the area specified by [S1], is converted into a decimal figure and stored in the area specified by [D]. · If a negative sign (-) is contained in the ASCII code specified by [S1], specify SS or SL for the operation unit. An operation error occurs if operation units US or UL are used. 14-21 High-level Instructions (Strings) Example of conversion Example 1) Operation unit: 16 bits (US) [i]...US [S1]...DT0 [S2]...DT3 (characters) [S1]...DT0 H 3620 6 DT1 H 3435 4 5 DT2 H 3633 6 3 [S2]...DT3 H 0006 [D]...DT10 [D] DT10 DT11 H FF9C (U 65436) DT0 to DT2: "65436" DT10: H FF9C (U 65436) Example 2) Operation unit: 16 bits (SS) [i]...SS [S1]...DT0 [S2]...DT3 [S1]...DT0 DT1 DT2 [S2]...DT3 (characters) H 2020 H 312D 1 H 3030 0 0 H 0006 [D]...DT10 [D] DT10 DT11 H FF9C (K -100) DT0 to DT2: "-100" DT10: H FF9C (K -100) Example 3) Operation unit: 32 bits (UL) [i]...UL [S1]...DT0 [S2]...DT5 [D]...DT10 [S1]...DT0 DT1 DT2 DT3 DT4 [S2]...DT5 (characters) H 3234 2 4 H 3439 4 9 H 3639 6 9 H 3137 1 7 H 3639 6 9 H 000A [D] DT10 DT11 DT12 H FF9C H FFFF (U 429467196) DT0 to DT4: "4294967196" DT10 to DT11: H FFFF FF9C (U 4294967196) Example 4) Operation unit: 32 bits (SL) [i]...SL [S1]...DT0 [S2]...DT5 (characters) [S1]...DT0 H 3234 DT1 H 3439 DT2 H 3639 DT3 H 3137 1 DT4 H 3639 0 0 [S2]...DT5 H 0006 [D]...DT10 [D] DT10 H FF9C DT11 H FFFF DT12 (K -100) DT0 to DT4: "-100" DT10 to DT11: H FFFF FF9C (K -100) Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the number of bytes specified by [S2] exceeds the [D] area. To be set when the conversion result exceeds the area. To be set when [S1] contains character ASCII codes other than 0 to 9, sign code, or space. 14-22 BTOA (Conversion: BIN ASCII) BTOA (Conversion: BIN ASCII) Ladder diagram R0 BTOA.US "%d" DT0 H20101 DT100 i S1 S2 N D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Control string (2 to 16 characters) S2 Starting address of the device that stores binary data N Conversion method D Starting address of the device that stores the ASCII code as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 Integer K U H Real number String Index modification SF DF " " S2 N(*1) D *1: To be handled as a 32-bit integer (UL), regardless of operation unit. Outline of operation · This instruction converts the binary data stored in the area starting with [S2] into ASCII codes. · For [S1], specify the type, number of digits, and precision of the data to be converted. · For [N], specify the number of data to be converted, the storage starting position, and the conversion direction. · The conversion result is stored in the area starting with [D]. · The maximum number of characters after conversion for a single datum is 32. An operation error occurs when it exceeds 32 characters. · To directly specify a character constant for the operand [S1], enter the constant in the "Instruction list" dialog box in the FPWIN GR7 programming tool. 14-23 High-level Instructions (Strings) Setting the control string [S1] Use string data in the format shown below to specify the type, number of characters, and precision of the conversion data. A variety of options (such as inserting a sign or spaces) can also be selected depending on the type of data to be converted. Refer to the following pages for details. [S1] = " % + 12.5 d , " Option setting (1) 0 : Zero padding + : A sign is added (plus sign) : A space is inserted - : Left align (default is right align) # : Characters are added according to the conversion data Number of characters after conversion and the precision Option setting (2) , : A comma is added BCD : Postfix characters are added H: Postfix characters are added Specify the total number of characters (n) and the number of characters of precision (m) with [n.m], [n], or [.m]. The number of characters of precision (m) changes according to the type of conversion data Type of data to be converted Number of characters of precision (m) d,i,u,x,X,b represents the number of characters in numerical strings. f represents the number of characters after the decimal point. g represents the number of significant figures. Type of data to be converted d: Signed integer Decimal ASCII u: Unsigned integer Decimal ASCII x: Unsigned integer Hexadecimal ASCII b: BDC integer Hexadecimal ASCII f: Floating point real number Floating point ASCII e: Floating point real number Exponential notation ASCII g: Floating point real number Floating point ASCII or exponential notation ASCII Setting the conversion method [N] Conversion method [N] should be specified in a Hex format in the 32-bit area. [N] = H 2 00 01 Amount of data to be converted H1 to H FFFF (1 to 65535) Convert the data to hexadecimal and specify it here Storage starting position H0 to H FF (Conversion) Specify the header where the converted character string is stored from the relative position of the low byte of [D]. The round numbers in the following diagram indicate the relative position. The character string is stored from relative position for H00 and from relative position for H01. H L [D] [D+1] [D+2] [D+3] Conversion direction H00: Forward direction H01: Reverse direction Specify a conversion direction. Forward direction can only be specified for hexadecimal data (control string %x) or BCD data (control string %b). For all other data formats, reverse direction is specified (fixed). [S2] H 1234 Forward direction (Characters) [D] H31 H32 1 2 [D+1] H33 H34 3 4 Reverse direction [D] H32 H31 [D+1] H34 H33 (Characters) 2 1 4 3 14-24 BTOA (Conversion: BIN ASCII) Setting conversion data for the control string [S1] Control string Data format BIN data before conversion ASCII data after conversion "%d" or "%i" 16-bit data (signed integer) 32-bit data (signed integer) Decimal ASCII data Decimal ASCII data "%u" 16-bit data (unsigned integer) 32-bit data (unsigned integer) Decimal ASCII data Decimal ASCII data "%x" 16-bit data 32-bit data Hexadecimal ASCII data (Forward/reverse direction) Hexadecimal ASCII data (Forward/reverse direction) "%b" 16-bit BCD data 32-bit BCD data Decimal ASCII data (Forward/reverse direction) Decimal ASCII data (Forward/reverse direction) 32-bit single-precision real number data "%f" 64-bit double-precision real number data Floating point ASCII data Floating point ASCII data "%e" 32-bit single-precision real number data 64-bit double-precision real number data Exponential notation ASCII data Convert to exponential notation ASCII data "%g" 32-bit single-precision real number data 64-bit double-precision real number data Exponential notation ASCII data or floating point ASCII data (whichever is shorter in the relevant notation) Exponential notation ASCII data or floating point ASCII data (whichever is shorter in the relevant notation) (Note): The number of converted digits for a control string is up to16. Available operation units SS SL US UL Usage example "%d" , "%5d" , "%+5d" , "%-5d", %05d" , %10.5d" , "%d,", "% d" "%u" , "%5u" , "%+5u" , "%-5u","%05u" , %10.5u" , "%u," US "%x" , "%5x" , "%-5x" , "%05x", "%10.5x" , "%x," , UL "%#x" , "%X" US "%b" , "%5b" , "%-5b" , "%05b", "%10.5b" , "%b," UL SF "%f" , "%5.2f" , "%+5.2f" "%-5.2f" , "%05.2f" , "%f," DF "%#f" , "% f" SF "%e" , "%5.2e" , "%+5.2e" "%-5.2e" , "%05.2e" ,"%e," DF "%#5.2e" , "% e" , "%E" SF "%g" , "%5.2g" , "%+5.2g" "%-5.2g" , "%05.2g" ,"%g," "%#5.2g" , "%G" DF Application example of control string [S1] The following is a conversion example according to the operation unit and conversion direction. Operation unit US Conversion direction Reverse Control string %+12.5u US Reverse %+10.7b US Forward %8.5X, US Forward %05b SF Reverse %+10.3e Binary data ASCII data K 1234 "01234" H 0123 "0000123" H 0123 "23010" H 01233456 "2301056340" SF123.4567 "1.235e+02" Description When %u is specified, the result is not signed. When %b is specified, the result is not signed. If an 8-character string is converted in the forward direction, it appears as shown below. Conversion of an odd number of characters in the forward direction is as shown below. An exponent is output in at least 2 digits. 14-25 High-level Instructions (Strings) Options for the control string [S1] Items Control string Binary data ASCII data Description Specification of alphabetical upper / lower case characters Specification of display digit %x %X %e %E %d %5d %10.5d %x %5x %10.5x %b %5b %f %8.3f %e %10.3e %g %8.6g H ABCD H ABCD SF1234.567 SF1234.567 K 100 K 100 K 100 H 12A H 12A H 12A H 123 H 123 SF 123.4567 SF 123.4567 SF 1234.567 SF 1234.567 SF 1234.567 SF 1234.567 "abcd" "ABCD" "1.234567e+3" "1.234567E+3" "100" "100" "00100" "12a" "12a" "0012a" "123" "123" "123.4567" "123.457" "1.234567e+03" "1.235e+03" "1234.567" "1234.57" Specify alphabetical upper or lower case characters used in hexadecimal and exponential notation ASCII data. The display digit is specified with "Total number of characters" and "Number of characters of precision". It is specified with "n.m", "n", or ".m", etc. n: Total number of characters, m: Number of characters of precision <Number of characters for precision> [d , i , u , x , X , b] represent the number of characters in numerical strings. [f , e , E] represent the number of characters after the decimal point. [g , G] represent the number of significant figures. If the number of characters is not specified, the number of digits and the storage area size of the converted data will vary according to the data before conversion. Specification of zero padding %05d %05x %05b %08.3f %010.3e K 100 H 12A H 123 SF 123.4567 SF 1234.567 "00100" "0012a" "00123" "0123.457" "01.235e+03" When the setting for the display digit is available, zero padding can be specified. Put zero (0) before the display digit. %-5d K 100 "100" Specification of right / left alignment %-5x %-5b %-8.3f H 12A H 123 SF 123.4567 "12a" "123" "123.457" Default is right align. To set to left align, add minus (-) before the specification of digit number. Specification of sign %-010.3e %+d %+d %+5d %+8.3f %+10.3e SF 1234.567 K 100 K -100 K 100 123.4567 1234.567 "1.235e+03" "+100" "-100" "+100" "+123.457" "+1.234e+03" A plus sign (+) is not added by default. To add a plus sign (+), add (+). Not available when %u, %b, or %x is specified. %d K 100 "100" Specification of digit position %d %8.3f %8.3f %10.3e K -100 SF 123.4567 SF -123.4567 SF 1234.567 "-100" "123.457" "-123.457" "1.235e+03" In the case of a positive number, a space is added to align the position in the case of a negative number. Add a space to align the position. %10.3e SF -1234.567 "-1.235e+03" %#x H 12A "0x12a" "0x" is added. Specification of another output type for numerical data type %#X %#8.0f %#10.0e %#10.3E %#9.0g %#.9G H 12A SF 123.4567 SF 1234.567 SF 1234.567 SF 1234 SF 1234 "0X12A" "123." "1.e+03" "1.E+03" "1234.0" "1234.0000" "0X" is added. "." is always added. "." is always added, and "0" after the decimal point is not omitted. Another output type is automatically given by adding "#". Specification of additional characters after numerical data %d, %x, %xH %bBCD K 100 H 100 H 100 H 100 "100," "100," "100H" "100BCD" The characters that follow the characters specified for conversion (d , x , b , f , e , g) are added after the numerical ASCII data. (Note 1): "" in the table represents a space. (Note 2): For exponential notation, it consists of a code (e or E), a sign, and a 2-digit number. (Note 3): If the conversion results in having fewer enabled digits than before conversion, the result is rounded off. 14-26 BTOA (Conversion: BIN ASCII) Example of conversion Example 1) Converting unsigned 16-bit binary data (2 data) to decimal ASCII data (6 digits + comma) x 2 The high byte of DT100 is set as the beginning of the storage area. It is left-aligned (low word side), and a comma is added before the data is stored. If it is fewer than 6 digits, spaces are inserted. [i]...US [S1]..."%-6u," Convert 16-bit data into decimal ASCII data (6 digits) [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Storage start position (1) [D]+1 bytes Conversion data amount (2) Convert [S2] and [S2]+1 Conversion data amount = 2 [S2] [S2] DT0 H 04D2 U 1234 [S2]+1 DT1 H FFC8 U 65480 DT2 Storage start position = +1 bytes [D] (characters) DT100 H 31 ** 1 ** DT101 H 3332 3 2 DT102 H 2034 _ 4 DT103 H 2C20 , _ DT104 H 3536 5 6 DT105 H 3834 8 4 DT106 H 2030 _ 0 DT107 H ** 2C ** , DT0 U 1234 (H 04D2) DT100 to DT103 "1234 ," DT1 U 65480 (H FFC8) DT104 to DT107 "65480 ," Example 2) Converting signed 16-bit binary data (2 data) to decimal ASCII data (5 digits x 2) The high byte of DT100 is set as the beginning of the storage area. Zero padding is used to store the data. [i]...SS [S1]..."%05d" Convert 16-bit data into decimal ASCII data (5 digits) (0 padding) [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Storage start position (1) [D]+1 bytes Conversion data amount (2) Convert [S2] and [S2]+1 Conversion data amount = 2 [S2] [S2] DT0 H 04D2 K 1234 [S2]+1 DT1 H FFC8 K -56 DT2 Storage start position = +1 bytes [D] (characters) DT100 H 30 ** 0 ** DT101 H 3231 2 1 DT102 H 3433 4 3 DT103 H 302D 0 - DT104 H 3530 5 0 DT105 H ** 36 ** 6 DT106 DT0: K 1234 (H 04D2) DT100 to DT102: "01234" DT1: K -56 (H FFC8) DT103 to DT105: "-0056" 14-27 High-level Instructions (Strings) Example 3) Converting signed 32-bit binary data (2 data) to decimal ASCII data (number of digits not specified) The low byte of DT100 is set as the beginning of the storage area. For a positive number, a space is inserted. Since the number of digits is not specified, the number of characters after conversion and the size of the area where the data is stored will vary according to the value of the binary data that is converted. [i]...SL [S1]..."%d" [S2]...DT0 Convert 32-bit (For a positive data into number, decimal a space ASCII data is inserted) [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 [S2] [S2] DT0 [S2+1] DT1 [S2+2] DT2 [S2+3] DT3 DT4 H 04D2 H 0000 H FFC8 H FFFF K 1234 K -56 Storage start position = +0 bytes [D] DT100 DT101 DT102 DT103 DT104 (characters) H31 H20 1 H33 H32 3 2 H2D H34 - 4 H36 H35 6 5 DT0 to DT1: U 1234 (H 0000 04D2) DT100 to DT102: "1234 " DT2 to DT3: U 4294967240 (H FFFF FFC8) DT102 to DT103: "-56" Example 4) Converting signed 32-bit binary data (2 data) to decimal ASCII data (10 digits x 2) The low byte of DT100 is set as the beginning of the storage area. It is right-aligned (high word side), and a space is inserted before the data is stored. [i]...SL [S1]..."%10d" Convert 32-bit data into decimal ASCII data (10 digits) [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 [S2] [S2] DT0 H 04D2 [S2+1] DT1 H 0000 K 1234 [S2+2] DT2 [S2+3] DT3 DT4 H FFC8 H FFFF K -56 Storage start position = +0 bytes [D] DT100 DT101 DT102 (characters) H 2020 H 2020 H 2020 DT103 DT104 DT105 DT106 DT107 DT108 DT109 DT110 H 3231 H 3433 H 2020 H 2020 H 2020 H 2D20 H 3635 21 43 - 65 DT0 to DT1: U 1234 (H 0000 04D2) DT100 to DT104: " 1234" DT2 to DT3: U 4294967240 (H FFFF FFC8) DT105 to DT109: " -56" 14-28 BTOA (Conversion: BIN ASCII) Example 5) Converting unsigned 16-bit binary data (2 data) to decimal ASCII data (10 digits x 2) The low byte of DT100 is set as the beginning of the storage area. 5 digits are stored as significant figures. If the control string is "u", the sign "+" is not output. [i]...US [S1]..."%+10.5u" Convert 16-bit data into decimal ASCII data (10 digits) [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+1 Conversion data amount = 2 [S2] [S2] DT0 H 04D2 U 1234 [S2]+1 DT1 H FFC8 U 65480 DT2 Storage start position = +0 bytes [D] (Characters) DT100 H 2020 DT101 H 2020 DT102 H 3020 0 DT103 H 3231 2 1 DT104 H 3433 4 3 DT105 H 2020 DT106 H 2020 DT107 H 3620 6 DT108 H 3435 4 5 DT109 H 3038 0 8 DT0: U 1234 (H 04D2) DT1: U 65480 (H FFC8) DT100 to DT104: " 01234" DT105 to DT109: " 65480" Example 6) Converting unsigned 32-bit binary data (2 data) to decimal ASCII data (12 digits x 2) The low byte of DT100 is set as the beginning of the storage area. It is stored left-aligned (low word side). Spaces are inserted. [i]...UL [S1]..."%-12u" Convert 32-bit data into decimal ASCII data (12 digits) (left align) [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 Storage start position = +0 bytes [S2] [D] (characters) [S2] DT0 [S2+1] DT1 [S2+2] DT2 [S2+3] DT3 DT4 H 04D2 H 0000 H FFC8 H FFFF U 1234 U 4294967240 DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109 DT110 DT111 H 3231 H 3433 H 2020 H 2020 H 2020 H 2020 H 3234 H 3439 H 3639 H 3237 H 3034 H 2020 2 1 4 3 24 49 69 27 04 DT0 to DT1: U 1234 (H 0000 04D2) DT100 to DT105: "1234" "DT2 to DT3: U 4294967240 (H FFFF FFC8) DT106 to DT110: "4294967240" 14-29 High-level Instructions (Strings) Example 7) Converting unsigned 16-bit binary data (2 data) to hexadecimal ASCII data (8 digits + comma) x 2 The low byte of DT100 is set as the beginning of the storage area. It is stored left-aligned (low word side) for 5 significant figures. Spaces and a comma are inserted. Hex data is in upper case. [i]...US [S1]..."%8.5X, " Convert 16-bit data into hexadecimal ASCII data (8 digits) [S2]...DT0 [N]...H 0002 00 00 ASCII data (forward direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+1 Conversion data amount = 2 [S2] [S2] DT0 H 0123 H 123 [S2]+1 DT1 H 89AB H 89AB DT2 Storage start position = +0 bytes [D] (characters) DT100 H 3332 3 2 DT101 H 3130 1 0 DT102 H 3020 0 DT103 H 2020 DT104 H 412C A , DT105 H 3842 8 B DT106 H 2039 9 DT107 H 2030 0 DT108 H 2C20 , DT109 DT0: H 0123 DT100 to DT104: "23010," DT1: H 89AB DT104 to DT108: "AB890," Example 8) Converting unsigned 32-bit binary data (2 data) to hexadecimal ASCII data (8 digits x 2) The low byte of DT100 is set as the beginning of the storage area. It is stored right-aligned (high word side) for 6 significant figures. The characters "0x" that represent Hex data are added. [i]...UL [S1]..."%#8.6x" [S2]...DT0 Convert 32-bit data into hexadecimal ASCII data (8 digits) (add "0x") [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 [S2] [S2] DT0 H 0123 [S2+1] DT1 H 0000 H 123 [S2+2] DT2 H ABCD [S2+3] DT3 H 0089 H 89ABCD DT4 Storage start position = +0 bytes [D] DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 (characters) H 7830 x 0 H 3030 0 0 H 3130 1 0 H 3332 3 2 H 7830 x 0 H 3938 9 8 H 6261 b a H 6463 d c DT0 to DT1: H 0123 DT100 to DT103: "0x000123" DT2 to DT3: H 89AB DT104 to DT107: "0x89abcd" 14-30 BTOA (Conversion: BIN ASCII) Example 9) Converting unsigned 16-bit BCD data (2 data) to decimal ASCII data (5 digits x 2) The low byte of DT100 is set as the beginning of the storage area. It is stored left-aligned (low word side) for 5 significant figures. Zero padding is used. [i]...US [S1]..."%05b" Convert 16-bit BCD data into decimal ASCII data (5 digits) (zero padding) [S2]...DT0 [N]...H 0002 00 00 ASCII data (forward direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+1 Conversion data amount = 2 [S2] [S2] DT0 H 0123 H 123 [S2]+1 DT1 H 3456 H 3456 DT2 Storage start position = +0 bytes [D] (characters) DT100 H 3332 3 2 DT101 H 3130 1 0 DT102 H 35 30 5 0 DT103 H 3336 3 6 DT104 H 3034 0 4 DT105 DT0: H 0123 DT100 to DT102: "23010" is the data that is converted from H0123. DT1: H 3456 DT102 to DT104: "56340" is the data that is converted from H3456. Example 10) Converting unsigned 32-bit BCD data (2 data) to decimal ASCII data (10 digits x 2) The low byte of DT100 is set as the beginning of the storage area. It is stored right-aligned (high word side). Zero padding is used within the 7 significant figures. Spaces are inserted for the remaining digits. [i]...UL [S1]..."%10.7b" Convert 32-bit BCD data into decimal ASCII data (10 digits) [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 [S2] [S2] DT0 [S2+1] DT1 [S2+2] DT2 [S2+3] DT3 DT4 H 0123 H 0000 H 3456 H 0012 H 123 H 123456 Storage start position = +0 bytes [D] (characters) DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109 DT110 H 2020 H 3020 H 3030 H 3130 H 3332 H 2020 H 3020 H 3231 H 3433 H 3635 0 00 10 32 0 21 43 65 DT0 to DT1: H 0000 0123 DT100 to DT104: "0000123" DT2 to DT3: H 0012 3456 DT105 to DT109: "0123456" 14-31 High-level Instructions (Strings) Example 11) Converting 32-bit single-precision floating point real number data (2 data) to floating point ASCII data (8 digits x 2) The high byte of DT100 is set as the beginning of the storage area. It is stored right-aligned (high word side). A decimal point is added followed by no digit. [i]...SF [S1]..."%#8.0f" Convert 32-bit single precision real number data into floating point ASCII data (8 digits) [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Storage start position (1) [D]+1 bytes Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 [S2] [S2] DT0 [S2+1] DT1 123.4567 [S2+2] DT2 [S2+3] DT3 -12.34567 DT4 DT5 Storage start position = +1 bytes [D] (characters) DT100 H 20 ** ** DT101 H 2020 DT102 H 3120 1 DT103 H 3332 3 2 DT104 H 202E . DT105 H 2020 DT106 H 2D20 - DT107 H 3231 2 1 DT108 H ** 2E ** . DT109 DT0 to DT3: 123.4567 DT100 to DT104: "123." DT4 to DT7: -12.34567 DT104 to DT108: "-12." Example 12) Converting 32-bit single-precision floating point real number data (2 data) to exponential notation ASCII data (10 digits x 2) The low byte of DT100 is set as the beginning of the storage area. 2 digits after the decimal point. Exponential notation is used. For a positive number, a space is inserted. [i]...SF [S1]..."%-10.2e" [S2]...DT0 [N]...H 0002 00 01 [D]...DT100 Convert 32-bit single precision real number data into exponential ASCII data (10 digits) ASCII data (reverse direction) Storage start position (0) [D]+0 bytes Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 [S2] [S2] DT0 [S2+1] DT1 123.4567 [S2+2] DT2 [S2+3] DT3 -12.34567 DT4 Storage start position = +0 bytes [D] (characters) DT100 H 3120 . 1 DT101 H 322E 3 2 DT102 H 6533 + e DT103 H 302B 2 0 DT104 H 2032 DT105 H 312D 1 - DT106 H 322E 2 . DT107 H 6533 e 3 DT108 H 302B 0 + DT109 H 2031 1 DT110 DT0 to DT3: 123.4567 DT100 to DT104: "1.23e+02 " DT4 to DT7: -12.34567 DT105 to DT109: "-1.23e+01" 14-32 BTOA (Conversion: BIN ASCII) Example 13) Converting 32-bit single-precision floating point real number data (2 data) to floating point ASCII data or exponential notation ASCII data (9 digits x 2) The high byte of DT100 is set as the beginning of the storage area. It is stored left-aligned (low word side). The data is converted to 7 significant figure floating point ASCII data before storing. (Note): The conversion is either to floating point ASCII data or to exponential notation ASCII data, whichever is shorter. [i]...SF [S1]..."%#9.7g" Convert 32-bit single precision real number data into exponential ASCII data (9 digits) or floating point ASCII data, whichever is shorter in the relevant notation [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Storage start position (0) [D]+1 byte Conversion data amount (2) Convert [S2] and [S2]+2 Conversion data amount = 2 [S2] [S2] DT0 [S2+1] DT1 123.45 [S2+2] DT2 [S2+3] DT3 DT4 -1234.567 Storage start position = +1 byte [D] (characters) DT100 H 20 ** DT101 H 3332 2 1 DT102 H 2E33 . 3 DT103 H 3534 5 4 DT104 H 3030 0 0 DT105 H 312D 1 - DT106 H 3332 3 2 DT107 H 2E34 . 4 DT108 H 3635 6 5 DT109 ** H37 7 DT0 to DT1: 123.4567 DT100 to DT104: " 123.4500" DT2 to DT3: -12.34567 DT104 to DT108: " -1234.567" Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the conversion format specified by [S1] is not an available operation unit. To be set when the conversion format specified by [S1] is not a control character. SR7 SR8 (ER) To be set when the number of ASCII code digits specified by [N] exceeds the maximum number of digits for the control characters specified by [S1]. To be set when the storage start position specified by [N] is out of the range. To be set when the conversion data amount specified by [N] exceeds the [S2] area. To be set when the conversion data amount specified by [N] is out of the range. To be set when the conversion result exceeds the ASCII code storage area specified by [N]. To be set when the conversion result exceeds the area specified by [D]. 14-33 High-level Instructions (Strings) ACHK (ASCII Data Check) Ladder diagram R0 ACHK.US "%3d" DT0 H20101 i S1 S2 N Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Control string (2 to 16 characters) S2 Starting number of the area that stores an ASCII code N Conversion method Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " S1 S2 N(*1) *1: To be handled as a 32-bit integer (UL), regardless of operation unit. Outline of operation · This instruction checks whether the specified ASCII code string can be converted using the ATOB instruction. · According to the control characters specified by [S1], this instruction checks whether the ASCII code stored in the area specified by [S2] can be normally converted using the conversion method specified by [N]. · If the check result is normal, the system relay SRB turns ON (1), and if abnormal, SRB turns OFF (0). · Specify the same value as the ATOB instruction for [S1] the control string, [S2] the beginning of the source data, and [N] the conversion method. · The operations for the maximum length of ASCII string and for the valid range of conversion data values are the same as the ATOB instruction. · To directly specify a character constant for the operand [S1], enter the constant in the "Instruction list" dialog box in the FPWIN GR7 programming tool. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the conversion format specified by [S1] is not an available operation unit. SR7 SR8 (ER) To be set when the conversion format specified by [S1] is not a control character. To be set when the number of ASCII code digits specified by [N] exceeds the maximum number of digits for the control characters specified by [S1]. To be set when the storage start position specified by [N] is out of the range. To be set when the conversion data amount specified by [N] exceeds the [S2] area. To be set when the conversion data amount specified by [N] is out of the range. 14-34 ATOB (Conversion: ASCII BIN) ATOB (Conversion: ASCII BIN) Ladder diagram R0 ATOB.US "%3d" DT0 H20101 DT100 i S1 S2 N D Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Control string (2 to 16 characters) S2 Starting number of the area that stores the ASCII data targeted for conversion N Conversion method D Starting number of the area that stores the binary data as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 N(*1) D *1: To be handled as a 32-bit unsigned integer, regardless of operation unit. Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction converts the ASCII code string data stored in the area starting with [S2] into binary data. · Specify the conversion method for [S1] and [N]. · The conversion result is stored in the area starting with [D]. Format of ASCII data · Data is processed for the number of data specified for [N], or considering a NULL character as the end of the ASCII string data to be converted. · If a comma (",") is included in the string data, it is processed as a separator for the data. · The maximum number of digits for a single datum is 28. Format Decimal integer Hexadecimal integer Floating point type real numbers Real number in exponential notation ASCII data before conversion "123456" "123456 " "12AB" "12AB " "00000012AB " "0x12AB", "1234.56789", " 1234" "1.234E+2" "1.23E-2 ", "1.234e+2", Binary data after conversion U 123456 U 123456 H 12AB H 12AB H 12AB H 12AB f 1234.56 f 1234.00 f 123.4 f 0.01234 f 123.4 14-35 High-level Instructions (Strings) Setting of control string [S1] Control string Format of data for conversion ASCII data before conversion BIN data after conversion Available operation units Data range Unsigned decimal ASCII data Unsigned 16-bit data US U0 to U65,535 "%nd" Signed decimal ASCII data Unsigned decimal ASCII data Signed 16-bit data Unsigned 32-bit data SS K-32,768 to K32,767 UL U0 to U4,294,967,295 Signed decimal ASCII data Signed 32-bit data SL K-2,147483,648 to K2,147,483,647 Hexadecimal ASCII data 16-bit data (Forward/reverse direction) US "%nx" Hexadecimal ASCII data 32-bit data (Forward/reverse direction) UL H0 to HFFFF H0 to HFFFFFFFF "%nb" Decimal ASCII data Decimal ASCII data 16-bit BCD data (Forward/reverse direction) US 32-bit BCD data (Forward/reverse direction) UL H0 to H9999 H0 to H99999999 "%nf" "%ne" Floating point real number (including exponential notation) ASCII data Floating point real number (including exponential notation) ASCII data 32-bit single-precision floating point real number data SF 64-bit double-precision floating point real number data DF 3.402823E+38 to 1.175494E-38 -1.175494E-38 -3.402823E+38 1.797693134862231E+308 to 2.2250738585072014E-308 -2.2250738585072014E-308 to -1.797693134862231E+308 (Note 1): For "n", specify the number of digits. Conversion is performed for every "n" digits. However, data separation occurs wherever a comma (",") appears. (Note 2): When omitting "n", insert a comma (",") to separate the data. (Note 3): When there is a comma followed by another comma, it is converted to the value "0". Example: When the number of the data is three, ",," is processed as the data "0, 0, and 0". Specification of conversion method [N] Conversion method [N] should be specified in a Hex format (8 digits) in the 32-bit area. [N] = H 2 00 01 Amount of data to be converted H1 to H FFFF (1 to 65535) Convert the data to hexadecimal and specify it here Conversion starting position H0 to H FF (Conversion) Specify the header of the character string to convert from the relative position of the low byte of [S2]. The round numbers in the following diagram indicate the relative position. The character string to be converted starts from relative position for H00 and from relative position for H1. H L [S2] [S2+1] [S2+2] [S2+3] Conversion direction H00: Forward direction H01: Reverse direction Specify a conversion direction. Forward direction can only be specified for hexadecimal data (control string %x) or BCD data (control string %b). For all other data formats, reverse direction is specified (fixed). H 1234 [D] Forward direction (Characters) [S2] H34 H33 4 3 [S2+1] H32 H31 2 1 Reverse direction (Characters) [S2] H32 H31 2 1 [S2+1] H34 H33 4 3 14-36 ATOB (Conversion: ASCII BIN) Example of conversion Example 1) Converting two hexadecimal ASCII data (4 digits) to two 16-bit binary data (hexadecimal) The conversion starts from the low byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...US [S1]..."%4x" Converts hexadecimal ASCII data (4-digit) to 16-bit data [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) Converts two 4-digit data Conversion starting position = +0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 3130 1 0 DT1 H 3332 3 2 DT2 H 3938 9 8 DT3 H 4241 B A DT4 [D] DT100 DT101 DT102 H 0123 H 89AB DT0 to DT1: "0123" DT100: H 0123 DT2 to DT3: "89AB" DT101: H 89AB Example 2) Converting two hexadecimal ASCII data (6 digits) to two 32-bit binary data (hexadecimal) The conversion starts from the low byte of DT0. It is converted in forward direction (the high word side of [S2] is considered as high-order numerical data). For empty digits of the storage area, zeros (0) are inserted. [i]...UL [S1]..."%6x" Converts hexadecimal ASCII data (6-digit) to 32-bit data [S2]...DT0 [N]...H 0002 00 00 ASCII data (forward direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) Converts two 6-digit data Conversion starting position = + 0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 3332 3 2 DT1 H 3130 1 0 DT2 H 3030 0 0 DT3 H 4443 D C DT4 H 4241 B A DT5 H 3938 9 8 DT6 [D] DT100 H 0123 DT101 H 0000 DT102 H ABCD DT103 H 0089 DT104 H 123 H 89ABCD * When the number of characters is smaller than the number of converted bits, the portions that are lacking are padded with "0". DT0 to DT2: "000123" DT100: H 0000 0123 DT3 to DT5: "89ABCD" DT101: H 0089 ABCD 14-37 High-level Instructions (Strings) Example 3) Converting two hexadecimal ASCII data (6 digits) to two 32-bit binary data (hexadecimal) The conversion starts from the low byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). For empty digits of the storage area, zeros (0) are inserted. [i]...UL [S1]..."%6x" Converts hexadecimal ASCII data (6-digit) to 32-bit data [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) Converts two 6-digit data Conversion starting position = + 0 byte Amount of data to be converted = 2 [S2] (characters) [D] DT0 H 3030 0 0 DT1 H 3130 1 0 DT2 H 3332 3 2 DT3 H 3938 9 8 DT4 H 4241 B A DT5 H 4443 D C DT6 DT100 H 0123 DT101 H 0000 DT102 H ABCD DT103 H 0089 DT104 H 123 H 89ABCD * When the number of characters is smaller than the number of converted bits, the portions that are lacking are padded with "0". DT0 to DT2: "000123" DT100: H 0000 0123 DT3 to DT5: "89ABCD" DT101: H 0089 ABCD Example 4) Converting two hexadecimal ASCII data (separated by commas) to two 10-bit binary data (decimal) The conversion starts from the high byte of DT0. If there is no specification for the number of digits, it is processed considering commas as the data delimiter. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...US [S1]..."%d" Converts decimal ASCII data to 16-bit data (Data end: ',') [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2]+1 bytes Amount of conversion data (2) 2 data separated by a comma Conversion starting position = +1 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 31 ** 1 ** DT1 H 33 32 3 2 DT2 H 2C 34 , 4 DT3 H 36 35 6 5 DT4 H 38 37 8 7 DT5 H ** 2C ** , DT6 [D] DT100 DT101 DT102 H 04D2 H 162E U 1234 U 5678 DT0 to DT2: "1234," DT100: U 1234 (H 04D2) DT3 to DT5: "5678," DT101: U 5678 (H 162E) 14-38 ATOB (Conversion: ASCII BIN) Example 5) Converting two hexadecimal ASCII data (separated by commas) to two 16-bit binary data (hexadecimal) The conversion starts from the high byte of DT0. If there is no specification for the number of digits, it is processed considering commas as the data delimiter. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...US [S1]... "%x" Converts hexadecimal ASCII data to 16-bit data (Data end: ',') [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2]+1 byte Amount of conversion data (2) 2 data separated by a comma Conversion starting position = + 1 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 20 ** ** DT1 H 3231 2 1 DT2 H 2C33 , 3 DT3 H 3420 4 DT4 H 4241 B A DT5 H ** 2C ** , DT6 [D] DT100 DT101 DT102 H 0123 H 04AB DT0 to DT2: "123," DT100: H 0123 DT3 to DT5: "4AB," DT101: H 04AB Example 6) Converting two decimal ASCII data (4 digits) to two 16-bit BCD data (if there is a comma at the end of the data) The conversion starts from the low byte of DT0. If the data includes a comma, it is processed as a data delimiter even if the number of digits is less than specified. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...US [S1]... "%4b" Converts decimal ASCII data to 16-bit BCD data (Data end: ',') [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) 2 data separated by a comma Conversion starting position = +0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 3231 2 1 DT1 H 2C33 , 3 DT2 H 3534 5 4 DT3 H ** 2C ** , DT4 [D] DT100 DT101 DT102 H 0123 H 0045 DT0 to DT1: "123," DT100: U 0291 (H 0123) DT2 to DT3: "45," DT101: U 0069 (H 0045) 14-39 High-level Instructions (Strings) Example 7) Converting two floating point ASCII data (with comma delimiters) to two 32-bit single-precision real number The conversion starts from the high byte of DT0. If there is no specification for the number of digits, it is processed considering commas as the data delimiter. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...SF [S1]... "%f" Converts floating point ASCII data to 32-bit real number data (Data end: ',') [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2]+1 byte Amount of data to be converted (2) 2 data separated by a comma Conversion starting position = +1 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 20 ** ** DT1 H 2020 DT2 H 3231 2 1 DT3 H 332E 3 . DT4 H 20 2C , DT5 H 2020 DT6 H 3534 5 4 DT7 H 362E 6 . DT8 H ** 2C ** , [D] DT100 DT101 DT102 DT103 DT104 SF 12.3 SF 45.6 DT0 to DT4: " 12.3," DT100 to DT101: SF 12.3 DT4 to DT8: " 45.6," DT102 to DT103: SF 45.6 Example 8) Converting two exponential notation ASCII data (with comma delimiters) to two 32-bit single-precision real numbers The conversion starts from the high byte of DT0. If there is no specification for the number of digits, it is processed considering commas as the data delimiter. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...SF [S1]..."%e" Converts exponential notation ASCII data to 32-bit single-precision real number data (Data end: ',') [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2]+1 byte Amount of conversion data (2) 2 data separated by a comma Conversion starting position = +1 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 31 ** 1 ** DT1 H 322E 2 . DT2 H 3433 4 3 DT3 H 4535 E 5 DT4 H 312B 1 + DT5 H 2C32 , 2 DT6 H 312D 1 - DT7 H 322E 2 . DT8 H 4533 E 3 DT9 H 322D 2 - DT10 H 2C33 , 3 [D] DT100 DT101 DT102 DT103 DT104 SF 1.2345E+12 SF -1.23E-23 DT0 to DT5: "1.2345E+12," DT100 to DT101: SF 1.2345E+12 DT6 to DT10: "-1.23E-23," DT102 to DT103: SF -1.23E-23 14-40 ATOB (Conversion: ASCII BIN) Example 9) Converting two decimal ASCII data (5 digits) to two 16-bit unsigned binary data (decimal) The conversion starts from the high byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...US [S1]... "%5d" Converts decimal ASCII data (5-digits) to 16-bit data (unsigned) [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2]+1 byte Amount of conversion data (2) two 5-digit data Conversion starting position = +1 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 20 ** ** DT1 H 3231 2 1 DT2 H 3433 4 3 DT3 H 3536 5 6 DT4 H 3834 8 4 DT5 H ** 30 ** 0 DT6 [D] DT100 DT101 DT102 H 04D2 H FFC8 U 1234 U 65480 DT0 to DT2: " 1234" DT100: U 1234 (H 04D2) DT3 to DT5: "65480" DT101: U 65480 (H FFC8) Example 10) Converting two decimal ASCII data (5 digits) to two 16-bit signed binary data (decimal) The conversion starts from the high byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...SS [S1]..."%5d" Converts decimal ASCII data (5-digit) to 16-bit data [S2]...DT0 [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2]+1 byte Amount of conversion data (2) two 5-digit data Conversion starting position = +1 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 20 ** ** DT1 H 3231 2 1 DT2 H 3433 4 3 DT3 H 2020 DT4 H 352D 5 - DT5 H ** 36 ** 6 DT6 [D] DT100 DT101 DT102 H 04D2 H FFC8 K 1234 K -56 DT0 to DT2: " 1234" DT100: K 1234 (H 04D2) DT3 to DT5: " -56" DT101: K -56 (H FFC8) 14-41 High-level Instructions (Strings) Example 11) Converting two decimal ASCII data (10 digits) to two 32-bit unsigned binary data (decimal) The conversion starts from the low byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...UL [S1]..."%10d" Converts decimal ASCII data (10-digit) to 32-bit data [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) two 10-digit data Conversion starting position = +0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 2020 DT1 H 2020 DT2 H 2020 DT3 H 3231 2 1 DT4 H 3433 4 3 DT5 H 3231 2 1 DT6 H 3433 4 3 DT7 H 3635 6 5 DT8 H 3837 8 7 DT9 H 3039 0 9 DT10 [D] DT100 DT101 DT102 DT103 DT104 H 04D2 H 0000 H 02D2 H 4996 U 1234 U 1234567890 DT0 to DT4: " 1234" DT100 to DT101: U 1234 (H 0000 04D2) DT5 to DT9: "1234567890" DT102 to DT103: U 1234567890 (H 4996 02D2) Example 12) Converting two decimal ASCII data (10 digits) to two 32-bit signed binary data (decimal) The conversion starts from the low byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...SL [S1]..."%10d" Converts decimal ASCII data (10-digit) to 32-bit data [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) two 10-digit data Conversion starting position = +0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 2020 DT1 H 2020 DT2 H 2020 DT3 H 3231 2 1 DT4 H 3433 4 3 DT5 H 2020 DT6 H 2020 DT7 H 2020 DT8 H 2D20 - DT9 H 3635 6 5 DT10 [D] DT100 DT101 DT102 DT103 DT104 H 04D2 H 0000 H FFC8 H FFFF K 1234 K -56 DT0 to DT4: " 1234" DT100 to DT101: K 1234 DT5 to DT9: " -56" DT102 to DT103: K -56 14-42 ATOB (Conversion: ASCII BIN) Example 13) Converting two hexadecimal ASCII data (4 digits) to two 16-bit binary data (hexadecimal) The conversion starts from the low byte of DT0. It is converted in forward direction (the high word side of [S2] is considered as high-order numerical data). [i]...US [S1]..."%4x" Converts hexadecimal ASCII data (4-digit) to 16-bit data [S2]...DT0 [N]...H 0002 00 00 ASCII data (forward direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) two 4-digit data Conversion starting position = +0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 3332 3 2 DT1 H 3130 1 0 DT2 H 4241 B A DT3 H 3938 9 8 DT4 [D] DT100 DT101 DT102 H 0123 H 89AB DT0 to DT1: "0123" DT100: H 0123 DT2 to DT3: "89AB" DT101: H 89AB Example 14) Converting two decimal ASCII data (8 digits) to two 32-bit BCD data The conversion starts from the low byte of DT0. It is converted in forward direction (the high word side of [S2] is considered as high-order numerical data). For empty digits of the storage area, zeros (0) are inserted. [i]...UL [S1]..."%8b" Converts decimal ASCII data (8-digit) to 32-bit BCD data [S2]...DT0 [N]...H 0002 00 00 ASCII data (forward direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) two 8-digit data Conversion starting position = +0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 3332 3 2 DT1 H 3130 1 0 DT2 H 3030 0 0 DT3 H 3030 0 0 DT4 H 3837 8 7 DT5 H 3635 6 5 DT6 H 3433 4 3 DT7 H 3231 2 1 [D] DT100 DT101 DT102 DT103 DT104 H 0123 H 0000 H 5678 H 1234 H 0000 0123 H 1234 5678 * When the number of characters is smaller than the number of converted bits, the portions that are lacking are padded with "0". DT0 to DT3 "00000123" DT100 to DT101 H 0000 0123 DT4 to DT7 "12345678" DT102 to DT103 H 1234 5678 14-43 High-level Instructions (Strings) Example 15) Converting two decimal ASCII data (7 digits) to two 32-bit BCD data The conversion starts from the low byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). For empty digits of the storage area, zeros (0) are inserted. [i]...UL [S1]..."%7b" Converts decimal ASCII data (7-digit) to 32-bit BCD data [S2]...DT0 [N]...H 0002 00 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (0) [S2]+0 byte Amount of conversion data (2) two 7-digit data Conversion starting position = +0 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 3030 0 0 DT1 H 3030 0 0 DT2 H 3231 2 1 DT3 H 3133 1 3 DT4 H 3332 3 2 DT5 H 3534 5 4 DT6 H 3736 7 6 [D] DT100 DT101 DT102 DT103 DT104 H 0123 H 0000 H 4567 H 0123 H 00000123 H 01234567 * When the number of characters is smaller than the number of converted bits, the portions that are lacking are padded with "0". DT0 to DT3: "0000123" DT100 to DT101: H 0000 0123 DT3 to DT6: "1234567" DT102 to DT103: H 0123 4567 Example 16) Converting two floating point ASCII data (10 digits) to two 32-bit single-precision real number data The conversion starts from the high byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). [i]...SF [S1]... "%10f" [S2]...DT0 Converts floating point ASCII data (10 characters) to 32-bit real number data [N]...H 0002 01 01 ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2]+1 byte Amount of conversion data (2) two 10-digit data Conversion starting position = +1 byte Amount of data to be converted = 2 [S2] (characters) DT0 H 20 ** ** DT1 H 2020 DT2 H 2020 DT3 H 3120 1 DT4 H 2E32 . 2 DT5 H 2033 3 DT6 H 2020 DT7 H 2020 DT8 H 3420 4 DT9 H 2E35 . 5 DT10 H ** 36 ** 6 [D] DT100 DT101 DT102 DT103 SF 12.3 SF 45.6 DT0 to DT5: " 12.3" DT100 to DT101: SF 12.3 DT5 to DT10: " 45.6" DT102 to DT103: SF 45.6 14-44 ATOB (Conversion: ASCII BIN) Example 17) Converting decimal ASCII data (separated by commas, ending with NULL) to two 16-bit binary data (decimal) The conversion starts from the high byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). It is processed considering commas as the data delimiter, and NULL as end of the data. [i]...US [S1]..."%d" : Converts decimal ASCII data to 16-bit data [S2]...DT0 [N]...H 0002 01 01 : ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2] + 1 byte Amount of conversion data (2) 2 data separated by a comma and ending with NULL Conversion starting position = + 1 byte Amount of data to be converted = 2 [S2] DT0 H 31 ** 1 ** DT1 H 33 H32 3 2 DT2 H 2C H34 , 4 DT3 H 36 H35 6 5 DT4 H 38 H37 8 7 DT5 ** H00 ** NULL DT6 [D] DT100 DT101 DT102 U1234 U5678 DT0 to DT2: "1234" DT100: U1234 DT3 to DT5: "5678" DT101: U5678 Example 18) Converting two hexadecimal ASCII data (separated by commas, with spaces) to two 16-bit binary data (hexadecimal) The conversion starts from the high byte of DT0. It is converted in reverse direction (the low word side of [S2] is considered as high-order numerical data). It is processed considering commas as the data delimiters. If a space is inserted after numerical data, the space is ignored and the numerical data is converted. [i]...US [S1]..."%x" : Converts hexadecimal ASCII data to 16-bit data [S2]...DT0 [N]...H 0002 01 01 : ASCII data (reverse direction) [D]...DT100 Conversion starting position (1) [S2] + 1 byte Amount of conversion data (2) 2 data separated by a comma Conversion starting position = + 1 byte Amount of data to be converted = 2 [S2] DT0 H 31 ** 1 ** DT1 H 33 H32 3 2 DT2 H 2C H20 , (SP) DT3 H 41 H34 A 4 DT4 H 20 H42 (SP) B DT5 ** H2C ** , DT6 [D] DT100 DT101 DT102 H0123 H04AB DT0 to DT2: "123" DT100: H0123 DT3 to DT5: "AB" DT101: H04AB 14-45 High-level Instructions (Strings) Flag operations Name Description To be set in the case of out-of-range in indirect access (index modification). To be set when the conversion format specified by [S1] is not an available operation unit. To be set when the conversion format specified by [S1] is not a control string. To be set when the number of digits for the conversion format specified by [S1] is 28 or more. SR7 SR8 (ER) To be set when the number of digits for the conversion format specified by [S1] is omitted, and the string for [S2] is specified with 28 or more digits without delimiters. To be set when the ASCII data specified by [S2] is a string that cannot be converted. Example 1) When the operation unit is US and the value exceeds the maximum number for conversion "65535" Example 2) When the strings for conversion contain characters other than values that can be converted (0 to 9, A to F) To be set when the beginning of conversion specified by [N] exceeds the [S2] area. To be set when the conversion data amount specified by [N] exceeds the [S2] area. To be set when the conversion data amount specified by [N] is out of the range. To be set when the conversion result exceeds the area specified by [D]. 14-46 SSET (Conversion: Character Constant ASCII Code) SSET (Conversion: Character Constant ASCII Code) Ladder diagram R0 SSET "ABC1230 DEF" DT0 S D List of operands Operand Description S Source string D Destination starting device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction converts the character constant specified by [S] to an ASCII code. The result is stored in the area starting with [D]. · Character constants should be put between "" (double quotations) for specification. · From 0 to 256 characters can be specified for a character constant. · The number of characters is stored in 1 word at the beginning of the storage area specified by [D]. In the subsequent areas, the character data converted to ASCII is stored in order starting from the low byte. · When setting, NULL (00) is not added to the end of characters. Process details Example 1) Setting the 11 characters of the string "ABC1230 DEF" in DT0 "ABC1230 DEF" DT0 11 (Number of characters) DT1 H 42 (B) H 41 (A) DT2 H 31 (1) H 43 (C) DT3 H 33 (3) H 32 (2) DT4 H 20 ( ) H 30 (0) DT5 H 45 (E) H 44 (D) DT6 H 46 (F) Byte address Higher bytes Lower bytes 14-47 High-level Instructions (Strings) Example 2) Setting 256 characters to DT0, repeating a set of the 16 characters from A to P "ABCDE...LMNOP" DT0 256 (Number of characters) DT1 H 42 (B) H 41 (A) DT2 H 44 (D) H 43 (C) DT3 H 46 (F) H 45 (E) DT126 H 4C (L) DT127 H 4E (N) DT128 H 50 (P) Byte address Higher bytes H 4B (K) H 4D (M) H 4F (O) Lower bytes Precautions during programming · The character data of the [D] area from before performing the operation is overwritten. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. 14-48 SSET (Conversion: Character Constant ASCII Code) Reference: Using FPWIN GR7 to enter instructions · Use the following procedure to enter instructions. 1) Press [Func (F6)]. The "Instruction list (Func)" dialog box is displayed. 2) Enter "SSET". 3) Enter a space. 4) Either select the ASCII shown in the pull-down menu, or enter a double quotation mark. 5) Enter a user-defined string to be specified by operand [S]. 6) Enter a double quotation mark. 7) Enter a space. 8) Enter the device number for the desired device. 9) Press either the [Overwrite] or [Insert] button. 14-49 High-level Instructions (Strings) Reference Table: ASCII Codes b7 b6 0 0 0 0 b5 0 0 1 1 b4 0 1 0 1 b7 b6 b5 b4 b3 b2 b1 b0 R C 0 1 2 3 0 0 0 0 0 NUL DEL SPACE 0 0 0 0 1 1 SOH DC1 ! 1 0 0 1 0 2 STX DC2 " 2 0 0 1 1 3 ETX DC3 # 3 0 1 0 0 4 EOT DC4 $ 4 0 1 0 1 5 ENQ NAK % 5 0 1 1 0 6 ACK SYN & 6 0 1 1 1 7 BEL ETB ' 7 1000 8 BS CAN ( 8 1001 9 HT EM ) 9 1010 A LF SUB * : 1011 B VT ESC + ; 1100 C FF FS , < 1 1 0 1 D CR GS - = 1 1 1 0 E SO RS . > 1111 F SI US / ? Reference Table: JIS8 Codes 1 1 0 0 0 1 4 5 @ P A Q B R C S D T E U F V G W H X I Y J Z K [ L M ] N ^ O _ 1 1 1 1 0 1 6 7 ` p a q b r c s d t e u f v g w h x i y j z k { l | m } n ~ o DEL 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 11001100110011 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 b7 b6 b5 b4 b3 b2 b1 b0 C R 0 1 2 3 4 5 6 7 8 9 ABCDEF 0 0 0 0 0 NUL TC7 (DEL) (SP) 0 @ P ` p Undefined 0 0 0 1 1 TC1 (SOH) DC1 ! 1 AQa q 0 0 1 0 2 TC2 (STX) DC2 " 2BRb r 0 0 1 1 3 TC3 (ETX) DC3 # 3CS c s 0 1 0 0 4 TC4 (EOT) DC4 $ 4DTd t 0 1 0 1 5 TC5 (ENQ) TC8 (NAK) % 5 E U e u Undefined Undefined Undefined Undefined 0 1 1 0 6 TC6 (ACK) TC9 (SYN) & 6 F V f v 0 1 1 1 7 BEL ETB ' 7 GW g w 1 0 0 0 8 EE0 (BS) CAN ( 8HXh x 1 0 0 1 9 EE1 (HT) EM )9IYi y 1 0 1 0 A EE2 (LF) SUB * : JZ j z 1 0 1 1 B EE3 (VT) ESC +;K[ k | 1 1 0 0 C EE4 (FF) IS4 (FS) , < L ¥ l | 1 1 0 1 D EE5 (CR) IS3 (GS) - = M ] m | 1110E SO IS2 (RS) . > N ^ n ¯ " 1111F SI IS1 (US) / ? O _ o DEL ' Do not use the undefined sections in the JIS8 code table. 14-50 PRINT (Text Creation) PRINT (Text Creation) Ladder diagram R0 PRINT DT0 DT100 DT200 S1 S2 D List of operands Operand Description S1 The starting address of the device storing the string data that represents a text creation form, or the character constant. S2 Starting address storing the data to be output to texts D Starting address of the device storing texts. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction is used for creating texts of mails, etc. Process details · ASCII code texts are created according to the specified text creation form. · The text creation form can be specified using the operand [S1], SSET instruction or the mail setting screen of FPWIN GR7. Created texts can be connected using the SADD instruction. · The maximum size of a mail text is 4096 bytes for sending an event mail, and 256 bytes for sending a logging/trace mail. Operand [S1] setting · Specify the device address storing the text creation form or character constant (max. 256 characters). · The text creation form is composed of a main text, conversion form (such as %d, %e), linefeed code (\n) and horizontal tab code (\t). Text creation form example This example includes a tab code, a body (a conversion form for 1 datum is inserted), and a linefeed code. "\t Floor A is %d degrees C.\n Line feed code Conversion form Text Tab code · Tab code (\t) is converted to ASCII code HT (09h). · The body is converted to the supported ASCII code. · In the part where a conversion form is inserted, the output data specified by [S2] is stored as ASCII code, according to the conversion form. For more information about the conversion form, refer to "PRINT/EPRINT Instruction Shared Conversion Form Table." · Linefeed code (\n) is converted to ASCII code CR+LF (0A0Dh). 14-51 High-level Instructions (Strings) Restrictions · Up to 4096 characters can be specified for the text creation form. An operation error occurs when it exceeds 4096 characters. · Up to 16 digits can be specified for one conversion form. An operation error occurs when it exceeds 16 digits. · The maximum number of characters after conversion for a single datum excluding %s and %S is 32. An operation error occurs when it exceeds 32 characters. · The maximum number of characters for %s or %S after conversion is 4096. · All strings that are not recognized as conversion forms are treated as main texts. Example: Conversion forms which do not allow capital letters (such as %D) The characters which are not recognized as judgment characters of conversion forms are included (such as %A, %Z) · To enter "%" in the body, specify "%%" (% x 2). Operand [S2] setting · Specify the starting address storing the data to be output to the text creation form. · Arrange conversion data in the order specified in the conversion form. · As for character data for %s, the data storing the number of (1-byte) characters is specified at the beginning. It can be set with the SSET instruction. Example SSET "Floor" DT112 S1 = "%d %u %x %b %f %e %Lg %s" S2 = DT100 Result -1 65535 ffff 1000 123.4567 123.4567 123.456789 Floor DT100 H FFFF Data for %d DT101 H FFFF Data for %u DT102 H FFFF Data for %x DT103 H 1000 Data for %b DT104 SF 123.4567 Data for %f DT105 DT106 SF 123.4567 Data for %e DT107 DT108 DT109 DF 123.456789 Data for %Lg DT110 DT111 DT112 K 5 Data for %s No. of byte DT113 H 6c (l) H 46 (F) DT114 H 6f (o) H 6f (o) DT115 ** H 72 (r) Data part 14-52 PRINT (Text Creation) Setting example Example 1) When inserting into the text two conversion forms (%d) that represent 16-bit signed integers and a linefeed code (\n) In the place of the conversion form (%d), the ASCII code that is equivalent to the integer data specified by [S2] is inserted. If a number of digits is not specified for the conversion form, the number of converted data and the size of the storage area will vary according to the value [S2]. - Image of mail text Floor A: 25 degrees C. Floor B: 28 degrees C. - Setting values S1="Floor A: %d degrees C.¥nFloor B: %d degrees C." S2=DT100 D=DT200 DT100 DT101 DT102 K 25 K 28 Data for %d Data for %d DT200 DT201 DT202 DT203 DT204 DT205 DT206 DT207 DT208 DT209 DT210 DT211 DT212 DT213 DT214 DT215 DT216 DT217 DT218 DT219 DT220 DT221 DT222 DT223 H002D The number of bytes is stored. H 6C (l) H 46 (F) H 6F (o) H 6F (o) H 20 () H 72 (r) H 3A (:) H 41 (A) H 32 (2) H 20 () H 20 () H 35 (5) The converted data for %d is inserted. H 65 (e) H 64 (d) H 72 (r) H 67 (g) H 65 (e) H 65 (e) H 20 () H 73 (s) H 2E (.) H 43 (C) H 46 (F) H 0D (CR) The ¥ line inserted. feed code (CR) is H 6F (o) H 6C (l) H 72 (r) H 6F (o) H 42 (B) H 20 () H 20 () H 3A (:) H 38 (8) H 32 (2) The converted data for %d is inserted. H 64 (d) H 20 () H 67 (g) H 65 (e) H 65 (e) H 72 (r) H 73 (s) H 65 (e) H 43 (C) H 20 () H 00 H 2E (.) 14-53 High-level Instructions (Strings) Example 2) When inserting into the text a conversion form (%d) that represents a 16-bit signed integer In the place of the conversion form (%d), the ASCII code that is equivalent to the integer data specified by [S2] is inserted. If a number of digits is not specified for the conversion form, the number of converted data and the size of the storage area will vary according to the value [S2]. - Image of mail text Production volume: 5 - Setting values S1="Production volume: %d" S2=DT1 D=DT50 DT1 K 5 DT2 DT3 DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 DT60 H 72 (r) H64 (d) H 63 (c) H 69 (i) H 6e (n) H 76 (v) H 6c (l) H 6d (m) H 3a (:) H 35 (5) U 14 H 50 (P) H 6f (o) H 75 (u) H 74 (t) H 6f (o) H 20 (SPACE) H 6f (o) H 75 (u) H 65 (e) H 20 (SPACE) No. of bytes Data part 14-54 PRINT (Text Creation) Example 3) When inserting into the text a horizontal tab code (\t: H09) In the place of the conversion form (\t), the ASCII code that is equivalent to the horizontal tab code is inserted. If a conversion form is not included in [S1], the data for [S2] will have no effect on the conversion results. - Image of mail text (Tab)Normal operation - Setting values S1=" tNormal operation" S2=DT1 D=DT50 DT1 DT2 DT3 DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 U 11 H 4e (N) H 72 (r) H 61 (a) H 20 (SPACE) H 70 (p) H 72 (r) H 74 (t) H 6f (o) ** H 09 (HT) H 6f (o) H 6d (m) H 6c (l) H 6f (o) H 65 (e) H 61 (a) H 69 (i) H 6e (n) No. of bytes Data part Example 4) When inserting into the text two conversion forms (%s) that represent strings In the place of the conversion form (%s), the ASCII code that is equivalent to the string data specified by [S2] is inserted. If a number of digits is not specified for the conversion form, the number of converted data and the size of the storage area will vary according to the value [S2]. - Image of mail text Location: Nagoya, Aichi - Setting values S1="Location: %s, %s" S2=DT1 D=DT50 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 U 6 H 61 (a) H 4E (N) H 6F (o) H 67 (g) H 61 (a) H 79 (y) U 5 H 69 (i) H 41 (A) H 68 (h) H 63 (c) ** H 69 (i) DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 DT60 DT61 DT62 U 17 H 6F (o) H 61 (a) H 69 (i) H 6E (n) H 20 (SPACE) H 61 (a) H 6F (o) H 61 (a) H 20 (SPACE) H 69 (i) H 68 (h) ** H 4C (L) H 63 (c) H 74 (t) H 6F (o) H 3A (:) H 4E (N) H 67 (g) H 79 (y) H 2C (,) H 41 (A) H 63 (c) H 69 (i) No. of bytes Data part Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when an out-of-range value is specified for parameters. To be set when the text creation form exceeds 4096 characters. To be set when texts exceed 4096 bytes. To be set when the conversion form is specified by a real number and conversion data is a non-real number. To be set when the size specified by the conversion form exceeds 32 characters. (excluding the conversion form %s) 14-55 High-level Instructions (Strings) PRINT/EPRINT Instruction Shared Conversion Form Table This table indicates the format for the "Conversion Form" that can be inserted in the "Text Creation Form" to be specified for operand [S1] from the PRINT instruction or the EPRINT instruction. Setting the control string [S1] Use string data in the format shown below to specify the type, number of characters, and precision of the conversion data. A variety of options (such as inserting a sign or spaces) can also be selected depending on the type of data to be converted. Refer to the following pages for details. [S1] = " % + 12.5 d , " Option setting (1) 0 : Zero padding + : A sign is added (plus sign) : A space is inserted - : Left align (default is right align) # : Characters are added according to the conversion data No. of characters after conversion and the precision Specify the total number of characters (n) and the number of characters of precision (m) with [n.m], [n], or [.m]. The number of characters of precision (m) changes according to the type of conversion data Type of data to be converted No. of characters of precision (m) d , Ld, i , Li, u ,Lu, represents the number of characters x , Lx , b, Lb in numerical strings. f, Lf, e, Le, E, LE represents the number of characters after the decimal point. g, Lg, G, LG represents the number of significant figures. Option setting (2) , : A comma is added BCD : Postfix characters are added H : Postfix characters are added Type of data to be converted (1) d: Signed integer Decimal ASCII u: Unsigned integer Decimal ASCII x: Unsigned integer Hexadecimal ASCII b: BDC integer Hexadecimal ASCII f: Floating point real number Floating point ASCII e: Floating point real number Exponential notation ASCII g: Floating point real number Floating point ASCII or exponential notation ASCII s: String data ASCII Type of data to be converted (2) L: Specify for 32-bit integer data or 64-bit real number data 14-56 PRINT/EPRINT Instruction Shared Conversion Form Table Table of conversion forms Conversion form Data format Data before conversion ASCII data after conversion Usage example "%d" or "%i" 16-bit data (signed integer) Decimal ASCII data "%d" , "%5d" , "%+5d" , "%-5d" , "%05d" , "%10.5d" , "% d" "%Ld" or "%Li" 32-bit data (signed integer) Decimal ASCII data "%Ld" , "%5Ld" , "%+5Ld" , "%-5Ld" , "%05Ld" , "%10.5Ld" , "% Ld" "%u" 16-bit data (unsigned integer) Decimal ASCII data "%u" , "%5u" , "%-5u" , "%05u" , "%10.5u" "%Lu" 32-bit data (unsigned integer) Decimal ASCII data "%Lu" , "%5Lu" , "%-5Lu" , "%05Lu" , "%10.5Lu" "%x" 16-bit data Hexadecimal ASCII data "%x" , "%5x" , "%-5x" , "%05x" , "%10.5x" , "%#x" , "%X" "%Lx" 32-bit data Hexadecimal ASCII data "%Lx" , "%5Lx" , "%-5Lx" , "%05Lx" , "%10.5Lx" , "%#Lx" , "%LX" "%b" 16-bit BCD data Decimal ASCII data "%b" , "%5b" , "%-5b" , "%05b" , "%10.5b" "%Lb" 32-bit BCD data Decimal ASCII data "%Lb" , "%5Lb" , "%-5Lb" , "%05Lb" , "%10.5Lb" "%f" 32-bit single-precision real number data Floating point ASCII data "%f" , "%5.2f" , "%+5.2f" , "%-5.2f" , "%05.2f" , "%#f" , "% f" "%Lf" 64-bit double-precision real number data Floating point ASCII data "%Lf" , "%5.2Lf" , "%+5.2Lf" , "%-5.2Lf" , "%05.2Lf" , "%#Lf" , "% Lf" "%e" 32-bit single-precision real number data Exponential notation ASCII data "%e" , "%5.2e" , "%+5.2e" , "%-5.2e" , "%05.2e" , "%#5.2e" , "% e" , "%E" "%Le" 64-bit double-precision real number data Exponential notation ASCII data "%Le" , "%5.2Le" , "%+5.2Le" , "%-5.2Le" , "%05.2Le" , "%#5.2Le" , "% Le" , "%LE" "%g" 32-bit single-precision real number data Exponential notation ASCII data or floating point ASCII data (whichever is shorter in the relevant notation) "%g" , "%5.2g" , "%+5.2g" , "%-5.2g" , "%05.2g" , "%#5.2g" , "%G" "%Lg" 64-bit double-precision real number data Exponential notation ASCII data or floating point ASCII data (whichever is shorter in the relevant notation) "%Lg" , "%5.2Lg" , "%+5.2Lg" , "%-5.2Lg" , "%05.2Lg" , "%#5.2Lg" , "%LG" "%s" String data String data (for the specified number of characters) "%s" , "%5s" , %-5s" ,"%-05s" "%S" String data String data (conversion for the specified number of characters, or up to H0) "%S" , "%5S" , %-5S" ,"%-05S" (Note 1): The number of converted digits for the conversion form is up to 16 digits. (Note 2): The 'L' of the conversion modifier can be specified in a lower-case letter. (Note 3): "%S" (upper-case letter) is supported for CPU unit Ver. 4.10 and later, or Ver. 3.40 to Ver. 3.**. 14-57 High-level Instructions (Strings) Options for the conversion form [S1] (BIN data ASCII data) Items Conversion BIN data before form conversion ASCII data after conversion Description %x Specification of alphabetical %X upper / lower %e case characters %E H ABCD H ABCD SF1234.567 SF1234.567 "abcd" "ABCD" "1.234567e+3" "1.234567E+3" Specify upper or lower case for letters of the alphabet used in hexadecimal and exponential notation ASCII data. For %d, %u, %b, and %f, upper-case letters are handled as body data. Specification of display digit %d %5d %10.5d %x %5x %10.5x %b %5b %f %8.3f %e %10.3e %g K 100 K 100 K 100 H 12A H 12A H 12A H 123 H 123 SF 123.4567 SF 123.4567 SF 1234.567 SF 1234.567 SF 1234.567 "100" "100" "00100" "12a" "12a" "0012a" "123" "123" "123.4567" "123.457" "1.234567e+03" "1.235e+03" "1234.567" The display digit is specified with "Total number of characters" and "Number of characters of precision." It is specified with "n.m", "n", or ".m", etc. n: Total number of characters, m: Number of characters of precision <Number of characters for precision> [d , ld , i , Li , u , Lu , x , Lx , X , LX , b , Lb ] represents the number of characters of numerical strings. [f , Lf , e , Le , E , LE ] represents the number of characters after the decimal point. Be sure to also specify the number of places after the decimal point. [g , Lg , G , LG] represent the number of significant figures. %8.6g SF 1234.567 "1234.57" If there is no specification for the number of characters, the number of digits for the data after conversion and the storage area size will vary according to the data before conversion. %05d K 100 "00100" Specification of zero padding %05x %05b %08.3f %010.3e H 12A H 123 SF 123.4567 SF 1234.567 "0012a" "00123" "0123.457" "01.235e+03" When the setting for the display digit is available, zero padding can be specified. Put zero (0) before the display digit. %-5d K 100 "100" Specification of right / left alignment %-5x %-5b %-8.3f H 12A H 123 SF 123.4567 "12a" "123" "123.457" Default is right align. To set to left align, add minus (-) before the specification of digit number. %-010.3e SF 1234.567 "1.235e+03" Specification of sign %+d %+d %+5d %+8.3f K 100 K -100 K 100 123.4567 "+100" "-100" "+100" "+123.457" This option is specified to add a plus sign (+). A plus sign (+) is not added by default. %+10.3e 1234.567 "+1.234e+03" %d K 100 "100" Specification of digit position %d %8.3f %8.3f %10.3e K -100 SF 123.4567 SF -123.4567 SF 1234.567 "-100" "123.457" "-123.457" "1.235e+03" In the case of a positive number, a space is added to align the positive number with negative numbers. When specifying %u, %x, or %b, existence of "" does not affect the results. %10.3e SF -1234.567 "-1.235e+03" Specification of another output type for numerical data type %#x %#X %#8.0f %#10.0e %#10.3E %#9.0g %#.9G H 12A H 12A SF 123.4567 SF 1234.567 SF 1234.567 SF 1234 SF 1234 "0x12a" "0X12A" "123." "1.e+03" "1.E+03" "1234.0" "1234.0000" "0x" is added. "0X" is added. "." is always added. "." is always added, and "0" after the decimal point is not omitted. Another output type is automatically given by adding "#". When specifying %u, %x, or %b, existence of "#" does not affect the results. (Note 1): "" in the table represents a space. (Note 2): For exponential notation, it consists of a code (e or E), a sign, and a 2-digit number. (Note 3): If the conversion results in having fewer enabled digits than before conversion, the result is rounded off. 14-58 PRINT/EPRINT Instruction Shared Conversion Form Table (Note 4): If a plus sign (+) and a space () are used together to specify the sign and the digit position respectively and the space () comes first, neither the "sign indication" nor the "specification of digit position" will be valid. When (+) comes first, "sign indication" will be valid. Example 1) %d K100 The output data is "100", and neither a space nor the sign is added. Example 2) %+d K100 The output data is "+100", and the sign is added. Processing when using conversion forms in combination (BIN data ASCII data) Conversion form Binary data before conversion ASCII data after conversion Remarks %-10.3e SF123.4567 "1.235e+02" Exponent is output in at least 2 digits. %+ u U1234 "1234" For %u, %x, or %b, the existence of a plus sign (+) in the conversion form does not affect the result. % u U1234 "1234" For %u, %x, or %b, the existence of a space () in the conversion form does not affect the result. %#u U 1234 "1234" For %u, %x, or %b, the existence of a number sign (#) in the conversion form does not affect the result. %+d %+d K1234 K1234 "1234" "+1234" If a plus sign (+) and a space () are used together to specify the sign and the digit position respectively and the space () comes first, neither the "sign indication" nor the "specification of digit position" will be valid. When plus sign (+) comes first, "sign indication" will be valid. Example 1) %d K100 The output data is "100", and neither a space nor the sign is added. Example 2) %+d K100 The output data is "+100", and the sign is added. Options for the conversion form [S1] (String data ASCII data) Items Conversion String data before ASCII data after form conversion conversion Description Specification of display digit %s %10s %10.5s "abcdef" "abcdef" "abcdef" "abcdef" "abcdef" "abcdef" In the case of "%s", it is left-aligned by default. Specify the number of digits per byte (equivalent to 1-byte character). For 2-byte characters, the number of digits is 2. When the digit number is not enough, an operation error occurs. When the decimal part is specified with %s, the settings after (.) will be invalid. Specification of zero padding %-010s %010s "abcdef" "abcdef" "00000abcdef" "abcdef" When the setting for the display digit is available, zero padding can be specified. Put zero (0) before the display digit. Specification of right / left alignment %-10s "abcdef" "abcdef " Default is left align. To set to right align, add a minus sign (-) before the specification of the number of digits. (Note 1): "" in the table represents a space. 14-59 High-level Instructions (Strings) TIMEstr (Date and Time Character String Conversion) Ladder diagram R0 TIMEstr SD0 DT0 DT10 S1 S2 D List of operands Operand Description S1 Starting address of the device that stores date and time information (7 words) S2 Starting address of the device that stores conversion patterns (hex data, 1 word) D Starting address of the device that stores the string data as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction converts data and time information to character strings. · The date and time information to be output is year, month, day, day of the week, hour, minute, and second. · This instruction can be used when date and time information is required for creating mail texts. This instruction is used in combination with the PRINT instruction. Process details · Converts the date and time information specified by [S1] to ASCII code, and stores it as string data in the area that starts with [D]. · The conversion pattern is specified for [S2]. [S1]: Settings of date and time information · Specify the starting address of the device that stores the date and time information. · Specify SD50 if you want to output the current time and date of PLC. · Checking the combination of year, month, day, or day of the week is not performed. Example) A setting of February 31 is not treated as an error. When SD50 is specified, the combination of year, month, day, or day of the week is correct. · Always store the data in the order mentioned in the table below regardless of the conversion pattern of [S2]. Operand [S1] [S1+1] [S1+2] [S1+3] [S1+4] [S1+5] [S1+6] Description Year Month Day Hour Minute Second Day of the week Specified range U0 to U99 U1 to U12 U1 to U31 U0 to U23 U0 to U59 U0 to U59 U0 to U6 Remarks The character string after conversion is 2000 to 2099. 14-60 TIMEstr (Date and Time Character String Conversion) [S2]: Specification of conversion pattern The conversion pattern is specified by 4-digit hex data. H Items Description Specify the output pattern for the string after conversion. Refer to the table on the next page for ways to display the month and day of the week. Value Constitution (Order) Format Month Day of the week display display 0 Year/Month/Day/(Day of the week) 1x1 Number Japanese 1 Year/Month/Day/(Day of the week) 2x1 Number Japanese Output Patterns 2 Year/Month/Day/(Day of the week) 1x1 3 Year/Month/Day/(Day of the week) 2x1 Number Chinese Number Chinese 4 Day of the week/Day/Month/Year 1x1 Number English 5 Day of the week/Day/Month/Year 1x1 Alphabet English (Note 1) 6 Day of the week/Day/Month/Year 1x1 Number English 7 Day of the week/Day/Month/Year 1x1 Alphabet English (Note 2) Date and time Value 0 1 2 Description Date and time Date only Time only Addition of day of the week Value 0 1 Description No Yes (Note 3) (Note 4) Delimiter Specify a delimiter for data. Value Date 0 / (slash) 1 (space) 2 - (hyphen) 3 . (period) 4 Chinese character 5 No 6 No Between date and time (space) (space) (space) (space) (space) (space) _ (underscore) Time : (colon) (space) : (colon) . (period) Chinese character No No (Note 5) (Note 1): When specifying 5 or 6 for the first digit, which is the delimiter, output pattern 5 is automatically corrected to pattern 4 for processing. (Note 2): When specifying 5 or 6 for the first digit, which is the delimiter, output pattern 7 is automatically corrected to pattern 6 for processing. (Note 3): When specifying 5 or 6 for the first digit, which is the delimiter, the specification of the addition of the day of the week is processed as "0" (No). (Note 4): When specifying 2 for the third digit, which is for the specification of date and time, the specification of addition of the day of the week is processed as "0" (No). (Note 5): When specifying a value other than 0 to 3 for the fourth digit of the output pattern, it is processed as the value 5. 14-61 High-level Instructions (Strings) Example of specification Conversion pattern Output content H0000 yyyy/mm/dd hh:mm:ss H0001 yyyy m m dd hh m m s s H0005 yyyymmdd hhmmss H0006 yyyymmdd_hhmmss H0102 yyyy-mm-dd H0203 hh.mm.ss H4000 dd/mm/yyyy hh:mm:ss H4006 ddmmyyyy_hhmmss H4012 d dd-mm-yyyy hh:mm:ss H4112 d dd-mm-yyyy H5000 dd/mm/yyyy hh:mm:ss H5012 d dd-mm-yyyy hh:mm:ss H6000 mm/dd/yyyy hh:mm:ss H6006 mmddyyyy_hhmmss H6012 d m m-dd-yyyy H7000 mm/dd/yyyy hh:mm:ss H7012 d m m-dd-yyyy hh:mm:ss H7112 d m m-dd-yyyy Output image 2014/09/05 05:06:32 2014 09 05 05 06 32 20140905 050632 20140905_050632 2014-09-05 05.06.32 05/09/2014 05:06:32 05092014_050632 Fri 05-09-2014 05:06:32 Fri 05-09-2014 05/Sep/2014 05:06:32 Fri 05-Sep-2014 05:06:32 09/05/2014 05:06:32 09052014_050632 Fri 09-05-2014 Sep/05/2014 05:06:32 Fri Sep-05-2014 05:06:32 Fri Sep-05-2014 Example of special specification (when automatically corrected) Conversion pattern Output content Output image H5005(*1) ddmmyyyy hhmmss 05092014 050632 H7006(*2) mmddyyyy_hhmmss 09052014_050632 H7016(*3) mmddyyyy_hhmmss 09052014_050632 H5216(*4) hhmmss 050632 H4014(*5) ddmmyyyy_hhmmss 05092014_050632 (Note 1): When specifying 5 or 6 for the first digit, which is the delimiter, output pattern 5 is automatically corrected to pattern 4 for processing. (Note 2): When specifying 5 or 6 for the first digit, which is the delimiter, output pattern 7 is automatically corrected to pattern 6 for processing. (Note 3): When specifying 5 or 6 for the first digit, which is the delimiter, the specification of the addition of the day of the week is processed as "0" (No). (Note 4): When specifying 2 for the third digit, which is for the specification of date and time, the specification of addition of the day of the week is processed as "0" (No). (Note 5): When specifying a value other than 0 to 3 for the fourth digit of the output pattern, it is processed as the value 5. 14-62 TIMEstr (Date and Time Character String Conversion) Example of processing Example 1) [S1]...DT100 [S2]...DT0 [D]...DT150 Output example Wed 08-06-2020 23:20:05 DT100 DT101 DT102 DT103 DT104 DT105 DT106 U 20 U 6 U8 U 23 U 20 U5 U3 Year Month Day Hour Minute Second Day of the week DT0 H 4012 DT150 DT151 DT152 DT153 DT154 DT155 DT156 DT157 DT158 DT159 DT160 DT161 DT162 U 23 H 65 (e) H 57(W) H 20 ( ) H 64 (d) H 38 (8) H 30 (0) H 30 (0) H 2D (-) H 2D (-) H 36 (6) H 30 (0) H 32 (2) H 30 (0) H 32 (2) H 32 (2) H 20 ( ) H 3A (:) H 33 (3) H 30 (0) H 32 (2) H 30 (0) H 3A (:) H 35 (5) No. of bytes Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the parameter of [S1] is out of the setting range. To be set when the parameter of [S2] is out of the setting range. To be set when the range between [S1] to [S1+6] is out of the accessible range. To be set when the destination range is outside the accessible range. 14-63 High-level Instructions (Strings) SCMP (String Compare) Ladder diagram R0 SCMP DT1 DT11 S1 S2 List of operands Operand Description S1 String 1 to be compared S2 String 2 to be compared Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction compares the string specified by [S1] and the string specified by [S2]. The comparison result is output to the system relays SRA to SRC (assessment flags for the comparison instruction). · Comparison flags (system relays SRA to SRC) are processed as follows. [S1] < [S2] [S1] = [S2] [S1] > [S2] SRA > OFF OFF ON SRB = OFF ON OFF SRC < ON OFF OFF · If the numbers of characters to be compared are different, they are processed as follows. [S1] "ABCDE" = "ABCD" < "B" > [S2] "ABCDE" "ABCDE" "ABCDE" 14-64 SCMP (String Compare) Process details Example) Comparing strings "ABCD" and "ABCDE", which are stored in the data register [S1]...DT0 [S2]...DT10 SRA...OFF SRB...OFF SRC...ON DT0 4 (1) DT10 5 (1) DT1 "B" "A" DT11 "B" "A" DT2 "D" "C" DT12 "D" "C" DT3 DT13 "E" DT4 DT14 DT5 DT15 DT6 H L H L S1<S2 SRA > OFF SRB = OFF SRC < ON (1) Number of characters Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the string range specified by [S1] or [S2] is out of the accessible range. SRA (>) SRB (=) Varies according to the comparison result. SRC (<) 14-65 High-level Instructions (Strings) SADD (String Addition) Ladder diagram R0 SADD DT0 DT10 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of String 1 to be connected S2 Starting device address of String 2 to be connected D Starting device address to store the connected string Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction combines the string specified by [S1] with the string specified by [S2], and sets the combined string to the device address specified by [D]. · The maximum number of characters for the result is 4096 characters. Process details Example) Combine the strings of DT0 and DT10, and set the result to DT20. DT0 5 (No. of characters) DT10 3 (No. of characters) DT1 "B" "A" DT11 "2" "1" DT2 "D" "C" DT12 "3" DT3 "E" + DT13 DT4 DT14 DT5 DT15 DT6 DT16 Higher Lower Higher Lower Byte address bytes bytes Byte address bytes bytes DT20 8 (No. of characters) DT21 "B" "A" DT22 "D" "C" = DT23 "1" "E" DT24 "3" "2" DT25 DT26 Higher Lower Byte address bytes bytes Precautions during programming · The character data of the [D] area from before performing the operation is overwritten. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the string range specified by [S1] or [S2] is out of the accessible range. To be set when the destination range is outside the accessible range. To be set when the connected string exceeds the maximum number of characters. 14-66 LEN (Obtainment of String Length) LEN (Obtainment of String Length) Ladder diagram R0 LEN DT0 DT100 S D List of operands Operand Description S Starting device address of the string D Starting device address to store the string length Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction sets the number of characters stored in the beginning of the character string specified by [S] to the device address specified by [D]. Process details Example) Set the number of characters of DT0 in DT100 DT0 DT1 DT2 DT3 DT4 DT5 Byte address 8 (No. of characters) "B" "A" "D" "C" "1" "E" "3" "2" Higher bytes Lower bytes DT100 8 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the obtained number of characters exceeds 4096. To be set when the string range specified by [S] is out of the accessible range. 14-67 High-level Instructions (Strings) LENGTH (Search String Length (Terminating NULL)) Instruction format R0 LENGTH DT0 U100 DT100 S1 S2 D List of operands Operand Description S1 The starting address of the string to be searched is specified. S2 The starting device address for storing the maximum searched string length or a constant is specified. (Available range: 1 to 4096) D The starting address storing string length is specified. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation This instruction detects a termination character (null) from a string and acquires the number of characters. Null characters are not included in the number of characters. Process details · Searches the length of the string specified by [S1]. · Searches NULL characters for the number of characters specified by [S2] (maximum string length) from [S1], and stores the string length excluding NULL characters in [D] (result) when NULL characters exist. · When there is no NULL character within the maximum string length [S2], the CY (SR9) flag is set, and the maximum string length is stored in the result [D]. · When a NULL character is found, the CY (SR9) flag is not cleared. Example of processing [S1] ... DT0, [S2] ... U10, [D] ... DT100 Example 1) With NULL Example 2) Without NULL [S1] device content "0123456" + NULL Value DT0 3130h DT1 3332h DT2 3534h DT3 0036h DT4 ****h Processing result String length ... 7 Value DT100 0007h SR9 ... No change [S1] device content "0123456789" Value DT0 3130h DT1 3332h DT2 3534h DT3 3736h DT4 3938h Processing result String length ... 10 Value DT100 000Ah SR9 ... ON 14-68 LENGTH (Search String Length (Terminating NULL)) Precautions during programming · Error flags are not cleared even when normal operation is performed. · Use ERR instruction for clearing error flags. Flag operations Name SR7 SR8 (ER) Description To be set in case of out-of-range in indirect access (index modification). To be set when the maximum string length specified by [S2] is out of the range. To be set when the maximum string length specified by [S2] exceeds the [S1] area. CY(SR9) To be set when a NULL character is not included in the string of [S1]. 14-69 High-level Instructions (Strings) SSRC (String Search) Ladder diagram R0 SSRC DT0 DT10 DT120 S1 S2 D List of operands Operand Description S1 Starting device address of the string data to be searched for S2 Starting device address of the string to be searched D Starting device address to store the search result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction searches the character data specified by [S1] from the character string specified by [S2]. · As for the search result, the number of the same character data is stored in the device address specified by [D], and the first matched relative position (byte units) is stored in [D]+1. Process details Example 1) Searching for the string "EFG" stored in DT0, in the string table starting from DT11 [S1] ... DT0 [S2] ... DT10 [S2] ... DT120 (a) (b) DT0 3 (1) DT10 8 (1) DT1 "F" "E" DT11 "B" "A" DT2 "G" DT12 "D" "C" DT3 DT13 "F" "E" DT4 DT14 "H" "G" DT5 DT15 DT6 DT16 H L H L DT120 U 1 (2) DT121 U 5 (3) (a) Area in which the string to be searched for is stored (b) String table that is searched (1) Number of characters (2) Number of matching strings (3) Relative position of matching string (Note): Using the low byte of DT11 at the beginning of the string table as a reference, the relative position of the low byte of DT13 is calculated as a value of 5, based on where it matches with string "EFG". 14-70 SSRC (String Search) Example 2) When the string "EF" being searched for is found in two locations on the string table after DT11 [S1] ... DT0 [S2] ... DT10 [S2] ... DT120 (a) (b) DT0 2 (1) DT10 8 (1) DT1 "F" "E" DT11 "B" "A" DT2 DT12 "F" "E" DT3 DT13 "B" "A" DT4 DT14 "F" "E" DT5 DT15 DT6 DT16 H L H L DT120 U 2 (2) DT121 U 3 (3) (a) Area in which the string to be searched for is stored (b) String table that is searched (1) Number of characters (2) Number of matching strings (3) Relative position of matching string (Note) (Note): Using the low byte of DT11 at the beginning of the string table as a reference, the relative position of the low byte of DT12 is calculated as a value of 3, based on where it matches in string "EF" first. Precautions during programming For [S1], the number of characters to search for in a string, specify the number of characters to be searched for. In the following figure, 1 is specified for the number of characters, and the string "A" is searched for. When 2 is specified for the number of characters, the string "AB" is searched for. (1) Number of characters DT0 2 (1) DT1 "B" "A" DT2 "D" "C" Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the number of characters [S1] is larger than [S2]. To be set when the string range specified by [S1] or [S2] is out of the accessible range. 14-71 High-level Instructions (Strings) RIGHT (Takeout of the Right Side of a String) Ladder diagram R0 RIGHT DT0 K5 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of the source data S2 Number of characters to be taken out (available data range: 1 to 4096) D Starting device address to store the result that is taken out Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction takes out the characters for the number of characters specified by [S2] from the right side (end of the character data) of the character string specified by [S1], and stores it in the device address specified by [D]. Process details Example 1) Taking out the last five characters from the DT0 string to transfer them to DT20 [S1]...DT0 [S2]...U5 [D]...DT20 Characters to search DT0 8 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 "1" "E" DT4 "3" "2" DT5 DT6 String table that is searched DT20 5 (No. of characters) DT21 "E" "D" DT22 "2" "1" DT23 "3" DT24 DT25 DT26 Byte address High Low Byte address High Low 14-72 RIGHT (Takeout of the Right Side of a String) Example 2) The number of characters of [S2] is larger than the number of characters in the string of [S1] [S1]...DT0 [S2]...U7 [D]...DT20 Characters to search DT0 3 (No. of characters) DT1 "B" "A" DT2 "C" DT3 DT4 DT5 String table that is searched DT20 3 (No. of characters) DT21 "B" "A" DT22 "C" DT23 DT24 DT25 Byte address High Low Byte address High Low Precautions during programming · The character data of the [D] area from before performing the operation is overwritten. · When the number of characters of [S2] is greater than the number of characters in the string of [S1], the transferal is performed for the number of characters of [S1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. To be set when [S2] (number of characters) is out of the range. 14-73 High-level Instructions (Strings) LEFT (Takeout of the Left Side of a String) Ladder diagram R0 LEFT DT0 K5 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of the source data S2 Number of characters to be taken out (available data range: 1 to 4096) D Starting device address to store the result that is taken out Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction takes out the characters for the number of characters specified by [S2] from the left side (beginning of the character data) of the character string specified by [S1], and stores it in the device address specified by [D]. Process details Example 1) Taking out the first five characters from the DT0 string to transfer them to DT20 [S1]...DT0 [S2]...U5 [D]...DT20 Characters to search String table that is searched DT0 8 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 "1" "E" DT4 "3" "2" DT5 DT6 DT20 5 (No. of characters) DT21 "B" "A" DT22 "D" "C" DT23 "E" DT24 DT25 DT26 Byte address High Low Byte address High Low 14-74 LEFT (Takeout of the Left Side of a String) Example 2) The number of characters of [S2] is larger than the number of characters in the string of [S1] [S1]...DT0 [S2]...U7 [D]...DT20 Characters to search DT0 3 (No. of characters) DT1 "B" "A" DT2 "C" DT3 DT4 DT5 DT6 String table that is searched DT20 3 (No. of characters) DT21 "B" "A" DT22 "C" DT23 DT24 DT25 DT26 Byte address High Low Byte address High Low Precautions during programming · The character data of the [D] area from before performing the operation is overwritten. · When the number of characters of [S2] is greater than the number of characters in the string of [S1], the transferal is performed for the number of characters of [S1]. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. To be set when [S2] (number of characters) is out of the range. 14-75 High-level Instructions (Strings) MIDR (Data Read from a Given Position in the String) Ladder diagram R0 MIDR DT0 K1 K3 DT20 S1 S2 S3 D List of operands Operand Description S1 Starting device address of the source data S2 Starting position (available data range: 0 to 4095) S3 Number of characters to be taken out (available data range: 1 to 4096) D Starting device address to store the result that is taken out Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 S3 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction takes out data for the number of characters specified by [S3] from the position specified by [S2] of the character string specified by [S1], and stores it in the device address specified by [D]. Process details Example 1) Taking out three characters from the first byte (second character) of the DT0 string to transfer them to DT20 [S1]...DT0 [S2]...U1 [S3]...U3 [D]...DT20 Characters to search DT0 8 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 "1" "E" DT4 "3" "2" DT5 DT6 String table that is searched DT20 DT21 DT22 DT23 DT24 DT25 DT26 3 (No. of characters) "C" "B" "D" Byte address High Low Byte address High Low 14-76 MIDR (Data Read from a Given Position in the String) Example 2) The number of characters of [S3] is larger than the number of characters of the [S1] string starting from the [S2] position [S1]...DT0 [S2]...U1 [S3]...U5 [D]...DT20 Characters to search DT0 8 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 "1" "E" DT4 "3" "2" DT5 DT6 String table that is searched DT20 DT21 DT22 DT23 DT24 DT25 DT26 3 (No. of characters) "2" "1" "3" Byte address High Low Byte address High Low Precautions during programming · The character data of the [D] area from before performing the operation is overwritten. · When the number of characters of [S3] is larger than the number of characters of the [S1] string starting from the [S2] position, the transferal is performed for the number of characters of [S1]. · The [S2] position should be specified by a number counted from low order in sequence, putting the least significant byte as K0 (Byte 0): 0, 1, 2 and so on. Flag operations Name Description SR7 SR8 (ER) To be set in the case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. To be set when [S3] (number of characters) is out of the range. To be set when the number of characters of [S1] is larger than [S2]. 14-77 High-level Instructions (Strings) MIDW (Rewrite from a Given Position in the String) Ladder diagram R0 MIDW DT0 K3 DT20 K1 S1 S2 D n List of operands Operand Description S1 Starting device address of the source data S2 Number of characters (available data range: 1 to 4096) D Destination starting device address n Starting position of the destination string (available data range: 0 to 4095) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D n Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction takes out data for the number of characters specified by [S2] from the character string specified by [S1], and transfers it to the position [n] of the character string specified by [D]. Process details Example 1) Taking out three characters from the DT0 string to transfer them to the first byte (second character) of the DT20 string [S1]...DT0 [S2]...U3 [D]...DT20 [n]...U1 Character string DT0 8 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 "F" "E" DT4 "H" "G" DT5 DT6 Byte address High Low Transfer destination DT20 8 (No. of characters) DT21 "2" "1" DT22 "4" "3" DT23 "6" "5" DT24 "8" "7" DT25 DT26 Byte address High Low Transfer destination after execution DT20 8 (No. of characters) DT21 "A" "1" DT22 "C" "B" DT23 "6" "5" DT24 "8" "7" DT25 DT26 Byte address High Low 14-78 MIDW (Rewrite from a Given Position in the String) Example 2) The number of characters of [S2] is larger than the number of characters in the string of [S1] [S1]...DT0 [S2]...U5 [D]...DT20 [n]...U1 Character string DT0 4 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 DT4 DT5 DT6 Byte address High Low Transfer destination DT20 8 (No. of characters) DT21 "2" "1" DT22 "4" "3" DT23 "6" "5" DT24 "8" "7" DT25 DT26 Byte address High Low Transfer destination after execution DT20 8 (No. of characters) DT21 "A" "1" DT22 "C" "B" DT23 "6" "D" DT24 "8" "7" DT25 DT26 Byte address High Low Precautions during programming · The character data of the [D] area from before performing the operation is overwritten. · When the number of characters of [S2] is larger than the number of characters in the string of [S1], the transferal is performed for the number of characters in the string of [S1]. · The [n] position should be specified by a number counted from low order in sequence, putting the least significant byte as K0 (Byte 0): 0, 1, 2 and so on. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when [S2] (number of characters) is out of the range. To be set when the number of characters of [D] is larger than [n]. 14-79 High-level Instructions (Strings) SREP (Replacement of a String) Ladder diagram R0 SREP DT0 DT20 U1 U3 S D p n List of operands Operand Description S Starting device address of the source string D Starting device address of the destination string p Replacement start position of the destination string (available data range: 0 to 4095) n Number of characters to be replaced (available data range: 1 to 4096) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D p n Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction replace the string specified by [S] with the characters specified by [n] from the position [p] in the string specified by [D]. Process details Example 1) Replacing the DT0 string with three characters from the 1st byte (2nd character) of DT20 [S1]...DT0 [D]...DT20 [p]...U1 Character string DT0 5 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 "E" DT4 DT5 DT6 Byte address High Low Transfer destination DT20 8 (No. of characters) DT21 "2" "1" DT22 "4" "3" DT23 "6" "5" DT24 "8" "7" DT25 DT26 Byte address High Low [n]...U3 Transfer destination after execution DT20 10 (No. of characters) DT21 "A" "1" DT22 "C" "B" DT23 "E" "D" DT24 "6" "5" DT25 "8" "7" DT26 Byte address High Low *In this case, the original data of the first byte to the fourth byte of DT20 that is the destination is deleted. As a result, the number of characters increases from 8 characters to 10 characters. 14-80 SREP (Replacement of a String) Example 2) The number of characters [n] is larger than the number of characters in the string [S1] as from the position specified by [p]. [S1]...DT0 [D]...DT20 [p]...U4 Character string DT0 5 (No. of characters) DT1 "B" "A" DT2 "D" "C" DT3 "E" DT4 DT5 DT6 Byte address High Low Transfer destination DT20 10 (No. of characters) DT21 "2" "1" DT22 "4" "3" DT23 "6" "5" DT24 "8" "7" DT25 "0" "9" DT26 Byte address High Low [n]...U8 Transfer destination after execution DT20 9 (No. of characters) DT21 "2" "1" DT22 "4" "3" DT23 "B" "A" DT24 "D" "C" DT25 "E" DT26 Byte address High Low Precautions during programming · Character data of the [D] area from before performing the operation is not cleared. (It is overwritten.) · If the number of characters [n] is larger than the number of characters in the string of [S1] as from the position specified by [p], then the replacement is performed for the number of characters of the string [S1] as from the position specified by [p]. · The [p] position should be specified by a number counted from low order in sequence, putting the least significant byte as K0 (Byte 0): 0, 1, 2 and so on. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the number of characters > string size. To be set when the number of characters of [D] is larger than [n]. To be set when [S2] (number of characters) is out of the range. 14-81 High-level Instructions (Strings) ESSET (Conversion: Character Constant ASCII Code: With Storage Area Size) Ladder diagram R0 ESSET U11 "ABC1230 DEF" DT0 S1 S2 D List of operands Operand Description S1 Storage area size (available range: U1 to U65534) S2 Character constant to be converted (available range: 0 to 256 characters) D Destination starting device address Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction stores the storage area size specified by [S1] in [D]. · The character constant specified by [S2] is converted to ASCII code, the number of characters (1 word) is stored in [D+1], and the character data converted to ASCII is stored in subsequent areas in sequence from the low byte. · Character constants should be put between "" (double quotations) for specification. · From 0 to 256 characters can be specified for a character constant. · When there are double quotation marks enclosing no character, it is recognized as a NULL character · When setting, NULL (00) is not added to the end of characters. Process details Example 1) Converting the string "ABC1230 DEF" (11 characters including a space) [S1]...U12 [S2]..."ABC1230 DEF" [D]...DT0 [S2] "ABC1230 DEF" DT0 12 (1) DT1 11 (2) DT2 H 42 (B) H 41 (A) DT3 H 31 (1) H 43 (C) DT4 H 33 (3) H 32 (2) DT5 H 20 (SP) H 30 (0) DT6 H 45 (E) H 44 (D) DT7 H 46 (F) H L (Note): The data (*) out of the destination range, the high byte of DT7, does not change. (1) Storage area size (2) Number of characters 14-82 ESSET (Conversion: Character Constant ASCII Code: With Storage Area Size) Example 2) Setting 256 characters to DT0, repeating a set of the 16 characters from A to P [S1]...U256 [S2]... "ABCDEF...KLMNOP" [D]...DT0 [S2] "ABCDEF...KLMNOP" DT0 256 (1) DT1 256 (2) DT2 H 42 (B) H 41 (A) DT3 H 44 (D) H 43 (C) H 46 (F) H 45 (E) DT126 DT127 H 4C (L) DT128 H 4E (N) DT129 H 50 (P) H 4B (K) H 4D (M) H 4F (O) H L (1) Storage area size (2) Number of characters Example 3) Converting 0 characters of the string "" (repeated double quotation marks) [S1]...U1 [S2]... "" [D]...DT0 DT0 1 (1) DT1 0 (2) [S2] DT2 DT3 "" DT4 DT5 DT6 DT7 H L (Note): The data (*) that is out of the destination range, DT2 to DT7 , does not change. (1) Storage area size (2) Number of characters Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when securing a storage area large enough to store the area starting with D causes the size to be out of the accessible range. To be set when 0 or 65535 is set for S1. To be set when the number of characters is larger than the storage area size. 14-83 High-level Instructions (Strings) EPRINT (Text Creation: With Storage Area Size) Ladder diagram R0 EPRINT DT0 DT2 DT3 S1 S2 D List of operands Operand Description S1 The starting address of the device storing the string data that represents a text creation form, or the character constant. S2 Starting address storing the data to be output to texts D Starting address of the device storing texts. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction is used for creating texts of mails, etc. Process details · ASCII code texts are created according to the specified text creation form. · The text creation form can be specified using the operand [S1], ESSET instruction or the mail setting screen of FPWIN GR7. Created texts can be connected using the ESADD instruction. · The maximum size of a mail text is 4096 bytes for sending an event mail, and 256 bytes for sending a logging/trace mail. Operand [S1] setting · Specify the device address storing the text creation form or character constant (max. 256 characters). · The text creation form is composed of a main text, conversion form (such as %d, %e), linefeed code (\n) and tab code (\t). Text creation form example This example includes a tab code, a body (a conversion form for 1 datum is inserted), and a linefeed code. "\t Floor A is %d degrees C.\n Line feed code Conversion form Text Tab code · Tab code (\t) is converted to ASCII code HT (09h). · The body is converted to the supported ASCII code. · In the part where a conversion form is inserted, the output data specified by [S2] is stored as ASCII code, according to the conversion form. For more information about the conversion form, refer to "PRINT/EPRINT Instruction Shared Conversion Form Table." · Linefeed code (\n) is converted to ASCII code CR+LF (0A0Dh). 14-84 EPRINT (Text Creation: With Storage Area Size) Restrictions · Up to 4096 characters can be specified for the text creation form. An operation error occurs when it exceeds 4096 characters. · Up to 16 digits can be specified for one conversion form. An operation error occurs when it exceeds 16 digits. · The maximum number of characters after conversion for a single datum excluding %s and %S is 32. An operation error occurs when it exceeds 32 characters. · The maximum number of characters for %s or %S after conversion is 4096. · All strings that are not recognized as conversion forms are treated as main texts. Example: Conversion forms which do not allow capital letters (such as %D) The characters which are not recognized as judgment characters of conversion forms are included (such as %A, %Z) · To enter "%" in the body, specify "%%" (% x 2). Operand [S2] setting · Specify the starting address storing the data to be output to the text creation form. · Arrange conversion data in the order of the conversion form specified for [S1]. · For the character data for %s and %S, specify data storing the number of (1-byte) characters in the starting word. String data can be set with the ESSET instruction. ESSET U2 "Floor" DT112 S1 = "%d %u %x %b %f %e %Lg %s" S2 = DT100 Result: -1 65535 ffff 1000 123.4567 123.4567 123.456789 Floor DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109 DT110 DT111 DT112 DT113 DT114 DT115 DT116 H FFFF H FFFF H FFFF H 1000 SF 123.4567 SF 123.4567 Data for %d Data for %u Data for %x Data for %b Data for %f Data for %e DF 123.456789 Data for %Lg K 5 K 5 H 6c (l) H 46 (F) H 6f (o) H 6f (o) ** H 72 (r) Data for %s Storage area size No. of bytes Data part 14-85 High-level Instructions (Strings) Setting example Example 1) When inserting into the text two conversion forms (%d) that represent 16-bit signed integers and a linefeed code (\n) In the place of the conversion form (%d), the ASCII code that is equivalent to the integer data specified by [S2] is inserted. If a number of digits is not specified for the conversion form, the number of converted data and the size of the storage area will vary according to the value [S2]. (*1) The start area (storage area size) for [D] is set before executing this instruction. (*2) The data out of the destination range does not change. g Floor A: 25°C Floor B: 28°C - Setting values S1="Floor A: %d°C¥nFloor B: %d°C" S2=DT100 D=DT200 DT100 DT101 DT102 K 25 K 28 DT200 DT201 DT202 DT203 DT204 DT205 DT206 DT207 DT208 DT209 DT210 DT211 DT212 DT213 DT214 DT215 DT216 DT217 U 32 U 30 H 6C (l) H 46 (F) H 6F (o) H 6F (o) H 20 (SPACE) H 72 (r) H 3A (:) H 41 (A) H 32 (2) H 20 (SPACE) H C2 (°) H 35 (5) H 43 (C) H B0 (°) H 0A (LF) H 0D (CR) H 6C (l) H 46 (F) H 6F (o) H 6F (o) H 20 (SPACE) H 72 (r) H 3A (:) H 42 (B) H 32 (2) H 20 (SPACE) H C2 (°) H 38 (8) H 43 (C) H B0 (°) (*2) Storage area size (*1) No. of bytes Data part 14-86 EPRINT (Text Creation: With Storage Area Size) Example 2) When inserting into the text a conversion form (%d) that represents a 16-bit signed integer In the place of the conversion form (%d), the ASCII code that is equivalent to the integer data specified by [S2] is inserted. If a number of digits is not specified for the conversion form, the number of converted data and the size of the storage area will vary according to the value [S2]. (*1) The start area (storage area size) for [D] is set before executing this instruction. (*2) The data out of the destination range does not change. Production volume: 5 - Setting values S1="Production volume: %u" S2=DT1 D=DT50 DT1 U 5 DT2 DT3 DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 DT60 DT61 DT62 H 72 (r) H64 (d) H 63 (c) H 69 (i) H 6e (n) H 76 (v) H 6c (l) H 6d (m) H 3a (:) H 35 (5) U 22 U 20 H 50 (P) H 6f (o) H 75 (u) H 74 (t) H 6f (o) H 20 (SPACE) H 6f (o) H 75 (u) H 65 (e) H 20 (SPACE) (*2) Storage area size (*1) No. of bytes Data part Example 3) When inserting into the text a horizontal tab code (\t: H09) In the place of the conversion form (\t), the ASCII code that is equivalent to the horizontal tab code is inserted. If a conversion form is not included in [S1], the data for [S2] will have no effect on the conversion results. (*1) The start area (storage area size) for [D] is set before executing this instruction. (*2) The data out of the destination range does not change. (*3) The [S2] data has no effect on the conversion results. Normal operation - Setting values S1="\tNormal operation" S2=DT1 D=DT50 DT1 (*3) DT2 (*3) DT3 (*3) DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 DT60 U 18 U 17 H 4e (N) H 72 (r) H 61 (a) H 20 (SPACE) H 70 (p) H 72 (r) H 74 (t) H 6f (o) (*2) H 09 (HT) H 6f (o) H 6d (m) H 6c (l) H 6f (o) H 65 (e) H 61 (a) H 69 (i) H 6e (n) Storage area size (*1) No. of bytes Data part 14-87 High-level Instructions (Strings) Example 4) When inserting into the text two conversion forms (%s) that represent strings In the place of the conversion form (%s), the ASCII code that is equivalent to the string data specified by [S2] is inserted. If a number of digits is not specified for the conversion form, the number of converted data and the size of the storage area will vary according to the value [S2]. Use the ESSET instruction to reset the [S2] string data. (*1) The start area (storage area size) for [D] is set before executing this instruction. (*2) The data out of the destination range does not change. Location: Nagoya, Aichi - Setting values S1="Location: %s, %s" S2=DT1 D=DT50 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 DT11 DT12 U 8 U 6 H 61 (a) H 4E (N) H 6F (o) H 67 (g) H 61 (a) H 79 (y) ** U 8 U 5 H 69 (i) H 41 (A) H 68 (h) H 63 (c) ** H 69 (i) ** DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 DT60 DT61 DT62 DT63 U 24 U 23 H 6F (o) H 61 (a) H 69 (i) H 6E (n) H 20 (SPACE) H 61 (a) H 6F (o) H 61 (a) H 20 (SPACE) H 69 (i) H 68 (h) (*2) H 4C (L) H 63 (c) H 74 (t) H 6F (o) H 3A (:) H 4E (N) H 67 (g) H 79 (y) H 2C (,) H 41 (A) H 63 (c) H 69 (i) Storage area size (*1) No. of bytes Data part Example 5) When inserting into the text two conversion forms (%s) that represent strings In the place of the conversion form (%s), the ASCII code that is equivalent to the string data specified by [S2] is inserted. The number of digits of the data to insert, right align, and left align are specified. Use the ESSET instruction to reset the [S2] string data. (*1) The start area (storage area size) for [D] is set before executing this instruction. (*2) The data out of the destination range does not change. (*3) If %s (which represents string) is specified, it is left-aligned by default. If a minus sign is added to the value for [S1], it is right-aligned. (*4) The symbol in figures represents a space. Location: [ Nagoya], [Aichi ] (*3)(*4) Right-aligned Left-aligned - Setting values S1="Location: %-8s, %8s" S2=DT1 D=DT50 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 DT11 DT12 U 10 U 6 H 61 (a) H 4E (N) H 6F (o) H 67 (g) H 61 (a) H 79 (y) ** U 10 U 8 H 69 (i) H 41 (A) H 68 (h) H 63 (c) ** H 69 (i) ** DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 DT60 DT61 DT62 DT63 DT64 DT65 DT66 DT67 U 32 U 32 H 6F (o) H 4C (L) H 61 (a) H 63 (c) H 69 (i) H 74 (t) H 6E (n) H 6F (o) H 20 (SPACE) H 3A (:) H 20 (SPACE) H 5B ([) H 4E (N) H 20 (SPACE) H 67 (g) H 61 (a) H 79 (y) H 6F (o) H 5D (]) H 61 (a) H 20 (SPACE) H 2C (,) H 41 (A) H 5B ([) H 63 (c) H 69 (i) H 69 (i) H 68 (h) H 20 (SPACE) H 20 (SPACE) H 5D (]) H 20 (SPACE) Storage area size (*1) No. of bytes Data part 14-88 EPRINT (Text Creation: With Storage Area Size) Example 6) Combining the conversion forms (%s), (%d), and (%s) which represent strings, and inserting a minus sign (-) In place of the conversion forms (%s), (%d), and (%s), ASCII code that is equivalent to the data specified by [S2] is inserted. Insert a minus sign. Use the ESSET instruction to reset the [S2] string data area. (*1) The start area (storage area size) for [D] is set before executing this instruction. (*2) The data out of the destination range does not change. Category: A-1-a - Setting values S1="Category: %s-%d-%s" S2=DT1 D=DT50 DT1 U 2 DT2 U 1 DT3 ** H 41 (A) DT4 H0001 DT5 U 2 DT6 U 1 DT7 ** H 61 (a) DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 U 16 U 15 H 61 (a) H 65 (e) H 6F (o) H 79 (y) H 20 (SPACE) H 2D (-) H 2D (-) (*2) H 43 (C) H 74 (t) H 67 (g) H 72 (r) H 3A (:) H 41 (A) H 31 (1) H 61 (a) Storage area size (*1) No. of bytes Data part Example 7) Combining the conversion forms (%s) and (%d) which represent strings to insert them In the places of conversion forms (%s) and (%d), the ASCII code that is equivalent to the data array specified by [S2] is inserted. Use the ESSET instruction to reset the [S2] string data area. (*1) The start area (storage area size) for [D] is set before executing this instruction. - Image of mail text Nagoya city: 25°C - Setting values S1="%s: %d°C" S2=DT1 D=DT50 DT1 U 8 DT2 U 6 DT3 H 61 (a) H 4E (N) DT4 H 6F (o) H 67 (g) DT5 H 61 (a) H 79 (y) DT6 ** DT7 K 25 DT50 DT51 DT52 DT53 DT54 DT55 DT56 DT57 DT58 DT59 DT60 CY ON H 61 (a) H 6F (o) H 61 (a) H 63 (c) H 74 (t) H 3A (:) H 32 (2) H C2 (°) H 43 (C) U 18 U 18 H 4E (N) H 67 (g) H 79 (y) H 20 (SPACE) H 69 (i) H 79 (y) H 20 (SPACE) H 35 (5) H B0 (°) Storage area size (*1) No. of bytes Data part Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when an out-of-range value is specified for parameters. SR7 SR8 (ER) To be set when the text creation form exceeds 4096 characters. To be set when texts exceed 4096 bytes. To be set when the conversion form is specified by a real number and conversion data is a non-real number. To be set when the size specified by the conversion form exceeds 32 characters. (Excluding the conversion forms %s, %S) To be set when the number of characters is larger than the storage area size for [S1] and [S2]. CY (SR9) To be set when created texts are larger than the storage area size of [D]. 14-89 High-level Instructions (Strings) ETIMEstr (Date and Time Character String Conversion: With Storage Area Size) Ladder diagram R0 ETIMEstr DT0 DT2 DT3 S1 S2 D List of operands Operand Description S1 Starting address of the device that stores date and time information (7 words) S2 Starting address of the device that stores conversion patterns (hex data, 1 word) D Starting address of the device that stores the string data as the conversion result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction converts data and time information to character strings. · The date and time information to be output is year, month, day, day of the week, hour, minute, and second. · This instruction can be used when date and time information is required for creating mail texts. This instruction is used in combination with the EPRINT instruction. Process details · Converts the date and time information specified by [S1] to ASCII code, and stores it as string data in the area that starts with [D]. · The conversion pattern is specified for [S2]. [S1]: Settings of date and time information · Specify the starting address of the device that stores the date and time information. · Specify SD50 if you want to output the current time and date of PLC. · Checking the combination of year, month, day, or day of the week is not performed. Example) A setting of February 31 is not treated as an error. When SD50 is specified, the combination of year, month, day, or day of the week is correct. · Always store the data in the order mentioned in the table below regardless of the conversion pattern of [S2]. Operand [S1] [S1+1] [S1+2] [S1+3] [S1+4] [S1+5] [S1+6] Description Year Month Day Hour Minute Second Day of the week Specified range U0 to U99 U1 to U12 U1 to U31 U0 to U23 U0 to U59 U0 to U59 U0 to U6 Remarks The character string after conversion is 2000 to 2099. 14-90 ETIMEstr (Date and Time Character String Conversion: With Storage Area Size) [S2]: Conversion pattern settings The conversion pattern is specified by 4-digit hex data. Refer to the page for the "TIMEstr (Date and Time Character String Conversion)" instruction. Example of processing Example 1) [S1]...DT100 [S2]...DT0 [D]...DT150 Output image ... Wed08-06-202023:20:05 [S1]...DT100 [S2]...DT0 [D]...DT150 Output example Wed 08-06-2020 23:20:05 DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT0 U 20 Year DT150 U 6 Month DT151 U 8 Day DT152 U 23 Hour DT153 U 20 Minute DT154 U 5 Second DT155 U 3 Day of the week DT156 DT157 DT158 H 4012 DT159 DT160 DT161 DT162 DT163 U 24 Storage area size (*1) U 23 Number of bytes H 65 (e) H 57 (W) H 20 ( ) H 64 (d) H 38 (8) H 30 (0) H 30 (0) H 2D (-) H 2D (-) H 36 (6) H 30 (0) H 32 (2) H 30 (0) H 32 (2) H 32 (2) H 20 ( ) H 3A (:) H 33 (3) H 30 (0) H 32 (2) H 30 (0) H 3A (:) H 35 (5) (*1) The start area (storage area size) for [D] is set before executing this instruction. 14-91 High-level Instructions (Strings) Example 2) When created character strings exceed the storage area size and CY is set [S1]...SD50 [S2]...DT0 [D]...DT10 Output image ... 2014 09 25 ()12 54 31 [S1]...SD50 [S2]...DT0 [D]...DT10 Output example 20140925() 125431 SD50 U 14 Year DT10 U 16 Storage area size (*1) SD51 SD52 U 9 Month U 25 Day DT11 U 16 Number of bytes DT12 H 30 (0) H 32 (2) CY ON SD53 U 12 Hour DT13 H 34 (4) H 31 (1) SD54 U 54 Minute DT14 H 4E94 () SD55 U 31 Second DT15 H 39 (9) H 30 (0) SD56 U 4 Day of the week DT16 H 8E8C () DT17 H 35 (5) H 32 (2) DT18 H FA93 () DT0 H 0014 DT19 H 96 () H 28 (() (*1) The start area (storage area size) for [D] is set before executing this instruction. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the parameter of [S1] is out of the setting range. To be set when the parameter of [S2] is out of the setting range. To be set when the range between [S1] to [S1+6] is out of the accessible range. To be set when the destination range is outside the accessible range. CY (SR9) To be set when created character strings are larger than the storage area size for [D]. 14-92 ESCMP (String Compare: With Storage Area Size) ESCMP (String Compare: With Storage Area Size) Ladder diagram R0 ESCMP DT0 DT10 S1 S2 List of operands Operand Description S1 String 1 to be compared (available range: 0 to 65534; for character constant: 0 to 256 characters) S2 String 2 to be compared (available range: 0 to 65534; for character constant: 0 to 256 characters) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 *1: Only 16-bit devices can be modified. (Character constants cannot be specified.) Integer K U H Real number String Index modification SF DF " " *1 Outline of operation · This instruction compares the string specified by [S1] and the string specified by [S2]. The comparison result is output to the system relays SRA to SRC (assessment flags for the comparison instruction). · The size of the storage area is not included in the judgment conditions. · Comparison flags (system relays SRA to SRC) are operated as follows. [S1] < [S2] [S1] = [S2] [S1] > [S2] SRA > OFF OFF ON SRB = OFF ON OFF SRC < ON OFF OFF · If the numbers of characters to be compared are different, they are processed as follows. [S1] "ABCDE" = "ABCD" < "B" > [S2] "ABCDE" "ABCDE" "ABCDE" · If "NULL" is included in the comparison, it is processed as follows. [S1] NULL = NULL < "B" > [S2] NULL "ABCDE" NULL 14-93 High-level Instructions (Strings) Process details Example 1) Comparing strings "ABCD" and "ABCDE", which are stored in the data register [S1]...DT0 [S2]...DT10 SRA...OFF SRB...OFF SRC...ON DT0 10 (1) DT10 8 (1) DT1 4 (2) DT11 5 (2) DT2 "B" "A" DT12 "B" "A" DT3 "D" "C" DT13 "D" "C" DT4 DT14 "E" DT5 DT15 DT6 H L H L S1<S2 SRA > OFF SRB = OFF SRC < ON Example 2) Comparing the string "ABCD" that is stored in the data register with the character constants "ABCDE" that are specified for the operand [S1]...DT0 [S2]..."ABCD" SRA...OFF SRB...ON SRC...OFF DT0 10 (1) DT1 4 (2) DT2 "B" "A" DT3 "D" "C" DT4 DT5 DT6 H L S2 "ABCD" S1=S2 SRA > OFF SRB = ON SRC < OFF Example 3) Comparing the NULL characters that are stored in the data register [S1]...DT0 [S2]...DT10 SRA...OFF SRB...ON SRC...OFF DT0 10 (1) DT10 10 (1) DT1 1 (2) DT11 1 (2) DT2 NULL DT12 NULL DT3 DT13 DT4 DT14 DT5 DT15 DT6 DT16 H L H L S1=S2 SRA > OFF SRB = ON SRC < OFF Example 4) Comparing the NULL character and the empty string that are stored in the data register [S1]...DT0 [S2]...DT10 SRA...ON SRB...OFF SRC...OFF DT0 10 (1) DT10 10 (1) DT1 1 (2) DT11 0 (2) DT2 NULL DT12 DT3 DT13 DT4 DT14 DT5 DT15 DT6 DT16 H L H L S1>S2 SRA > ON SRB = OFF SRC < OFF (1) Storage area size (2) Number of characters Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the storage areas specified by S1 and S2 are out of the accessible range. To be set when the number of characters is larger than the storage area size for each operand. To be set when a data table with a storage area size of 0 or 65535 is specified. SRA (>), SRB (=) SRC (<) Varies according to the comparison result. 14-94 ESADD (String Addition: With Storage Area Size) ESADD (String Addition: With Storage Area Size) Ladder diagram R0 ESADD DT0 DT10 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of String 1 to be connected (available range: 0 to 65534; for character constant: 0 to 256 characters) S2 Starting device address of String 2 to be connected (available range: 0 to 65534; for character constant: 0 to 256 characters) D Starting device address to store the connected string Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 D *1: Only 16-bit devices can be modified. (Character constants cannot be specified.) Integer K U H Real number String Index modification SF DF " " *1 Outline of operation · This instruction combines the string specified by [S1] with the string specified by [S2], and stores the combined string to the device address specified by [D]. · The maximum number of characters for the result is 65534 characters. · For [S1], [S2], and [D], the size of the starting storage area must be set by using the user program before an instruction is executed. Process details Example 1) Connecting strings "ABCDE" and "123", which are stored in the data register [S1]...DT0 [S2]...DT10 [D]...DT20 (a) DT0 10 (1) DT1 5 (2) DT2 "B" "A" DT3 "D" "C" DT4 "E" DT5 DT6 H L (b) DT10 10 (1) DT11 3 (2) DT12 "2" "1" DT13 "3" DT14 DT15 DT16 H L (c) DT20 10 (1) DT21 8 (2) DT22 "B" "A" DT23 "D" "C" DT24 "1" "E" DT25 "3" "2" DT26 H L (Note): The content of the data (*) DT26 does not change when it is out of the range of the destination. (1) Storage area size (2) Number of characters 14-95 High-level Instructions (Strings) Example 2) When the size of the connected strings exceeds the storage area size for [D] The strings are stored up to the range allowed by the storage area size, and carry flag SR9 (CY) is set. [S1]...DT30 [S2]...DT40 [S3]...DT50 CY...ON (a) DT30 10 (1) DT31 5 (2) DT32 "B" "A" DT33 "D" "C" DT34 "E" DT35 DT36 H L (b) DT40 10 (1) DT41 8 (2) DT42 "2" "1" DT43 "4" "3" DT44 "6" "5" DT45 "8" "7" DT46 H L DT50 DT51 DT52 DT53 DT54 DT55 DT56 (c) 10 10 "B" "A" "D" "C" "1" "E" "3" "2" "5" "4" H L CY (1) (2) ON Precautions during programming · If the connection result is larger than the storage area size of [D], the string is stored only up to the storage area size for [D]. · When specifying with a character constant, the maximum is 256 characters. · A NULL character is processed as one character. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the string range specified by [S1] or [S2] is out of the accessible range. To be set when the destination range is outside the accessible range. To be set when the number of characters is larger than the storage area size for S1 and S2. To be set when a data table with a storage area size of 0 or 65535 is specified. SR9 (CY) To be set when the connection results is larger than the storage area size of [D]. 14-96 ELEN (Obtainment of String Length: With Storage Area Size) ELEN (Obtainment of String Length: With Storage Area Size) Ladder diagram R0 ELEN DT0 DT100 S D List of operands Operand Description S Starting device address of the string (available range: 0 to 65534) D Starting device address to store the string length Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction stores the number of characters stored in the beginning of the character string specified by [S] to the device address specified by [D]. · A NULL character is processed as one character. Process details Stores the number of characters in a character string that are stored after data register DT0. [S]...DT0 [D]...DT100 DT0 10 DT1 8 DT2 "B" "A" DT3 "D" "C" DT4 "1" "E" DT5 "3" "2" DT6 H L (1) (2) DT100 K 8 (1) Storage area size (2) Number of characters Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). To be set when the string range specified by [S] is out of the accessible range. To be set when the number of characters is larger than the storage area size for [S]. To be set when a data table with a storage area size of 0 or 65535 is specified. 14-97 High-level Instructions (Strings) ESSRC (String Search: With Storage Area Size) Ladder diagram R0 ESSRC DT0 U1 DT10 DT120 S1 p S2 D List of operands Operand Description S1 Starting device address of the string data to be searched for (available range: 0 to 65534; for character constant: 0 to 256 characters) p Starting search position of the string to be searched for (available range: 1 to 65534) S2 Starting device address of the string to be searched (available range: 1 to 65534; for character constant: 0 to 256 characters) D Starting device address to store the search result Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 p S2 D *1: Only 16-bit devices, and integer constants can be modified. (Character constants cannot be specified.) Outline of operation · This instruction searches for the string data specified by [S1] in the string table starting from [S2]. · For [p], specify the relative position (by byte) in the string table where the search starts. · For the search result, the number of same character data is stored in the device whose address is specified by [D], and the relative position (by byte) of the first match is stored in [D+1]. Process details Example 1) Searching for string "EFG" stored in DT0, in the string table from DT10 [S1]...DT0 [p]...U1 [S2]...DT10 [S2]...DT120 (a) (b) DT0 10 (1) DT10 10 (1) DT1 3 (2) DT11 8 (2) DT2 "F" "E" DT12 "B" "A" DT3 "G" DT13 "D" "C" DT4 DT14 "F" "E" DT5 DT15 "H" "G" DT6 DT16 H L H L DT120 U 1 (3) DT121 U 5 (4) (a) Area in which the string to be searched for is stored (b) String table that is searched (1) Storage area size (3) Number of matching strings (2) Number of characters (4) Relative position of matching string (Note): Using the low byte of DT12 at the beginning of the string table as a reference, the relative position of the low byte of DT14 is calculated as a value 5, based on where it matches with string "EFG". 14-98 ESSRC (String Search: With Storage Area Size) Example 2) When the string "EF" being searched for is found in two locations on the string table after DT10 [S1]...DT0 [p]...U1 [S2]...DT10 [S2]...DT120 (a) (b) DT0 10 (1) DT10 10 (1) DT1 2 (2) DT11 8 (2) DT2 "F" "E" DT12 "B" "A" DT3 DT13 "F" "E" DT4 DT14 "B" "A" DT5 DT15 "F" "E" DT6 DT16 H L H L DT120 U 2 (3) DT121 U 3 (4) (Note): Using the low byte of DT12 at the beginning of the string table as a reference, the relative position of the low byte of DT13 is calculated as a value 3, based on where it matches with string "EF" first. Example 3) Searching for string "EF" midway through a string data table (p = 5: 5th byte) [S1]...DT0 [p]...U1 [S2]...DT10 [S2]...DT120 (a) (b) DT0 10 (1) DT10 10 (1) DT1 2 (2) DT11 8 (2) DT2 "F" "E" DT12 "B" "A" DT3 DT13 "F" "E" DT4 DT14 "B" "A" DT5 DT15 "F" "E" DT6 DT16 H L H L DT120 U 1 (3) DT121 U 7 (4) (Note): Using the low byte of DT12 at the beginning of the string table as a reference, the relative position for the low byte of DT15 is calculated as a value 7, based on where it matches with string "EF" first. Example 4) When 0 is specified for the number of characters for the string data to be searched for For both the number and the relative position, 0 is stored. [S1]...DT0 [p]...U1 [S2]...DT10 [S2]...DT120 (a) DT0 10 DT1 0 DT2 DT3 DT4 DT5 DT6 H L (b) (1) DT10 10 (1) (2) DT11 8 (2) DT12 "B" "A" DT13 "F" "E" DT14 "B" "A" DT15 "F" "E" DT16 H L DT120 U 0 (3) DT121 U 0 (4) (a) Area in which the string to be searched for is stored (1) Storage area size (2) Number of characters (b) String table that is searched (3) Number of matching strings (4) Relative position of matching string 14-99 High-level Instructions (Strings) Precautions during programming · For [S1], the number of characters to search for in a string, specify the number of characters to be searched for. In the following figure, 1 is specified for the number of characters, and the string "A" is searched for. When 2 is specified for the number of characters, the string "AB" is searched for. (1) Storage area size (2) Number of characters DT0 4 (1) DT1 2 (2) DT2 "B" "A" DT3 "D" "C" · The number of data for search results is the number of matches that occurred from the starting search position to the end of the data table. · The relative position where the search results match is the number of bytes from the start of the data table to where the search result first matches after the starting search position. · To search for the 2nd and subsequent relative positions, specify a value equal to the previous relative position + 1 for the operand [p] representing the starting search position, and then execute the instruction again. · When specifying with a character constant, the maximum is 256 characters. · If an empty string is specified for the search string data [S1], 0 is output for search results [D] and [D+1]. · The number of output bytes for the search results of the ESSRC instruction is counted starting from 1. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the number of characters [S1] is larger than [S2]. To be set when [p] is larger than the number of characters of [S2]. To be set when the string range specified by [S1] or [S2] is out of the accessible range. To be set when the number of characters is larger than the storage area size for [S1] and [S2]. To be set when a data table with a storage area size of 0 or 65535 is specified. 14-100 ERIGHT (Takeout of the Right Side of a String: With Storage Area Size) ERIGHT (Takeout of the Right Side of a String: With Storage Area Size) Ladder diagram R0 ERIGHT DT0 U5 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of the source data (available range: 0 to 65534; for character constant: 0 to 256 characters) S2 Number of characters to be taken out (available range: 0 to 65534) D Starting device address to store the result that is taken out Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 Integer K U H Real number String Index modification SF DF " " *1 S2 D *1: Only 16-bit devices, and integer constants can be modified. (Character constants cannot be specified.) Outline of operation · This instruction takes out the characters for the number specified for [S2] from the right side (end of the character data) of the string specified by [S1], and stores them as string data in the device whose address is specified by [D]. · The number of bytes of string data that are taken out is stored in [D+1]. · For both [S1] and [D], the size of the starting storage area must be set by using the user program before an instruction is executed. Process details Example 1) Taking out the last five characters "DE123" from the string "ABCDE123" to store them as string data with storage area in DT20 and later [S1] ... DT0 [S2] ... U5 [S2] ... DT20 (a) DT0 10 DT1 8 DT2 "B" "A" DT3 "D" "C" DT4 "1" "E" DT5 "3" "2" DT6 H L (b) (1) DT20 10 (1) (2) DT21 5 (2) DT22 "E" "D" DT23 "2" "1" DT24 "3" DT25 DT26 H L (Note): The data (*) that is out of the destination range, starting from the high byte of DT24 and ending with DT26, does not change. (a) Area in which the string to be taken out is stored (b) Area in which the string that is taken out is stored (1) Storage area size (2) Number of characters 14-101 High-level Instructions (Strings) Example 2) When the number of characters specified for [S2] is larger than the number of characters for the string that is stored in [S1] The number of characters that is stored in [S1] is taken out and stored in [D]. [S1] ... DT0 [S2] ... U7 [S2] ... DT20 (a) (b) DT0 10 (1) DT20 10 (1) DT1 3 (2) DT21 3 (2) DT2 "B" "A" DT22 "B" "A" DT3 "C" DT23 "C" DT4 DT24 DT5 DT25 DT6 DT26 H L H L (Note): The data (*) that is out of the destination range, starting from the high byte of DT23 and ending with DT26, does not change. Example 3) When the number of characters that were taken out exceeds the storage area size for [D] Only the amount of characters that can be stored in [D] is transferred, and the carry flag SR9 (CY) is set to ON. [S1] ... DT30 [S2] ... U7 [S2] ... DT50 DT30 DT31 DT32 DT33 DT34 DT35 DT36 (a) 10 5 "B" "A" "D" "C" "E" H L (1) DT50 (2) DT51 DT52 DT53 (b) 4 4 "C" "B" "E" "D" H L (1) (2) CY ON (a) Area in which the string to be taken out is stored (b) Area in which the string that is taken out is stored (1) Storage area size (2) Number of characters Precautions during programming · When the number of characters of [S2] is greater than the number of characters in the string of [S1], the transferal is performed for the number of characters of [S1]. · When the number of characters in [S2] is larger than the storage area size of [D], the transferal is performed for the storage area size of [D]. · When specifying with a character constant, the maximum is 256 characters. · When specifying an empty string for [S1], the result is always 0. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the destination range is outside the accessible range. To be set when [S2] (number of characters) is out of the range. To be set when the number of characters is larger than the storage area size for [S1]. SR9 (CY) To be set when a data table with a storage area size of 0 or 65535 is specified. To be set when the number of characters taken out is larger than the storage area size of [D]. 14-102 ELEFT (Takeout of the Left Side of a String: With Storage Area Size) ELEFT (Takeout of the Left Side of a String: With Storage Area Size) Ladder diagram R0 ELEFT DT0 U5 DT20 S1 S2 D List of operands Operand Description S1 Starting device address of the source data (available range: 0 to 65534; for character constant: 0 to 256 characters) S2 Number of characters to be taken out (available range: 0 to 65534) D Starting device address to store the result that is taken out Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 Integer K U H Real number String Index modification SF DF " " *1 S2 D *1: Only 16-bit devices, and integer constants can be modified. (Character constants cannot be specified.) Outline of operation · This instruction takes out characters as specified by [S2] from the left side (start of the character data) of the string specified by [S1], and stores them as string data with storage area in the device address specified by [D]. · The number of bytes of string data that are taken out is stored in [D+1]. · For both [S1] and [D], the size of the starting storage area must be set by using the user program before an instruction is executed. Process details Example 1) Taking out the first five characters "ABCDE" from the string "ABCDE123" to store them as string data with storage area in DT20 and later [S1] ... DT0 [S2] ... U5 [S2] ... DT20 (a) DT0 10 DT1 8 DT2 "B" "A" DT3 "D" "C" DT4 "1" "E" DT5 "3" "2" DT6 H L (b) (1) DT20 10 (1) (2) DT21 5 (2) DT22 "B" "A" DT23 "D" "C" DT24 "E" DT25 DT26 H L (Note): The data (*) that is out of the destination range, starting from the high byte of DT24 and ending with DT26, does not change. (a) Area in which the string to be taken out is stored (b) Area in which the string that is taken out is stored (1) Storage area size (2) Number of characters 14-103 High-level Instructions (Strings) Example 2) When the number of characters specified for [S2] is larger than the number of characters for the string that is stored in [S1] The number of characters that is stored in [S1] is taken out and stored in [D]. [S1] ... DT0 [S2] ... U7 [S2] ... DT20 (a) (b) DT0 10 (1) DT20 10 (1) DT1 3 (2) DT21 3 (2) DT2 "B" "A" DT22 "B" "A" DT3 "C" DT23 "C" DT4 DT24 DT5 DT25 DT6 DT26 H L H L (Note): The data (*) that is out of the destination range, starting from the high byte of DT23 and ending with DT26, does not change. Example 3) When the number of characters that were taken out exceeds the storage area size for [D] Only the amount of characters that can be stored in [D] is transferred, and the carry flag SR9 (CY) is set to ON. [S1] ... DT30 [S2] ... U7 [S2] ... DT50 DT30 DT31 DT32 DT33 DT34 DT35 DT36 (a) 10 5 "B" "A" "D" "C" "E" H L (1) DT50 (2) DT51 DT52 DT53 (b) 4 4 "B" "A" "D" "C" H L (1) (2) CY ON (a) Area in which the string to be taken out is stored (b) Area in which the string that is taken out is stored (1) Storage area size (2) Number of characters Precautions during programming · When the number of characters of [S2] is greater than the number of characters in the string of [S1], the transferal is performed for the number of characters of [S1]. · When the number of characters in [S2] is larger than the storage area size of [D], the transferal is performed for the storage area size of [D]. · When specifying with a character constant, the maximum is 256 characters. · When specifying an empty string for [S1], the result is always 0. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the destination range is outside the accessible range. To be set when [S2] (number of characters) is out of the range. To be set when the number of characters is larger than the storage area size for [S1]. SR9 (CY) To be set when a data table with a storage area size of 0 or 65535 is specified. To be set when the number of characters taken out is larger than the storage area size of [D]. 14-104 EMIDR (Data Read from a Given Position in the String: With Storage Area Size) EMIDR (Data Read from a Given Position in the String: With Storage Area Size) Ladder diagram R0 EMIDR DT0 U1 U3 DT20 S1 S2 S3 D List of operands Operand Description S1 Starting device address of the source data (available range: 0 to 65534; for character constant: 0 to 256 characters) S2 Starting position (available range: 0 to 65533) S3 Number of characters to be taken out (available range: 0 to 65534) D Starting device address to store the result that is taken out Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 S2 S3 D *1: Only 16-bit devices, and integer constants can be modified. (Character constants cannot be specified.) Outline of operation · This instruction takes out data for the number of characters specified by [S3] from the string data specified by [S1], and stores them as string data with a storage area in the device whose address is specified by [D]. · For [S2], specify the position for taking out string data. · For both [S1] and [D], the size of the starting storage area must be set by using the user program before an instruction is executed. Process details Example 1) Taking out the three characters "BCD" from the 1st byte (2nd character) of the string "ABCDE123" to store them as string data with storage area in DT20 and later [S1]...DT0 [S2]...U1 [S3]...U3 [D]...DT20 (a) DT0 10 DT1 8 DT2 "B" "A" DT3 "D" "C" DT4 "1" "E" DT5 "3" "2" DT6 H L (b) (1) DT20 10 (1) (2) DT21 3 (2) DT22 "C" "B" DT23 "D" DT24 DT25 DT26 H L (Note): The data (*) that is out of the destination range, starting from the high byte of DT23 and ending with DT26, does not change. (a) Area in which the string to be taken out is stored (b) Area in which the string that is taken out is stored (1) Storage area size (2) Number of characters 14-105 High-level Instructions (Strings) Example 2) When the number of characters specified for [S3] is larger than the number of characters for the string that is stored in [S1] after [S2] Take out the three characters "123" which come after the 5th character of [S2], and store them in [D]. [S1]...DT0 [S2]...U5 [S3]...U5 [D]...DT20 (a) (b) DT0 10 (1) DT20 10 (1) DT1 8 (2) DT21 3 (2) DT2 "B" "A" DT22 "2" "1" DT3 "D" "C" DT23 "3" DT4 "1" "E" DT24 DT5 "3" "2" DT25 DT6 DT26 H L H L (Note): The data (*) that is out of the destination range, starting from the high byte of DT23 and ending with DT26, does not change. Example 3) When the number of characters that were taken out exceeds the storage area size for [D] Only the amount of characters that can be stored in [D] is transferred, and the carry flag SR9 (CY) is set to ON. [S1]...DT0 [S2]...U5 [S3]...U5 [D]...DT20 DT30 DT31 DT32 DT33 DT34 DT35 DT36 (a) 10 10 "B" "A" "D" "C" "1" "E" "3" "2" "5" "4" H L (1) DT50 (2) DT51 DT52 DT53 (b) 4 4 "2" "1" "4" "3" H L (1) (2) CY ON (a) Area in which the string to be taken out is stored (b) Area in which the string that is taken out is stored (1) Storage area size (2) Number of characters Precautions during programming · When the number of characters of [S3] is larger than the number of characters of the [S1] string starting from the [S2] position, the transferal is performed for the number of characters of [S1]. · The [S2] position should be specified by a number counted from low order in sequence, putting the least significant byte as K0 (Byte 0): 0, 1, 2 and so on. · When the number of characters in the operation result is larger than the storage area size of [D], the transferal is performed for the storage area size of [D]. · When specifying with a character constant, the maximum is 256 characters. · When specifying an empty string for [S1], the result is always 0. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the destination range is outside the accessible range. To be set when the number of characters for [S1] is smaller than or equal to [S2]. To be set when the number of characters is larger than the storage area size for [S1]. To be set when a data table with a storage area size of 0 or 65535 is specified. SR9 (CY) To be set when the number of characters taken out is larger than the storage area size of [D]. 14-106 EMIDW (Rewrite from a Given Position in the String: With Storage Area Size) EMIDW (Rewrite from a Given Position in the String: With Storage Area Size) Ladder diagram R0 EMIDW DT0 U3 DT20 U1 S1 S2 D n List of operands Operand Description S1 Starting device address of the source data (available range: 0 to 65534; for character constant: 0 to 256 characters) S2 Number of characters (available range: 0 to 65534) D Destination starting device address n Starting position of the destination string (available range: 0 to 65533) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " *1 S1 S2 D n *1: Only 16-bit devices, and integer constants can be modified. (Character constants cannot be specified.) Outline of operation · This instruction takes out data for the number of characters specified by [S2] from the character string specified by [S1], and transfers it to the position [n] of the character string specified by [D]. Process details Example 1) Taking out the three characters "ABC" from the DT0 string to transfer them to the 1st byte (2nd character) of the DT20 string [S1]...DT0 [S2]...U3 [D]...DT20 [n]...U1 (a) (b) DT0 10 (1) DT20 10 (1) DT1 8 (2) DT21 8 (2) DT2 "B" "A" DT22 "2" "1" DT3 "D" "C" DT23 "4" "3" DT4 "F" "E" DT24 "6" "5" DT5 "H" "G" DT25 "8" "7" DT6 DT26 H L H L (c) DT20 10 (1) DT21 8 (2) DT22 "A" "1" DT23 "C" "B" DT24 "6" "5" DT25 "8" "7" DT26 H L (Note): The data (*) for DT26 that is out of the destination range does not change. (a) Area in which the string to be taken out is stored (b) Destination area (before transferring) (1) Storage area size (2) Number of characters (c) Destination area (after transferring) 14-107 High-level Instructions (Strings) Example 2) Taking out the four characters "ABCD" from the DT0 string to transfer them to the 1st byte (2nd character) of the DT20 string This indicates that the number of characters specified for [S2] is larger than the number of characters for the string that is stored in [S1]. [S1]...DT0 [S2]...U5 [D]...DT20 [n]...U1 (a) (b) DT0 10 (1) DT20 10 (1) DT1 4 (2) DT21 8 (2) DT2 "B" "A" DT22 "2" "1" DT3 "D" "C" DT23 "4" "3" DT4 DT24 "6" "5" DT5 DT25 "8" "7" DT6 DT26 H L H L (c) DT20 10 (1) DT21 8 (2) DT22 "A" "1" DT23 "C" "B" DT24 "6" "D" DT25 "8" "7" DT26 H L (Note): The data (*) for DT26 that is out of the destination range does not change. Example 3) When the number of characters that were taken out exceeds the storage area size for [D] Only the amount of characters that can be stored in [D] starting from the 7th is transferred, and carry flag SR9 (CY) is set to ON. [S1]...DT30 [S2]...U5 [D]...DT50 [n]...U7 (a) (b) DT30 10 (1) DT50 10 (1) DT31 8 (2) DT51 8 (2) DT32 "B" "A" DT52 "2" "1" DT33 "D" "C" DT53 "4" "3" DT34 "F" "E" DT54 "6" "5" DT35 "H" "G" DT55 "8" "7" DT36 DT56 H L H L (c) DT50 10 (1) DT51 10 (2) DT52 "2" "1" DT53 "4" "3" DT54 "6" "5" DT55 "A" "7" DT56 "C" "B" H L CY ON (a) Area in which the string to be taken out is stored (1) Storage area size (b) Destination area (before transferring) (2) Number of characters (c) Destination area (after transferring) Precautions during programming · When the number of characters of [S2] is larger than the number of characters in the string of [S1], the transferal is performed for the number of characters in the string of [S1]. · The [n] position should be specified counting by a number counted from low order in sequence, putting the least significant byte as K0 (Byte 0): 0, 1, 2 and so on. · When the number of characters in the operation result is larger than the storage area size of [D], the transferal is performed for the storage area size of [D]. · When specifying with a character constant, the maximum is 256 characters. · When specifying an empty string for [S1], the result is always 0. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when [S2] (number of characters) is out of the range. To be set when the number of characters of [D] is larger than [n]. To be set when the number of characters is larger than the storage area size for [S1] and [D]. SR9 (CY) To be set when a data table with a storage area size of 0 or 65535 is specified. To be set when the number of characters taken out is larger than the storage area size of [D]. 14-108 ESREP (Replacement of a String: With Storage Area Size) ESREP (Replacement of a String: With Storage Area Size) Ladder diagram R0 ESREP DT0 DT20 U1 U3 S D p n List of operands Operand Description S Starting device address of the source string (available range: 0 to 65534; for character constant: 0 to 256 characters) D Starting device address of the destination string (available range: 1 to 65534) p Replacement start position of the destination string (available range: 0 to 65533) n Number of characters to be replaced (available range: 0 to 65534) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " *1 D p n *1: Only 16-bit devices, and integer constants can be modified. (Character constants cannot be specified.) Outline of operation · This instruction replaces the string specified by [D] with the string specified by [S]. · For [p], specify the relative position in [D] where the string is replaced, and for [n] specify the number of characters to be replaced. Process details Example 1) Taking out the five characters "ABCDE" from the DT0 string to transfer them to the 1st byte (2nd character) of the DT20 string [S]...DT0 [D]...DT20 [p]...U1 [n]...U3 (a) (b) DT0 10 (1) DT20 10 (1) DT1 5 (2) DT21 8 (2) DT2 "B" "A" DT22 "2" "1" DT3 "D" "C" DT23 "4" "3" DT4 "E" DT24 "6" "5" DT5 DT25 "8" "7" DT6 DT26 H L H L (c) DT20 10 (1) DT21 10 (2) DT22 "A" "1" DT23 "C" "B" DT24 "E" "D" DT25 "6" "5" DT26 "8" "7" H L (Note): The data "234", from the 2nd to the 4th character in the destination area (before transferring), is deleted, and the data "5678", from the 5th to the 8th character, is shifted. (a) Area in which the string to be taken out is stored (b) Destination area (before transferring) (c) Destination area (after transferring) (1) Storage area size (2) Number of characters 14-109 High-level Instructions (Strings) Example 2) Taking out the five characters "ABCDE" from the DT0 string to transfer them to the 4th byte (5th character) of the DT20 string This indicates that the number of characters specified for [n] is larger than the number of characters for the string that is stored in [S1]. [S]...DT0 [D]...DT20 [p]...U4 [n]...U8 (a) (b) DT0 10 (1) DT20 10 (1) DT1 5 (2) DT21 10 (2) DT2 "B" "A" DT22 "2" "1" DT3 "D" "C" DT23 "4" "3" DT4 "E" DT24 "6" "5" DT5 DT25 "8" "7" DT6 DT26 "0" "9" H L H L (c) DT20 10 (1) DT21 9 (2) DT22 "2" "1" DT23 "4" "3" DT24 "B" "A" DT25 "D" "C" DT26 "0" "E" H L Example 3) When the number of characters that were taken out exceeds the storage area size for [D] Only the amount of characters that can be stored in [D] starting from the 5th byte (6th character) is transferred, and carry flag SR9 (CY) is set to ON. [S]...DT30 [D]...DT50 [p]...U5 [n]...U3 (a) (b) DT30 10 (1) DT50 10 (1) DT31 7 (2) DT51 8 (2) DT32 "B" "A" DT52 "2" "1" DT33 "D" "C" DT53 "4" "3" DT34 "F" "E" DT54 "6" "5" DT35 "G" DT55 "8" "7" DT36 DT56 H L H L (c) DT50 10 (1) DT51 10 (2) DT52 "2" "1" DT53 "4" "3" DT54 "A" "5" DT55 "C" "B" DT56 "E" "D" H L CY ON (a) Area in which the string to be taken out is stored (1) Storage area size (b) Destination area (before transferring) (2) Number of characters (c) Destination area (after transferring) Precautions during programming · If the number of characters [n] is larger than the number of characters in the string [S1] as from the position specified by [p], then the replacement is performed for the number of characters of the string [S] as from the position specified by [p]. · The [p] position should be specified by a number counted from low order in sequence, putting the least significant byte as K0 (Byte 0): 0, 1, 2 and so on. · When specifying with a character constant, the maximum is 256 characters. · When specifying an empty string for [S1], the result is always 0. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when [S] (number of characters) is out of the range. SR7 SR8 (ER) SR9 (CY) To be set when the number of characters of [D] is larger than [n]. To be set when the position of [p] is larger than the number of characters of [D]. To be set when the number of characters is larger than the storage area size for [S] and [D]. To be set when a data table with a storage area size of 0 or 65535 is specified. To be set when [n] (number of characters to be replaced) is out of the range. To be set when the number of characters taken out is larger than the storage area size of [D]. 14-110 15 15 High-level Instructions (Communication) Applicable Models: All Models High-level Instructions (Communication) UNITSEL (Specification of a Communication Unit Slot Port) Ladder diagram R0 UNITSEL U 0 U 2 S1 S2 List of operands Operand Description S1 Slot number of the unit S2 COM port number or user connection number Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction should be described immediately before the following communication instructions, to specify the targets of execution. GPTRNS, pGPSEND, GPSEND, GPRECV, SEND, RECV, PMSET, pPMSET, PMGET, RDET, ETSTAT, IPv4SET, PINGREQ, CONSET, OPEN, CLOSE, NTPcREQ, NTPcSV, FTPcSV, FTPcSET, FTPcLOG, FTPcREQ, FTPcCTL, HTTPcSV, HTTPcSET, HTTPcREQ, HTTPcCTL, SMTPcBDY, SMTPcBRD, SMTPcSV, SMTPcADD, SMTPcSET, SMTPcREQ, SMTPcCTL, EIPNDST, EIPSTART, EIPSTOP, EIP_IN, EIP_OT · In the case of a CPU with built-in SCU, specify a slot number (U0) for [S1] and a COM port number for [S2]. · In the case of a CPU with built-in ET-LAN, specify a slot number (U100) for [S1] and a connection number for [S2]. · In the case of a serial communication unit, specify a slot number (U1 to 16) for [S1] and a COM port number for [S2]. · This instruction obtains the type of slot specified by [S1], and checks that the communication port number specified by [S2] falls within the available range. If the number is out of the range, an error will occur. · In the case of SCU, check that the specified communication port (COM port number) is equipped with a communication cassette. If the specified COM port is not equipped with a communication cassette, an error will occur. · If no error occurs, the values of [S1] and [S2] should be set to system data register (SD40, SD41) of the CPU unit. 15-2 UNITSEL (Specification of a Communication Unit Slot Port) Specification of [S1] and [S2] · Specify a slot number of the unit in [S1]. The set value for [S1] should be stored in system data register SD40. · Specify a communication port in [S2]. (In the case of SCU: COM port number. In the case of CPU with built-in ET-LAN: connection number.) The set value for [S2] should be stored in system data register SD41. Unit type CPU with built-in SCU [S1] Slot No. U0 [S2] COM Port No. User connection No. U0 to U2 CPU with built-in ET-LAN U100 U1 to U16 U17 to U216 (Note 1) Serial Communication Unit (SCU) U1 to U64 U1 to U4 (Note 1): CPU unit Ver. 3 and later is required to use connection numbers U17 to U216 for a CPU unit with built-in ET-LAN. In addition, the number of user connections must also be changed in tool software "FPWIN GR7 Configuration" "Built-in ET-LAN" "Add-on". Example of program Example 1) Specify COM2 for SCU with built-in CPU in Slot 0 R0 UNITSEL U 0 U 2 S1 S2 Example 2) Specify User Connection 5 for ET-LAN with built-in CPU in Slot 100 R0 UNITSEL U 100 U 5 S1 S2 Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). The COM port specified by [S2] does not exist (no cassette, not a communication cassette). The connection specified by [S2] does not exist (out of the connection number range). 15-3 High-level Instructions (Communication) GPTRNS / pGPSEND /GPSEND (General-Purpose Communication Send Instruction) Ladder diagram (GPTRNS) R0 X8 Y8 DF UNITSEL U0 U1 S1 S2 GPTRANS.US DT101 DT100 DT0 Ladder diagram (pGPSEND) R0 X8 Y8 DF i S n D UNITSEL U0 U1 S1 S2 pGPSEND.US DT101 DT100 DT0 Ladder diagram (GPSEND) R0 X8 Y8 i S n D UNITSEL U0 U1 S1 S2 GPSEND.US DT101 DT100 DT20 i S n D (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i (Note): When a negative value is specified for operand [n], it is necessary to specify an SS operation unit. List of operands Operand Description S Starting number for the device for storing the sent data n Number of bytes of the sent data, or starting number of the device where the amount of sent data is stored D Starting number of the device that stores the processing result (1 word) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 n(*1) D(*1) *1: Always 16-bit data/device, regardless of the specification of operation units [i]. Integer K U H Real number String Index modification SF DF " " 15-4 GPTRNS / pGPSEND /GPSEND (General-Purpose Communication Send Instruction) Outline of operation · Data are sent from the communication port to external devices. · Data of [n] bytes are sent from the unit / communication port set by the UNITSEL instruction, starting with the starting address (word address) of the sent data area specified by [S]. · Data to be sent are set by the user program, in the area starting with [S]. · The processing result is stored in the area specified by [D]. Process details · The slot numbers and communication port numbers specified with UNITSEL instruction are obtained from the system data register (SD). · This instruction confirms that the general-purpose communication clear to send flag of a specified communication port is ON and the general-purpose communication sending flag is OFF. · When sending is enabled, sent data is transferred to the send buffer of a communication port and a request to send is executed. KEY POINTS · The case of SCU shows the case that it is used in the following combination. - COM.0 port equipped in the CPU unit - Communication cassettes attached to the CPU unit (COM.1 to COM.2 ports) - Communication cassettes attached to the serial communication unit (COM.1 to COM.4 ports) · The case of ET-LAN shows the case that it is used in the following combination. - LAN port equipped in the CPU unit (Applicable models: CPU unit CPS4*E and CPS3*E only) · As the communication cassette (Ethernet type) has an Ethernet-serial conversion function, the internal interface operates with similar programs as the case of SCU. The setting method and programming method are different from those for the CPU with built-in ET-LAN. Comparison of GPTRNS / pGPSEND / GPSEND instructions Instruction Characteristics GPTRNS pGPSEND (Note 1) The data send confirmation process is performed on the completion of scan. (Note 2) Advantages Data is sent only once by turning on execution conditions at the time of data send. Up to 16 send operations can be performed simultaneously to different COM ports and Disadvantages connections. (The total of simultaneous usage of SEND, RECV, GPTRNS, pGPSEND, and pPMSET instructions) The data send confirmation process is performed in the operation processing for the GPSEND instruction. (Note 2) GPSEND Advantages Disadvantages Data can be sent to different COM ports and connections simultaneously without limit. It is necessary to turn ON the execution condition of the GPSEND instruction until the end of data sending, and turn OFF the execution condition at a scan in which the end of data transmission is confirmed. (Note 1): As the result of executing an operation, the conditions under which an error is set for operand [D] will vary. Condition in which errors occur GPTRNS pGPSEND GPSEND General-purpose communication clear to send flag is OFF. (Note 2) 16 or more SEND, RECV, GPTRNS, pGPSEND, and pPMSET instructions are used simultaneously. - Communication error (Note 2): Even when the same port is specified and the GPTRNS instruction is executed during the execution of the general-purpose communication transmission, an error does not occur and the result is not updated. (Note 3): The data sending confirmation process indicates if the sending flag is cleared, if the send results flag is set, and if the processing results are stored in [D]. 15-5 High-level Instructions (Communication) Formulation of a sent data table [S] · Data to be sent is stored from the low byte of a given area specified by [S]. · The figure below shows the case where the string "ABCDE" is converted with the SSET instruction. DT100 U5 (1) DT101 H42(B) H41(A) DT102 H44(D) H43(C) (2) DT103 ----- H45(E) DT104 ----- ----- (1) Once the SSET instruction is executed, the number of characters is set in the starting word. Then, the characters that are converted are stored in the following area. (2) DT101 is set for operand [S] of the GPTRNS / pGPSEND / GPSEND instruction, and when the instruction is executed the data is sent in ascending order from the low byte. Setting the number of bytes in sent data [n] Unit type Setting value Description SCU (Note 1) (Note 2) 1 to 4096 -1 to -4096 When the value is positive, an end code is automatically added according to the "Terminator setting" of COM settings. When the value is negative, an end code is not automatically added regardless of the "Terminator setting" of COM settings. ET-LAN 1 to 16384 1 to 16372 - When "Add no special header" is on (Default connection setting): (Note 3) - Sent data and end code are not distinguished. It is not automatically added. - When "Add a special header" is on: (Note 3) - Sent data and end code are not distinguished. It is not automatically added. (Note 1): For SCU, up to 4096 bytes can be sent, including a start code and an end code. The start code and end code are set from the configuration menu of the tool software or with the PMSET instruction. When "Start code STX" is set to "Enabled", the maximum amount of sent data that can be specified is decremented by one. When "Terminator setting" is set to "ETX" or "CR", the maximum amount of sent data is decremented by one. When "Terminator setting" is set to "CR+LF", the maximum amount of sent data is decremented by two. When "Terminator setting" is set to "Time", the maximum amount of sent data is not decremented. (Note 2): For specifying a negative value for [n] (signed integer K), specify SS for the operation units. (Note 3): A "special header" is added when communicating with a conventional FP2 ET-LAN unit, and when communication is performed with MEWTOCOL. Normally, select "Add no special header" in the user connection setting. Operand [D] settings · Specify the device area of the master unit storing the processing result (1 word). · The following values are stored depending on the state. State When starting the transmission request When transmission is completed When an error occurs Value that is set H 0 Number of transmitted bytes HFFFF 15-6 GPTRNS / pGPSEND /GPSEND (General-Purpose Communication Send Instruction) Precautions during programming · In order to enable communication, settings should be made in the configuration menu of the tool software. · For a CPU unit with a built-in SCU, select "General-purpose communication" in "FP7 Configuration" "Built-in SCU" "Communication mode". For a Serial Communication Unit, also select "General-purpose communication" in "Communication mode". · For CPU unit with a built-in ET-LAN, use the FPWIN GR7 tool software to select "General-purpose communication" in "FP7 Configuration" "Built-in ET-LAN" "User connection information setting" "Operation mode setting". · Before executing the GPTRNS instruction, pGPSEND instruction, or GPSEND instruction, describe the UNITSEL instruction and specify the target unit and communication port or connection. · The GPTRNS, pGPSEND, and GPSEND instructions should be executed after confirming that the general-purpose communication clear to send flag for the target COM port and connection is ON and that the general-purpose communication sending flag is OFF. · For the GPSEND instruction, be sure to keep the execution condition ON until the completion of the transmission that sets the general-purpose communication sending flag to OFF. · The general-purpose communication sent flag in the WX area is used for confirming the completion of the transmission using the general-purpose communication. · When data is sent to a communication port that is undergoing transmission, it results in no operation. No error occurs. · Sending zero-byte data results in an error. · For a GPTRNS instruction and a pGPSEND instruction, up to 16 instructions can be executed simultaneously for different COM ports and connections. (The total of simultaneous usage of SEND, RECV, GPTRNS, pGPSEND, and pPMSET instructions) · The GPTRNS, pGPSEND, and GPSEND instructions are not available in interrupt programs. Precautions during programming (in the case of SCU) · If a positive number is specified for [n], the start code and end code that are specified in the configuration menu are automatically added to the data to be sent. Do not include a start code or an end code in the sent data. · If an end code will not be added, specify a negative number for the amount of sent data [n]. In addition, select "SS" as the operation units. · The maximum volume of data that can be sent with GPTRNS, pGPSEND, and GPSEND instructions is 4,096 bytes, including a start code and an end code. Precautions during programming (in the case of CPU with built-in ET-LAN) · General-purpose communication can be used for user connections 1 to 16. It cannot be used for the system connection and the expansion user connections 17 to 216. · User connections should be in the "connected" state. We recommend using the FPWIN GR7 tool software to set "Open automatically" in "Built-in ET-LAN" "User connection information setting " "Open type". Also, the connections can be connected with the OPEN instruction. · No start code or end code is added to data that is sent. Depending on the protocol of an external device, if a start code and an end code need to be sent, store them as part of the sent data. · The maximum volume of data that can be sent in a single instance with GPTRNS, pGPSEND, and GPSEND instructions is 16,384 bytes. 15-7 High-level Instructions (Communication) Sample program (in the case of SCU) · This program checks that the general-purpose communication mode is on (X8:ON) and that general-purpose sending is not in progress in the same port (Y8:OFF), and then starts up the sending program. · Using the SSET instruction, convert any given message into an ASCII string. Set the number of sent characters to the data register DT100, and the sent message to the data register DT101. · Using the UNITSEL instruction, specify the slot number (U0) and the COM. port number (U1). · In the GPTRNS / pGPSEND / GPSEND instruction, specify and execute the start of the table that stores the message to be sent (DT101) and the number of characters in the data (DT100). GPTRNS instruction R0 X8 Y8 ( DF ) R100 < SET > GPTRNS execution conditions X8: Clear to send flag: ON Y8: Send active flag: OFF R100 R100 SSET "ABCDE" DT100 S1 S2 UNITSEL U0 U1 S1 S2 Data conversion S1: Sent data S2: Sent data storage DT100: Number of sent characters DT101 and after: Sent data Communication port settings S1: Slot 0 (U0) S2: COM1 (U1) GPTRNS.US DT101 S DT100 DT0 n D R100 < RST > Transmission processing S: Header for sent data (DT101) n: Number of sent characters (DT100) D: Execution result code (DT0) GPTRNS execution conditions reset GPSEND instruction R0 X80 Y80 R101 R100 R100 R100 DF R100 SSET "ABCDE" DT100 S1 S2 UNITSEL U100 U1 S1 S2 Y8 DF / GPSEND.US DT101 S DT100 n DT0 D R101 GPSEND execution condition X80: Clear to send flag: ON Y80: Send active flag: OFF Data conversion S1: Sent data S2: Sent data storage DT100: Number of sent characters DT101 and after: Sent data Communication port settings S1: CPU LAN port (U100) S2: COM1 (U1) Transmission processing S: Header for sent data (DT101) n: Number of sent characters(DT100) D: Execution result code (DT0) Transmission completion check GPSEND execution conditions reset KEY POINTS · For the GPSEND instruction, it is necessary to turn ON the execution condition until the end of data sending, and turn OFF the execution condition at a scan in which the end of data sending is confirmed. 15-8 GPTRNS / pGPSEND /GPSEND (General-Purpose Communication Send Instruction) Time chart (in the case of SCU) · Data are sent in ascending order from low bytes of [S+1] in the table specified by the GPTRNS / pGPSEND / GPSEND instruction. · During sending, the general-purpose communication sending flags (Y8, Y9, YA, YB) are turned ON. They turn OFF when sending is completed. · The sending result (0: normal completion; 1: abnormal completion) is stored in the general-purpose communication sent flags (Y0, Y1, Y2, Y3). General-purpose communication clear to send flag (X8, X9, XA, XB) Checks that the flag is ON General-purpose Checks that the communication sending flag is OFF flag (Y8, Y9, YA, YB) GPTRNS/pGPSEND/G PSEND execution Sent flag (Y0, Y1, Y2, 3) Data sending Instruction executable conditions Clear to send flag (X8, X9, XA, XB): ON Sending flag (Y8, Y9, YA, YB): OFF Sending flag (Y8, Y9, YA, YB): While sending: ON, Sending done: OFF Sent flag (Y0, Y1, Y2, Y3): Normal completion: OFF Abnormal completion: ON I/O allocation (in the case of CPU with built-in SCU) COM Port No. 1 2 0 Name Name X8 X9 XA General-purpose communication clear to send flag Turns ON when the unit is set to the general-purpose communication mode. Y8 Y9 YA General-purpose communication sending flag Turns ON when sending with general-purpose communication mode. Turns OFF when the sending process is completed. Y0 Y1 Y2 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. (Note 2): In the case of the GPTRNS and pGPSEND instructions, the sending flag and send results flag are updated after the scan is complete. (Note 3): In the case of the GPSEND instruction, the sending flag and send results flag are updated after sending is completed when the next GPSEND instruction is executed. If sending time is shorter than scan time, the general-purpose communication sending flags (Y8, Y9, YA, YB) are turned OFF when the GPSEND instruction is executed in the subsequent scan following completion of data sending. The flags remain ON for at least one scan time. I/O allocation (in the case of Serial Communication Unit) COM Port No. 1 2 3 4 Name Description X8 X9 XA XB General-purpose communication clear to send flag Turns ON when the unit is set to the general-purpose communication mode. Y8 Y9 YA YB General-purpose communication sending flag Turns ON when sending with general-purpose communication mode. Turns OFF when the sending process is completed. Y0 Y1 Y2 Y3 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. (Note 2): In the case of the GPTRNS and pGPSEND instructions, the sending flag and send results flag are updated after the scan is complete. (Note 3): In the case of the GPSEND instruction, the sending flag and send results flag are updated after sending is completed when the next GPSEND instruction is executed. If sending time is shorter than scan time, the general-purpose communication sending flags (Y8, Y9, YA, YB) are turned OFF when the GPSEND instruction is executed in the subsequent scan following completion of data sending. The flags remain ON for at least one scan time. 15-9 High-level Instructions (Communication) Sample program (in the case of CPU with built-in ET-LAN) · This program checks that Connection 1 is established in the general-purpose communication mode (X80:ON) and that general-purpose sending is not in progress in the same port (Y80:OFF), and then starts up the sending program. · Using the SSET instruction, convert any given message into an ASCII string. Set the number of sent characters to the data register DT100, and the sent message to the data register DT101. · The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1). · In the GPTRNS / pGPSEND / GPSEND instruction, specify and execute the start of the table that stores the message to be sent (DT101) and the number of characters in the data (DT100). GPTRNS instruction R0 X80 Y80 ( DF ) R100 < SET > GPTRNS execution conditions X80: Clear to send flag: ON Y80: Send active flag: OFF R100 R100 SSET "ABCDE" DT100 S1 S2 UNITSEL U100 U1 S1 S2 Data conversion S1: Sent data S2: Sent data storage DT100: Number of sent characters DT101 and after: Sent data Communication port settings S1: CPU LAN port (U100) S2: Connection 1 (U1) GPTRNS.US DT101 S DT100 DT0 n D R100 < RST > Transmission processing S: Header for sent data (DT101) n: Number of sent characters (DT100) D: Execution result code (DT0) GPTRNS execution conditions reset GPSEND instruction R0 X80 Y80 R101 R100 R100 R100 DF R100 Y80 DF / SSET "ABCDE" DT100 S1 S2 UNITSEL U100 U1 S1 S2 GPSEND.US DT101 S DT100 n DT0 D R101 GPSEND execution conditions X80: Clear to send flagON Y80: Send active flagOFF Data conversion S1: Sent data S2: Sent data storage DT100: Number of sent characters DT101 and after: Sent data Communication port settings S1: CPU LAN port (U100) S2: Connection 1 (U1) Transmission processing S: Header for sent data (DT101) n: Number of sent characters(DT100) D: Execution result code (DT0) Transmission completion check GPSEND execution conditions reset KEY POINTS · For the GPSEND instruction, it is necessary to turn ON the execution condition until the end of data sending, and turn OFF the execution condition at a scan in which the end of data sending is confirmed. 15-10 GPTRNS / pGPSEND /GPSEND (General-Purpose Communication Send Instruction) Time chart (in the case of CPU with built-in ET-LAN) · Data are sent in ascending order from low bytes of [S+1] in the table specified by the GPTRNS / pGPSEND / GPSEND instruction. · During sending, the general-purpose communication sending flags that correspond to the connection (Y80 to Y8F) are turned ON. They turn OFF when sending is completed. · The sending result (0: normal completion; 1: abnormal completion) is stored in the general-purpose communication sent flags (Y70 to Y7F). General-purpose communication clear to send flag (X80 - X8F) Check that the flag is ON General-purpose communication sending Check that the flag is OFF flag (Y80 - Y8F) Execute GPSEND GPSEND instruction executable conditions Clear to send flag (X80 - X8F): ON Sending flag (Y80 - Y8F): OFF Sending flag (Y80 - Y8F): While sending: ON When sending done and instruction executed: OFF Sent flag (Y70 - Y7F) Sending data Sent flag (Y70 - Y7F): Normal completion: OFF Abnormal completion: ON I/O allocation (in the case of CPU with built-in ET-LAN) I/O number Name Description X80 to X8F General-purpose communication clear to send flag Turns ON when general-purpose communication is in a connected status. Y80 to Y8F General-purpose communication sending flag Turns ON when sending with general-purpose communication. Y70 to Y7F Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. (Note 2): In the case of the GPTRNS and pGPSEND instructions, the sending flag and send results flag are updated after the scan is complete. (Note 3): In the case of the GPSEND instruction, the sending flag and send results flag are updated after sending is completed when the next GPSEND instruction is executed. Flag operations Name Description SR7 SR8 (ER) To be set in case of out-of-range in indirect access (index modification). The connection specified with UNITSEL is closed (other than "Connect"). The communication mode of the communication port specified with UNITSEL is not "General-purpose communication." Data device specified by [S] exceeds the area. Sent data amount specified by [n] is 0. The volume including a start code and an end code exceeds the specified maximum value. The sent data amount specified by [n] exceeds the data area. Either 0 or a negative value is set for [N] in the settings of sending to ET-LAN. To be set when executed in an interrupt program. 15-11 High-level Instructions (Communication) GPRECV (General-Purpose Communication Receive Instruction) Ladder diagram R0 UNITSEL U0 U1 S1 S2 GPRECV.US DT0 DT10 i D1 D2 (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description D1 Starting address of the received data storage data area D2 Ending address of the received data storage data area Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX D1(*1) D2(*1) *1: Always 16-bit data/device, regardless of the specification of operation units [i]. Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction reads data that is sent from an external device and received by the communication port of the unit. · This instruction reads received data from the communication unit and the communication port set by the UNITSEL instruction, and stores the number of received bytes in the area specified by [D1] and the received data in the areas [D1+1] to [D2]. · In the case of SCU, data received from the partner are stored in 8 receive buffers for each COM port. By executing the GPRECV instruction, data in the receive buffer can be copied to a given operation memory. · In the case of CPU with built-in ET-LAN, data received from the partner are stored in 1 receive buffer for each connection. By executing the GPRECV instruction, data in the receive buffer can be copied to a given operation memory. Amount of received data and end code Items SCU In the case of CPU with built-in ET-LAN Amount of received data 0 to 4096 (Note 1) 0 to 16384 End code identification Yes (according to the SCU communication settings (end settings)) No identification (Note 1): For SCU, up to 4096 bytes can be sent, including a start code and an end code. The start code and end code are set from the configuration menu of the tool software or with the PMSET instruction. When "Start code STX" is set to "Enabled", the maximum amount of sent data that can be specified is decremented by one. When "Terminator setting" is set to "ETX" or "CR", the maximum amount of sent data is decremented by one. When "Terminator setting" is set to "CR+LF", the maximum amount of sent data is decremented by two. When "Terminator setting" is set to "Time", the maximum amount of sent data is not decremented. 15-12 GPRECV (General-Purpose Communication Receive Instruction) Storage method for received data DT200 U5 DT201 H32(2) H31(1) DT202 H34(4) H33(3) DT203 ----- H35(5) DT204 ----- ----- ----- ----- ----- Received number of bytes are stored. Received data are stored in ascending order from lower bytes. If the number of received bytes is smaller than the area specified by the GPRECV instruction, the value is not overwritten. KEY POINTS · The case of SCU shows the case that it is used in the following combination. - COM.0 port equipped in the CPU unit - Communication cassettes attached to the CPU unit (COM.1 to COM.2 ports) - Communication cassettes attached to the serial communication unit (COM.1 to COM.4 ports) · As the communication cassette (Ethernet type) has an Ethernet-serial conversion function, the internal interface operates with similar programs as the case of SCU. The setting method and programming method are different from those for the CPU with built-in ET-LAN. 15-13 High-level Instructions (Communication) Sample program (in the case of SCU) · When the received flag (X0) turns ON, the reception program is started up by the GPRECV instruction. · Using the UNITSEL instruction, specify the slot number (U0) and the COM. port number (U1). · In the GPRECV instruction, specify and execute the start of the data table that stores the received message (DT200) and the final address (DT209). X0 DF R100 GPRECV execution condition Received flag: ON R100 UNITSEL U0 U1 S1 S2 GPRECV US DT200 D1 DT209 D2 Communication port settings S1: Slot 0 built-in CPU (U0) S2: COM1 (U1) GPRECV processing D1: Header for received data (DT200) D2: End for received data (DT209) Time chart (in the case of SCU) · Data received from an external device are stored in the receive buffer. · When the end code is received, the received flag (X0, X1, X2, X3) turns ON. Subsequently, the following data are stored in the buffers upon reception. Data for 8 buffers can be received consecutively. Start receiving Received data Reception done flag X0 12 5 (CR) GPRECV execution condition R100 A B ON OFF ON OFF Execute GPRECV instruction · When the GPRECV instruction is executed, data are copied to the specified area, and the received flags (X0, X1, X2, X3) are turned OFF. The received flags (X0, X1, X2, X3) are turned OFF when I/O refresh is executed at the start of the following scans. Receive buffer Cr Received data Reception done flag (X0,X1,X2,X3) Cr Reception done flag (X0,X1,X2,X3): Reception done: ON, Received data copy done using GPRECV instruction: OFF Execute GPRECV 15-14 GPRECV (General-Purpose Communication Receive Instruction) I/O allocation (in the case of CPU with built-in SCU) COM Port No. 1 2 0 Name Name X0 X1 X2 General-purpose communication Turns ON when the receiving process is completed in the received flag general-purpose communication mode. X4 X5 X6 General-purpose communication received data copied flag Turns ON when the GPRECV instruction is executed and the received data have been copied into the specified operation memory. Turns OFF when there are no applicable data. I/O allocation (in the case of Serial Communication Unit) COM Port No. 1 2 3 4 Name Description X0 X1 X2 X3 General-purpose communication received flag Turns ON when the receiving process is completed in the general-purpose communication mode. X4 X5 X6 X7 General-purpose communication received data copied flag Turns ON when the GPRECV instruction is executed and the received data have been copied into the specified operation memory. Turns OFF when there are no applicable data. Precautions during programming (in the case of SCU) · Use the UNITSEL instruction immediately before the GPRECV instruction to specify a target port for communication. · When the general-purpose communication received flag is ON for the targeted COM port, execute GPRECV. · When multiplex reception is in progress, the received flag remains ON after the received data have been copied using the GPRECV instruction. The received data cannot be copied at the leading edge of the reception done signal. · The received data copied by the GPRECV instruction do not include a start code or an end code. · It is also possible to receive binary data using the GPRECV instruction. In this case, "time" should be used for the end setting. · The received data or the received data amount do not include the end code. (It is stripped off.) · In the case of SCU which has eight 4096-byte buffers inside, data equivalent to the eight buffers can be received consecutively. · If the reception of the ninth datum of data is performed by SCU before the GPRECV instruction is executed to take out data from SCU's receive buffer, a buffer FULL error occurs in SCU, and the ninth datum is discarded. · If the GPRECV instruction is executed when the receive buffer FULL error is on, the oldest received datum is taken out, and the receive buffer FULL error is canceled. · When no data have been received, the general-purpose communication control flag (received copy flag) turns OFF. · After data have been received, and copy to the operation memory of the CPU unit has been completed, the general-purpose communication control flag (received data copied flag) turns ON. · In the case of a direct address and an index modification address, specify the same device for D1 and D2. At the same time, specify the addresses so that D1 is less than D2. 15-15 High-level Instructions (Communication) Sample program (in the case of CPU with built-in ET-LAN) · When the received flag (X70) of Connection 1 turns ON, the reception program is started up by the GPRECV instruction. · The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1). · In the GPRECV instruction, specify and execute the start of the data table that stores the received message (DT200) and the final address (DT209). X70 DF R100 GPRECV execution condition Received flag: ON R100 UNITSEL U100 U1 S1 S2 GPRECV US DT200 D1 DT209 D2 Communication port settings S1: CPU LAN port (U100) S2: Connection 1 (U1) GPRECV instruction execution D1: Header for received data (DT200) D2 : End for received data (DT209) Time chart (in the case of CPU with built-in ET-LAN) · Data received from an external device are stored in the receive buffer for each connection. · When data are received, the received flag (X70 to X7F) turns ON. · When the GPRECV instruction is executed, data are copied to the specified area, and the received flags (X70 to X7F) are turned OFF. The received flags (X70 to X7F) are turned OFF when I/O refresh is executed at the start of the following scans. Receive buffer Received data Reception done flag (X70 - X7F) Reception done flag (X70 - X7F): Reception done: ON, Received data copy done using GPRECV instruction: OFF Execute GPRECV I/O allocation (in the case of CPU with built-in ET-LAN) I/O allocation Name Name X70 to X7F General-purpose communication Turns ON when receiving is completed in the general-purpose received flag communication mode. Precautions during programming (in the case of CPU with built-in ET-LAN) · Use the UNITSEL instruction immediately before the GPRECV instruction to specify a target connection for communication. · When the general-purpose communication received flag is ON for the targeted connection, execute GPRECV. · The maximum volume of data that can be received in one session using the GPRECV instruction, from the LAN port of the FP7 CPU unit, is 16,384 bytes. · Depending on the communication format of an external device, if a start code and an end code are contained, they are stored in the operation memory as part of received data. When necessary, insert a program to extract data content. · In the case of a direct address and an index modification address, specify the same device for D1 and D2. At the same time, specify the addresses so that D1 is less than D2. KEY POINTS · As the communication cassette (Ethernet type) has an Ethernet-serial conversion function, the internal interface operates with similar programs as the case of SCU. The setting method and programming method are different from those for the CPU with built-in ET-LAN. Refer to the section describing the case of SCU. 15-16 GPRECV (General-Purpose Communication Receive Instruction) Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. An SCU or ET-LAN unit does not exist in the slot specified by UNITSEL. SR7 SR8 (ER) The communication mode of the communication port specified with UNITSEL is not "General-purpose communication." The COM port specified by UNITSEL does not exist. Connection specified by UNITSEL is in a "reception done OFF" status, but not in a "connected" status. Data device specified by [D1] and/or [D2] exceeds the area. The specified [D1] is greater than or equal to [D2]. The devices specified for [D1] and [D2] differ. 15-17 High-level Instructions (Communication) SEND (MEWTOCOL Master / MODBUS Master) Ladder diagram R0 XC YC DF UNITSEL U0 U1 S1 S2 SEND.US DT100 U2 U1 DT400 DT0 i S n D1 D2 D3 (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the sender data area n Amount of sent data D1 Partner station number D2 Starting address of the receiver data area in the partner unit D3 Starting address of the device area in the master unit that stores the execution result code (1 word) Available word devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S Integer K U H Real number String Index modification SF DF " " n D1 D2(*1) *2 *2 *2 D3 *1: When the receiver is FP7, only global devices can be specified. (Local devices cannot be specified.) *2: In the MODBUS mode, this cannot be specified as the receiver. Available bit devices (: Available) Operand Bit device X YRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification S n D1 D2(*1) *2 *2 D3 *1: When the receiver is FP7, only global devices can be specified. (Local devices cannot be specified.) *2: In the case of MODBUS and MEWTOCOL-COM, a bit device cannot be specified. Outline of operation · Commands are sent from the communication port of the unit to perform the data transmission with external devices. Message in accordance with the protocol is automatically formulated by PLC. The user program only has to specify the station number and the memory address, and execute the SEND/RECV instruction, to carry out reading and writing. · Communication mode should be selected in the configuration menu of the tool software FPWIN GR7. 15-18 SEND (MEWTOCOL Master / MODBUS Master) · When the SEND instruction is executed, data are read from the device in the master unit, starting with [S], and stored in the address starting with [D2] of the partner unit. · Depending on the type of device specified by [S] and [D2], the transfer method (register transfer / bit transfer) varies. · The amount of sent data [n] is specified in words for the register transfer, and in the number of bits for the bit transfer. · The execution result code is stored in 1 word of area within the master unit specified by [D3]. Setting of sent data amount [n] Transfer method Communication mode Sent data amount n Note MEWTOCOL-COM 1 to 507 words Register transfer MEWTOCOL-DAT 1 to 1020 words 1 to 2038 words Connection setting: Setting of the MEWTOCOL Communication type setting: Connect with FP2 ET-LAN Connection setting: Setting of the MEWTOCOL Communication type setting: Do not connect with FP2 ET-LAN MODBUS 1 to 127 words MODBUS Command 15 (WY and WR writing) and Command 16 (DT multiple word writing) are used. MEWTOCOL-COM Fixed to 1 bit During MEWTOCOL-COM, WCS command is used. Bit transfer MEWTOCOL-DAT Fixed to 1 bit During MEWTOCOL-DAT, contact information write 52H is used. MODBUS 1 to 2040 Use the force multiple coils command 15. (Note 1): The transfer method varies according to the device type specified for operands [S] and [D2]. Register transfer is selected for a 16-bit device, and bit transfer for a 1-bit device. (Note 2): The amount of sent data is specified in words for the register transfer, and in bits for the bit transfer. Specification of partner station number [D1] Communication mode When SCU is used When ET-LAN is used MEWTOCOL-COM MEWTOCOL-DAT 0 to 99, 238 (decimal) = EE (hexadecimal) 1 to 64, 238 (decimal) = EE Non-SCU-compliant (hexadecimal) MODBUS 0 to 255 0 to 255 (Note 1): In the case of SCU, when "0" is specified for the partner station number, global transfer is selected. At this time, there is no response message from the partner. (Note 2): For connection between FP7 and FP7, specify "1". Destination is determined by the IP address. Specification of receiver address [D2] Transfer method Communication mode Address range MEWTOCOL-COM 0 to 99999 Register transfer MEWTOCOL-DAT 0 to 65535F MODBUS 0 to 65535 (H FFFF) MEWTOCOL-COM 0 to 999F Bit transfer MEWTOCOL-DAT 0 to 65535 (H FFFF) MODBUS 0 to 65535 (H FFFF) (Note 1): When the receiver is the file register FL, specify a constant. Example) For FL100, specify U100. For the file register, only bank 0 can be specified. Execution result code [D3] Code Description H 0 Normal end H 1 The communication port is being used in the master communication. H 2 The communication port is being used in the slave communication. H 3 The number of master communication instructions simultaneously used is exceeded. H 4 Transmission timeout H 5 Response reception timeout Code H 6 H 7 Description Reception error (Note 1) I/O allocation shortage error (Note 2) H41 Format error H60 Parameter error H61 Data error H91 Missing expansion slave unit error 15-19 High-level Instructions (Communication) (Note 1): It occurs when an abnormal telegram is received in the master communication. In the case of a format error in the header of an individual protocol, the communication discards the received data and a response reception timeout occurs. (Note 2): It occurs when the communication control I/O relays corresponding to the communication port (master communication clear to send flag, master communication sending flag, master communication sending result relay) are not allocated as I/O words of the CPU unit in the I/O map. It occurs only when the number of user connections of ET-LAN is expanded and this instruction is executed specifying that expanded connections. Sample program (in the case of SCU) · This program sends the command from the COM1 port of the CPU unit to write the content of PLC's data registers DT100 to DT101 into the data areas DT400 to DT401 of the external device (station number 1). · This program checks that the master mode is on (XC) and that sending is not in progress in the same port (YC), and then starts up the SEND instruction. · Using the UNITSEL instruction, specify the slot number (U0) and the COM. port number (U1). · In the SEND instruction, specify and execute the source's starting address (DT100) and data amount (U2), the destination's station number (U1) and starting address (DT400). R0 R100 DF XC YC Master Master communication communication clear to send flag sending flag UNITSEL R100 SEND execution U0 U1 S1 S2 SEND execution conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: Slot 0 (U0) S2: COM1 (U1) SEND.US DT100 U2 S1 n U1 DT400 DT0 D1 D2 D3 SEND processing S: Data storage area (DT100) n: Sent data amount (U2) D1: Partner unit no. (U1) D2: Destination address (DT400) D3: Execution result code (DT0) Time chart (in the case of SCU) Master communication clear to send flag (XC, XD, XE, XF) Check that the flag is ON Master communication Check that the sending flag flag is OFF (YC, YD, YE, YF) Execute SEND Master communication sent flag (Y0, Y1, Y2, Y3) Sending data SEND instruction executable conditions Clear to send flag (XC, XD, XE, XF): ON Sending flag (YC, YD, YE, YF): OFF Sending flag (YC, YD, YE, YF): While sending: ON; Sending done: OFF Sent flag (Y0, Y1, Y2, Y3): Normal completion: OFF Abnormal completion: ON Response reception processing KEY POINTS · The case of SCU shows the case that it is used in the following combination. - COM.0 port equipped in the CPU unit - Communication cassettes attached to the CPU unit (COM.1 to COM.2 ports) - Communication cassettes attached to the serial communication unit (COM.1 to COM.4 ports) · As the communication cassette (Ethernet type) has an Ethernet-serial conversion function, the internal interface operates with similar programs as the case of the CPU with built-in SCU. The setting method and programming method are different from those for the CPU with built-in ET-LAN. The communication cassette (Ethernet type) does not support MODBUS. 15-20 SEND (MEWTOCOL Master / MODBUS Master) I/O allocation (in the case of CPU with built-in SCU) COM Port No. 1 2 0 Name Description XC XD XE Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. I/O allocation (in the case of Serial Communication Unit) COM Port No. 1 2 3 4 Name Description XC XD XE XF Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE YF Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Y3 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. Precautions during programming (in the case of SCU) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target port for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (XC to XF) are ON for the corresponding channel, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a communication port where master communication is in progress. Confirm that the "master communication sending flags" (YC to YF) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a port where slave communication is in progress. · If there is no response, the "master communication sending flags" (YC to YF) remain ON during the time-out period set in the CPU configuration. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing COM ports. 15-21 High-level Instructions (Communication) Sample program (in the case of CPU with built-in ET-LAN) · This program sends the command from the LAN port of the CPU unit to write the content of PLC's data registers DT100 to DT101 into the data areas DT400 to DT401 of the external device. · This program checks that Connection 1 is established in the master mode (X90) and that sending is not in progress in the same port (Y90), and then starts up the SEND instruction. · The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1). · In the SEND instruction, specify and execute the source's starting address (DT100) and data amount (U2), the destination's station number (U1) and starting address (DT400). R0 R100 DF X90 Y90 Master Master communication communication clear to send flag sending flag UNITSEL R100 SEND execution U100 U1 S1 S2 SEND.US DT100 U2 S n U1 DT400 DT0 D1 D2 D3 SEND execution conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: CPU LAN port (U100) S2: Connection 1 (U1) SEND processing S: Data storage area (DT100) n: Sent data amount (U2) D1: Partner unit no. (U1) D2: Destination address (DT400) D3: Execution result code (DT0) Time chart (in the case of CPU with built-in ET-LAN) Master communication clear to send flag (X90 - X9F) Check that the flag is ON Master communication Check that the sending flag flag is OFF (Y90 - Y9F) Execute SEND SEND instruction executable conditions Clear to send flag (X90 - X9F): ON Sending flag (Y90 - Y9F): OFF Sending flag (Y90 - Y9F): While sending: ON ED instruction executed following response reception processing: OFF Master communication sent flag (Y70 - Y7F) Sending data Sent flag (Y70 - Y7F): Normal completion: OFF Abnormal completion: ON Response reception processing I/O allocation (in the case of CPU with built-in ET-LAN) I/O number Name Description X90 to X9F Master communication clear to send flag Turns ON when a connection is established in the master communication. Y90 to Y9F Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the ED instruction is executed after the completion of the response receive processing. Y70 to Y7F Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. 15-22 SEND (MEWTOCOL Master / MODBUS Master) Precautions during programming (in the case of CPU with built-in ET-LAN) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target connection number for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (X90 to X9F) are ON for the corresponding connection, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a connection where master communication is in progress. Confirm that the "master communication sending flags" (Y90 to Y9F) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a connection where slave communication is in progress. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing connections. · For communication between LAN ports of FP7, specify "U1" for the partner station number. The receiver is determined by the IP address. KEY POINTS · As the communication cassette (Ethernet type) has an Ethernet-serial conversion function, the internal interface operates with similar programs as the case of the CPU with built-in SCU. The setting method and programming method are different from those for the CPU with built-in ET-LAN. Refer to the section describing the case of SCU. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the sender range is out of the accessible range. COM port or connection specified by UNITSEL does not exist, or communication is not possible in the specified connection. SR7 SR8 (ER) Data device specified by [S] is invalid, or exceeds the area. Sent data amount specified by [n] is invalid. Station number specified by [D1] is out of the range. Data device specified by [D2] is invalid, or exceeds the area. Result storage device specified by [D3] is invalid. Integer specification for [D2] is only available for the MODBUS direct address specification type, and invalid for other types. Specified bit devices for [S] and [D2], and/or specified 16-bit device, differ. 15-23 High-level Instructions (Communication) RECV (MEWTOCOL Master / MODBUS Master) Ladder diagram R0 XC YC DF UNITSEL U0 U1 S1 S2 RECV.US U1 DT400 U2 DT100 DT0 i S1 S2 n D1 D2 (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Partner station number S2 Starting address of the device of the sender data area in the partner unit n Amount of received data D1 Starting address of the receiver data area in the master unit D2 Starting address of the device area in the master unit that stores the execution result code (1 word) Available word devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 Integer K U H Real number String Index modification SF DF " " S2(*1) n D1 D2 *1: When the sender is FP7, only global devices can be specified. (Local devices cannot be specified.) Available bit devices (: Available) Operand S1 Bit device X YRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification S2(*1) *2 *3 *3 n D1 D2 *1 When the sender is FP7, only global devices can be specified. (A local device cannot be specified.) *2 In the case of MODBUS mode, a bit device cannot be specified. *3 In the case of MEWTOCOL-COM mode or MODBUS mode, a bit device cannot be specified. Outline of operation · Commands are sent from the communication port of the unit to perform the data transmission with external devices. · Data can be read and written by specifying station numbers and memory addresses and executing the SEND and RECV instructions in a user program, because PLC automatically creates messages according to the protocol. · Communication mode should be selected in the configuration menu of the tool software FPWIN GR7. 15-24 RECV (MEWTOCOL Master / MODBUS Master) · When the RECV instruction is executed, the data is read from the address that starts with [S2] in the partner station number [S1] and the data is stored in the area that starts with [D1] in the master unit. · Depending on the type of device specified by [S2] and [D1], the transfer method (register transfer / bit transfer) varies. · The amount of received data [n] is specified in words for the register transfer, and in the number of bits for the bit transfer. · The execution result code is stored in 1 word of area within the master unit specified by [D2]. Specification of partner station number [S1] Communication mode When SCU is used When ET-LAN is used MEWTOCOL-COM MEWTOCOL-DAT (Note) 1 to 99, 238 (decimal) = EE (hexadecimal) 1 to 64, 238 (decimal) = EE Non-SCU-compliant (hexadecimal) (Note) MODBUS 1 to 255 1 to 255 (Note): For connection between FP7 and FP7, specify "1". Destination is determined by the IP address. Specification of starting address [S2] of the sender data area Transfer method Communication mode Address range MEWTOCOL-COM 0 to 99999 Register transfer MEWTOCOL-DAT 0 to 65535F MODBUS 0 to 65535 (H FFFF) MEWTOCOL-COM 0 to 999F Bit transfer MEWTOCOL-DAT 0 to 65535 (H FFFF) MODBUS 0 to 65535 (H FFFF) (Note): When the receiver is the file register FL, specify a constant. Example) For FL100, specify U100. For the file register, only bank 0 can be specified. Specification of the amount of received data [n] Transfer method Communication mode Types of communication port Setting range MEWTOCOL-COM 1 to 509 words RCC command and RD command are used. Register transfer *1 MEWTOCOL-DAT MODBUS 1 to 1020 words 1 to 2038 words 1 to 127 words Connection setting: Setting of the MEWTOCOL Communication type setting: Connect with FP2 ET-LAN Connection setting: Setting of the MEWTOCOL Communication type setting: Do not connect with FP2 ET-LAN For reading WY and WR, use Command 1. For reading WX, use Command 2. For reading DT, use Command 3. For reading WL and LD, use Command 4. Bit transfer *2 MEWTOCOL-COM MEWTOCOL-DAT MODBUS Fixed to 1 bit Fixed to 1 bit 1 to 2040 bits During MEWTOCOL-COM, RCS command is used. During MEWTOCOL-DAT, read contact information 53H is used. Command 1 is used for reading Y and R. Command 2 is used for X. *1 When 16-bit devices are specified for sender [S] and receiver [D2]. *2 When bit devices are specified for sender [S] and receiver [D2]. Execution result code [D2] Code Description Code Description H 0 Normal end H 6 Reception error (Note 1) H 1 The communication port is being used in the master communication. H 7 I/O allocation shortage error (Note 2) H 2 The communication port is being used in the slave communication. H41 Format error H 3 The number of master communication instructions simultaneously used is exceeded. H60 Parameter error H 4 Transmission timeout H61 Data error H 5 Response reception timeout H91 Missing expansion slave unit error (Note 1): It occurs when an abnormal telegram is received in the master communication. In the case of a format error in the header of an individual protocol, the communication discards the received data and a response reception timeout occurs. 15-25 High-level Instructions (Communication) (Note 2): It occurs when the communication control I/O relays corresponding to the communication port (master communication clear to send flag, master communication sending flag, master communication sending result relay) are not allocated as I/O words of the CPU unit in the I/O map. It occurs only when the number of user connections of ET-LAN is expanded and this instruction is executed specifying that expanded connections. Sample program (in the case of SCU) · This program sends the command from the COM1 port of the CPU unit, reads the data from the data areas DT400 to DT401 of the external device (station number 1), and writes the data into the data registers DT100 to DT101 of the PLC. · This program checks that the master mode is on (XC) and that sending is not in progress in the same port (YC), and then starts up the RECV instruction. · Using the UNITSEL instruction, specify the slot number (U0) and the COM. port number (U1). · In the RECV instruction, specify and execute the partner station number (U1), starting address (DT400), data amount (U2), and PLC's starting address to store the data (DT100). R0 R100 DF XC YC Master Master communication communication clear to send flag sending flag UNITSEL R100 RECV execution U0 U1 S1 S2 RECV execution start conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: Slot 0 S2COM1 RECV.US U1 DT400 U2 DT100 DT0 S1 S2 n D1 D2 RECV processing S1: Partner unit no. (U1) S2: Data address (DT400) n: Data amount (U2) D1: Data storage area (DT100) D2: Execution result code (DT0) Time chart (in the case of SCU) Master communication clear to send flag XC,XD,XE,XF Checks that the flag is ON Checks that the Master communication flag is OFF sending flag YC,YD,YE,YF RECV execution Master communication sent flag Y0,Y1,Y2,Y3 Data sending RECV Instruction executable conditions Clear to send flag (XC,XD,XE,XF): ON Sending flag (YC,YD,YE,YF): OFF Sending flag (YC,YD,YE,YF): While sending: ON, Sending done: OFF Sent flag (Y0,Y1,Y2,Y3): Normal completion: OFF Abnormal completion: ON Response reception processing 15-26 RECV (MEWTOCOL Master / MODBUS Master) KEY POINTS · The case of SCU shows the case that it is used in the following combination. - COM.0 port equipped in the CPU unit - Communication cassettes attached to the CPU unit (COM.1 to COM.2 ports) - Communication cassettes attached to the serial communication unit (COM.1 to COM.4 ports) · As the communication cassette (Ethernet type) has an Ethernet-serial conversion function, the internal interface operates with similar programs as the case of the CPU with built-in SCU. The setting method and programming method are different from those for the CPU with built-in ET-LAN. The communication cassette (Ethernet type) does not support MODBUS. I/O allocation (in the case of CPU with built-in SCU) COM Port No. 1 2 0 Name Description XC XD XE Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. I/O allocation (in the case of Serial Communication Unit) COM Port No. 1 2 3 4 Name Description XC XD XE XF Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE YF Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Y3 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. Precautions during programming (in the case of SCU) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target port for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (XC to XF) are ON for the corresponding channel, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a communication port where master communication is in progress. Confirm that the "master communication sending flags" (YC to YF) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a port where slave communication is in progress. · If there is no response, the "master communication sending flags" (YC to YF) remain ON during the time-out period set in the CPU configuration. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing COM ports. 15-27 High-level Instructions (Communication) Sample program (in the case of CPU with built-in ET-LAN) · This program sends the command from the LAN port of the CPU unit, reads the data from the data areas DT400 to DT401 of the external device, and writes the data into the data registers DT100 to DT101 of the PLC. · This program checks that Connection 1 is established in the master mode (X90) and that sending is not in progress in the same port (Y90), and then starts up the RECV instruction. · The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1). · In the RECV instruction, specify and execute the partner station number (U1), starting address (DT400), data amount (U2), and PLC's starting address to store the data (DT100). R0 R100 DF X90 Y90 Master Master communication communication clear to send flag sending flag UNITSEL R100 RECV execution U100 U1 S1 S2 RECV.US U1 DT400 U2 DT100 DT0 S1 S2 n D1 D2 RECV execution start conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: CPU LAN port (U100) S2: Connection 1 (U1) RECV processing S1: Partner station no. (U1) S2: Data address (DT400) n: Data amount (U2) D1: Data storage area (DT100) D2: Execution result code (DT0) Time chart (in the case of CPU with built-in ET-LAN) Master communication clear to send flag (X90 - X9F) Check that the flag is ON Master communication Check that the sending flag flag is OFF (Y90 - Y9F) Execute RECV RECV instruction executable conditions Clear to send flag (X90 - X9F): ON Sending flag (Y90 - Y9F): OFF Sending flag (Y90 - Y9F): While sending: ON ED instruction executed following response reception processing: OFF Master communication sent flag (Y70 - Y7F) Sent flag (Y70 - Y7F): Normal completion: OFF Abnormal completion: ON Sending data Response reception processing I/O allocation (in the case of CPU with built-in ET-LAN) I/O number Name Description X90 to X9F Master communication clear to send flag Turns ON when a connection is established in the master communication. Y90 to Y9F Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the ED instruction is executed after the completion of the response receive processing. Y70 to Y7F Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. 15-28 RECV (MEWTOCOL Master / MODBUS Master) Precautions during programming (in the case of CPU with built-in ET-LAN) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target connection number for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (X90 to X9F) are ON for the corresponding connection, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a connection where master communication is in progress. Confirm that the "master communication sending flags" (Y90 to Y9F) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a connection where slave communication is in progress. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing connections. · For communication between LAN ports of FP7, specify "U1" for the partner station number. The receiver is determined by the IP address. KEY POINTS · As the communication cassette (Ethernet type) has an Ethernet-serial conversion function, the internal interface operates with similar programs as the case of the CPU with built-in SCU. The setting method and programming method are different from those for the CPU with built-in ET-LAN. Refer to the section describing the case of SCU. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. COM port or connection specified by UNITSEL does not exist, or communication is not possible in the specified connection. SR7 SR8 (ER) Partner station number specified by [S1] is out of the range. Partner unit sender data device specified by [S2] is invalid. Sent data amount specified by [n] is invalid. Data device of the receiver data area in the master unit specified by [D1] is invalid, or exceeds the area. Result storage device specified by [D2] is invalid. Specified bit devices for [S2] and [D1], and/or specified 16-bit device, differ. Integer specification for [S2] is only available for the MODBUS address direct specification type, and invalid for other types. 15-29 High-level Instructions (Communication) SEND (MODBUS Master: Function Code Specification) Ladder diagram R0 XC YC DF UNITSEL U0 U1 S1 S2 SEND.US DT100 U10 H100A HFF DT0 i S n D1 D2 D3 (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Items Settings S Starting address of the sender data area n Amount of sent data MODBUS command to be used, and the partner station number D1 High byte MODBUS function code (two hexadecimal digits) Low byte Partner station number (two hexadecimal digits) D2 MODBUS starting address of the receiver data area of the partner unit D3 Starting address of the device area in the master unit that stores the execution result code (1 word) Setting range 1 to 127 words 1 to 2040 bits H5, H6, HF, H10 H0 to HFF (0 to 255) H0 to HFFFF (0 to 65535) - Available word devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S n D1 Integer K U H Real number String Index modification SF DF " " D2 *1 D3 *1: When the receiver is FP7, only global devices can be specified. (Local devices cannot be specified.) Available bit devices (: Available) Operand S n D1 D2 *1 Bit device X YRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modifier D3 15-30 SEND (MODBUS Master: Function Code Specification) Outline of operation · The MODBUS command is sent from the communication port of the unit to perform the data transmission with external devices. · Data can be read and written by specifying station numbers and memory addresses and executing the SEND and RECV instructions in a user program, because PLC automatically creates messages according to the protocol. · Communication mode should be selected in the configuration menu of the tool software FPWIN GR7. · Specify the MODBUS command to be used, and the partner MODBUS station number, in a Hex format in [D1]. · When the SEND instruction is executed, data are read from the device in the master unit, starting with [S], and stored in the address starting with [D2] of the partner unit. · The transfer method (register transfer/bit transfer) and the type of MODBUS command that can be used vary, depending on the type of device specified by [S] and data amount specified by [n]. · The amount of sent data [n] is specified in words for the register transfer, and in the number of bits for the bit transfer. · The execution result code is stored in 1 word of area within the master unit specified by [D3]. Specification of [S], [n] and [D1] · The transfer method and the MODBUS function code that can be used vary, depending on the type of device specified by the operand [S] and the sent data amount specified by [n]. Types of device to be specified for [S] Transfer method 16-bit device WX, WY, WR, WL, DT, LD Register transfer 1-bit device X, Y, R, L, DT.n, LD.n Bit transfer Amount of sent data [n] 1 2 to 127 1 2 to 2040 Value that can be specified for high bytes of [D1] H6: Preset single register (06) HF: Force multiple coils (15) H10: Preset multiple registers (16) HF: Force multiple coils (15) H10: Preset multiple registers (16) H5: Force single coil (05) HF: Force multiple coils (15) HF: Force multiple coils (15) · The amount of sent data [n] is specified in words for the register transfer, and in bits for the bit transfer. · Operand [D1] is specified as a combination of a two-digit hexadecimal MODBUS function code and a two-digit hexadecimal partner station number. Example: Specify "H100A" in the case of MODBUS function code 16 (preset multiple registers) and station number 10. · In the case of SCU, when "0" is specified for the partner station number, global transfer is selected. At this time, there is no response message from the partner. Execution result code [D3] Code Description Code Description H 0 Normal end H 6 Reception error (Note 1) H 1 The communication port is being used in the master communication. H 7 I/O allocation shortage error (Note 2) H 2 The communication port is being used in the slave communication. H8001 Function code error H 3 The number of master communication instructions simultaneously used is exceeded. H8002 Device number error (out of range) H 4 Transmission timeout H8003 Device quantity error (out of range) H 5 Response reception timeout (Note 1): It occurs when an abnormal telegram is received in the master communication. In the case of a format error in the header of an individual protocol, the communication discards the received data and a response reception timeout occurs. (Note 2): It occurs when the communication control I/O relays corresponding to the communication port (master communication clear to send flag, master communication sending flag, master communication sending result relay) are not allocated as I/O words of the CPU unit in the I/O map. It occurs only when the number of user connections of ET-LAN is expanded and this instruction is executed specifying that expanded connections. 15-31 High-level Instructions (Communication) Sample program (in the case of SCU) · This program sends the command from the COM1 port of the CPU unit, and then writes the content of PLC's data registers DT100 to DT101 into the data areas 400001 to 400002 of the external device (station number 1). · This program checks that the master mode is on (XC) and that sending is not in progress in the same port (YC), and then starts up the SEND instruction. · Using the UNITSEL instruction, specify the slot number (U0) and the COM. port number (U1). · In the SEND instruction, specify and execute PLC's starting address (DT100) and data amount (U2), MODBUS function code to be used (16: H10), and partner station number (H01) and starting address (H0). Check addresses of connected devices in the instruction manuals of devices. R0 R100 DF XC YC Master Master communication communication clear to send flag sending flag UNITSEL R100 SEND execution U0 U1 S1 S2 SEND.US DT100 U2 H1001 H0 DT0 S n D1 D2 D3 SEND execution conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: Slot 0 (U0) S2: COM1 (U1) SEND processing S: Data storage area (DT100) n: Sent data amount (U2) D1: MODBUS code (H10) and Partner station no. (H01) D2: Destination address (H0) D3: Execution result code (DT0) (Note 1): Operand [D1] of SEND instruction is specified by combining two hexadecimal digits of MODBUS function code with two hexadecimal digits of partner device station number. When the MODBUS function code is 16, [D1] H10 should be specified. (Note 2): When the partner device is FP series PLC, Operand [D2] of SEND instruction can be specified using the device number. Time chart (in the case of SCU) Master communication clear to send flag (XC, XD, XE, XF) Check that the flag is ON Master communication Check that the sending flag flag is OFF (YC, YD, YE, YF) Execute SEND Master communication sent flag (Y0, Y1, Y2, Y3) Sending data SEND instruction executable conditions Clear to send flag (XC, XD, XE, XF): ON Sending flag (YC, YD, YE, YF): OFF Sending flag (YC, YD, YE, YF): While sending: ON; Sending done: OFF Sent flag (Y0, Y1, Y2, Y3): Normal completion: OFF Abnormal completion: ON Response reception processing KEY POINTS · The case of SCU shows the case that it is used in the following combination. - COM.0 port equipped in the CPU unit - Communication cassettes attached to the CPU unit (COM.1 to COM.2 ports) - Communication cassettes attached to the serial communication unit (COM.1 to COM.4 ports) · The communication cassette (Ethernet type) does not support MODBUS. 15-32 SEND (MODBUS Master: Function Code Specification) I/O allocation (in the case of CPU with built-in SCU) COM Port No. 1 2 0 Name Description XC XD XE Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. I/O allocation (in the case of Serial Communication Unit) COM Port No. 1 2 3 4 Name Description XC XD XE XF Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE YF Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Y3 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. Precautions during programming (in the case of SCU) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target port for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (XC to XF) are ON for the corresponding channel, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a communication port where master communication is in progress. Confirm that the "master communication sending flags" (YC to YF) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a port where slave communication is in progress. · If there is no response, the "master communication sending flags" (YC to YF) remain ON during the time-out period set in the CPU configuration. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing COM. ports. 15-33 High-level Instructions (Communication) Sample program (in the case of CPU with built-in ET-LAN) · This program sends the MODBUS command (16) from the LAN port of the CPU unit, and then writes the content of PLC's data registers DT100 to DT101 into the data areas 400001 to 400002 of the external device (MODBUS addresses 0000H to 0001H). · This program checks that Connection 1 is established in the master mode (X90) and that sending is not in progress in the same port (Y90), and then starts up the SEND instruction. · The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1). · In the SEND instruction, specify and execute PLC's starting address (DT100) and data amount (U2), MODBUS command (16 = H10), and partner station number (H01) and starting address (H0). Check addresses of connected devices in the instruction manuals of devices. R0 R100 DF X90 Y90 Master Master communication communication clear to send flag sending flag UNITSEL U100 S1 R100 SEND execution relay U1 S2 SEND.US DT100 U2 H1001 H0 DT0 S n D1 D2 D3 SEND execution conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: CPU LAN port (U100) S2: Connection 1 (U1) SEND instruction execution S: Data storage area (DT100) n: Sent data amount (U2) D1: MODBUS command (H10) Partner unit no. (H01) D2: Destination address (H0) D3: Execution result code (DT0) Time chart Master communication clear to send flag (X90 - X9F) Check that the flag is ON Master communication Check that the sending flag flag is OFF (Y90 - Y9F) Execute SEND SEND instruction executable conditions Clear to send flag (X90 - X9F): ON Sending flag (Y90 - Y9F): OFF Sending flag (Y90 - Y9F): While sending: ON ED instruction executed following response reception processing: OFF Master communication sent flag (Y70 - Y7F) Sending data Sent flag (Y70 - Y7F): Normal completion: OFF Abnormal completion: ON Response reception processing I/O allocation I/O number Name Description X90 to X9F Master communication clear to send flag Turns ON when a connection is established in the master communication. Y90 to Y9F Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the ED instruction is executed after the completion of the response receive processing. Y70 to Y7F Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. 15-34 SEND (MODBUS Master: Function Code Specification) Precautions during programming (in the case of CPU with built-in ET-LAN) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target connection number for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (X90 to X9F) are ON for the corresponding connection, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a connection where master communication is in progress. Confirm that the "master communication sending flags" (Y90 to Y9F) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a connection where slave communication is in progress. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing connections. · In the MODBUS-TCP mode, specify the partner station number as operand for the SEND/RECV instruction. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the sender range is out of the accessible range. COM port or connection specified by UNITSEL does not exist, or communication is not possible in the specified connection. SR7 SR8 (ER) Data device specified by [S] is invalid, or exceeds the area. Sent data amount specified by [n] is invalid. MODBUS command and/or station number specified by [D1] is invalid. Data device specified by [D2] is invalid, or exceeds the area. Result storage device specified by [D3] is invalid. Integer specification for [D2] is only available for the MODBUS address direct specification type, and invalid for other types. Result storage device specified by [D3] is invalid. 15-35 High-level Instructions (Communication) RECV (MODBUS Master: Function Code Specification) Ladder diagram R0 XC YC DF UNITSEL U0 U1 S1 S2 RECV.US H30F HFF U10 DT100 DT0 i S1 S2 n D1 D2 (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Items Settings MODBUS function code to be used, and the partner station number S1 High byte MODBUS function code (two hexadecimal digits) Low byte Partner station number (two hexadecimal digits) S2 MODBUS starting address of the sender in the partner unit n Amount of received data D1 Device starting address of the receiver data area in the master unit D2 Starting address of the device area in the master unit that stores the execution result code (1 word) Setting range H1 to H4 (1 to 4) H1 to HFF (1 to 255) H0 to HFFFF (0 to 65535) 1 to 127 words 1 to 2040 bits - Available word devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 n Integer K U H Real number String Index modification SF DF " " *1 D1 D2 *1: Only in the case of "direct address specification" (main instruction) in the MODBUS mode, an integer can be specified for the sender address. Available bit devices (: Available) Operand Bit device X Y R L T C P E SR IN OT Specification of bit of word device DT.n LD.n Index modification S1 S2 n D1 D2 15-36 RECV (MODBUS Master: Function Code Specification) Outline of operation · The MODBUS command is sent from the communication port of the unit to send/receive data to/from external devices. · Data can be read and written by specifying station numbers and memory addresses and executing the SEND and RECV instructions in a user program, because PLC automatically creates messages according to the protocol. · Specify the MODBUS command and the partner MODBUS address in a Hex format in [S1]. · When the RECV instruction is executed, data are read from the address starting with [S2] in the partner unit, and stored in the area starting with [D1] in the master unit. · The transfer method (register transfer/bit transfer) and the MODBUS function code that can be used vary, depending on the type of device specified by [D1]. · The amount of received data [n] is specified in words for the register transfer, and in the number of bits for the bit transfer. · The execution result code is stored in 1 word of area within the master unit specified by [D2]. Specification of [S1] and [n] · Operand [S1] is specified as a combination of a two-digit hexadecimal MODBUS function code and a two-digit hexadecimal partner station number. Example: Specify "H030F" in the case of MODBUS function code 03 (read holding registers) and station number 15. · The transfer method and the MODBUS function code that can be used vary, depending on the type of device specified by the operand [D1]. Device to be specified for [D1] Transfer method 16-bit device WX, WY, WR, WL, DT, LD Register transfer 1-bit device X, Y, R, L, DT.n, LD.n Bit transfer Value that can be specified for high bytes of [S1] H1: Read coil status (01) H2: Read input status (02) H3: Read holding registers (03) H4: Read input registers (04) H1: Read coil status (01) H2: Read input status (02) · The amount of received data is specified in words for the register transfer, and in bits for the bit transfer. Execution result code [D2] Code Description Code Description H 0 Normal end H 6 Reception error (Note 1) H 1 The communication port is being used in the master communication. H 7 I/O allocation shortage error (Note 2) H 2 The communication port is being used in the slave communication. H8001 Function code error H 3 The number of master communication instructions simultaneously used is exceeded. H8002 Device number error (out of range) H 4 Transmission timeout H8003 Device quantity error (out of range) H 5 Response reception timeout (Note 1): It occurs when an abnormal telegram is received in the master communication. In the case of a format error in the header of an individual protocol, the communication discards the received data and a response reception timeout occurs. (Note 2): It occurs when the communication control I/O relays corresponding to the communication port (master communication clear to send flag, master communication sending flag, master communication sending result relay) are not allocated as I/O words of the CPU unit in the I/O map. It occurs only when the number of user connections of ET-LAN is expanded and this instruction is executed specifying that expanded connections. 15-37 High-level Instructions (Communication) Sample program (in the case of SCU) · This program sends the command from the COM1 port of the CPU unit, reads the data from the data areas 400001 to 400002 of the external device (station number 1), and writes the data into the data registers DT100 to DT101 of the PLC. · This program checks that the master mode is on (XC) and that sending is not in progress in the same port (YC), and then starts up the RECV instruction. · Using the UNITSEL instruction, specify the slot number (U0) and the COM. port number (U1). · In the RECV instruction, specify and execute the partner station number (U1), MODBUS command to be used and partner station number (H0301), starting address (400001), data amount (U2), and PLC's starting address to store the data (DT100). Check addresses of connected devices in the instruction manuals of devices. R0 R100 DF XC YC Master Master communication communication clear to send flag sending flag UNITSEL R100 RECV execution U0 U1 S1 S2 RECV.US H0301 H0 S1 S2 U2 DT100 DT0 n D1 D2 RECV execution start conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: Slot 0 (U0) S2: COM1 (U1) RECV processing S1: MODBUS code (H03) and partner station no. (H01) S2: Partner station address (H0) (H0: Respond to 400001) n: Data amount (U2) D1: Data storage area (DT100) D2: Execution result code (DT0) (Note 1): Operand [S1] of RECV instruction is specified by combining two hexadecimal digits of MODBUS function code with two hexadecimal digits of partner device station number. (Note 2): When the partner device is FP series PLC, Operand [S2] of RECV instruction can be specified using the device number. Time chart (in the case of SCU) Master communication clear to send flag XC,XD,XE,XF Checks that the flag is ON Checks that the Master communication flag is OFF sending flag YC,YD,YE,YF RECV execution Master communication sent flag Y0,Y1,Y2,Y3 Data sending RECV Instruction executable conditions Clear to send flag (XC,XD,XE,XF): ON Sending flag (YC,YD,YE,YF): OFF Sending flag (YC,YD,YE,YF): While sending: ON, Sending done: OFF Sent flag (Y0,Y1,Y2,Y3): Normal completion: OFF Abnormal completion: ON Response reception processing KEY POINTS · The case of SCU shows the case that it is used in the following combination. - COM.0 port equipped in the CPU unit - Communication cassettes attached to the CPU unit (COM.1 to COM.2 ports) - Communication cassettes attached to the serial communication unit (COM.1 to COM.4 ports) · The communication cassette (Ethernet type) does not support MODBUS. 15-38 RECV (MODBUS Master: Function Code Specification) I/O allocation (in the case of CPU with built-in SCU) COM Port No. 1 2 0 Name Description XC XD XE Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. I/O allocation (in the case of Serial Communication Unit) COM Port No. 1 2 3 4 Name Description XC XD XE XF Master communication clear to send flag Turns ON when MEWTOCOL-COM, MEWTOCOL7, or MODBUS-RTU is set for the communication mode, and the unit is in the RUN mode. YC YD YE YF Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the sending process is completed. Y0 Y1 Y2 Y3 Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. Precautions during programming (in the case of SCU) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target port for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (XC to XF) are ON for the corresponding channel, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a communication port where master communication is in progress. Confirm that the "master communication sending flags" (YC to YF) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a port where slave communication is in progress. If there is no response, the "master communication sending flags" (YC to YF) remain ON during the time-out period set in the CPU configuration. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing COM ports. 15-39 High-level Instructions (Communication) Sample program (in the case of CPU with built-in ET-LAN) · This program sends MODBUS commands (03) from the LAN port of the CPU unit, reads the data from the data area of an external device 400001 to 400002 (MODBUS address 0000H to 0001H), and writes the content into PLC's data register DT100 to DT101. · This program checks that Connection 1 is established in the master mode (X90) and that sending is not in progress in the same port (Y90), and then starts up the RECV instruction. · The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1). · In the RECV instruction, specify and execute the type of MODBUS command and partner station number (H0301), starting address (H0), data amount (U2), and PLC's starting address to store the data (DT100). Check addresses of connected devices in the instruction manuals of devices. R0 R100 DF X90 Master communication clear to send flag Y90 Master communication sending flag UNITSEL R100 RECV execution U100 U1 S1 S2 RECV.US H301 H0 S1 S2 U2 DT100 DT0 n D1 D2 RECV execution start conditions Clear to send flag: ON Sending flag: OFF Settings for the communication port S1: CPU LAN port (U100) S2: Connection 1 (U1) RECV instruction execution S1: MODBUS command (H03) Partner station no. (H01) S2: Data address (H0) n: Data amount (U2) D1: Data storage area (DT100) D2: Execution result code (DT0) Time chart (in the case of CPU with built-in ET-LAN) Master communication clear to send flag (X90 - X9F) Check that the flag is ON Master communication Check that the sending flag flag is OFF (Y90 - Y9F) Execute RECV RECV instruction executable conditions Clear to send flag (X90 - X9F): ON Sending flag (Y90 - Y9F): OFF Sending flag (Y90 - Y9F): While sending: ON ED instruction executed following response reception processing: OFF Master communication sent flag (Y70 - Y7F) Sent flag (Y70 - Y7F): Normal completion: OFF Abnormal completion: ON Sending data Response reception processing I/O allocation (in the case of CPU with built-in ET-LAN) I/O number Name Description X90 to X9F Master communication clear to send flag Turns ON when a connection is established in the master communication. Y90 to Y9F Master communication sending flag Turns ON during sending data based on SEND/RECV instruction. Turns OFF when the ED instruction is executed after the completion of the response receive processing. Y70 to Y7F Sent flag Reports completion result of sending data in genera-purpose communication or master communication. (Normal completion: 0, Abnormal completion: 1) (Note 1): Each contact is used for reading the operation state. Do not write over it with a user program. 15-40 RECV (MODBUS Master: Function Code Specification) Precautions during programming (in the case of CPU with built-in ET-LAN) · Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target connection number for communication. · Master communication is only enabled when MEWTOCOL or MODBUS is selected. Confirm that the "master communication clear to send flags" (X90 to X9F) are ON for the corresponding connection, and execute the SEND/RECV instruction. · Another SEND/RECV instruction cannot be executed for a connection where master communication is in progress. Confirm that the "master communication sending flags" (Y90 to Y9F) are OFF, and execute the instruction. · A SEND/RECV instruction cannot be executed for a connection where slave communication is in progress. · Up to 16 SEND/RECV instructions can be executed simultaneously for differing connections. · In the MODBUS-TCP mode, specify the partner station number as operand for the SEND/RECV instruction. Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. COM port or connection specified by UNITSEL does not exist, or communication is not possible in the specified connection. SR7 SR8 (ER) Partner station number specified by [S1] is out of the range. Partner unit sender data device specified by [S2] is invalid. Sent data amount specified by [n] is invalid. Data device of the receiver data area in the master unit specified by [D1] is invalid, or exceeds the area. Result storage device specified by [D2] is invalid. Integer specification for [S2] is only available for the MODBUS address direct specification type, and invalid for other types. 15-41 High-level Instructions (Communication) PMSET / pPMSET (Change of SCU Parameters) Ladder diagram R0 UNITSEL U0 U1 S1 S2 PMSET DT0 U12 DT100 S n D (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. List of operands Operand Description S Start of the area that stores data to be set as communication parameters n Specified number of words Other than PLC link mode (setting range: 1 to 12). PLC link mode (setting range: 1 to 26) D Starting address of the device area in the master unit that stores the processing result (1 word) Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S n D Integer K U H Real number String Index modification SF DF " " Outline of operation · Communication parameters of the COM port of the unit is changed with a user program. · This instruction sets the communication parameters to be changed within [n] words from the area starting with [S], and then executes the PMSET/pPMSET instruction to issue the setting change request to the unit. · While the requested change is being processed, bit 15 of the processing result storage area [D] turns ON. When the process is completed, it turns OFF. · The processing result is stored in the area specified by [D]. If there is any abnormality, bit 14 of [D] turns ON. The error code is stored in low bytes of [D]. · By reading setting parameters using the PMGET instruction, and setting parameters to be changed using the PMSET/pPMSET instruction, the settings can be simplified. Precautions during programming · Describe UNITSEL instruction immediately before the PMSET/pPMSET instruction, and specify the slot and COM port numbers of the unit the parameters of which are changed. · Checking of the processing result should be carried out when bit 15 (process in-progress flag) of the area specified by [D] is switched from 1 to 0. · If parameter change is carried out for a COM port where sending/receiving is in progress, the sending/receiving process is canceled and parameters are changed. At this time, received data are lost. The sending process is suspended. · The content set by PMSET/pPMSET instruction is not held in case of power outage. Turn on the power supply again and switch to RUN mode to return to the configuration information set in the tool software. · It is not possible to change the mode from other than the PLC link mode to the PLC link mode. · When changing the station number, make sure that the new number does not duplicate the number for any other device. 15-42 PMSET / pPMSET (Change of SCU Parameters) Comparison between the PMSET instruction and the pPMSET instruction Instruction Characteristics The processing result is checked during the operation processing of the PMSET instruction. (Note 1) PMSET Advantages Disadvantages The PMSET instruction can be executed without any restrictions for different COM ports. It is necessary to turn ON the execution condition of the PMSET instruction until the end of processing, and turn OFF the execution condition at the scan in which the end of data transmission is confirmed. The processing result is checked at the end of a scan. (Note 1) pPMSET (Note 1) Advantages Disadvantages The parameter change processing is performed only once by turning on the execution condition at the time of data send. Up to 16 send operations can be performed simultaneously to different COM ports. (The total of simultaneous usage of SEND, RECV, pGPSEND, GPTRNS, and pPMSET instructions.) (Note 1): Checking of the processing result means that the result of the parameter change processing is stored in [D]. Parameter settings Operand Parameter Range Settings [S] [S+1] [S+2] [S+3] U0 U1 Communication mode U2 U8 U9 Station number setting U1 to U999 Baud rate setting Data length setting U0 to U10 U0, U1 U0: MEWTOCOL-COM U1: MEWTOCOL7-COM U2: MODBUS-RTU U8: General-purpose communication U9: PLC link (only station number can be changed) Station number U1 to U999 MEWTOCOL-COM: U1 to U99 MEWTOCOL7-COM: U1 to U999 MODBUS-RTU: U1 to U247 PLC link: U1 to U16 (Default: 0) U0: 300, U1: 600, U2: 1200, U3: 2400, U4: 4800, U5: 9600, U6: 19200, U7: 38400, U8: 57600, U9: 115200, U10: 230400 bps U0: 7-bit length, U1: 8-bit length [S+4] [S+5] Parity setting Stop bit length setting U0 to U2 U0, U1 U0: No parity, U1: Odd parity, U2: Even parity U3: Parity fixed to 0 (Note 3) U0: 1 bit, U1: 2 bits [S+6] [S+7] RS/CS enabled or disabled (Note 1) Send waiting time U0, U1 U0 to U10000 U0: Disable, U1: Enable U0: Immediate Effective time = Un x 0.01 ms (0 to 100 ms) [S+8] Start code STX U0, U1 U0: Disable, U1: Enable [S+9] Terminator setting U0 to U3 U0: cR; U1: cR+Lf; U2: Time; U3: ETX [S+10] [S+11] Terminator judgement time U0 to U10000 Modem initialization U0 to U2 U0: For 32 bits Effective time = Un × 0.01 ms (Only enabled when the end setting is "Time".) U0: Not initialize U1: Execute the first initialization only (Note 2) U2: Re-execute initialization at the time of setting. [S+12] Reserved area U0 U0 [S+13] Communication option U0, U1 bit 0: Used to select whether to continue or stop the PLC link. 0 = The PLC link stops when a communication error occurs. 1 = The PLC link continues even when a communication error occurs. bit 1 to 15: Reserved (Note 1): RS/CS can be selected only when a 1-channel, 5-wire communication cassette (product number AFP7CCS2) is used. (Note 2): The modem is initialized when the power is on, PMSET/pPMSET instruction is executed, and the RUN mode is turned ON. Initialization is executed only in the first session. (Excluding when the power supply is turned off and then on again.) (Note 3): U3 can be specified only for a built-in SCU. In addition, parity bit is fixed to 0 when data is sent, and the parity bit is not checked when data is received. 15-43 High-level Instructions (Communication) PLC link W0 setting (Setting is enabled when the communication mode is set to the PLC link mode; only COM1 is enabled) Operand [S+14] [S+15] [S+16] [S+17] [S+18] [S+19] [S+20] [S+21] [S+22] [S+23] [S+24] [S+25] Parameter Link area block number PLC link W0 maximum station number Range of link relays Range U0, U1 U2 to U16 U0 to U64 Range of link registers U0 to U128 Link relay sending start number Size of link relay send area Link register sending start number Size of link register send area Reserved area Reserved area Reserved area Reserved area U0 to U63 U0 to U64 U0 to U127 U0 to U127 U0 U0 U0 U0 Settings Block number of link relay/link register area PLC link W0 maximum station number Specify the range of link relays used for communication (specification by number of words, relative values within the specified block) Specify the range of link registers used for communication (relative values within the specified block) Link relay sending start number (specification by number of words, relative value within the specified block) Size of link relay send area (specification by number of words) Link register sending start number (specification by number of words, relative value within the specified block) Size of link register send area (specification by number of words) Content of the processing result [D] · Execution results are stored in the area of 1 word. · The execution result code in the low byte is valid when the process in-progress flag of bit 15 is zero. bit no. 15 8 7 0 000000 Process in-progress flag 0: Process done 1: In-progress Execution result flag 0: Normal completion 1: Abnormal completion Execution result code 0: Normal completion 1: The communication port specified by UNITSEL instruction is invalid 2: Setting error 3: Mode change error 4: Communication port occupied 5: Change request parameter inconsistency (At the start/end of the setting process, parameters specified by operands are inconsistent) 6: 16 or more SEND, RECV, GPTRNS, pGPSEND, and pPMSET instructions are used simultaneously. Note 1 (Note 1): Execution result code "6" is enabled for the pPMSET instruction. Program example 1 (PMSET instruction) · This program sets 12 words of communication parameters for COM1 port of CPU with built-in SCU, which are stored in the area starting with Data Register DT0. The processing result is stored in DT100. · For the PMSET instruction, it is necessary to turn ON the execution condition of the PMSET instruction until the end of processing, and turn OFF the execution condition at a scan in which the end of data transmission is confirmed. R0 DF R1 SET R1 UNITSEL U0 U1 S1 S2 PMSET DT0 S U12 DT100 n D R1 DT100.F DF/ R1 RST 15-44 PMSET / pPMSET (Change of SCU Parameters) DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 DT11 U 0 Communication mode U 1 Unit no. setting U 5 Baud rate setting U 1 Data length setting U 1 Parity setting U 0 Stop bit length setting U 0 RS/CS valid or invalid U 0 Send waiting time U 0 Header STX U 0 Terminator setting U 0 Terminator judgment time U 0 Modem initialization Higher byte Lower byte DT100 H 0 H 0 Processing result ('0' for normal completion) Program example 2 (pPMSET instruction) · This program sets 12 words of communication parameters for COM1 port of CPU with built-in SCU, which are stored in the area starting with Data Register DT0. The processing result is stored in DT100. · For the pPMSET instruction, the parameter change processing is performed only once at the leading edge when the execution condition turns ON. R1 UNITSEL U0 U1 S1 S2 pPMSET DT0 S U12 DT100 n D R1 RST Program example 3 (PMSET instruction, specification by PLC link parameter) · This program sets 26 words of communication parameters for COM1 port of CPU with built-in SCU, which are stored in the area starting with Data Register DT0. The processing result is stored in DT100. · For the PMSET instruction, it is necessary to turn ON the execution condition of the PMSET instruction until the end of processing, and turn OFF the execution condition at a scan in which the end of data transmission is confirmed. R0 DF R1 SET R1 UNITSEL U0 U1 S1 S2 PMSET DT0 S R1 DT100.F DF/ U26 DT100 n D R1 RST 15-45 High-level Instructions (Communication) DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 DT20 DT21 DT22 DT23 DT24 DT25 DT100 U 9 U 1 U 5 U 1 U 1 U 0 U 0 U 0 U 0 U 0 U 0 U 0 U 0 U 0 U 0 U 16 U 32 U 64 U 0 U 19 U 0 U 32 U 0 U 0 U 0 U 0 Communication mode Station number setting Baud rate setting Data length setting Parity setting Stop bit length setting RS/CS enabled or disabled Send waiting time Start code STX Terminator setting Terminator judgement time Modem initialization Reserved area Communication option Link area block number PLC link W0 maximum station number Range of link relays Range of link registers Link relay sending start number Size of link relay send area Link register sending start number Size of link register send area Reserved area Reserved area Reserved area Reserved area High byte Low byte H 0 H 0 Processing result ('0' for normal completion) Flag operations Name Description To be set in case of out-of-range in indirect access (index modification). SR7 SR8 (ER) To be set when the COM port specified by UNITSEL does not exist. To be set when the device specified for [S] to set the parameters is invalid. To be set when the number of words specified by [n] is out of the available range. To be set when the device specified for [D] to store the processing result is invalid. 15-46 PMGET (Acquiring SCU Parameters) PMGET (Acquiring SCU Parameters) Ladder diagram R0 UNITSEL U0 U1 S1 S2 PMGET U1 DT0 S D (Note): The above figure shows the case that S1=U0 (CPU unit with built-in SCU) and S2=U1 (port number 1) are specified by the UNITSEL instruction. List of operands Operand Description Types of data to be acquired: S 0: Communication parameters; 1: Communication monitoring area information; 2: PLC link status flag information; 3: PLC link error frequency information; 4: PLC link time interval information; 5: PLC link settings parameter monitoring information D Starting address of the area to store the acquired communication parameters (monitoring information) Available devices (: Available) 16-bit 32-bit Operand device device WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · This instruction reads the parameters of the COM port of the unit, and stores them in the area starting with [D]. · Specify the type of acquired data for [S]. Precautions during programming · Describe the UNITSEL instruction immediately before the PMGET instruction, and specify the slot and COM port numbers of the unit for which the parameters are acquired. · The size of the area that stores data varies in the range of 7 to 192 words according to the data type specified in [S]. Value of [S] 0 1 2 3 4 5 Types of data to be acquired Communication parameter Communication monitoring area information PLC link status flag information PLC link error frequency information PLC link time interval information PLC link settings parameter monitoring information Amount of stored data 26 words 7 words 8 words 9 words 8 words 192 words 15-47 High-level Instructions (Communication) Acquired data (communication parameters): When [S] = 0 Storage location Items Range Description U0 U1 [D] Communication mode U2 U8 U9 U0: MEWTOCOL-COM U1: MEWTOCOL7-COM U2: MODBUS-RTU U8: General-purpose communication U9: PLC link [D+1] Station number setting U1 to U999 Station number U1 to U999 MEWTOCOL-COM: U1 to U99 MEWTOCOL7-COM: U1 to U999 MODBUS-RTU: U1 to U247 PLC link: U1 to U16 (Default: 0) [D+2] Baud rate setting U0 to U10 U0: 300, U1: 600, U2: 1200, U3: 2400, U4: 4800, U5: 9600, U6: 19200, U7: 38400, U8: 57600, U9: 115200, U10: 230400 bps [D+3] Data length setting U0, U1 U0: 7-bit length, U1: 8-bit length [D+4] Parity setting U0 to U2 U0: No parity, U1: Odd parity, U2: Even parity, U3: Parity fixed to 0 [D+5] Stop bit length setting U0, U1 U0: 1 bit, U1: 2 bits [D+6] RS/CS enabled or disabled (Note 1) U0, U1 U0: Disable, U1: Enable [D+7] Send waiting time U0 to 10000 U0: Immediate Effective time = Un x 0.01 ms (0 to 100 ms) [D+8] Start code STX U0, U1 U0: Disable, U1: Enable [D+9] Terminator setting U0 to U3 U0: CR, U1: CR+LF, U2: Time, U3: ETX [D+10] Terminator judgement time U0 to U10000 U0: For 32 bits Effective time = Un × 0.01 ms (Only enabled when the Terminator setting is "Time".) [D+11] Modem initialization U0 to U2 U0: Not initialize U1: Execute the first initialization only (Note 2) U2: Re-execute initialization at the time of setting. [D+12] to [D+13] Reserved for system U0 Reserved area for system [D+14] Link area block number U0,U1 Block number of link relay/link register area [D+15] PLC link W0 maximum station number U2 to U16 Values out of the range are handled as "16". [D+16] Range of link relays U0 to U64 Specify the range of link relays used for communication (specification by number of words, relative values within the specified block) [D+17] Range of link registers U0 to U128 Specify the range of link registers used for communication (relative values within the specified block) [D+18] Link relay sending start number U0 to U63 Link relay sending start number (specification by number of words, relative value within the specified block) [D+19] Size of link relay send area U0 to U64 Size of link relay send area (specification by number of words) [D+20] Link register sending start number U0 to U127 Link register sending start number (specification by number of words, relative value within the specified block) [D+21] Size of link register send area U0 to U127 Size of link register send area (specification by number of words) [D+22] to [D+25] Reserved for system U0 Reserved area for system (Note 1): RS/CS can be selected only when an RS-232C (5-wire) x 1-channel communication cassette (product number AFP7CCS2) is used. (Note 2): The modem is initialized at the time of setting (when the power is on, PMGET instruction is executed, or switching to the RUN mode). Initialization is executed only in the first session. (Excluding when the power supply is turned off and then on again.) (Note 3): Settings of [D+14] to [D+21] are only enabled when the communication mode of the COM1 port is PLC link. 15-48 PMGET (Acquiring SCU Parameters) Acquired data (communication monitoring area information): When [S] = 1 Storage location Items Range Description U0 U0: MEWTOCOL-COM U1 U1: MEWTOCOL7-COM [D] Operation mode U2 U8 U2: MODBUS-RTU U8: General-purpose communication U9 U9: PLC link HFFFF HFFFF: Modem initialization [D+1] Communication cassette detection U0 U232 U422 U485 U0: No communication cassette U 232: RS-232C U 422: RS-422 U 485: RS-485 [D+2] Reception error code - The bits corresponding to when an error occurs turn ON. (0: Normal, 1: Error) Bit 0: Receive buffer overrun Bit 1: Stop bit undetected (frame error) Bit 2: Parity inconsistency Bit 7 to 3: 0 (fixed) Bit 8: Receive buffer overflow Bit 9: Receive buffer FULL Bit 15 to 10: 0 (fixed) [D+3] Number of occurrences of reception error U0 to U65535 The number of times reception errors were detected is stored. [D+4] Setting error code - The bits corresponding to when an error occurs turn ON. (0: Normal, 1: Error) Bit 0: Mode setting/change abnormality (A mode number that cannot be set or changed is specified) Bit 7 to 1: 0 (fixed) Bit 8: Communication parameters setting error Bit 9: Sent data amount abnormality Bit 15 to 10: 0 (fixed) [D+5] Error parameter number U1 to U12 Parameter number which data outside the range is specified (Effective only when the communication parameter setting error occurs.) [D+6] Modem initialization status H0000 H0100 H0200 H02FF No operation During initialization Initialization succeeded (When modem initialization is completed, the operation mode automatically returns to its original state.) Initialization failed (When modem initialization is completed, the operation mode automatically returns to its original state.) 15-49 High-level Instructions (Communication) Acquired data (PLC link status flag information): When [S] = 2 Storage location Items Range Description U1 to U999 MEWTOCOL-COM: U1 to U99 [D] Master unit number U1 to U999 MEWTOCOL7-COM: U1 to U999 MODBUS-RTU: U1 to U247 PLC link: U1 to U16 (Default: 0) [D+1] Error flag 1 H0000 to H00DF Bit 0: Transmission error (0 = Normal, 1 = Transmission error) Bit 1: Station number overlap (0 = Normal, 1 = Error) Bit 2: Area overlap (0 = Normal, 1 = Error) Bit 3: Link error (0 = Normal, 1 = Error) Bit 4: Maximum station number inconsistency (0 = Normal, 1 = Error) Bit 5: Fixed to 0 Bit 6: Link stop (0 = Operating, 1 = Stop status) Bit 7: Initializing (0 = Regular, 1 = Initializing) Bit 15 to 8: Not used [D+2] Error flag 2 H0000 to H00FF Bit 0: Lost token (0 = Normal, 1 = Error) Bit 1: Duplicate token (0 = Normal, 1 = Error) Bit 2: Lost signal (0 = Normal, 1 = Error) Bit 3: Reception of undefined command Bit 4: BCC error (0 = Normal, 1 = Error) Bit 5: Received data format error (0 = Normal, 1 = Error) Bit 6: Transmission error (0 = Normal, 1 = Error) Bit 7: Procedural error (0 = Normal, 1 = Error) Bit 15 to 8: Not used [D+3] Transmission error flag H0000 to H0003 Bit 0: Link 0 (0 = Normal, 1 = Error) Bit 1: Link 1 (0 = Normal, 1 = Error) Bit 15 to 2: Not used [D+4] Transmission assurance H0000 flag by station to H00FF Bit 0: Station number 1 (0: Stop, Error state, 1: Normal transmission state) : Bit 15: Station number 16 (0: Stop, Error state, 1: Normal transmission state) [D+5] Station PLCs Operation mode flag H0000 to H00FF Bit 0: Station number 1 (0: PROG mode, 1: RUN mode) : Bit 15: Station number 16 (0: PROG mode, 1: RUN mode) [D+6] Station PLCs Operation state flag H0000 to H00FF Bit 0: Station number 1 (0: Normal, 1: Error) : Bit 15: Station number 16 (0: Normal, 1: Error) [D+7] Area overlap flag H0000 to H00FF Bit 0: Station number 1 (0: Normal, 1: Area overlap occurs (Position of partner unit is ON.) : Bit 15: Station number 16 (0: Normal, 1: Area overlap occurs (Position of partner unit is ON.) 15-50 PMGET (Acquiring SCU Parameters) Acquired data (PLC link error frequency information): When [S] = 3 Storage location Items Range Description [D] Number of lost tokens [D+1] Number of duplicate tokens [D+2] Number of no signal states [D+3] Number of times of receptions of undefined commands [D+4] Number of sum check errors for reception U0 to U65535 The number of occurrences of each error is stored. [D+5] Number of received data format errors [D+6] Number of transmission errors [D+7] Number of procedural errors [D+8] Number of duplicate parent units Acquired data (PLC link time interval information): When [S] = 4 Storage location Items Range Description [D] RING counter for the number of receptions U0 to U65535 The number of receptions is stored. When the value exceeds 65535, it returns to 0. [D+1] Current receive interval (x 1 ms) - [D+2] Minimum receive interval (x 1 ms) - The reception interval is stored. [D+3] Maximum receive interval (x 1 ms) - [D+4] RING counter for the number of transmissions U0 to U65535 The number of transmissions is stored. When the value exceeds 65535, it returns to 0. [D+5] Current send interval (x 1 ms) - [D+6] Minimum send interval (x 1 ms) - The transmission interval is stored. [D+7] Maximum send interval (x 1 ms) - 15-51 High-level Instructions (Communication) Acquired data (PLC link setting parameter monitoring information): When [S] = 5 Storage location Items Range Description [D] Link area block number U0, U1 HFFFF The block number of the link relay/link register area is stored. U0, U1: Block number of the master unit HFFFF: Other units [D+1] PLC link W0 maximum station number U2 to U16 Values out of the range are handled as "16". [D+2] Range of link relays U0 to U64 Specify the range of link relays used for communication (specification by number of words, relative values within the specified block) [D+3] Range of link registers U0 to U128 Specify the range of link registers used for communication (relative values within the specified block) [D+4] Link relay sending start number U0 to U63 Link relay sending start number (specification by number of words, relative value within the specified block) [D+5] Size of link relay send area U0 to U64 Size of link relay send area (specification by number of words) [D+6] Link register sending start number U0 to U127 Link register sending start number (specification by number of words, relative value within the specified block) [D+7] Size of link register send area U0 to U127 Size of link register send area (specification by number of words) [D+8] to [D+11] Reserved for system - Reserved area (Note 1): The storage destinations shown above are for station number 1. 12 words are assigned to each station and are stored in a 192-word area in order starting from the information for station number 1. In addition, they occupy the 192-word area. Items PLC link station No. and storage destination Station No. 1 Station No. 2 ----- Station No. 15 Station No. 16 Link area block number [D] [D+12] ----- [D+168] [D+180] PLC link W0 maximum station number [D+1] [D+13] ----- [D+169] [D+181] Range of link relays [D+2] [D+14] ----- [D+170] [D+182] Range of link registers [D+3] [D+15] ----- [D+171] [D+183] Link relay sending start number [D+4] [D+16] ----- [D+172] [D+184] Size of link relay send area [D+5] [D+17] ----- [D+173] [D+185] Link register sending start number [D+6] [D+18] ----- [D+174] [D+186] Size of link register send area [D+7] [D+19] ----- [D+175] [D+187] Reserved for system [D+8] to [D+11] [D+20] to [D+23] ----- [D+176] to [D+179] [D+188] to [D+191] Flag operations Name Description Out-of-range in indirect access (index modification) SR7 SR8 (ER) Destination range is out of the accessible range. SCU unit does not exist in the slot specified by UNITSEL. COM port specified by UNITSEL does not exist. Parameter storage device specified by [D] is invalid. 15-52 CONFIG (Change configuration) CONFIG (Change configuration) Ladder diagram SR13 CONFIG "MEWTOCOL" "FL=DT100" S1 S2 List of operands Operand Description S1 Specify the character constant or the starting address of the device storing the string data that indicates the configuration type. S2 Specify the character constant or the starting address of the device storing the string data that indicates the contents of change of the configuration. Available devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 S2 Integer K U H Real number String Index modification SF DF " " Outline of operation · When "MEWTOCOL" is specified for [S1] This instruction configures the settings so that reception is possible if the MEWTOCOL-COM(RD,WD) or MEWTOCOL-DAT(50H,51H) command is used to specify a device FL from another FP series PLC. This function is compatible with FP2SH. This instruction can be used for an FP7 CPU unit with built-in SCU, built-in ET-LAN, or Serial Communication Unit. Specify whether to assign data to FL0 or to the device number (DT/LD) of the FP7 CPU unit, if FL is specified by the partner device for MEWTOCOL-COM or MEWTOCOL-DAT communication. · When "TCP-NODELAY" is specified for [S1] Possible to change the enable/disable setting for the TCP-NODELAY option between all system connections and user connection. While communication is performed with a device that is set with TCP delay ACK, high-speed communication becomes possible if the TCP-NODELAY option is enabled, The state of the enable/disable setting for the TCP-NODELAY option can be confirmed using the TCP-NODELAY option flag (X63). When the power is turned ON, the TCP-NODELAY option is disabled. After this instruction is executed, the TCP-NODELAY option is enabled. Flag operations S1 MEWTOCOL TCP-NODELAY S2 FL=DTx FL=LDx ENABLE DISABLE Settings Assign FL0 to the address DTx. Assign FL0 to the address LDx. The TCP-NODELAY option is enabled. The TCP-NODELAY option is disabled. Precautions during programming · Set this instruction to be executed only one time after switching to RUN. · When specifying a device for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different. · Both upper and lower case letters can be used for operands. · Not possible to execute while the built-in Ethernet is initialized. Before executing this instruction, make sure that the IP address establishment flag (X62) is turned OFF. 15-53 High-level Instructions (Communication) Example of program (for enabling TCP-NODELAY option) R100 X62 DF CONFIG "TCP-NODELAY" "ENABLE" Flag operations Name Description To be set when the device specified by [S1] exceeds the area. SR7 SR8 (ER) To be set when the device specified by [S2] exceeds the area. To be set when a keyword that is not expected is specified. To be set when the device corresponding to FL0 specified by [S2] exceeds the area. (Note 1) To be set when the number of characters for operand specifying character constant exceeds 256. To be set for a device that does not have the Ethernet function. (Note 2) SR9 To be set when executed during the initialization of Ethernet. (Note 2) The detail code set for SD29 is "11: Ethernet initialization active". (Note 1): Only when "MEWTOCOL" is specified for [S1] (Note 2): Only when "TCP-NODELAY" is specified for [S1] 15-54 16 16 High-level instructions (Multi-wire Link Communication) High-level instructions (Multi-wire Link Communication) SEND (When FP7 Multi-wire Link Unit Is Used) Ladder diagram R0 X100 Y100 DF SEND.US DT11 i S UNITSEL U10 U3 n D1 U1 S1 DT120 D2 U0 S2 DT10 D3 (Note): The above figure shows the case that the FP7 multi-wire link unit for S1=U1 (slot number 1) is specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S Starting address of the sender data area n Amount of sent data D1 Partner unit station number D2 Starting address of the device in the receiver data area of the partner unit D3 Starting address of the device area of the master unit that stores the execution result code (1 word) Available word devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX Integer K U H Real number String Index modification SF DF " " S n D1 D2(*1) D3 *1: When the destination unit is FP7, only global devices can be specified. (Local devices cannot be specified.) Available bit devices (: Available) Operand Bit device X YRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification S n D1 D2(*1) D3 *1: When the destination unit is FP7, only global devices can be specified. (Local devices cannot be specified.) Outline of operation · Data can be transferred from the master unit to the partner unit between PLCs connected by MEWNET-W or MEWNET-W2. · When the SEND instruction is executed, the data is read from the device that starts with [S] in the master unit and the data is stored in the address that starts with [D2] in the partner unit. 16-2 SEND (When FP7 Multi-wire Link Unit Is Used) Setting the amount of sent data [n] Transfer method Communication Mode Amount of sent data n Register transfer W mode W2 mode 1 to 55 words 1 to 1020 words Bit transfer W mode W2 mode Fixed at 1 bit Fixed at 1 bit (Note 1): The transfer method varies according to the device type specified for operands [S] and [D2]. The register transfer is used for 16-bit devices and the bit transfer is used for 1-bit devices. Devices specified for [S] and [D2] Transfer method 16-bit device: WX, WY, WR, WL, DT, LD Register transmission 1-bit device: X, Y, R, L, DT.n, LD.n Bit transmission (Note 2): The amount of sent data is specified in words for the register transfer and in bits for the bit transfer. Specification of partner unit station number [D1] Communication Mode Setting range W mode 1 to 32 W2 mode 1 to 64 Specification of destination address [D2] Transfer method Communication Mode Address range Register transfer W mode W2 mode 0 to 65535 Bit transfer W mode W2 mode 0 to 65535F (Note 1): When the destination is the file register FL, specify a constant. Example) For FL100, specify U100. For the file register, only bank 0 can be specified. Execution result code [D3] Code Description Code Description H0 Normal end H24 Transmission format error H1 The communication port is being used in the master communication. H25 FP7 multi-wire link unit hardware error H2 The communication port is being used in the slave communication. H26 The unit number setting error occurs. H3 The number of master communication instructions simultaneously used is exceeded. H27 NOT support H4 Transmission timeout H28 No response H5 Response reception timeout H29 FP7 multi-wire link unit hardware error H6 Reception error (Note 1) H30 Transmission time-out error H7 I/O allocation shortage error (Note 2) H8 The send buffer is being used. H31 to H39 FP7 multi-wire link unit hardware error H9 Master unit station number unset error H41 Format error H21 NACK H60 Parameter error H22 WACK H61 Data error H23 The unit number duplicate error occurs. H91 Missing expansion slave unit error (Note 1): It occurs when an abnormal telegram is received in the master communication. In the case of a format error in the header of an individual protocol, the communication discards the received data and a response reception timeout occurs. (Note 2): It occurs when the communication control I/O relays corresponding to the communication port (master communication clear to send flag, master communication sending flag, master communication send done result relay) are not allocated as I/O words of the CPU unit in the I/O map. It occurs only when the number of user connections of ET-LAN is expanded and this instruction is executed specifying that expanded connections. 16-3 High-level instructions (Multi-wire Link Communication) Precautions during programming · Describe the UNITSEL instruction immediately before the SEND instruction and specify the slot number of the FP7 multi-wire link unit in [S] and "0" in [S2]. · For FP7 multi-wire link unit, the SEND instruction executes the transmission and reception by MEWTOCOL-DAT (fixed). · Up to 16 send instructions can be performed to different COM ports and connections simultaneously. (The total of simultaneous usage of SEND, RECV, pPSEND, GPTRNS, and pPMSET instructions) · For FP7 multi-wire link unit, only one of those instructions can be executed for one unit at a time. Flag operation Name Description To be set in the case of out-of-range in indirect access (index modification). To be set when the source range is outside the accessible range. To be set when the FP7 multi-wire link unit that is specified by UNITSEL does not exist. SR7 SR8 (ER) To be set when the data device specified by [S] is incorrect or exceeds the area. To be set when the amount of sent data specified by [n] is incorrect. To be set when the station number that is specified by [D1] is out of the range. To be set when the data device specified by [D2] is incorrect or exceeds the area. To be set when the result storing device that is specified by [D3] is incorrect. To be set when the type (1-bit or 16-bit) of the specified device is different between [S] and [D2]. 16-4 RECV (When FP7 Multi-wire Link Unit Is Used) RECV (When FP7 Multi-wire Link Unit Is Used) Ladder diagram R0 X100 Y100 DF RECV.US U3 i S1 UNITSEL R100 U20 S2 n U1 S1 DT200 D1 U0 S2 DT10 D2 (Note): The above figure shows the case that the FP7 multi-wire link unit for S1=U1 (slot number 1) is specified by the UNITSEL instruction. Available operation units (: Available) Operation unit bit US SS UL SL SF DF i List of operands Operand Description S1 Partner unit station number S2 Starting address of the device in the sender data area of the partner unit n Amount of received data D1 Starting address of the device in the receiver data area of the master unit D2 Starting address of the device area of the master unit that stores the execution result code (1 word) Available word devices (: Available) 16-bit 32-bit device device Operand WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S1 Integer K U H Real number String Index modification SF DF " " S2(*1) n D1 D2 *1: When the source unit is FP7, only global devices can be specified. (Local devices cannot be specified.) Available bit devices (: Available) Operand S1 S2(*1) n D1 Bit device XYRL TCP E SR IN OT Specification of bit of word device DT.n LD.n Index modification D2 *1: When the source unit is FP7, only global devices can be specified. (Local devices cannot be specified.) Outline of operation · Data can be transferred from the partner unit to the master unit between PLCs connected by MEWNET-W or MEWNET-W2. · When the RECV instruction is executed, the data is read from the address that starts with [S2] in the partner unit station number [S1] and the data is stored in the area that starts with [D1] in the master unit. 16-5 High-level instructions (Multi-wire Link Communication) Specification of partner unit station number [S1] Communication Mode Setting range W mode 1 to 32 W2 mode 1 to 64 Specification of the starting address [S2] of the sender data area Transfer method Communication Mode Address range Register transfer W mode W2 mode 0 to 65535 Bit transfer W mode W2 mode 0 to 65535F (Note 1): The transfer method varies according to the device type specified for operands [S2] and [D1]. The register transfer is used for 16-bit devices and the bit transfer is used for 1-bit devices. Device specified in [S2] and [D1] Transfer method 16-bit device: WX, WY, WR, WL, DT, LD Register transmission 1-bit device: X, Y, R, L, DT.n, LD.n Bit transmission (Note 2): The bit devices DT, n, LD and n cannot be specified for the starting address of the source data of partner unit. (Note 3): When the destination is the file register FL, specify a constant. Example) For FL100, specify U100. For the file register, only bank 0 can be specified. Setting the amount of received data [n] Transfer method Communication Mode Register transfer W mode W2 mode Amount of sent data n 1 to 56 words 1 to 1020 words Bit transfer W mode W2 mode Fixed at 1 bit (Note 1): The amount of sent data is specified in words for the register transfer and in bits for the bit transfer. Execution result code [D2] Code Description H0 Normal end Code H24 Description Transmission format error H1 The communication port is being used in the master communication. H25 FP7 multi-wire link unit hardware error H2 The communication port is being used in the slave communication. H26 The unit number setting error occurs. H3 The number of master communication instructions simultaneously used is exceeded. H4 Transmission timeout H5 Response reception timeout H6 Reception error (Note 1) H7 I/O allocation shortage error (Note 2) H8 The send buffer is being used. H27 H28 H29 H30 H31 to H39 NOT support No response FP7 multi-wire link unit hardware error Transmission time-out error FP7 multi-wire link unit hardware error H9 Master unit station number unset error H41 Format error H21 NACK H60 Parameter error H22 WACK H61 Data error H23 The unit number duplicate error occurs. H91 Missing expansion slave unit error (Note 1): It occurs when an abnormal telegram is received in the master communication. In the case of a format error in the header of an individual protocol, the communication discards the received data and a response reception timeout occurs. (Note 2): It occurs when the communication control I/O relays corresponding to the communication port (master communication clear to send flag, master communication sending flag, master communication send done result relay) are not allocated as I/O words of the CPU unit in the I/O map. It occurs only when the number of user connections of ET-LAN is expanded and this instruction is executed specifying that expanded connections. 16-6 RECV (When FP7 Multi-wire Link Unit Is Used) Precautions during programming · Describe the UNITSEL instruction immediately before the RECV instruction and specify the slot number of the FP7 multi-wire link unit in [S1] and "0" in [S2]. · For FP7 multi-wire link unit, the RECV instruction executes the transmission and reception by MEWTOCOL-DAT (fixed). · Up to 16 send instructions can be performed to different COM ports and connections simultaneously. (The total of simultaneous usage of SEND, RECV, pPSEND, GPTRNS, and pPMSET instructions) · For FP7 multi-wire link unit, only one of those instructions can be executed for one unit at a time. Flag operation Name Description To be set in the case of out-of-range in indirect access (index modification). To be set when the destination range is outside the accessible range. To be set when the FP7 multi-wire link unit that is specified by UNITSEL does not exist. SR7 SR8 (ER) To be set when the partner unit station number that is specified by [S1] is out of the range. To be set when the source data device of the partner unit specified by [S2] is incorrect. To be set when the amount of sent data specified by [n] is incorrect. To be set when the data device in the receiver data area in the master unit specified by [D1] is incorrect or exceeds the area. To be set when the result storing device that is specified by [D2] is incorrect. To be set when the type (1-bit or 16-bit) of the specified device is different between [S2] and [D1]. 16-7 High-level instructions (Multi-wire Link Communication) PMGET (Acquiring MEWNET-W Parameters) Ladder diagram R100 UNITSEL U1 S1 PMGET U2 S U0 S2 DT0 D (Note): The above figure shows the case that the FP7 multi-wire link unit for S1=U1 (slot number 1) is specified by the UNITSEL instruction. List of operands Operand Description Type of acquired data S 0: PLC link communication state, 1: Network participation state, 2: W link communication error information, 3: PLC link refresh operation monitoring information D Starting address of the area that stores the acquired communication parameter (monitor information) Available devices (: Available) 16-bit 32-bit Operand device device WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · Monitor information showing the communication state and PLC link operation can be acquired. · The MEWNET-W communication parameters of the FP7 multi-wire link unit are read and stored in the area that starts with [D]. · Specify the type of acquired data in [S]. Precautions during programming · Describe the UNITSEL instruction immediately before the PMGET instruction. Specify the slot number of the unit from which the parameters are acquired for [S1] and specify 0 for [S2]. · The size of the area that stores data varies in the range of 3 to 15 words according to the data type specified in [S]. Value of [S] 0 1 2 3 Type of acquired data PLC link communication state Network participation state W link communication error information PLC link refresh operation monitoring information Amount of stored data 3 words 3 words 15 words 8 words Storage location [D] to [D+2] [D] to [D+2] [D] to [D+14] [D] to [D+7] 16-8 PMGET (Acquiring MEWNET-W Parameters) Acquired data (PLC link communication state): When [S] = 0 Storage location Items Range Description [D] PLC link address duplicate station number Bit 0 to bit 15: Station number 1 to station number 16 OFF: Normal ON: Area duplication occurs (The position of the partner unit is set to ON.) [D+1] PLC link transmission assurance relay H0 to HF Bit 0 to bit 15: Station number 1 to station number 16 OFF: When stopped or in abnormal state ON: PLC link communicating normally [D+2] PLC link operation mode relay Bit 0 to bit 15: Station number 1 to station number 16 OFF: PROG. mode ON: RUN mode Acquired data (network participation state): When [S] = 1 Storage location Items Range Description [D] Number of units added to the link U0 to U32 The number of units added to the link is stored. The value is 0 when the existing unit in the network is only one or a station number is being changed. [D+1] [D+2] Link participation unit flag Station number 1 to 16 Link participation unit flag Station number. 17 to 32 H0 to HF Bit 0 to bit 15: Station number 1 to station number 16 OFF: Not exist ON: Participating Bit 0 to bit 15: Station number 17 to station number 32 OFF: Not exist ON: Participating Acquired data (W link communication error information): When [S] = 2 Storage location Items Range Description [D] Number of occurrences of non-token state [D+1] Number of occurrences of duplicate tokens [D+2] Number of occurrences of non-signal state [D+3] Number of occurrences of synchronous abnormality [D+4] Number of occurrences of transmission answer NACK [D+5] Number of occurrences of three consecutive transmission answers NACK [D+6] Number of occurrences of transmission answer WACK [D+7] [D+8] Number of occurrences of three consecutive transmission answers WACK Number of occurrences of non-response U0 to U255 The number of occurrences of each error is stored. [D+9] Number of occurrences of three consecutive non-response [D+10] Number of occurrences of receive command code error [D+11] Number of occurrences of received data CRC error [D+12] Number of absences of received data end code [D+13] Number of occurrences of received data format error [D+14] Number of occurrences of received data NOT support error 16-9 High-level instructions (Multi-wire Link Communication) Acquired data (PLC link refresh operation monitoring information): When [S] = 3 Storage location Items Range Description [D] RING counter for the number of receptions U0 to U65535 The number of receptions is stored. When the value exceeds 65535, it returns to 0. [D+1] Current receive interval (x 1 ms) - [D+2] Minimum receive interval (x 1 ms) - The reception interval is stored. [D+3] Maximum receive interval (x 1 ms) - [D+4] RING counter for the number of transmissions U0 to U65535 The number of transmissions is stored. When the value exceeds 65535, it returns to 0. [D+5] Current send interval (x 1 ms) - [D+6] Minimum send interval (x 1 ms) - The send interval is stored. [D+7] Maximum send interval (x 1 ms) - Flag operation Name Description To be set in the case of out-of-range in indirect access (index modification, pointer access). SR7 SR8 (ER) To be set when the destination range is outside the accessible range. To be set when the FP7 multi-wire link unit does not exist in the slot that is specified by UNITSEL. To be set when the COM port specified by UNITSEL does not exist. To be set when the parameter storing device that is specified by [D] is invalid. 16-10 PMGET (Acquiring MEWNET-W2 Parameters) PMGET (Acquiring MEWNET-W2 Parameters) Ladder diagram R100 UNITSEL U1 U0 S1 S2 PMGET U2 DT0 S D (Note): The above figure shows the case that the FP7 multi-wire link unit for S1=U1 (slot number 1) is specified by the UNITSEL instruction. List of operands Operand Description Type of acquired data S 0: PLC link communication state, 1: Network participation state, 2: W2 link error system counter type error area, 3: W2 link error system error register area D Starting address of the area that stores the acquired communication parameter (monitor information) Available devices (: Available) 16-bit 32-bit Operand device device WX WY WR WL WS SD DT LD UM WI WO TS CS TE CE IX S D Integer K U H Real number String Index modification SF DF " " Outline of operation · Monitor information showing the communication state and PLC link operation can be acquired. · The MEWNET-W2 communication parameters of the FP7 multi-wire link unit are read and stored in the area that starts with [D]. · Specify the type of acquired data in [S]. Precautions during programming · Describe the UNITSEL instruction immediately before the PMGET instruction. Specify the slot number of the unit from which the parameters are acquired for [S1] and specify 0 for [S2]. · The size of the area storing data varies in the range of 5 to 18 words according to the data type specified in [S]. Value of [S] Type of acquired data 0 PLC link communication state 1 Network participation state 2 W2 link error system counter type error area 3 W2 link error system error register area Amount of stored data 6 words 5 words 18 words 10 words Storage location [D] to [D+5] [D] to [D+4] [D] to [D+17] [D] to [D+9] 16-11 High-level instructions (Multi-wire Link Communication) Acquired data (PLC link communication state): When [S] = 0 Storage location Items Range Description [D] to [D+1] PLC link state monitor flag station number 1 to 32 Bit 0 to bit 31: Station number 1 to station number 32 OFF: Stopped ON: PLC link communicating normally [D+2] to [D+3] PLC link operation mode flag station number 1 to 32 H0 to HFFFFFFFF Bit 0 to bit 31: Station number 1 to station number 32 OFF: PROG. mode ON: RUN mode [D+4] to [D+5] PLC link operation state flag station number 1 to 32 Bit 0 to bit 31: Station number 1 to station number 32 OFF: No error ON: Error occurs in PLC for which transmission assurance is ON. (Note 1): Even when (3) has been set for the PLC link operation state flag in the configuration "W2 link unit setting" of the tool software, the data of 6 words is read by the PMGET instruction. Acquired data (network participation state): When [S] = 1 Storage location Items Range Description [D] Number of units added to the link U0 to U64 The number of units added to the link is stored. The value is 0 when the existing unit in the network is only one or a station number is being changed. [D+1] Link participation unit flag Station number 1 to 16 Bit 0 to bit 15: Station number 1 to station number 16 OFF: Not exist ON: Participating [D+2] [D+3] Link participation unit flag Station number 17 to 32 Link participation unit flag Station number 33 to 48 H0 to HFFFF Bit 0 to bit 15: Station number 17 to station number 32 OFF: Not exist ON: Participating Bit 0 to bit 15: Station number 33 to station number 48 OFF: Not exist ON: Participating [D+4] Link participation unit flag Station number 49 to 64 Bit 0 to bit 15: Station number 49 to station number 64 OFF: Not exist ON: Participating 16-12 PMGET (Acquiring MEWNET-W2 Parameters) Acquired data (W2 link error system counter type error area): When [S] = 2 Storage location Items Range Description [D] Number of lost tokens [D+1] Number of duplicate tokens [D+2] Number of occurrences of non-signal state [D+3] Number of occurrences of synchronous abnormality [D+4] Number of occurrences of send NACK error (When an error occurs) [D+5] Number of occurrences of send NACK error (At the time of third retry) [D+6] Number of occurrences of send WACK error (When an error occurs) [D+7] Number of occurrences of send WACK error (When occurred 16 times continuously) [D+8] [D+9] Number of occurrences of non-response (When an error occurs) Number of occurrences of non-response (At the time of third retry) U0 to U255 The number of occurrences of each error is stored. [D+10] Number of receptions of undefined commands [D+11] Number of occurrences of receive parity check error [D+12] Number of occurrences of END CODE reception error [D+13] Number of occurrences of received data format error [D+14] Number of occurrences of received data NOT support error [D+15] Number of token retransmissions [D+16] Number of detection of unit OFF [D+17] Number of occurrences of link error state 16-13 High-level instructions (Multi-wire Link Communication) Acquired data (W2 link error system error register area): When [S] = 3 Storage location Items Description Bit no.15 8 7 0 [D] State of error currently occurs Error counter U0-U255 Error code When the same error occurs, the error counter of high byte will be updated. When the error content changes and the error is cleared, the information will be stored in the error occurrence state history area ([D+2] to [D+9]). Bit no.15 8 7 0 [D+1] [D+2] [D+3] [D+4] [D+5] [D+6] [D+7] [D+8] [D+9] Error occurrence state history management Error occurrence state history area 1 Error occurrence state history area 2 Error occurrence state history area 3 Error occurrence state history area 4 Error occurrence state history area 5 Error occurrence state history area 6 Error occurrence state history area 7 Error occurrence state history area 8 Number of updates of error history U0-U255 Latest pointer in the storage area of past errors (Changes from 0 1 2 ... 8 1 ...) (Changes from 0 1 2 ... 8 1...) When the latest pointer in the storage area of past errors is 0, it indicates that there is no error. When the number of error updates is 0, it indicates that there is no update. History of error occurrence state (parameter of [D]) 1 History of error occurrence state (parameter of [D]) 2 History of error occurrence state (parameter of [D]) 3 History of error occurrence state (parameter of [D]) 4 History of error occurrence state (parameter of [D]) 5 History of error occurrence state (parameter of [D]) 6 History of error occurrence state (parameter of [D]) 7 History of error occurrence state (parameter of [D]) 8 Flag operation Name Description To be set in the case of out-of-range in indirect access (index modification, pointer access). SR7 SR8 (ER) To be set when the destination range is outside the accessible range. To be set when the FP7 multi-wire link unit does not exist in the slot that is specified by UNITSEL. To be set when the COM port specified by UNITSEL does not exist. To be set when the parameter storing device that is specified by [D] is invalid. 16-14 PMGET (Acquiring MEWNET-F Parameters) PMGET (Acquiring MEWNET-F Parameters) Ladder diagram R100 UNITSEL U1 U0 S1 S2 PMGET U1 DT0 S D (Note): The above figure shows the case that the FP7 multi-wire link unit for S1=U1 (slot number 1) is specified by the UNITSEL instruction. List of operands Opera