FP7 CPU Unit Command Reference Manual

WUME-FP7CPUPGR-08

Panasonic Industrial Devices SUNX Co., Ltd. Panasonic Industrial Devices SUNX Co.

FP7 CPU Unit - Panasonic Industry

WUME-FP7CPUEIP. FP7 Web Server Function Manual. WUME-FP7WEB. Instructions for Built-in COM Port. FP7 series User's Manual (SCU Communication).

FP7 CPU Unit Command Reference Manual

PDF FP7 CPU Unit Command Reference Manual, WUME-FP7CPUPGR-08

PLC FP7 | Panasonic Industry Europe GmbH

PDF mn fp7 cpu programming pidsx en
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

Operand Description

S

Type of acquired data 0: Number of F link services, 1: F link operation state monitor

D

Starting address of the area that stores the acquired communication parameter (monitor information)

 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
· Monitor information showing the communication state can be acquired.

· MEWNET-F 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 1 to 10 words according to the data type specified in [S].

Value of [S] Type of acquired data

0

Number of F link services

1

F link operation state monitor

Amount of stored data
1 word
10 words

Storage location
[D]
[D] to [D+9]

16-15

High-level instructions (Multi-wire Link Communication)

 Acquired data (number of F link services): When [S] = 0

Storage location

Items

Range

Description

[D]

F link service counter

U0 to U65535

Service ring counter of master unit

 Acquired data (F link operation state monitor): When [S] = 1

Storage location

Items

Range

Description

[D] to [D+1]

Connected unit

Bit 0 to bit 31: Station number 1 to station number 32 OFF: Disconnected unit ON: Connected unit

[D+2] to [D+3] [D+4] to [D+5] [D+6] to [D+7]
[D+8] to [D+9]

Abnormal unit current value
Abnormal unit cumulative value
Setting of slave unit where I/O verification error occurred
Slave unit where instantaneous power failure occurred

H0 to HFFFFFFFF

Bit 0 to bit 31: Unit number 1 to unit number 32 OFF: Normal unit ON: Abnormal unit

 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-16

PMSET / pPMSET (Change of MEWNET-W Parameters)

PMSET / pPMSET (Change of MEWNET-W Parameters)
 Ladder diagram

R100

UNITSEL

U1

S1

PMSET

DT0

U1

i

S

n

U0
S2 DT100
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

S

Start of the area that stores data to be set as communication parameters

n

Specified number of words (Setting range: 10 or 1) (Note 1)

D

Starting address of the device area in the master unit that stores the processing result (1 word)

(Note 1): When the station number is 17 or more, specify 1.

 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 " "



n

   

 





D

   

 



 Outline of operation
· The MEWNET-W communication parameters of the FP7 multi-wire link unit are changed with a user program.
· Set communication parameters to be changed within [n] words from the area starting with [S], and execute the PMSET/pPMSET instruction, to issue the setting change request to the unit.
· 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
· The station number of the FP7 multi-wire link unit can be set by the PMSET/pPMSET instruction only when the station number selector on the unit is set to 0.
· Describe the UNITSEL instruction immediately before the PMSET/pPMSET instruction. Specify the slot number of the unit from which the parameters are acquired for [S1] and specify 0 for [S2].
· 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.
· The content set by the PMSET/pPMSET instruction is not held in the 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.
· When setting it for the FP7 multi-wire link unit, it cannot be used in an interrupt program.

16-17

High-level instructions (Multi-wire Link Communication)

 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

Advantage Disadvantage

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 a 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)

Advantage Disadvantage

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].

 Communication parameter settings in W mode

Operand

Parameter

Range

Settings

[S]

Unit number

U1 to U32

It can be changed only when the rotary switch on the front panel of the unit is set to 0. When using the PLC link, set it in the range of 1 to 16.

[S+1] [S+2]

Link relay holding start number
Link register holding start number

U0 to U128 U0 to U128

Specify the hold area of link relays by word numbers. Specify the hold area of link relays by word numbers.

[S+3]

Memory block number

U0 to U7

Memory block number of PLC link area

[S+4]

Range of link relays

U0 to U64

Link relay usable range in the above memory block

[S+5]

Range of link registers

U0 to U128

Link register usable range in the above memory block

[S+6] [S+7] [S+8]

Link relay transmission start number
Link relay transmission size
Link register transmission start number

U0 to U63 U0 to U64 U0 to U127

Link relay transmission start number Link relay transmission size Link register transmission start number

[S+9]

Link register transmission size

U1 to U127

As for the link register transmission size, up to 127 words can be sent.

 Content of the processing result [D]
· Execution results are stored in the area of one word.
· The execution result code in the low byte is valid when the process in-progress flag of bit 15 is zero.
· If an error occurs, the execution result flag (bit 14) is turned ON. The description of the error is stored in the execution result code (bits 0 to 7).

Bit no.15
Process in-progress flag 0: Process done 1: In-progress
Execution result flag 0: Normal completion 1: Abnormal completion

8 7

0

000000

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) 7: Unit number setting on the front panel of the multi-wire link unit (When the switch is not 0)

16-18

PMSET / pPMSET (Change of MEWNET-W Parameters)

 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 FP7 multi-wire link unit does not exist in the slot that is specified by UNITSEL. To be set when the device specified by [S] is out of the range. To be set when the number of words specified by [n] is out of the available range.

To be set when the instruction is executed in an interrupt program and the FP7 multi-wire link unit is the target.

REFERENCE
· For details of sample programs, refer to "PMSET / pPMSET (Change of MEWNET-W2 Parameters)."

16-19

High-level instructions (Multi-wire Link Communication)

PMSET / pPMSET (Change of MEWNET-W2 Parameters)
 Ladder diagram

R100

UNITSEL

U1

S1

PMSET

DT0

U1

i

S

n

U0
S2 DT100
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

S

Start of the area that stores data to be set as communication parameters

n

Specified number of words (Setting range: U1) (Note 1)

D

Starting address of the device area in the master unit that stores the processing result (1 word)

(Note 1): For MEWNET-W2, specify 1.

 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
· The MEWNET-W2 communication parameters of the FP7 multi-wire link unit are changed with a user program.
· Set communication parameters to be changed within [n] words from the area starting with [S], and execute the PMSET/pPMSET instruction, to issue the setting change request to the unit.
· 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
· The station number of the FP7 multi-wire link unit can be set by the PMSET/pPMSET instruction only when the rotary switch on the front panel of the unit is set to 0.
· Describe UNITSEL instruction immediately before PMSET/pPMSET instruction. Specify the slot number of the unit from which the parameters are acquired for [S1] and specify 0 for [S2].
· 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.
· 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.
· When setting it for the FP7 multi-wire link unit, it cannot be used in an interrupt program.

16-20

PMSET / pPMSET (Change of MEWNET-W2 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

Advantage Disadvantage

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 a 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)

Advantage Disadvantage

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].

 Communication parameter settings in W2 mode

Operand

Parameter

Range

Settings

[S]

Station number

U1 to U64

It can be changed only when the rotary switch on the front panel of the unit is set to 0.

 Content of the processing result [D]
· Execution results are stored in the area of one word.
· The execution result code in the low byte is valid when the process in-progress flag of bit 15 is zero.
· If an error occurs, the execution result flag (bit 14) is turned ON. The description of the error is stored in the execution result code (bits 0 to 7).

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) 7: Unit number setting on the front panel of the multi-wire link unit (When the switch is not 0)

 Program example (PMSET instruction)
· The example below shows the case when the communication parameter of one word that is stored in the area that starts with the data register DT0 is set in the FP7 multi-wire link unit in slot number 1. 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 U1

U0

S1

S2

PMSET DT0 S
R1 DT100.F  DF/ 

U1

DT100

n

D

R1  RST 

16-21

High-level instructions (Multi-wire Link Communication)

 Program example (pPMSET instruction)
· The example below shows the case when the communication parameter of one word that is stored in the area that starts with the data register DT0 is set in the FP7 multi-wire link unit in slot number 1. The processing result is stored in DT100.
· For the pPMSET instruction, when the execution condition arises, the parameter change processing is performed only once.

R1

UNITSEL U1

U0

S1

S2

pPMSET DT0 S

U1

DT100

n

D

R1  RST 

 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 FP7 multi-wire link unit does not exist in the slot that is specified by UNITSEL. To be set when the device specified by [S] is out of the range. To be set when the number of words specified by [n] is out of the available range.

To be set when the instruction is executed in an interrupt program and the FP7 multi-wire link unit is the target.

16-22

ERR (When FP7 Multi-wire Link Unit Is Used)

ERR (When FP7 Multi-wire Link Unit Is Used)
 Ladder diagram

R100

ERR.US U 0

i

n

 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. (0: Clear the self-diagnostic error.)

 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
When the ERR instruction is executed with [n] set to U0, the instruction operates as follows: · Clears errors in the FP7 multi-wire link unit. · Resets the values of the system relays and the system data registers in the table shown below.

Device No. SR50 SR51 SR52 SR53 SR54 SR55

Application FP7 multi-wire link unit 1 error FP7 multi-wire link unit 2 error FP7 multi-wire link unit 3 error FP7 multi-wire link unit 4 error FP7 multi-wire link unit 5 error FP7 multi-wire link unit 6 error

Device No.

Application

SD90

FP7 multi-wire link unit 1 error (High-order 8 bits = Error code, Low-order 8 bits = Unit number)

SD91

FP7 multi-wire link unit 2 error (High-order 8 bits = Error code, Low-order 8 bits = Unit number)

SD92

FP7 multi-wire link unit 3 error (High-order 8 bits = Error code, Low-order 8 bits = Unit number)

SD93

FP7 multi-wire link unit 4 error (High-order 8 bits = Error code, Low-order 8 bits = Unit number)

SD94

FP7 multi-wire link unit 5 error (High-order 8 bits = Error code, Low-order 8 bits = Unit number)

SD95

FP7 multi-wire link unit 6 error (High-order 8 bits = Error code, Low-order 8 bits = Unit number)

(Note 1): Error information can be read by PMGET instruction.

 Flag operation

Name

Description

SR7 SR8 (ER)

To be set when the error code n is out of the range.

16-23

High-level instructions (Multi-wire Link Communication)
16-24

17
17 High-level Instructions (Ethernet Communication)
Applicable Models: CPS41E/CPS4E/CPS31E/CPS3E

High-level Instructions (Ethernet Communication)

RDET (ET-LAN Status Read)

 Ladder diagram

R0

UNITSEL U100

U1

S1

S2

RDET

DT0

D

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands

Operand Description

D

The status is stored in the first 7-word area [D] to [D+6] of the status storage 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

D

   

 

Integer K U H

Real number

String

Index

modification SF DF " "



 Outline of operation
· This instruction acquires a status summary that indicates the statuses of all connections of ET-LAN.
· It describes the UNITSEL instruction immediately before the RDET instruction, and specifies the targeted ET-LAN port. For connection numbers, set any value within the range of 1 to 16.
· The acquired information is converted into integer values in the Hex format, in accordance with the relevant allocation, and stored in the 7-word area starting with [D].
 Precautions during programming
· It is necessary to set the slot number and connection number of ET-LAN targeted in communication, using the UNITSEL instruction.
 ET-LAN status information
· Connection status of all connections
· OPEN status
· OPEN abnormality status
· Number of connections in-progress in the FTP server

17-2

RDET (ET-LAN Status Read)

 ET-LAN status information

Operand Data name

Data to be stored

[D] [D+1] [D+2] [D+3] [D+4] [D+5]

Connection status summary
OPEN status summary
OPEN abnormality status summary

Low word High word Low word High word Low word High word

0: Other than connected status 1: Connected status
0: Close 1: Open
0: No abnormality 1: Abnormality

They are stored in the corresponding bits as allocated in the following table.
S1 to S4: System connection
U1 to U16: User connection
FTP-S: FTP server

[D+6]

Number of connections in-progress in the FTP server

(Note): Correspondence between connections and bits for the connection status summary, OPEN status summary, and OPEN abnormality status summary

High word

Low word

b15-b9 b8 b7-b4 b3 b2 b1 b0 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0

- FTP-S - U16 U15 U14 U13 U12 U11 U10 U9 U8 U7 U6 U5 U4 U3 U2 U1 S4 S3 S2 S1

 Example of program
All the connection summaries for the built-in ET-LAN in the CPU unit are acquired and stored in the 7-word area starting with DT10.

R1
UNITSEL U 100 U 1

RDET DT10

 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. The connection specified by UNITSEL does not exist, or the value is out of the range. The parameter storage device specified by [D] is invalid.

17-3

High-level Instructions (Ethernet Communication)

ETSTAT (Acquiring Ethernet Unit Information: IP/MAC/Destination)
 Ladder diagram

R0

UNITSEL

U100

U1

S1

S2

ETSTAT

"IPv4"

"CONNECT"

DT0

S1

S2

D

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
ETSTAT "IPv4" "CONNECT" DT0

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a read type, or a character constant.

S2

Starting address of the device area that stores the string data that indicates a target to be read, or a character constant.

D

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

S1

   

 

S2

   

 

D

   

 

Integer K U H

Real number

String

Index

modification

SF DF " "

 

 Outline of operation
· This instruction reads the information of the Ethernet unit.
 Process details
· The parameter information or status information specified by [S1] and [S2] is read and stored in the area starting with [D].
· The number of words in the storage area varies according to the type of read data and the target.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· For [S1] and [S2], specify the starting address of the device area that stores the string data that indicates the information to be read, or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD", and "abcd" are all synonymous.
· This instruction is not available in interrupt programs.

17-4

ETSTAT (Acquiring Ethernet Unit Information: IP/MAC/Destination)

 Setting of the operands [S1] and [S2]

Setting item Settings

When specifying reading IPv4 address

S1

Read type

When specifying reading IPv6 address

Specify "IPv4". Specify "IPv6".

S2

Read target

Refer to "Data to be read and the number of words".

D

Read destination Specify the destination device address to which the state is read out.

 Data to be read and the number of words
Data to be read and the number of words vary depending on the combination of [S1] and [S2].

[S1][S2]

Storage location

Name

Number of words

Format

Description

[D] - [D+3]

Master unit IP address (IPv4)

4

Decimal

Master unit IPv4 address

[S1]: "IPv4" [S2]: "MAC"

[D+4] - [D+7]
[D+8] - [D+11]
[D+12] [D+14]

Subnet mask (IPv4)
Default gateway (IPv4)
Master unit MAC address

4

Decimal

Subnet mask

4

Decimal

Default gateway

3

Hexadecimal Master unit MAC address

Total number of words

15

-

[D] - [D+3]

Master unit IP address (IPv4)

4

Decimal

Master unit IPv4 address

[D+4] - [D+7] Subnet mask (IPv4)

4

Decimal

Subnet mask

[S1]: "IPv4"

[D+8] - [D+11] Default gateway (IPv4)

4

[S2]: "CONNECT"

[D+12]

Destination IP address type

1

Decimal Decimal

Default gateway 0:IPv4

[D+13] [D+16]

Destination IP address

4

Decimal

Destination IP address (for IPv4) (Note 2)

Total number of words

17

-

[D] - [D+3]

Master unit IP address (IPv4)

4

Decimal

Master unit IPv4 address

[D+4] - [D+7] Subnet mask (IPv4)

4

Decimal

Subnet mask

[S1]: "IPv4"

[D+8] - [D+11] Default gateway (IPv4)

4

[S2]:

[D+12]

Master unit port number

1

"CONNECT1" or

[D+13]

Destination IP address type

1

"CONNECT2"

[D+14] [D+17]

Destination IP address

4

Decimal Decimal Decimal
Decimal

Default gateway The master unit port number in use
0:IPv4
Destination IP address (for IPv4) (Note 2)

[D+18]

Destination port number

1

Decimal

Partner unit port number (Note 2)

Total number of words

19

-

(Note 1): For IPv4, a decimal number is stored in each area of the storage. Example) When the master unit IP address is 192.168.1.5, the IP address is stored as follows: [D]=U192, [D+1]=U168, [D+2]=U1, [D+3]=U5
(Note 2): The destination varies depending on the setting of the communication method (TCP/UDP) as shown in the following table.

Communication method

Setting of [S2] CONNECT, CONNECT1

CONNECT2

TCP client

Partner unit (server) that is set as the destination

- Partner unit (server) to which the connection is established
- No connection is established: 0

TCP server (specific partner unit)
TCP server (any partner unit)

Partner unit (client) that is allowed to be connected
Partner unit (client) that is connected most recently A partner unit (client) has never been connected: 0

- Partner unit (client) whose connection is established
- No connection is established: 0

UDP

Partner unit that is set as the destination (for master communication)

17-5

High-level Instructions (Ethernet Communication)

[S1][S2]

Storage location

Name

Number of words

Format

Description

[D] - [D+7]

Master unit IP address 1 (IPv6)

8

Hexadecimal

Master unit IPv6 address (Manual setting)

[D+8] - [D+15]

Master unit IP address 2 (IPv6)

8

Hexadecimal

Master unit IPv6 address (link local) (Note 2)

[D+16] - [D+23]

Master unit IP address 3 (IPv6)

8

Hexadecimal

Master unit IPv6 address (router) (Note 3)

[S1]: "IPv6" [S2]: "MAC"

[D+24] - [D+31]

Master unit IP address 4 (IPv6)

8

Hexadecimal

Master unit IPv6 address (DHCP) (Note 3)

[D+32]

Subnet prefix length

1

Decimal

Subnet prefix length

[D+33] - [D+40] Default gateway (IPv6)

8

Hexadecimal Default gateway

[D+41] - [D+43]

Master unit MAC address

3

Hexadecimal Master unit MAC address

Total number of words

44

-

[D] - [D+7]

Master unit IP address 1 (IPv6)

8

Hexadecimal

Master unit IPv6 address (Manual setting)

[D+8] - [D+15]

Master unit IP address 2 (IPv6)

8

Hexadecimal

Master unit IPv6 address (link local) (Note 2)

[D+16] - [D+23]

Master unit IP address 3 (IPv6)

8

Hexadecimal

Master unit IPv6 address (router) (Note 3)

[S1]: "IPv6"

[D+24] - [D+31]

Master unit IP address 4 (IPv6)

8

Hexadecimal

Master unit IPv6 address (DHCP) (Note 3)

[S2]:

"CONNECT" [D+32]

Subnet prefix length

1

Decimal

Subnet prefix length

[D+33] - [D+40] Default gateway (IPv6)

8

Hexadecimal Default gateway

[D+41]

Destination IP address type

1

Decimal

1:IPv6

[D+42] - [D+49] Destination IP address

8

Hexadecimal

Destination IP address (for IPv6) (Note 4)

Total number of words

50

[D] - [D+7]

Master unit IP address 1 (IPv6)

8

Hexadecimal

Master unit IPv6 address (Manual setting)

[D+8] - [D+15]

Master unit IP address 2 (IPv6)

8

Hexadecimal

Master unit IPv6 address (link local) (Note 2)

[D+16] - [D+23]

Master unit IP address 3 (IPv6)

8

Hexadecimal

Master unit IPv6 address (router) (Note 3)

[S1]: "Ipv6"

[D+24] - [D+31]

Master unit IP address 4 (IPv6)

8

Hexadecimal

Master unit IPv6 address (DHCP) (Note 3)

[S2]: "CONNECT1" or

[D+32] [D+33] - [D+40]

Subnet prefix length Default gateway (IPv6)

1

Decimal

Subnet prefix length

8

Hexadecimal Default gateway

"CONNECT2" [D+41]

Master unit port number

1

Decimal

The master unit port number in use

[D+42]

Destination IP address type

1

Decimal

1:IPv6

[D+43] - [D+50] Destination IP address

8

Hexadecimal

Destination IP address (for IPv6) (Note 4)

[D+51]

Destination port number

1

Decimal

Partner unit port number (Note 4)

Total number of words

52

-

(Note 1): For IPv6, a hexadecimal number is stored in each area of the storage. Example) When the master unit IP address is fe80::1234:5678:1234:5678, the IP address is stored as follows: [D]=HFE80, [D+1]=H0, [D+2]=H0, [D+3]=H0, [D+4]=H1234, [D+5]=H5678, [D+6]=H1234, [D+7]=H5678
(Note 2): The value that is set by the FP7 CPU unit is stored in the area for the master unit IPv6 address (link local). (Note 3): The master unit IPv6 address (router) is stored when automatic acquisition from the router is selected. The master unit IPv6
address (DHCP) is stored when automatic acquisition from the DHCP server is selected. If there is no response, "0" is stored.

17-6

ETSTAT (Acquiring Ethernet Unit Information: IP/MAC/Destination)

(Note 4): The destination varies depending on the setting of the communication method (TCP/UDP) as shown in the following table.

Communication method

Setting of [S2] CONNECT, CONNECT1

CONNECT2

TCP client

Partner unit (server) that is set as the destination

- Partner unit (server) to which the connection is established
- No connection is established: 0

TCP server (specific partner unit)
TCP server (any partner unit)

Partner unit (client) that is allowed to be connected
Partner unit (client) that is connected most recently A partner unit (client) has never been connected: 0

- Partner unit (client) whose connection is established
- No connection is established: 0

UDP

Partner unit that is set as the destination (for master communication)

 Execution example
Example 1) When specifying IPv4 address and MAC address The results are stored in the 15-word area that starts with [D]. [S1]... "IPv4" [S2]... "MAC" [D]...DT0

DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 DT11 DT12 DT13 DT14

Value H00C0 (U192) H00A8 (U168) H0005 (U5) H001E (U30) H00FF (U255) H00FF (U255) H00FF (U255) H0000 (U0) H00C0 (U192) H00A8 (U168) H0005 (U5) H0001 (U1) HAABB HCCDD HEEFF

Description The master unit IPv4 address is stored. Example) 192.168.5.30
The subnet mask is stored. Example) 255.255.255.0
Default gateway Example) 192.168.5.1
The MAC address of the master unit is stored. Example) AA-BB-CC-DD-EE-FF

17-7

High-level Instructions (Ethernet Communication)

Example 2) When specifying IPv4 address and the destination IP address of a specified connection The results are stored in the 17-word area that starts with [D]. [S1]... "IPv4" [S2]... "CONNECT" [D]...DT0

DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 DT10 DT11 DT12 DT13 DT14 DT15 DT16

Value H00C0 (U192) H00A8 (U168) H0005 (U5) H001E (U30) H00FF (U255) H00FF (U255) H00FF (U255) H0000 (U0) H00C0 (U192) H00A8 (U168) H0005 (U5) H0001 (U1) H0000 H00C0 (U192) H00A8 (U168) H0005 (U5) H000B (U11)

Description
The master unit IPv4 address is stored. Example) 192.168.5.30
The subnet mask is stored. Example) 255.255.255.0
Default gateway Example) 192.168.5.1
This value indicates the type of the IP address. For IPv4, the value is "0".
The destination IPv4 address is stored. Example) 192.168.5.11

17-8

ETSTAT (Acquiring Ethernet Unit Information: IP/MAC/Destination)

Example 3) When specifying IPv6 address and the destination IP address of a specified connection The results are stored in the 50-word area that starts with [D]. [S1]... "IPv6" [S2]... "CONNECT" [D]...DT0

DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 -DT15 DT16 -DT23

Value HFE80 H0011 H2233 H4455 H6677 H8899 HAABB HCCDD
-
-

Description
The master unit IPv6 address (manual setting) is stored. Example) fe80:0011:2233:4455:6677:8899:aabb:ccdd
The master unit IPv6 address (link local) is stored. When [Automatically acquire IPv6 address] - [Acquire from router] is selected, the master unit IPv6 address is stored. For manual setting, "0" is stored.

DT24 -DT31

-

When [Automatically acquire IPv6 address] - [Acquire from DHCP] is selected, the master unit IPv6 address is stored. For manual setting, "0" is stored.

DT32
DT33 DT34 DT35 DT36 DT37 DT38 DT39 DT40 DT41 DT42 DT43 DT44 DT45 DT46 DT47 DT48 DT49

H0100 (U64)
HFE80 H0000 H0000 H0000 H0000 H0000 H0000 H0001 H0001 HFE80 H0011 H2233 H4455 H6677 H8899 HAABB HCCDD

The subnet prefix length is stored. Example) 64
The IPv6 address of the default gateway is stored. Example) fe80::1
The type of the IP address is stored. For IPv6, the value is "1".
The destination IPv6 address is stored. Example) fe80:0011:2233:4455:6677:8899:aabb:ccdd

17-9

High-level Instructions (Ethernet Communication)

Example 4) When specifying IPv6 address and MAC address The results are stored in the 44-word area that starts with [D]. [S1]... "IPv6" [S2]... "MAC" [D]...DT0

DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 -DT15 DT16 -DT23

Value HFE80 H0011 H2233 H4455 H6677 H8899 H99AA HAABB
-
-

Description
The master unit IPv6 address (manual setting) is stored. Example) fe80:0011:2233:4455:6677:8899:99aa:aabb
The master unit IPv6 address (link local) is stored. When [Automatically acquire IPv6 address] - [Acquire from router] is selected, the master unit IPv6 address is stored. For manual setting, "0" is stored.

DT24 -DT31

-

When [Automatically acquire IPv6 address] - [Acquire from DHCP] is selected, the master unit IPv6 address is stored. For manual setting, "0" is stored.

DT32
DT33 DT34 DT35 DT36 DT37 DT38 DT39 DT40 DT41 DT42 DT43

H0100 (U64)
HFE80 H0000 H0000 H0000 H0000 H0000 H0000 H0001 HAABB HCCDD HEEFF

The subnet prefix length is stored. Example) 64
The IPv6 address of the default gateway is stored. Example) fe80::1
The MAC address of the destination unit is stored. Example) AA-BB-CC-DD-EE-FF

17-10

ETSTAT (Acquiring Ethernet Unit Information: IP/MAC/Destination)

Example 5) When specifying the destination port number for a specified IPv4 connection The results are stored in the 19-word area that starts with [D]. [S1]... "IPv4" [S2]... "CONNECT1" [D]...DT20

DT20 DT21 DT22 DT23 DT24 DT25 DT26 DT27 DT28 DT29 DT30 DT31 DT32 DT33 DT34 DT35 DT36 DT37
DT38

Value H00C0 (U192) H00A8 (U168) H0005 (U5) H001E (U30) H00FF (U255) H00FF (U255) H00FF (U255) H0000 (U0) H00C0 (U192) H00A8 (U168) H0005 (U5) H0001 (U1) H9001 H0000 H00C0 (U192) H00A8 (U168) H0005 (U5) H000B (U11)
H8001 (U32769)

Description
The master unit IPv4 address is stored. Example) 192.168.5.30
The subnet mask is stored. Example) 255.255.255.0
Default gateway Example) 192.168.5.1
The master unit port number is stored. This value indicates the type of the IP address. For IPv4, the value is "0".
The destination IPv4 address is stored. Example) 192.168.5.1
The destination port number is stored. Example) 32769

17-11

High-level Instructions (Ethernet Communication)

Example 6) When specifying the destination port number for a specified IPv6 connection The results are stored in the 52-word area that starts with [D]. [S1]... "IPv6" [S2]... "CONNECT1" [D]...DT0

DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 -DT15 DT16 -DT23 DT24 -DT31
DT32
DT33 DT34 DT35 DT36 DT37 DT38 DT39 DT40 DT41 DT42 DT43 DT44 DT45 DT46 DT47 DT48 DT49 DT50
DT51

Value HFE80 H0011 H2233 H4455 H6677 H8899 HAABB HCCDD
-
-
-
H0100 (U64)
HFE80 H0000 H0000 H0000 H0000 H0000 H0000 H0001 H9001 H0001 HFE80 H0011 H2233 H4455 H6677 H8899 H99AA HCCDD
H8001 (U32769)

Description
The master unit IPv6 address (manual setting) is stored. Example) fe80:0011:2233:4455:6677:8899:aabb:ccdd
The master unit IPv6 address (link local) is stored. When [Automatically acquire IPv6 address] - [Acquire from router] is selected, the master unit IPv6 address is stored. For manual setting, "0" is stored. When [Automatically acquire IPv6 address] - [Acquire from DHCP] is selected, the master unit IPv6 address is stored. For manual setting, "0" is stored. The subnet prefix length is stored. Example) 64
The IPv6 address of the default gateway is stored. Example) fe80::1
The master unit port number is stored. The type of the IP address is stored. For IPv6, the value is "1".
The destination IPv6 address is stored. Example) fe80:0011:2233:4455:6677:8899:99AA:ccdd
The destination port number is stored. Example) 32769

 Flag operations

Name

Description

To be set when the read area is out of the range.

To be set when the read type (S1) is set to an item other than "IPv4", "IPv6", "FTPc", "HTTPc", or "SMTPc".

SR7 SR8 (ER)

To be set when the target to be read (S2) is set to an item other than "MAC", "CONNECT", "IDx", "LOGx", "IDALL", or "LOGALL".
To be set when an unset transfer setting is specified.
To be set when an unset logging/trace transfer setting is specified.

To be set when the unit specified by UNITSEL is not the built-in ET-LAN in the CPU unit.

To be set when executed in an interrupt program.

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-12

ETSTAT (Acquiring Ethernet Unit Information: FTP/HTTP/SMTP)

ETSTAT (Acquiring Ethernet Unit Information: FTP/HTTP/SMTP)

 Ladder diagram

R0

UNITSEL

U100

U1

S1

S2

ETSTAT

"IPv4"

"CONNECT"

DT0

S1

S2

D

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
ETSTAT "FTPc" "IDALL" DT0

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a read type, or a character constant.

S2

Starting address of the device area that stores the string data that indicates a target to be read, or a character constant.

D

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

S1

   

 

S2

   

 

D

   

 

Integer K U H

Real number

String

Index

modification SF DF " "

 

 Outline of operation
This instruction reads the information of the Ethernet unit.
 Process details
· The parameter information or status information specified by [S1] and [S2] is read and stored in the area starting with [D].
· The number of words in the storage area varies according to the type of read data and the target.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· For [S1] and [S2], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous.
· This instruction is not available in interrupt programs.

17-13

High-level Instructions (Ethernet Communication)

 Setting of the operands [S1] and [S2]

Setting item Settings

When specifying FTP client

Specify "FTPc".

S1

Read type

When specifying HTTP client

Specify "HTTPc". (Note 1)

When specifying mail transmission

Specify "SMTPc".

When specifying transfer numbers individually

Specify "IDx" with x being a value from 0 to 15.

S2

Read target

When specifying logging individually

Specify "LOGx" with x being a value from 0 to 15. (Note 1)

When specifying all transfer numbers

Specify "IDALL".

When specifying all loggings

Specify "LOGALL". (Note 1)

D

Read destination Specify the destination device address to which the state is read out.

(Note 1): When "HTTPc" is specified for [S1], neither "LOGx" nor "LOGALL" can be specified for [S2]. If one of them is specified, an operation error occurs.

 Data to be read and the number of words
Data to be read and the number of words vary depending on the setting of [S2].

[S2]

Storage location
[D]
[D+1]

Name
Transferring ID number
Transferring data type

[D+2]

Transfer status

"IDALL"

(1)

"LOGALL" (Note 1)

[D+3]

(Note 2)

Transfer result

[D+4]- [D+9]

Latest transfer success time

[D+10]- [D+15]

Latest transfer failure time

[D+16]- [D+17]

Number of transfer successes (Whole)

[D+18]- [D+19]

Number of transfer failures (Whole)

Total number of words

[D]

Control relay (Note 3)

"IDx" (2) "IDALL"
(Note 1)

[D+1]

Execution done code (Note 4)

[D+2]

Transfer done code

[D+3]- [D+4]

Number of successful executions (individual)

[D+5]- [D+6]

Number of failed executions (individual)

Total number of words

Number of words
1 1
1
1 6 6

Description
0 to 15 Transfer setting ID or log setting ID (for FTP/HTTP) Trigger setting ID or log setting ID (for SMTP)
0: File transfer or event mail 1: Logging/trace transfer or logging/trace mail
High byte H0: Retry not in progress, H1: During retry
Low byte H00: No request, H01: Waiting for transfer, H02: During login, H03: During sending, H04: During receiving, H05: Transfer complete
0: Transfer succeeded, 1: Login error, 2: Transfer error, 3: Transfer canceled
Year, month, day, hour, minute and second when the last transfer succeeded
Year, month, day, hour, minute and second when the last transfer failed

2

Number of times that transfer succeeded

2

Number of times that transfer failed

20

-

1

FTPc control relay, HTTPc control relay, Mail transmission control relay

1

0: Normal completion. An error code is stored at abnormal completion.

1

FTP/HTTP/SMTP response code (Note 5)

2

Number of times that transfer succeeded

2

Number of times that transfer failed

7

-

17-14

ETSTAT (Acquiring Ethernet Unit Information: FTP/HTTP/SMTP)

[D]

Control relay (Note 3)

1

FTPc logging control relay, HTTPc logging control relay, Mail transmission logging control relay

[D+1]

"LOGx"

[D+2]

(3) "LOGALL"

(Note 2) [D+3]- [D+4]

Execution done code (Note 4)
Transfer done code
Number of successful executions (individual)

1

0: Normal completion. An error code is stored at abnormal completion.

1

FTP/HTTP/SMTP response code (Note 5)

2

Number of times that transfer succeeded

[D+5]- [D+6]

Number of failed executions (individual)

2

Number of times that transfer failed

Total number of words

7

-

(Note 1): When "IDALL" is specified, the entire status (20 words) and the status (7 words) for each registered ID are read. (Note 2): When "LOGALL" is specified, the entire status (20 words) and the status (7 words) for each registered LOG are read. (Note 3): The control relay reads the states of relays for each ID or LOG setting. For details, refer to "p.17-17." (Note 4): For details of execution done codes at abnormal completion, refer to "p. 17-17." (Note 5): For details of FTP/HTTP/SMTP response codes, refer to "p. 17-18 to p.17-19."

 Execution example
Example 1) When specifying a transfer number

The 7-word status for the transfer number that is specified by [S2] is read.

[S1]... "FTPc" [S2]... "ID5" [D]...DT0

DT0 DT1 DT2 DT3-DT4 DT5-DT6

Control relay Execution done code Transfer done code Number of successful transfers (individual) Number of failed transfers (individual)

Example 2) When specifying "IDALL" (all ID numbers)

The entire status for all transfer IDs and the status for each ID that is set are read. [S1]... "FTPc" [S2]... "IDALL" [D]...DT0

DT0 DT1 DT2 DT3 DT4-DT9 DT10-DT15 DT16-DT17 DT18-DT19 DT20 DT21-DT27 DT28-DT34 DT35-DT41 DT(21+7x) -DT(27+7x)

Transferring ID number Transferring data type Transfer status Transfer result Latest transfer success time Latest transfer failure time Number of transfer successes (Whole) Number of transfer failures (Whole) ID transfer setting Status of ID0 Status of ID1 Status of ID2 -
Status of IDx

Only the bit for each ID number that is set is turned ON.
The status data (7 words) for each of the 16 IDs is read. Control relay: 1 word Execution done code: 1 word Transfer done code: 1 word Number of successful executions (individual): 2 words Number of failed executions (individual): 2 words

17-15

High-level Instructions (Ethernet Communication)

Example 3) When "LOGALL" (all LOG numbers) is specified

The entire status of the logging trace and the status of each ID that is set for the logging trace are read.

[S1]... "FTPc" [S2]... "LOGALL" [D]...DT0

DT0

Transferring ID number

DT1

Transferring data type

DT2

Transfer status

DT3

Transfer result

DT4-DT9

Latest transfer success time

DT10-DT15

Latest transfer failure time

DT16-DT17

Number of transfer successes (Whole)

DT18-DT19

Number of transfer failures (Whole)

DT20

LOG transfer setting

Only the bit for each ID number that is set is turned ON.

DT21-DT27 DT28-DT34 DT35-DT41 DT(21+7x) -DT(27+7x)

Status of LOG0 Status of LOG 1 Status of LOG 2 -
Status of LOG x

The status data (7 words) for each of the 16 LOG numbers is read. Control relay: 1 word Execution done code: 1 word Transfer done code: 1 word Number of successful executions (individual): 2 words Number of failed executions (individual): 2 words

 Control relay
Each of the following bits is allocated for the control relay (1 word).

Bit no. 15

87 43 0

00000000

Transfer disable relay (bit 15)
0: Transfer enabled, 1: Transfer disabled

0: Fixed

Transfer request relay (bit 0) 0: No request, 1: Request

Transfer cancel request relay (bit 14) 0: Not cancel, 1: Cancel

Transfer active relay (bit 1) 0: Stop, 1: During transfer

Transfer direction relay (bit 5) 0: Send, 1: Receive

Retry active relay (bit 2) 0: No retry, 1: During retry

Execution result relay (bit 4) 0: Normal completion, 1: Abnormal completion

Execution done relay (bit 3) 0: During process, 1: Instruction execution complete

(Note 1): The transfer direction relay (bit 5) is "0" for logging or an HTTP client. (Note 2): The transfer cancel request relay (bit 14) is "0" for logging or an HTTP client.

17-16

ETSTAT (Acquiring Ethernet Unit Information: FTP/HTTP/SMTP)

 List of execution done codes

Code Name

Description

0

Normal end

To be set when the processing of a transfer request instruction is completed successfully.

1

Transfer server unset error

To be set when the setting of the server that is accessed during the execution of a transfer request instruction is not completed.

2

Transfer setting unset error

To be set when the transfer setting for the transfer number that is specified during the execution of a transfer request instruction is not completed.

3

Destination group unset error

To be set when the destination group setting for the transfer number that is specified during the execution of a transfer request instruction is not completed.

4

Client registration error

To be set when a process request to a client fails to register.

5

Transfer disabled error

To be set when the transfer disable relay is "1=Transfer disabled" for the transfer number that is specified during the execution of a transfer request instruction.

6

Transfer canceled error

To be set when the transfer cancel request relay is changed from "0" to "1" (the leading edge OFF to ON) which means a request to cancel.

7

Transfer failed error

To be set when the transfer done relay is "1=Transfer done" and the transfer failure relay is "1=Transfer failed".

8

Data decompression error (write)

To be set when an error occurs during decompression of data for registration to a client.

9

Data decompression error (read)

To be set when an error occurs during acquisition of data from a client.

10

File delete error

To be set when file deletion after transfer is specified but the file cannot be deleted.

17-17

High-level Instructions (Ethernet Communication)

 List of transfer done codes (FTP error codes)
Error code Description

226

Normal end

421

It is not possible to provide services. Ends control connection. At the time of the shutdown of server.

425

It is not possible to open data connection.

426

Connection was closed and data transfer was canceled for some reason.

450

It is not possible to execute the request for any reason of access authority or file system.

451

Processing was canceled due to a local error.

452

It is not possible to execute due to any problem in disk capacity.

500

Syntax error of commands

501

Syntax error of arguments or parameters

502

Command is not implemented.

503

The order of using commands is wrong.

504

Arguments or parameters are not implemented.

530

User could not log in.

532

Charging information must be confirmed with ACCT command for file transmission.

550

It is not possible to execute the request for any reason of access authority or file system.

551

It is not possible to execute because of a problem in the type of page structure.

552

It is not possible to execute due to any problem in disk capacity.

553

it is not possible to execute due to an incorrect file name.

1XXX

An error occurred during file deletion after transfer (not to be retried).

9XX

Client service error

 List of transfer done codes (HTTP error codes)
Error code Description

2XX

Normal end

300

Multiple pages can be used.

301

This address was moved to another address.

302

This address is temporarily placed in another address.

303

Refer to another page.

304

Although the access was permitted, the target document has not been updated.

305

Only the access via the proxy of Location field can be permitted.

307

This address temporarily belongs to another address.

400

An error occurs in the request such as a typing mistake.

401

Failed in authentication. (This error occurs in cases such as the entry of a wrong password.)

403

You do not have access rights.

404

The page of the appropriate address does not exist, or the server is down.

405

A request of an unpermitted method type was received.

406

As a result drawn from the Accept header, unacceptable content was included.

407

Proxy authentication is required first.

408

No response was made to the request within the waiting time.

409

The request could not be completed because it conflicts with the resource of the current state.

410

The request cannot be used in the server and the destination address is unknown.

411

The requet without the defined Content-Length was rejected.

412

The condition given in more than one request header field was judged incorrect in the test on the server.

413

The request was rejected because its size is larger than the processible size.

414

The request was rejected because its URI is too long.

17-18

ETSTAT (Acquiring Ethernet Unit Information: FTP/HTTP/SMTP)

 List of transfer done codes (HTTP error codes)
Error code Description

415

The requested service was rejected by the server because the requested resource is an unsupported format for the requested method.

416

The request contains the Range header field, but no If-Range request header field.

417

The expansion of the Expect request header field was not accepted.

500

An error occurs in CGI script, etc.

501

The function required for executing the request is not supported.

502

An incorrect response was received when the server acting as a gateway or proxy attempted to execute a request.

503

It is not possible to access the address for some reason.

504

A response necessary for completing the request could not be received from a server such as DNS.

505

An unsupported HTTP protocol version was received.

9XX

Client service error

 List of transfer done codes (SMTP error codes)
Error code Description

0

Normal end

421

Not available.

450

Failed because mailbox is not available (temporarily).

451

Server error

452

Memory shortage

500

Unknown command

501

Command argument error

502

Command is not implemented.

503

Command sequence is incorrect.

504

Command parameter is not implemented.

550

Failed because mailbox is not available (permanently).

551

User is not a local user.

552

Command was cancelled because client memory area assignment is exceeded.

553

Mailbox name is invalid.

554

Transaction failed.

9XX

Client service error

 Flag operations

Name

Description

To be set when the read area is out of the range.

To be set when the read type (S1) is set to an item other than "IPv4", "IPv6", "FTPc", "HTTPc", or "SMTPc".

SR7 SR8 (ER)

To be set when the target to be read (S2) is set to an item other than "MAC", "CONNECT", "IDx", "LOGx", "IDALL", or "LOGALL".
To be set when a combination other than the combinations listed in the restrictions on combination is specified for the type (S1) and target (S2) to be read.
To be set when an unset transfer setting is specified.

To be set when an unset logging/trace transfer setting is specified.

To be set when the unit specified by UNITSEL is not the built-in ET-LAN in the CPU unit.

To be set when executed in an interrupt program.

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-19

High-level Instructions (Ethernet Communication)

IPv4SET (IP Address Setting)
 Ladder diagram

R0

X61

 DF 

IPv4SET

UNITSEL

U100

U1

S1

S2

"IP=192.168.1.5,MASK=255.255.255.0,GWIP=192.168.1.1"

S

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
IPv4SET "IP=192.168.1.5,MASK=255.255.255.0,GWIP=192.168.1.1"

 List of operands
Operand Description

S

Starting address of the device area that stores the string data that indicates the set parameters, or a character constant.

 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 configures the IP (IPv4) address setting.

 Process details
· The IPv4 setting parameter for [S] is stored in the operation work area, and the IP address (required), the subnet mask (optional), and the gateway (optional) of the Ethernet unit are initialized. For the items that are not changed by the instruction, the values that are set in the tool software are applied.

· Communication is not available during the initialization of the Ethernet.

· Statuses such as the establishment of IPv4 address or cable disconnection can be checked in the input relay area WX6 (X60 to X69).

· For details of the input relay area WX6, refer to "19-10 Ethernet Function: IP Addresses."

· If this instruction is executed with an IP address that is out of the available range, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed. For details, refer to "Range of the available IP addresses."

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

· The content set by this instruction is not held in the case of power outage. When the mode changes from PROG. to RUN again, the configuration information set by the tool software will be preset.

· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

The power supply for the PLC is switched from OFF to ON.

The PLC is changed to PROG mode.

Changes to RUN mode without rewriting the configuration.
Changes to RUN mode after rewriting the configuration

Operation Setting using the configuration Setting using instructions Setting using the configuration

17-20

IPv4SET (IP Address Setting)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· If the IP address setting is changed during communication, the process performed during communication will fail.

· Execute this instruction only once when starting the PLC. Do not execute it repeatedly.

· It takes more than three seconds to complete initialization after configuring this setting. Communication is disconnected until the completion of the initialization. All connections with the Ethernet function are disconnected during the execution.

· This instruction is not available in interrupt programs.

 Operand [S] setting
· Specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant.

· Both upper and lower case characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous.

· When specifying a device area for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item Settings

IPv4 address

Specify IP address (IPv4). Specify the keyword "IP=" at the beginning. IP=111.122.133.144

S

Subnet mask

Specify subnet mask. Specify the keyword "MASK=" at the beginning. MASK=255.255.255.0

Specify IP address of default gateway. Specify the keyword "GWIP=" at the beginning.

Default gateway

GWIP=111.122.133.4 Specify "0" when the default gateway is not used.

(Note 1): Input each setting parameter separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the keywords in the order of the above table.

Setting example

Example 1 S "IP=192.168.1.5,MASK=255.255.255.0,GWIP=192.168.1.1"

Settings

IP address: 192.168.1.5, Subnet mask: 255.255.255.0, Default gateway: 192.168.1.1

Example 2 S "IP=192.168.1.5,MASK=255.255.255.0,GWIP=0"

Settings

IP address: 192.168.1.5, Subnet mask: 255.255.255.0, Default gateway: Not use

· When an address is specified that is unusable for the parameters, the system relay SR9 (carry flag CY) is set to ON, one of the error codes 1 (IP address error) to 4 (default gateway error) is set for the system data register SD29 (Ethernet communication error code), and the process is terminated.
· For details of the available range of the address, refer to "19-10 Ethernet Function: IP Addresses."

17-21

High-level Instructions (Ethernet Communication)

 Setting status when parameters are omitted
· IPv4 address is essential. It must be described.

· "Subnet mask" and "Default gateway" can be omitted. Omitted parameters are not changed.

Parameter

IP (Internet Protocol):

MASK

Required

Omitted

Required

Set

Required

Omitted

GWIP
Set Omitted Omitted

Specification method
"IP=xxxx,GWIP=xxxx" "IP=xxxx,MASK=xxxx" "IP=xxxx"

Result reflected in parameters

IP Address

Subnet mask

Default gateway

Changed

Not changed Changed

Changed

Changed

Not changed

Changed

Not changed Not changed

Setting example

Example 1 S "IP=192.168.1.5,,GWIP=192.168.1.1"

Settings

IP address: 192.168.1.5, Subnet mask: Not change, Default gateway: 192.168.1.1

Example 2 S "IP=192.168.1.5,MASK=255.255.255.0"

Settings

IP address: 192.168.1.5, Subnet mask: 255.255.255.0, Default gateway: Not change

Example 3 S "IP=192.168.1.5"

Settings

IP address: 192.168.1.5, Subnet mask: Not change, Default gateway: Not change

 Example of program
· After confirming that the Ethernet initialization active flag (X61) is OFF, the instruction is executed.
· The UNITSEL instruction is used to specify a slot number (LAN port: U100) and a connection number (U1 to U16).
· Once the instruction is executed, the IPv4 setting parameter will be written in the system work area and initialization will be requested to the unit.
· Once the initialization is requested, the unit will close all connections and disconnect the communication.
· The unit turns OFF the IP address establishment flag (X62) and initializes the Ethernet unit with the value specified in the system work area.
· The unit starts auto negotiation at the time of initialization.
· The IP address establishment flag (X62) turns ON on the completion of initialization. It takes about three seconds to complete the initialization.
· Each communication task of FTPc, HTTPc and SMTPc starts according to the settings. It is possible to confirm those states with the ready flag for each operation.
· Each connection which automatic connection has been set is made, and the clear to send flag turns ON when the connections are complete.

R0 X61
Ethernet initialization active flag
R100 ( DF )
IPv4SET

R100

IPv4SET execution relay

UNITSEL U100 U5

S1

S2

"IP=192.168.1.5,MASK=255.255.255.0" S

IPv4SET execution conditions Ethernet initialization active flag: OFF
Specification of the slot port of the communication unit S1: Built-in ET-LAN in the CPU unit
(U100) S2: Connection 5 (U5)
IPv4SET instruction execution S: Setting parameters (Changes the IP, MASK)

17-22

IPv4SET (IP Address Setting)

 Time chart
The following figure shows the case for executing IPv4SET instruction using the FTP client function and mail send function (SMTP client).

(1)

(2)

(3)

(4)

Ethernet initialization active (X61)

IP address established (X62)

FTP server preparation done (X64)

FTP client preparation done (X65)

HTTP client preparation done (X68)

SMTP client preparation done (X69)

Master communication clear to send flag General-purpose communication clear to send flag

About 3 sec.

About 3 sec.

(1) PROG > RUN (Power ON)
Ethernet initialization done
(2) FTP client/SMTP client preparation done
Connection done

(3) IPv4 address setting (Executes IPv4SET instruction)
Ethernet initialization done
(4) FTP client/SMTP client preparation done
Connection done

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the same keyword is specified redundantly. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when the setting is other than IPv4. To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256.

To be set when the instruction is executed with an incorrect IP address. The detail code set in SD29 is "1: Specification of incorrect IP address".

To be set when executed with an incorrect subnet mask. The detail code set in SD29 is "2: Specification of incorrect subnet mask".

CY (SR9)

To be set when executed with an incorrect default gateway. The detail code set in SD29 is "3: Specification of incorrect default gateway".

To be set when executed in combination with incorrect IP addresses. The detail code set in SD29 is "4: Combination of incorrect IP addresses".

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-23

High-level Instructions (Ethernet Communication)

pPINGREQ (PING Request)

 Ladder diagram

R0

X62

 DF 

UNITSEL

U100

U1

S1

S2

pPINGREQ

U3

DT0

S

D

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Number of requests to send PING (Available range: 1 to 10 times)

D

Starting address of the device area that stores the results of the PING requests

 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 performs a PING send request to the partner unit IP address of a specified connection for the number of times that is specified by [S].

· This instruction is used for checking the operation status of a communication relay device.

· This instruction is dedicated to ET-LAN.

 Process details
· The PING request results are stored in the area that starts with [D].

· The timeout period for one PING response is one second (fixed).

· When the Ethernet task is initialized during a PING request, zero is set to all the areas in which the results are stored ([D]).

· The size of sent/received data is 56 bytes (fixed).

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· When a partner unit IP address is not specified, an error occurs.

· Use the ETSTAT instruction to check the target IP address for the PING request.

 Operand [S] setting
The instruction requests the sending of PING for the number of times that is specified for [S].

Setting item S

Settings
Number of times for sending PING

Specify the number of times.

Setting range 1 to 10 times

17-24

pPINGREQ (PING Request)

 Area storing execution results [D] to [D+5]

Operand

Execution result

Description

[D]

Execution result code

FFFF: In progress, 0: Normal end, H1x: Request error, H2x: Response error

[D+1]

Number of transmissions

[D+2]

Number of responses

[D+3] [D+4] [D+5]

Response time (maximum) Response time (minimum) Response time (Average)

U0 to U1000 (ms) Response time is in 10 ms unit. When it is less than 10 ms, 0 is stored.

 Execution result code [D]
· In the case of abnormal request (10 to 13), it is set when the instruction is executed and the PING request is not performed.
· The response error (20) occurs when no response is returned from the Ethernet task.

Code H0 H10 H11 H12 H13 H14 H15 H20

Execution result Normal end Double startup error Number of requests to send error Ethernet unit unselected error Connection unused error Disconnection error Ethernet initialization active error Ethernet task response timeout

PING request instruction is being executed. The number of requests to send is not in the available range (1 to 10). The unit selected with UNITSEL is not Ethernet unit. The specified connection is set to "Not use". Ethernet is disconnected. Ethernet is being initialized. It occurs when no response is returned from the Ethernet task.

 Example of processing
Example 1) Once, when PING request, send and response has been completed successfully (when the response time is 10 ms)

[S]...U1 [D]...DT10

DT10 DT11 DT12 DT13 DT14 DT15

H FFFF K 0 K 0 K 0 K 0 K 0

DT10 DT11 DT12 DT13 DT14 DT15

H FFFF K 0 K 0 K 0 K 0 K 0

DT10 DT11 DT12 DT13 DT14 DT15

H0 K 1 K 1 K 10 K 10 K 10

When instruction is executed

PING is being executed.

PING response is completed.

Example 2) Three times, when the PING request, transmission, and response have been completed successfully (when the response time is 10, 13, or 22 ms)

[S]...U3 [D]...DT10

DT10 DT11 DT12 DT13 DT14 DT15

H FFFF K 0 K 0 K 0 K 0 K 0

DT10 DT11 DT12 DT13 DT14 DT15

H FFFF K 0 K 0 K 0 K 0 K 0

DT10 DT11 DT12 DT13 DT14 DT15

H0 K 3 K 3 K 22 K 10 K 15

When instruction is executed

PING is being executed.

PING response is completed.

17-25

High-level Instructions (Ethernet Communication)

Example 3) Three times, when PING request was made, and the operation timed out once (when the response time is 10 or 14 ms)
[S]...U3 [D]...DT10

DT10 DT11 DT12 DT13 DT14 DT15

H FFFF K 0 K 0 K 0 K 0 K 0

DT10 DT11 DT12 DT13 DT14 DT15 DT16

H FFFF K 0 K 0 K 0 K 0 K 0

DT10 DT11 DT12 DT13 DT14 DT15

K 0 K 3 K 2 K 14 K 10 K 12

When instruction is executed

PING is being executed.

PING response is completed.

Example 4) When PING request abended (Disconnection detection)

[S]...U1 [D]...DT10

DT10 DT11 DT12 DT13 DT14 DT15

K 13 K 0 K 0 K 0 K 0 K 0

When instruction is executed

PING is being executed.

PING response is completed.

 Example of program
· The UNITSEL instruction is used to specify a slot number (LAN port: U100) and a connection number (U1 to U16 for general-purpose communication).
· The PINGREQ instruction checks the operation status of the specified unit.

R0

Specification of the slot port of the communication unit

UNITSEL U100 U1

S1: ET-LAN port (U100)

S1

S2

S2: Connection 1 (U1)

pPINGREQ U3 S

DT10 D

PINGREQ instruction execution S: Number of times of PING request (U3) D: Address for storing the results (DT10)

 Flag operations

Name

Description

SR7

To be set when the device address specified by [D] to [D+5] exceeds the upper limit of the device.

SR8

To be set in the case of out-of-range in indirect access (index modification).

(ER)

To be set when executed in an interrupt program.

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-26

CONSET (User Connection Setting)

CONSET (User Connection Setting)
 Ladder diagram

R0

X62

 DF 

UNITSEL

U100

U1

S1

S2

CONSET "GP,OPTNAV,SV,AUTO,UDP" "PORT=9000,DISCONT=0" U1 U16

S1

S2

D1 D2

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
CONSET "GP,OPTNAV,SV,AUTO,UDP" "PORT=9000,DISCONT=0" U1 U16

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates the parameters for operation setting, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the parameters for port setting, or a character constant.

D1

Device address where the setting start connection number is stored, or a constant

D2

Device address where the setting end connection number is stored, or a constant

 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

   

 

D1

   

 

D2

   

 

Integer K U H
   

Real number

String

Index

modification SF DF " "

 
 

 Outline of operation
· This instruction sets the connection setting parameters that are specified by [S1] and [S2], for the connections which are in the range specified by [D1] and [D2].

 Process details
· This instruction sets the connection setting parameters that are specified by [S1] and [S2], for the connections which are in the range specified by [D1] and [D2].

· If an incorrect IP address is specified, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· This instruction can be executed when the IP address establishment flag (X62) is ON. As an execution condition of the instruction, insert a program that checks the status of the flag (X62). If this instruction is executed when the flag (X62) is OFF, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

The power supply for the PLC is switched from OFF to ON.

The PLC is changed to PROG Changes to RUN mode without rewriting the configuration.

mode.

Changes to RUN mode after rewriting the configuration.

Operation Setting using the configuration Setting using instructions Setting using the configuration

17-27

High-level Instructions (Ethernet Communication)
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· For [S1] and [S2], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous.
· Set to make [D1] be equal to or smaller than [D2]. · The maximum number that can be set for connection numbers for [D1] and [D2] is "Number of user
connection information settings" in the Ethernet unit configuration data. · When the open method is by client connection, the partner unit IP address is set incrementally one by one
for each connection from the setting start connection to the setting end connection. · When the open method is by server connection, the master unit port number is set incrementally one by one
for each connection from the setting start connection to the setting end connection. · Specify [D1] and [D2] so that the IP address of the partner unit or the master unit port does not exceed the
available range. · An operation error occurs when a connection is open or a connection with the automatic open setting exists
at the time of the execution. However, when multiple connections are set, the settings for the connections before the connection in which an operation error occurs will change. The settings for the connections after the connection in which an operation error occurs will not change. · An operation error occurs if a set of connections in the range that is specified by [D1] and [D2] contains connections for a multi connection server. · This instruction is not available in interrupt programs.
17-28

CONSET (User Connection Setting)

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates the parameters for operation setting, or a character constant.

· When "INITIAL" is specified instead of parameters, the instruction operates according to the table of special keywords.

Setting item Settings

Specify an operation mode.

MEWCOM : Specifies MEWTOCOL-COM.

MEW7COM : Specifies MEWTOCOL-7.

MODBUS

: Specifies MODBUS-TCP.

Operation mode setting
(Essential)

MEWDAT MC3EBIN GP

: Specifies MEWTOCOL-DAT. : Specifies the MC protocol (3E BINARY). : Specifies general-purpose communication.

GP_LARGE

: Specifies general-purpose communication (with large capacity reception).

* An operation error occurs when GP is specified for the 17th or later user connections. * An operation error occurs when GP_LARGE is specified for the second or later user connections.

Specify protocol options. Available options differ according to operation modes. OPTAV: Option is available. OPTNAV: Option is not available.

Operation mode select

Option is available.

Option is not available.

MEWTOCOL-COM

Connect with FP2 ET-LAN No connection

MEWTOCOL7-COM

Invalid

-

S1

MODBUS-TCP

Invalid

-

Option settings (Essential)

MEWTOCOL-DAT MC protocol (3E BINARY)

Connect with FP2 ET-LAN Invalid

No connection

General-purpose Communication

Not append a special header

Append a special header

General-purpose communication (with large capacity reception)

Not append a special header

Cannot specify

* An operation error occurs if OPTNAV is specified when GP_LARGE is specified for the operation mode setting.

Open method setting
Server/Client (Essential)

Specify open method (Server/Client). CL: Client connection, SV: Server connection (any partner)

Open method setting
Automatic/Manual (Essential)

Specify open method (Auto/Manual).
AUTO: Open automatically MANU: Not open automatically (Open with open instruction)

Communication method setting (Essential)

Specify communication method (TCP/UDP). TCP: TCP/IP setting, UDP: UDP/IP setting * An operation error occurs if UDP is specified when GP_LARGE is specified for the operation mode setting.

(Note 1): For operation settings, input each setting parameter separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): The operation setting parameters cannot be omitted. Specify them in the order of the above table. (Note 4): There is the following difference between high-level instructions and configuration data when UDP is specified for the
communication method. Although the open method (server/client) setting is not available for configuration data, it must be specified either server or client for high-level instructions. Specify SV for using it as slave connection, and specify CL for using it as master connection. (Note 5): General-purpose communication (with large capacity reception) is available for the CPU unit CPS4*CPS3* Ver.4.32 or later.

17-29

High-level Instructions (Ethernet Communication)

Setting example

Example 1 S1 "MEWCOM,OPTAV,CL,AUTO,TCP"

Settings

Operation mode setting: MEWCOM, Option setting: Option available, Open method (Server/Client): Client, Open method (Automatic/Manual): Open automatically, Communication method: TCP/IP

Example 2 S1 "MODBUS,OPTNAV,SV,MANU,UDP"

Settings

Operation mode setting: MODBUS, Option setting: Option not available, Open method (Server/Client): Server (any partner), Open method (Automatic/Manual): Not open automatically, Communication method: UDP/IP

Example 3 S1 "GP,OPTNAV,SV,AUTO,UDP"

Settings

Operation mode setting: GP, Option setting: Option not available Open method (Server/Client): Server (any partner), Open method (Automatic/Manual): Open automatically, Communication method: UDP/IP

Example 4 S1 "GP_LARGE,OPTAV,SV,MANU,TCP"

Settings

Operation mode setting: General-purpose communication (large capacity general-purpose reception), Option setting: Not append a special header Open method (Server/Client): Server (any partner) Open method (Automatic/Manual): Not open automatically, Communication method: TCP/IP

 Special keyword of operand [S1] setting

Special keyword

Description

INITIAL

Set the default.

Setting example

Example S1 "INITIAL"

Settings

Operating mode setting: MEWTOCOL-COM, Option setting: Option not available, Open method (Server/Client): Client, Open method (Automatic/Manual): Open automatically, Communication method: TCP/IP

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates the parameters for port setting, or a character constant. Setting items differ between specifying Client and specifying Server. It is prohibited to specify the same setting parameter redundantly. If specified, an error occurs.

<When specifying Client (when connecting from FP7)>
· The partner unit IP address is set by being incremented by one for each connection from the setting start connection number to the setting end connection number. The increment range is the lower one block only.

· Partner unit port numbers and unused connection disconnect time are not incremented.

· An error occurs if the value of IPv4 address exceeds 255 or the value of IPv6 address exceeds FFFFh when they are incremented.

Setting item Settings

Specify the partner unit IP address of the setting start connection. Specify the keyword "IPv4=" or "IPv6=" at the beginning.

Partner unit IP address

- For an IPv4 address IPv4=111.122.133.144

- For an IPv6 address IPv6=1111:1222::1555:0:0:1888

(Essential)

* When specifying IPv4, 000.000.000.000(0.0.0.0) cannot be specified.

* When specified, CY flag (SR9) turns ON and 1 (IP address error) is set to SD29, and the

process is terminated.

S2

* An operation error does not occur. The setting is not made.

Partner unit port number
(Essential)

Specify the port number (1 to 65535) of partner unit. Specify the keyword "PORT=" at the beginning.
PORT=xxxx

Unused connection disconnect time

Specify unused connection disconnect time (0 to 4294967295: 10 ms unit) However, when 0 is specified, connection is not automatically disconnected. Specify the keyword "DISCOUNT=" at the beginning.

(Essential)

DISCONT=xxxx

(Note 1): Upper and lower case characters can be used for specifying keywords. (Note 2): All the items cannot be omitted. Specify them in the order of the above table.

17-30

CONSET (User Connection Setting)

Setting example

Example 1 S2 "IPv4=192.255.2.10,PORT=9000,DISCONT=0"

Settings

Partner unit IP address: 192.255.2.10, Partner unit port number: 9000, Unused connection disconnect time: 0

Example 2 S2 "IPv6=1111:1222::1555:0:0:1999,PORT=10000,DISCONT=30000"

Settings

Partner unit IP address: 1111:1222::1555:0:0:1999, Partner unit port number: 10000, Unused connection disconnect time: 30000

Example 3 S2 "IPv4=192.255.100.11,PORT=2500,DISCONT=50"

Settings

Partner unit IP address: 192.255.100.11, Partner unit port number: 2500, Unused connection disconnect time: 50

<When specifying Server (when connecting to FP7)>
· The master unit port number is set by being incremented by one for each connection from the setting start connection number to the setting end connection number. The unused connection disconnect time is not incremented.

· An error occurs if the port number exceeds 65535 when it is incremented.

Setting item S2

Settings
Master unit port number (Essential)
Unused connection disconnect time (Essential)

Specify the master unit port number (1 to 65535) of setting start connection. Specify the keyword "PORT=" at the beginning. PORT=xxxx
Specify unused connection disconnect time (0 to 4294967295: 10 ms unit) However, when 0 is specified, connection is not automatically disconnected. Specify the keyword "DISCOUNT=" at the beginning.
DISCONT=xxxx

Setting example

Example 1 S2 "PORT=9000,DISCONT=0"

Settings

Master unit port number: 9000, Unused connection disconnect time: 0

Example 2 S2 "PORT=10000,DISCONT=30000"

Settings

Master unit port number: 10000, Unused connection disconnect time: 30000

Example 3 S2 "PORT=10000,DISCONT=70"

Settings

Master unit port number: 10000, Unused connection disconnect time: 70

 Operand [D1] setting
· Specify the device address storing a setting start connection number or a constant.

Setting item D1

Settings
Setting start connection number

Specify setting start connection number.

Setting range 1 to 216 (maximum)

 Operand [D2] setting
· Specify the device address storing a setting end connection number or a constant.

Setting item D2

Settings
Setting end connection number

Specify setting end connection number.

Setting range 1 to 216 (maximum)

17-31

High-level Instructions (Ethernet Communication)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when [D1] is larger than [D2]. To be set when [D1] and [D2] exceed the number of user connection information settings. To be set when an out-of-range value is specified for parameters. To be set when the same keyword is specified redundantly. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when the lower one block of IP address exceeds the available range when incremented. To be set when the master unit port number exceeds the settable range when incremented. To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256. To be set when there is an open connection. To be set when there is a connection with the automatic open setting.
An operation error occurs if a set of connections in the range that is specified by [D1] and [D2] contains connections for a multi connection server. To be set when "GP_LARGE" is specified for the operation mode setting in [S1] and "OPTNAV" is specified for the option setting in [S1]. To be set when "GP_LARGE" is specified for the operation mode setting in [S1] and "UDP" is specified for the communication method in [S1]. To be set when "GP_LARGE" is specified for the operation mode setting in [S1] and [D1] or [D2] is not 1.

CY (SR9)

To be set when the instruction is executed with an incorrect IP address. The detail code set in SD29 is "1: Specification of incorrect IP address".
To be set when the instruction is executed while the IP address is not established. The detail code set in SD29 is "12: IP address not established".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-32

OPEN (Connection Open)

OPEN (Connection Open)
 Ladder diagram

R0  DF 

X62

UNITSEL

U100 S1
OPEN

U1 S2 U216 S

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Device address storing the connection number to be opened or a constant.

 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 opens a specified connection.
 Process details
· The communication circuit of the connection specified by [S] is opened.
· When the connection is already open, this instruction is not executed.
· The completion of the open operation can be confirmed by the status (ON) of the clear to send flag for the master communication or general-purpose communication.
· The open method setting (automatic/manual) is not changed.
· This instruction can be executed when the IP address establishment flag (X62) is ON. As an execution condition of the instruction, insert a program that checks the status of the flag (X62). If this instruction is executed when the flag (X62) is OFF, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.
· During the processing of connection, the system relay SR9 (carry flag CY) is set and this instruction is not executed.
· When the connection is occupied, this instruction is not executed.
· To open connections for a multi connection server, specify the first connection. If this instruction is executed for a connection other than the first connection, an operation error occurs.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· When the open type is set to open automatically, it is not necessary to execute this instruction.
· This instruction is not available in interrupt programs.

17-33

High-level Instructions (Ethernet Communication)

 Operand [S] setting
Specify the device address storing the connection number to be opened or a constant.

Setting item S

Settings Connection number

Specify a connection number.

Setting range 1 to 216

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when executed in an interrupt program. To be set when this instruction is executed for a connection other than the first connection in a multi connection server.

CY (SR9)

To be set when the instruction is executed while the IP address is not established. The detail code set in SD29 is "12: IP address not established".
To be set when executed during the processing of connection. The detail code set in SD29 is "14: Connection being processed".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-34

CLOSE (Connection Close)

CLOSE (Connection Close)
 Ladder diagram

R0  DF 

X62

UNITSEL

U100 S1
CLOSE

U1 S2 U216 S

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Device address storing the connection number to be closed or a constant.

 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 closes a specified connection.
 Process details
· The communication circuit of the connection specified by [S] is closed.
· When the communication circuit is already closed, this instruction is not executed.
· The completion of the close operation can be confirmed by the status (OFF) of the clear to send flag for the master communication or general-purpose communication.
· This instruction can be executed when the IP address establishment flag (X62) is ON. As an execution condition of the instruction, insert a program that checks the status of the flag (X62). If this instruction is executed when the flag (X62) is OFF, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the connection is occupied, the system relay SR9 (carry flag CY) is set and this instruction is not executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.
· To close connections for a multi connection server, specify the first connection. If this instruction is executed for a connection other than the first connection, an operation error occurs.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· When the open type is set to open automatically, the connection is closed once, but it will be automatically connected again.
· This instruction is not available in interrupt programs.
 Operand [S] setting
Specify the device address storing the connection number to be closed or a constant.

Setting item S

Settings Connection number

Specify a connection number.

Setting range 1 to 216 (maximum)

17-35

High-level Instructions (Ethernet Communication)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when executed in an interrupt program. To be set when this instruction is executed for a connection other than the first connection in a multi connection server.

CY (SR9)

To be set when the instruction is executed while the IP address is not established. The detail code set in SD29 is "12: IP address not established".
To be set when the instruction is executed while the connection is occupied. The detail code set in SD29 is "15: Connection being occupied".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-36

NTPcSV (NTP Destination Server Setting Instruction)

NTPcSV (NTP Destination Server Setting Instruction)

 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

S1

S2

NTPcSV "IPv4=192.168.1.1,TIMEZONE=+0000" "DAY0900"

S1

S2

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
NTPcSV "IPv4=192.168.1.1,TIMEZONE=+0000" "DAY0900"

 List of operands

Operand Description

S1

Starting address of the device area that stores the string data that indicates the parameters for specifying a server, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the parameters for specifying time acquisition timing, or a character 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

S1

   

 

S2

   

 

*1: Only 16-bit devices can be modified. (Character constants cannot be specified.)

Integer K U H

Real number

String

Index

modification

*1 SF DF " "

 

 Process details · This instruction sets a destination NTP server and time zone to send a time adjustment request.

· The NTP server address and the time zone are set in the CPU unit (built-in ET-LAN) according to [S1].

· The timing of the time acquisition request is set according to [S2].

· The data that is already set in the CPU configuration is invalid and the NTP time acquisition request is executed at the timing that is specified by this instruction.

· The setting is valid until the power turns off. Also, the setting is valid until PROG. mode changes to RUN mode after a project is copied using an SD card and a communication command (download of project, backup/restoration of project, writing of configuration fixed area, forced cancel of security, initialization of system (factory default setting)) is executed. However, the time acquisition timing (CPU configuration) setting follows the project setting simultaneously when the project is changed, regardless of the mode change from PROG. to RUN.

· The setting content will not be lost even if the IPv4SET instruction is executed.

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

17-37

High-level Instructions (Ethernet Communication)

 Details of operand [S1]
Starting address of the device area that stores the string data that indicates the parameters for specifying a server, or a character constant.

Setting item
S1

Settings
NTP server IP address or host name (can be omitted)
Time zone Set (can be omitted)

Specify IP address or host name. For an IP address, specify the keyword "IPv4=" or "IPv6=" at the beginning. For a host name, specify "HOST=".

* The number of characters should be within 68 characters including a keyword ("IPv4=", "IPv6=", or "HOST=").

- For an IPv4 address

- For an IPv6 address

"IPv4=111.122.133.144"

"IPv6=1111:1222::1555:0:0:1888"

- For a host name

"HOST=ntp.pidsx.com"

Specify the time zone setting in "dHHMM" format (d: "+" or "-", HH: hour "00" to "24", MM: minute "00" to "59").

Specify the keyword "TIMEZONE=" at the beginning.

- For GMT+09:00 (Osaka, Sapporo, Tokyo)

- For GMT-10:00 (Hawaii)

"TIMEZONE=+0900"

"TIMEZONE=-1000"

- For GMT 00:00 (Greenwich Mean Time)

"TIMEZONE=+0000"

· Input "IP address or host name of NTP server" and "Time zone setting" separated by a comma ",".

· The keywords should be specified in the order shown in the above table. Upper and lower case characters can be used for specifying keywords.

· A part of parameters can be omitted. Omitted parameters are not changed.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting example

Example 1

S1 Settings

"IPv4=111.122.133.144,TIMEZONE=+0900" NTP server (IPv4): 111.122.133.144, Time zone: GMT+09:00

Setting example when omitting a part of a keyword

Example 2

S1 Settings

"HOST=ntp.pidsx.com" NTP server (Host name): ntp.pidsx.com, Time zone: Unchanged

Example 3

S1 Settings

",TIMEZONE=+0900" NTP server (IPv4): Unchanged, Time zone: GMT+09:00

Example 4

S1 Settings

"" NTP server (IPv4): Unchanged, Time zone: Unchanged

17-38

NTPcSV (NTP Destination Server Setting Instruction)

 Details of operand [S2]
Specify the starting address of the device area that stores the string data that indicates the parameters for specifying time acquisition timing, or a character constant.

Setting item Settings

Once daily Appointed time (can be omitted)

Time data acquisition timing: Once a day at a specified time. DAY= DISABLE: Not set HHMM: Set, HH: hour "00" to "23", MM: minute "00" to "59"

Once weekly

Time data acquisition timing: Once a week at a specified day of the week and time.

S2

Specified day of the week and time

WEEK= DISABLE: Not set WHHMM: Set, W: 0 (Sunday) to 6 (Saturday), HH: hour "00" to "23", MM: minute "00"

(can be omitted)

to "59"

Once monthly Specified date and time (can be omitted)

Time data acquisition timing: Once a month at a specified date and time. MONTH= DISABLE: Not set DDHHMM: Set, DD: "01" to "28", HH: hour "00" to "23", MM: minute "00" to "59"

· Input "Once daily/specified time", "Once weekly/specified day of the week and time" or "Once monthly/specified date and time" separated by a comma ",".

· The keywords should be specified in the order shown in the above table. Upper and lower case characters can be used for specifying keywords.

· A part of parameters can be omitted. Omitted parameters are not changed.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting example

Example 1

S2 Settings

"DAY=1234,WEEK=62345,MONTH=010010"
Once daily/specified time: Once daily at 12:34, Once weekly/specified day of the week and time: Every Saturday at 23:45, Once monthly/specified date and time: First day of every month at 00:10

Setting example when omitting a part of a keyword

Example 2

S2 Settings

"DAY=1234"
Once daily/specified time: Once daily at 12:34, Once weekly/specified day of the week and time: Unchanged, Once monthly/specified date and time: Unchanged

Example 3

S2 Settings

",WEEK=01234"
Once daily/specified time: Unchanged, Once weekly/specified day of the week and time: Every Sunday at 12:34, Once monthly/specified date and time: Unchanged

Example 4

S2 Settings

",,MONTH=112233"
Once daily/specified time: Unchanged, Once weekly/specified day of the week and time: Unchanged, Once monthly/specified date and time: 11th day of every month at 22:33

Example 5

S2 Settings

"DAY=DISABLE,WEEK=DISABLE,MONTH=282356"
Once daily/specified time: Not set (setting disabled), Once weekly/specified day of the week and time: Not set (setting disabled), Once monthly/specified date and time: 28th day of every month at 23:56

Example 6

S2 Settings

""
Once daily/specified time: Unchanged, Once weekly/specified day of the week and time: Unchanged, Once monthly/specified date and time: Unchanged

17-39

High-level Instructions (Ethernet Communication)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· For [S1] and [S2], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different.

· "When power supply is ON" cannot be set for the acquisition timing.

· After executing this instruction: When any of the settings "Once daily/specified time", "Once weekly/specified day of the week and time" and "Once monthly/specified date and time" is set to "Set", the time data acquisition method "Acquire automatically from SNTP server" should be set to "Yes". When all the settings "Once daily/specified time", "Once weekly/specified day of the week and time" and "Once monthly/specified date and time" are set to "Not set", the time data acquisition method "Acquire automatically from SNTP server" should be set to "No".

· This instruction is not available in interrupt programs.

· This instruction cannot be used while the NTP time is being acquired. It is recommended to use this instruction only once.

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the unit specified by UNITSEL is not the built-in ET-LAN in the CPU unit. To be set when executed in an interrupt program. To be set while acquiring the time of NTP.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

17-40

pNTPcREQ (Time Adjustment Request Instruction)

pNTPcREQ (Time Adjustment Request Instruction)

 Ladder diagram
R0 X62

UNITSEL U100

U1

S1

S2

pNTPcREQ

DT0

DT2

DT3

S1

S2

D

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S1

Specify the number of times of request processing. (Settable range: 0 to 20 times)

S2

Specify the interval of request processing. (Settable range: 16 to 600 seconds)

D

Specify the starting address of the device area that stores the execution result of time adjustment. HFFFF: In progress, H0: Normal end, H1: Request error, H2: Communication error, H3: Response error

 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 requests to adjust the time.
 Process details
· Set the number of processing times for the time adjustment request by S1.
· If the time adjustment timeout is predicted, add the number of times of retransmission.
· For canceling the time adjustment retransmission, set the number of processing times to 0. For the retransmission canceling process, the execution result is not stored in [D].
· Set the time adjustment processing interval by [S2].
· The execution result of time adjustment is stored in the area that starts with [D].
· The timeout period for one time adjustment attempt is fixed to three seconds. When multiple time adjustment attempts are specified, a new request starts after the timeout period elapses (3 seconds) plus [S2] seconds (the processing interval).
· The total timeout period (seconds) for time adjustment is obtained by the following formula: S1x3 + (S2x(S1-1)). (Here, S1 is larger than 0.)

17-41

High-level Instructions (Ethernet Communication)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· It is necessary to set the SNTP server address in [Built-in ET-LAN configuration]. The setting of [Acquire automatically from SNTP server] that is set from [CPU configuration] > [Time data acquisition method] does not affect the instruction.

· When the Ethernet task is initialized during a time adjustment request, zero is set to all the areas in which the results are stored ([D]).

· Do not execute time adjustment continuously as there is a possibility that the access to the server will be prohibited.

· When this instruction is executed during the execution of an SNTP request using the time specified in [Acquisition timing] under [CPU configuration] > [Time data acquisition method], the request starts as a new request taking the execution of this instruction as a starting point.

· When the time specified in [CPU configuration] comes during the execution of this instruction, the execution of this instruction takes priority.

· The execution of the SNTP request by the [CPU configuration] setting is performed as follows; Timeout period = 3 seconds, Number of processing times = 20 times, Processing interval = 16 seconds.

· Even when the number of processing times [S1] is set to zero, specify a value within the normal range for the processing interval [S2].

· The NTP time adjustment processing by this instruction continues even after the PLC mode switches from RUN to PROG.

 Execution result code [D]
· In the case of abnormal request (10 to 15), the time adjustment request that is set when the instruction is executed is not performed.

· The communication error (20) occurs if no response is returned from the server after time adjustment is requested. (No response means that any response is not returned even when the processing is performed for the specified number of times.)

· The response error (30) occurs if no response is returned from the Ethernet task.

Code

Execution result

H0

Normal end

H10

Double startup error

The time adjustment request instruction is being executed. (Note 1)

H11

SNTP server address setting error ET-LAN setting, SNTP server address setting = "0.0.0.0"

H12

Disconnection error

Ethernet is disconnected.

H13

Ethernet initialization active error

Own IP address is not established. (X62 OFF)

H14

Number of processing times setting error

The specified number of processing times is out of the range.

H15

Processing interval setting error

The specified processing interval is out of the range.

H20

Response timeout error

The response time of time adjustment processing exceeds the predefined time. (Note 2)

H30

Ethernet task response timeout

It occurs when no response is returned from the Ethernet task.

(Note 1): The double startup error does not occur when the instruction is executed with the number of processing times being set to 0 to cancel the time adjustment request instruction.
(Note 2): This error occurs also when an NTP IP address is not resolved.

17-42

pNTPcREQ (Time Adjustment Request Instruction)
 Example of processing
Example 1) When the following operations are completed successfully: Time adjustment is requested.  Time is being adjusted.  Time adjustment is completed. [S1]...U1 [S2]...U16 [D]...DT10

DT10 HFFFF

DT10 HFFFF

DT10

0

When instruction is executed

Time is being adjusted

Time adjustment is complete.

Example 2) When a response timeout occurs during time adjustment [S1]...U3 [S2]...U16 [D]...DT10

DT10 HFFFF

DT10 HFFFF

DT10

20

When instruction is executed

Time is being adjusted

Time adjustment is complete.

Timeout occurs after 41 seconds: S1x3 + (S2x(S1-1)). (Total processing time before timeout is 3 seconds multiplied by 3. Total processing interval is 16 seconds multiplied by (3-1).)

Example 3) When a time adjustment request abends (Ethernet initialization active error) [S1]...U2 [S2]...U16 [D]...DT10

DT10

13

When instruction is executed
Example 4) When a time adjustment request abends (Number of processing times setting error) [S1]...U2 [S2]...U21 [D]...DT10

DT10

14

When instruction is executed

17-43

High-level Instructions (Ethernet Communication)

 Canceling the time adjustment request
· When the number of processing times is set to zero and the pNTPcREQ instruction is executed, a time adjustment request that is being executed is canceled.
· Only cancelling the request process is performed. The response waiting state for an NTP request (whose timeout period is fixed to 3 seconds) cannot be canceled.
· The following figures show some cases when the pNTPcREQ instruction is executed with the number of times (S1) being 2.
1) Normal execution

Instruction execution No. of processing timesS1=2
NTP request Execution result area

No. of processing times = 2

First request

During processing interval

Second request

H FFFF

2) Cancellation of the processing during an NTP request

H0 or H20 or H30

Instruction execution No. of processing times (S1)=2
NTP request

No. of processing times = 2

No. of processing times = 0

First request.

Instruction execution (cancel) No. of processing times S1=0
Execution result area

H FFFF

H0 or H20

3) Cancellation of the processing during the processing interval of an NTP request

Instruction execution No. of processing times (S1)=2
NTP request
Instruction execution (cancel) No. of processing times (S1) =0 Execution result area

No. of processing times = 2

No. of processing times = 0

First request

Interruption of waiting for processing interval

H FFFF

H20

17-44

pNTPcREQ (Time Adjustment Request Instruction)

 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 unit specified by UNITSEL is not the built-in ET-LAN. To be set when executed in an interrupt program.

17-45

High-level Instructions (Ethernet Communication)

FTPcSV (FTP Client Connected Server Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

S1

S2

FTPcSV "SV0,IPv4=192.168.1.1" "USER=user,PASS=pw" "TOUT=30"

S1

S2

S3

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
FTPcSV "SV0,IPv4=192.168.1.1" "USER=user,PASS=pw" "TOUT=30"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates the parameters for specifying a server, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the login setting parameters, or a character constant.

S3

Starting address of the device area that stores the string data that indicates the detailed setting parameters, or a character constant.

 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 " "

  

 Outline of operation
· This instruction sets the server to which the FTP client is connected.
 Process details
· The settings for the server to which the FTP client is connected are specified in the CPU unit according to the specified parameters.
· The instruction can be executed when the transfer request relays of the FTPc control relay and the FTPc logging/trace control relay are OFF (0: No request). As an execution condition of the instruction, insert a program that checks the states of the transfer request relays. The states of the transfer request relay and the logging transfer request relay can be read with the ETSTAT instruction. Store the states that are read in a device such as an internal relay. An operation error occurs if the instruction is executed when one of the transfer request relays is ON.
· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

Operation

The power supply for the PLC is switched from OFF to ON.

Setting using the configuration

The PLC is changed to PROG Changes to RUN mode without rewriting the configuration. Setting using instructions

mode.

Changes to RUN mode after rewriting the configuration

Setting using the configuration

· If an incorrect IP address is specified, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

17-46

FTPcSV (FTP Client Connected Server Setting)

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· For [S1] to [S3], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different. The number of characters should not exceed 256.

· Both upper and lower case characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous. However, the server host name, the user name, and the password are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates the parameters for specifying a server, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· Specify the FTP server setting from SV0 in order. When the right order is skipped, an error occurs. It is possible to specify when the setting has been already registered.

· Only one server can be specified at the same time.

· Specify an FTP server number, the IP address or host name of an FTP server, a port number, an open method, and the SSL3/TLS1 authentication setting within 256 one-byte characters in total.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

FTP server number (Essential)

Specify FTP servers. Specify the following keywords. SV0: Server 0, SV1: Server 1, SV2: Server 2, SV3: Server 3

Specify IP address or host name. For an IP address, specify the keyword "IPv4=" or "IPv6=" at the beginning. For a host name, specify "HOST=".

FTP server's IP address or host name (Essential)

- For IPv4: IPv4=111.122.133.144
- For IPv6: IPv6=1111:122:2:1555:0:0:1888
* For details of the range of IPv4 addresses that can be specified, refer to "19-10 IP address setting specifications."

S1

- For a host name

HOST=FTP.pidsx.com

Port number (Can be omitted)

Specify port number. Port number range: 1 to 65535 PORT=: Port number (Default = 21)

Open method (Can be omitted)

Specify open method. Active=act/Passive=pasv OPEN=: Open method (Default = act)

SSL3/TLS1 authentication (can be omitted)

Specify whether or not to use SSL3/TLS1 authentication. SSL: Use SSL3/TLS1 NON: Not use

(Note 1): Input an FTP server number, the IP address or host name of an FTP server, a port number, an open method, and the SSL3/TLS1 authentication setting separated by a comma ",".
(Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the parameters for specifying servers in the order of the above table.

17-47

High-level Instructions (Ethernet Communication)

Setting example

Example 1 S1 "SV0,IPv4=192.255.2.10,PORT=21,OPEN=act,SSL"

Settings

FTP server number: 0, IP address: 192.255.2.10, Port number: 21, Open method: Active, SSL3/TLS1 authentication: Use

Example 2 S1 "SV1,IPv6=1111:1222:1555:0:0:1888,SSL"

Settings

FTP server number: 1, IP address: 1111:1222:1555:0:0:1888, Port number: Omitted (Default: 21), Open method: Omitted (Default: Active), SSL3/TLS1 authentication: Use

Example 3 S1 "SV2,HOST=FTP.pidsx.com,PORT=28,OPEN=pasv,NON"

Settings

FTP server number: 2, Host name: FTP.pidsx.com, Port number: 28, Open method: Passive, SSL3/TLS1 authentication: Not use

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates parameters, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· When "INITIAL" or "KEEP" is specified instead of parameters, the instruction operates according to the table of special keywords.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

Specify a user name.

User name (Can be omitted)

Specify the keyword "USER=" at the beginning.

USER=XXX (Default: root)

S2

Specify a password.

Password (Can be omitted)

Specify the keyword "PASS=" at the beginning.

PASS=XXX (Default: root)

(Note 1): Input a user name and password separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the login setting parameters in the order of the above table.

Setting example

Setting range Maximum 32 one-byte characters
Maximum 32 one-byte characters

Example 1 S2 "USER=root,PASS=pidsx"

Settings

User name: root, Password: pidsx

Example 2 S2 "USER=PANASONIC,PASS=SUNX"

Settings

User name: PANASONIC, Password: SUNX

 Operand [S2]: user name and password setting

Patterns

Specification method

Specify user name: Delete password

"USER=xxx,PASS="

Delete user name: Specify password

"USER=,PASS=xxx"

Delete user name: Delete password

"USER=,PASS="

Specify user name: Not change password "USER=xxx"

Not change user name: Specify password ",PASS=xxx"

17-48

FTPcSV (FTP Client Connected Server Setting)

Setting example

Example 1 S2 "USER=root,PASS="

Settings

User name: root, Password: Delete

Example 2 S2 "USER=,PASS=SUNX"

Settings

User name: Delete, Password: SUNX

Example 3 S2 "USER=,PASS="

Settings

User name: Delete, Password: Delete

Example 4 S2 "USER=root"

Settings

User name: root, Password: Not change

Example 5 S2 ",PASS=SUNX"

Settings

User name: Not change, Password: SUNX

 Special keyword of operand [S2] setting

Special keyword

Description

INITIAL

Set the default.

KEEP

The current setting is not changed.

Setting example

Example 1 S2 "INITIAL"

Settings

User name: root, Password: root

Example 2 S2 "KEEP"

Settings

User name: Not change, Password: Not change

 Operand [S3] setting
· Specify the starting address of the device area that stores the string data that indicates parameters, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· When "INITIAL" or "KEEP" is specified instead of parameters, the instruction operates according to the table of special keywords.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

Setting range

Timeout period (Can be omitted)

Specify a timeout period. TOUT=: Time setting (Default: 60 seconds)

30 to 300 seconds

S3

Number of retries (Can be omitted)

Specify the number of retries. RTRY=: Number of retries (Default: 3 times)

0 to 3

Retry interval (Can be omitted)

Specify the number of retries. RTTM=: Retry interval (Default: 600 seconds) *4

10 to 86400 seconds

(Note 1): Input a timeout period, number of retries and retry interval separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the detailed setting parameters in the order of the above table. (Note 4): The retry interval can be specified by 10 seconds. It is rounded down to the 100. (Example: When specifying 38 seconds, it
becomes 30 seconds.)

17-49

High-level Instructions (Ethernet Communication)

Setting example

Example 1 S3 "TOUT=30,RTRY=2,RTTM=500"

Settings

Timeout period: 30 seconds, Number of retries: Twice, Retry interval: 500 seconds

Example 2 S3 "TOUT=270,RTRY=0,RTTM=4900"

Settings

Timeout period: 270 seconds, Number of retries: 0 (Not retry), Retry interval: 4900 seconds

Example 3 S3 "TOUT=30,RTRY=25"

Settings

Timeout period: 30 seconds, Number of retries: 25, Retry interval: Not change

Example 4 S3 ",RTRY=25,RTTM=3000"

Settings

Timeout period: Not change, Number of retries: 25, Retry interval: 3000 seconds

 Special keyword of operand [S3] setting

Special keyword

Description

INITIAL

Set the default.

KEEP

The current setting is not changed.

Setting example

Example 1 S3 "INITIAL"

Settings

Timeout period: 60 seconds, Number of retries: 3, Retry interval: 600 seconds

Example 2 S3 "KEEP"

Settings

Timeout period: Not change, Number of retries: Not change, Retry interval: Not change

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the same keyword is specified redundantly. To be set when even one request active relay of FTPc control relay or FTPc logging/trace control relay is 1: Requesting. To be set when "Add-on" is set to "Not use" in Built-in ET-LAN setting. To be set when server numbers are not specified in the right order. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256.

CY (SR9)

To be set when the instruction is executed with an incorrect IP address. The detail code set in SD29 is "1: Specification of incorrect IP address".
To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-50

FTPcSET (FTP Client Transfer Setting)

FTPcSET (FTP Client Transfer Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

S1

S2

FTPcSET "ID=0" "SV0,PUTDATA,NON" "DT0,100,SS,10" "/data.csv"

S1

S2

S3

S4

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
FTPcSET "ID=0" "SV0,PUTDATA,NON" "DT0,100,SS,10" "/data.csv"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a transfer setting number, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the parameters for operation setting, or a character constant.

File transfer:

Starting address of the device area that stores the string data that indicates a source file name, or a character constant.

S3

PUT operation for a device:

Starting address of the device area that stores the string data that indicates source device settings, or a character constant.

GET operation for a device:

Starting address of the device area that stores the string data that indicates destination device settings, or a character constant.

File transfer:

Starting address of the device area that stores the string data that indicates a destination folder name, or a character constant.

S4

PUT operation for a device:

Starting address of the device area that stores the string data that indicates destination file settings, or a character constant.

GET operation for a device:

Starting address of the device area that stores the string data that indicates a source file name, or a character constant.

 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
· This instruction configures the FTP client transfer settings (0 to 15).
· Before executing this instruction, use the "FTPcSV (FTP Client Connected Server Setting)" instruction or the programming tool software "FPWIN GR7" to configure the settings of the destination server.

17-51

High-level Instructions (Ethernet Communication)

 Process details
· The FTP client transfer settings of [S2] to [S4] are stored in the transfer setting area that is specified by [S1].

· The instruction can be executed when the transfer request relays of the FTPc control relay and the FTPc logging/trace control relay are OFF (0: No request). As an execution condition of the instruction, insert a program that checks the states of the transfer request relays. The states of the transfer request relay and the logging transfer request relay can be read with the ETSTAT instruction. Store the states that are read in a device such as an internal relay. An operation error occurs if the instruction is executed when one of the transfer request relays is ON.

· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

The power supply for the PLC is switched from OFF to ON.

The PLC is changed to PROG Changes to RUN mode without rewriting the configuration.

mode.

Changes to RUN mode after rewriting the configuration

Operation Setting using the configuration Setting using instructions Setting using the configuration

· Data is actually sent to files or acquired from files when the FTP client transfer request (FTPcREQ) instruction is executed after the completion of the FTP client transfer settings.

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· For [S1] to [S4], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different.

· The number of characters should not exceed 256.

· Both upper and lower case characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous. However, the folder name and the file name that are included in a path name are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates a transfer setting number, or a character constant.

Setting item

Settings

Setting range

S1

Transfer setting number

Specify a transfer setting number. ID=: Transfer setting number

0 to 15

(Note 1): Transfer setting numbers should be specified from number 0 in ascending order. An error occurs when transfer setting numbers are not specified in ascending order. If transfer settings have been already registered, this rule is not applied.

Setting example

Example 1 S1 "ID=1"

Settings

Transfer setting number: 1

Example 2 S1 "ID=8"

Settings

Transfer setting number: 8

17-52

FTPcSET (FTP Client Transfer Setting)

 Operand [S2] setting
· Specify the starting address of the device area that stores the operation setting parameter, or a character constant.

Setting item

Settings

Specification of FTP Specify FTP servers. (3 digits fixed)

server

SV0: Server 0, SV1: Server 1, SV2: Server 2, SV3: Server 3

Set the target for the transfer and operation.

Parameter string Target

Transfer operation

PUTFILE

File

Send to servers (Overwrite method)

PUTFILE-OVW

File

Send to servers (Overwrite method)

S2

Target and operation PUTFILE-REN

File

of transfer

GETFILE

File

Send to servers (Rename method) Obtain from servers

PUTDATA

Device

Send to servers (Overwrite method)

PUTDATA-OVW Device

Send to servers (Overwrite method)

PUTDATA-REN

Device

Send to servers (Rename method)

GETDATA

Device

Obtain from servers

File after transfer

Setting for deleting source files after transfer. (3 digits fixed) DEL: Delete, NON: Not delete

(Note 1): Input each operation setting parameter separated by a comma ",". (Note 2): The operation setting parameters cannot be omitted. Specify them in the order of the above table. (Note 3): For details of the transfer operations (overwrite method and rename method), refer to "Overwrite method and rename method
(p.17-54)."

Setting example

Example 1 S2 "SV3,PUTFILE,NON"

Settings

FTP server: 3, Target: File, Operation: Send (PUT) Overwrite method, File after transfer: Not delete

Example 2 S2 "SV1,PUTFILE-OVW,DEL"

Settings

FTP server: 1, Target: File, Operation: Send (PUT) Overwrite method, File after transfer: Delete

Example 3 S2 "SV0,PUTFILE-REN,DEL"

Settings

FTP server: 0, Target: File, Operation: Send (PUT) Rename method, File after transfer: Delete

Example 4 S2 "SV2,GETFILE,DEL"

Settings

FTP server: 2, Target: File, Operation: Get (GET), File after transfer: Delete

Example 5 S2 "SV1,GETFILE,NON"

Settings

FTP server: 1, Target: File, Operation: Get (GET), File after transfer: Not delete

17-53

High-level Instructions (Ethernet Communication)

 Overwrite method and rename method
The overwrite method (default) or rename method can be selected for file transfer (PUTFILE or PUTDATA).

Items Operation of overwrite method
Operation of rename method
Tentative file name

Description
- Files are written with specified file names. - When writing is interrupted for some reasons (such as troubles in network or servers), the partially written
file remains. - It is not possible to judge on the server side whether files have been transferred successfully or not without
checking the file size or the contents.
- Specified data or files are transferred with tentative file names, and they are renamed to specified file names after the successful completion of transfer.
- The successful completion of file transfer can be confirmed by checking the specified file names on the server side.
- The processing time is longer than that of the overwrite method.
- FP7_MAC address (Hexadecimal 12 characters).tmp (Extension tmp) - If a file already exists when renaming files, that file is deleted before renaming. - This situation may occur when the transfer of multiple files is being retried.

KEY POINTS
· For transferring files to FTP servers, the overwrite method or rename method is selectable. As tentative file names are renamed after the completion of the transfer in the rename method, it is possible to confirm that the files have reached to FTP servers successfully.

17-54

FTPcSET (FTP Client Transfer Setting)

 Operand [S3] setting (for file transfer)
· Specify the starting address of the device area that stores the string data that indicates a source file name, or a character constant.

Setting item Settings

For PUT

Specify a file name in an SD memory card with an absolute path.

S3

Source File Name

For GET

Specify a file name from the home directory of a user which logs in FTP servers with a relative

path.

(Note 1): Wild cards "*" and "?" are usable for file names. (Note 2): An error occurs when the number of files which match wild cards 101 or more.

 Operand [S3] setting (PUT operation for a device)
· Specify the starting address of the device area that stores the string data that indicates source device settings, or a character constant.

Setting item Settings
Source device

- Global device Specify device code + device number. - Local device "PB" + PB number + "_" (underscore) + device code + device number

<Devices that can be specified>

Global device

Local device

WX

WX

WY

WY

WR

WR

WL

WL

DT

DT

LD

LD

Setting range

Number of transferred data (data amount)

Specify the number of transferred data (number of data).
* The number of data that can be transferred simultaneously is 1MB for all 16 IDs. However, they are calculated with data after conversion.

1 to 524228 (512k data)

Specify a conversion method.

S3

Parameter

Extension (Saving format)

BIN1w Unconverted 16-bit binary

.BIN (binary data)

US

16-bit unsigned decimal

SS

16-bit signed decimal

UL

32-bit unsigned decimal

Conversion

SL

32-bit signed decimal

method

SF

32-bit single-precision floating

point

.CSV

DF

64-bit double-precision floating point

(comma-separated text)

HEX1w 16bitHEX

HEX2w 32bitHEX

HEX4w 64bitHEX

ASCII

ASCII character (Output enclosed with "")

Line feed position

Specify line feed position. 0: Output the end of file only n: Output by n data

0 to 255

(Note 1): Input each source device setting parameter separated by a comma ",". (Note 2): Specify the operation setting parameters in the order of the above table. (Note 3): When omitting "conversion method" and subsequent items, the conversion method is set to 16-bit binary and the line feed
position is set to 0 (output the end of file only). (Note 4): When omitting "Line feed position", it is set to 0: Output the end of file only.

17-55

High-level Instructions (Ethernet Communication)

Setting example

Example 1 S3 "WX16,32,BIN1w,0"

Settings

Device setting, Device division: Global, Device code: WX, Device number: 16 Number of transferred data: 32 (32 words), Conversion method: Unconverted 16-bit binary, Line feed position: Output the end of file only

Example 2 S3 "DT123456,250,SS,10"

Settings

Device setting, Device division: Global, Device code: DT, Device number: 123456 Number of transferred data: 250 (250 words), Conversion method: 16-bit signed decimal, Line feed position: Output by 10 data

Example 3 S3 "WR0,16,DF"

Settings

Device setting, Device division: Global, Device code: WR, Device number: 0 Number of transferred data: 16 (64 words), Conversion method: 64-bit double-precision floating point, Line feed position: Output the end of file only

Example 4 S3 "WL10,128"

Settings

Device setting, Device division: Global, Device code: WL, Device number: 10 Number of transferred data: 128 (128 words), Conversion method: Unconverted 16-bit binary, Line feed position: Output the end of file only

Example 5 S3 "PB100_WR1000,50,US,0"

Settings

Device setting, Device division: Local, PB number: 100, Device code: WR, Device number: 1000 Number of transferred data: 50 (50 words), Conversion method: 16-bit unsigned decimal, Line feed position: Output the end of file only

Example 6 S3 "PB15_LD16,40,HEX4w,2"

Settings

Device setting, Device division: Local, PB number: 15, Device code: LD, Device number: 16 Number of transferred data: 40 (160 words), Conversion method: 64-bit HEX, Line feed position: Output by 2 data

Example 7 S3 "PB10_WL10,32,UL"

Settings

Device setting, Device division: Local, PB number: 10, Device code: WL, Device number: 10 Number of transferred data: 32 (64 words), Conversion method: 32-bit unsigned decimal, Line feed position: Output the end of file only

Example 8 S3 "PB1_WY128,5"

Settings

Device setting, Device division: Local, PB number: 1, Device code: WY, Device number: 128
Number of transferred data: 5 (5 words), Conversion method: Unconverted 16-bit binary, Line feed position: Output the end of file only

17-56

FTPcSET (FTP Client Transfer Setting)

 Operand [S3] setting (GET operation for a device)
· Specify the starting address of the device area that stores the string data that indicates destination device settings, or a character constant.

Setting item Settings
Destination device

- Global device Specify device code + device number. - Local device "PB" + PB number + "_" (underscore) + device code + device number

<Devices that can be specified>

Global device

Local device

WX

WX

WY

WY

WR

WR

WL

WL

DT

DT

LD

LD

Setting range

Number of transferred data (data amount)

Specify the number of transferred data (number of data).
* The number of data that can be transferred simultaneously is 1MB for all 16 IDs. They are calculated with file size.

1 to 524228 (512k data)

S3

Specify a conversion method.

Parameter

Extension (Saving format)

BIN1w Unconverted 16-bit binary .BIN (binary data)

US

16-bit unsigned decimal

SS

16-bit signed decimal

UL

32-bit unsigned decimal

Conversion

SL

32-bit signed decimal

method

SF

32-bit single-precision floating point

.CSV

DF

64-bit double-precision floating point

(comma-separated text)

HEX1w 16bitHEX

HEX2w 32bitHEX

HEX4w 64bitHEX

ASCII

ASCII character (Output enclosed with "")

(Note 1): Input each source device setting parameter separated by a comma ",". (Note 2): Specify the operation setting parameters in the order of the above table. (Note 3): When omitting "Conversion method", it is set to unconverted 16-bit binary. (Note 4): The number of data that can be transferred simultaneously is 1MB for all 16 IDs. They are calculated with file size.

Setting example

Example 1 S3 "WX16,32,BIN1w"

Settings

Device setting, Device division: Global, Device code: WX, Device number: 16, Number of transferred data: 32 (32 words), Conversion method: Unconverted 16-bit binary

Example 2 S3 "DT123456,250,SS"

Settings

Device setting, Device division: Global, Device code: DT, Device number: 123456, Number of transferred data: 250 (250 words), Conversion method: 16-bit signed decimal

Example 3 S3 "WR0,16,DF"

Settings

Device setting, Device division: Global, Device code: WR, Device number: 0, Number of transferred data: 16 (64 words), Conversion method: 64-bit double-precision floating point

Example 4 S3 "WL10,128"

Settings

Device setting, Device division: Global, Device code: WL, Device number: 10 Number of transferred data: 128 (128 words), Conversion method: Unconverted 16-bit binary

17-57

High-level Instructions (Ethernet Communication)

 Operand [S4] setting (for file transfer)
· Specify the starting address of the device area that stores the string data that indicates a destination folder name, or a character constant.

Setting item

Settings

Specify a folder name from the home directory of a user which logs in FTP

S4

Destination For PUT file name

servers with a relative path. For specifying the home directory, specify "/" or "\" only.
Note) When an English keyboard is used, use "\" instead of "¥".

For GET

Specify a storage folder name in an SD memory card with an absolute path.

(Note): When the specified destination folder does not exist, the folder is automatically created with up to eight hierarchies.

 Operand [S4] setting (PUT operation for a device)
· Specify the starting address of the device area that stores the string data that indicates destination file settings, or a character constant.

Setting item

Settings

Specify a destination file name.

Destination Specify a folder name and file name from the home directory of a user which logs in FTP servers file name with a relative path.

* The string after the last "." (period) is applied as the extension of the file name.

S4

File name Specify the position of the automatic additional data added to a file name.

automatic TOP: Automatic additional data is added before a file name.

addition

END: Automatic additional data is added after a file name.

position

* Automatic additional data is year, month, day, hour, minute and second "(yymmdd_hhmmss)".

(Note 1): Specify a destination file name within 240 characters. (Note 2): When the specified destination folder does not exist, the folder is automatically created with up to eight hierarchies. (Note 3): Specify the operation setting parameters in the order of the above table. (Note 4): When omitting "File name automatic addition position", automatic additional data is not added to a file name.

Setting example

Example 1 S4 "\FTP\PutData1.bin,TOP"

Settings

Destination file name: \FTP\PutData1.bin
Automatic additional data: year, month, day, hour, minute and second "(yymmdd_hhmmss)". Automatic addition position: Automatic additional data is added before the file name.

Example 2 S4 "\FTP\PutData2.bin,END"

Settings

Destination file name: \FTP\PutData2.bin
Automatic additional data: year, month, day, hour, minute and second "(yymmdd_hhmmss)". Automatic addition position: Automatic additional data is added after the file name.

Example 3 S4 "\FTP\PutData3.bin"

Settings

Destination file name: \FTP\PutData3.bin Automatic addition position: Automatic additional data is not added to the file name.

 Operand [S4] setting (GET operation for a device)

Setting item

Settings

S4

Source File Name

Specify the starting address of the device area that stores the string data that indicates a source file name, or a character constant.

(Note): Specify a folder name and file name from the home directory of a user which logs in FTP servers with a relative path.

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when transfer setting numbers are not specified in ascending order. To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256. To be set when an FTP server that has not been specified with the destination server setting instruction or the tool software is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-58

FTPcLOG (FTP Client Logging/Trace Transfer Setting)

FTPcLOG (FTP Client Logging/Trace Transfer Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

FTPcLOG

"LOG=0" S1

U100 S1
"SV0" S2

U1 S2 "LogData" S3

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
FTPcLOG "LOG=0" "SV0" "LogData"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a logging/trace number, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the parameters for operation setting, or a character constant.

S3

Starting address of the device area that stores the string data that indicates a destination folder name, or a character constant.

 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 " "

  

 Outline of operation
· This instruction configures the logging/trace transfer setting.
 Process details
· The logging/trace transfer settings of [S2] to [S3] are stored in the logging/trace transfer setting area that is specified by [S1].
· The instruction can be executed when the transfer request relay of the FTPc logging/trace control relay is OFF (0: No request). As an execution condition of the instruction, insert a program that checks the state of the transfer request relay. The state of the FTPc logging transfer request relay can be read with the ETSTAT instruction. Store the state that is read in a device such as an internal relay. An operation error occurs if this instruction is executed when the transfer request relay is ON.
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

17-59

High-level Instructions (Ethernet Communication)

· For [S1] to [S3], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous. However, the destination folder name is case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
Specify the starting address of the device area that stores the string data that indicates a logging/trace number, or a character constant.

Setting item S1

Settings Specify a LOG number (0 to 15) as string data. Example) "LOG=0"

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates the parameters for operation setting, or a character constant.

· Only one server can be specified at the same time. Specify a FTP server number with one-byte three characters.

Setting item

Settings

Specification of an

Specify an FTP server (server 0 to 3) as string data. Example) "SV0

FTP server (essential)

Specification of transfer operation (Can be omitted)

Select the operation for transferring logging/trace files. Specify the operation after the keyword "MODE=". When either method is not specified, "Overwrite method" is applied. MODE=OVW or MODE=REN

S2

OVW

Performs transfer files with files names specified by the logging/trace setting. When the transfer is interrupted due to any trouble with the network or the server, the file

Overwrite method transferred partway remains in the server.

(Default)

Confirm if the transfer has succeeded with an instruction such as ETSTAT instruction.

REN Rename method

Performs transfer files with temporary file names, and renames them to specified file names after the success of the transfer. The successful completion of file transfer can be confirmed by checking the file names specified by the logging/trace setting.
The processing time is longer than that of the overwrite method.

(Note 1): Input each operation setting parameter separated by a comma ",". (Note 2): Specify the operation setting parameters in the order of the above table. The order of keywords cannot be changed. (Note 3): Upper and lower case characters can be used for specifying keywords.

Setting example

Example 1 S2 "SV0,MODE=OVW"

Settings

FTP server: 0, Transfer operation: Overwrite method

Example 2 S2 "SV3,MODE=REN"

Settings

FTP server: 2, Transfer operation: Rename method

Example 3 S2 "SV3"

Settings

FTP server: 3, Transfer operation: (Omitted)

 Operand [S3] setting
· Specify the starting address of the device area that stores the string data that indicates a destination folder name, or a character constant.

· A destination folder name should be specified within 256 one-byte characters.

Setting item

Settings

Setting range

S3

Destination folder name

Specify the starting address of the device area that stores the string data that indicates a destination folder name, or a character constant.

Maximum 256 one-byte characters

(Note 1): When the specified destination folder does not exist, the folder is automatically created with up to eight hierarchies. (Note 2): Specify a folder name from the home directory of a user which logs in FTP servers with a relative path.

17-60

FTPcLOG (FTP Client Logging/Trace Transfer Setting)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when the request active relay of the FTPc logging/trace control relay for a specified number is 1: Requesting. To be set when the logging/trace condition of a specified LOGn number is not registered. To be set when an out-of-range value is specified for parameters. To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256. To be set when an unset FTP server is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-61

High-level Instructions (Ethernet Communication)

FTPcREQ (FTP Client Transfer Request)

 Ladder diagram

R0

X60 X61 X65

 DF 

UNITSEL

U100

U1

S1

S2

FTPcREQ

U0

S

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Device address where the transfer number (0 to 15) is stored, or a constant.

 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 requests the transfer of the FTP client.

· Before executing this instruction, use the "FTPcSET (FTP Client Transfer Setting)" instruction or the programming tool software "FPWIN GR7" to configure transfer settings.

 Operand [S] setting

Setting item Settings

S

Transfer number

Specify the device address storing a transfer number or a constant.

Setting range 0 to 15

 Process details
· The transfer request relay of the transfer number that is specified by [S] is turned ON.
· This instruction can be executed when the FTP client preparation done flag (X65) is ON. As an execution condition of the instruction, insert a program that checks the status of the flag (X65). An operation error occurs if this instruction is executed when the flag (X65) is OFF.
· This instruction can be executed when the cable disconnection detection flag (X60) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X60). If this instruction is executed when the flag (X60) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

17-62

FTPcREQ (FTP Client Transfer Request)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· This instruction is not available in interrupt programs.

 Time chart
· The following diagram shows the process in which a transfer request is executed and data transfer from a server to FP7 is completed successfully.

· The control relays (bit0 to bit15) can be monitored by using the ETSTAT instruction to read and store their state in arbitrary operation devices.

(1) (2) (3) (4)

(5)

(6)

Ethernet initialization active flag (X61)
FTP client preparation done flag (X65)
Transfer request relay ETSTAT [D] bit0
Transfer active relay ETSTAT [D] bit1
Retry active relay ETSTAT [D] bit2
Execution done relay ETSTAT [D] bit3
Execution result relay ETSTAT [D] bit4
Transfer direction relay ETSTAT [D] bit5
Transfer cancel request relay ETSTAT [D] bit14
Transfer disable relay ETSTAT [D] bit15

Turns OFF when transfer is requested.

Normal completion Execution result relay: 0 Transfer done code: 0
Transfer direction relay ServerPLC: 1 PLCServer: 0

(1) RUN (Power on)

(4) Transfer request (Executes FTPcREQ instruction)

(2) FTP client preparation done (3) Transfer setting (Executes FTPcSET instruction)

(5) FTP client login succeeded (Starts transfer)

(6)

Transfer process done (Completes the execution of FTPcREQ instruction)

 Control relay
Name

Bit No.

Description

Transfer request relay

0

0: No request, 1: Request

Transfer active relay

1

0: Stop, 1: During transfer

Retry active relay

2

0: No retry, 1: During retry

Execution done relay

3

0: During process, 1: Instruction execution complete

Execution result relay

4

0: Normal 1: Failed

Transfer direction relay

5

0: Send, 1: Receive

Reserved for system

6 to 13

-

Transfer cancel request relay 14

0: Not cancel, 1: Cancel

Transfer disable relay

15

0: Transfer enabled, 1: Transfer disabled

(Note): The states of control relays can be read with the ETSTAT instruction.

17-63

High-level Instructions (Ethernet Communication)

 Completion codes
Name

Number of words Description

Execution done code

1

Execution done code

Transfer done code

1

Response code of FTP client

(Note): The state of completion codes can be read with the ETSTAT instruction.

When the instruction is executed under one of the following conditions, a transfer error occurs and the corresponding error code is set in the execution done code.

State

Code

State

Code

Destination server is not set.

1

Transfer prohibition setting

5

Transfer setting is not set.

2

Registering a process request failed.

4

Data decompression failed. (When accessing data with PUT)

8

Data decompression failed. (When accessing data with GET)

9

 FTP client preparation done (WX6 bit 5)

Name

Bit No.

Description

FTP client preparation done (X65)

5

0: FTP client preparation incomplete, 1: FTP client preparation complete

(Note): For details of Ethernet-related flags, refer to "19-10 Ethernet Function: IP Addresses."

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set in the case of out-of-range in indirect access (index modification). To be set when the FTP client preparation done (X65) is OFF at the time of the execution of instruction. To be set when an out-of-range value is specified for parameters. To be set when the transfer request relay of a specified ID is "Request". To be set when executed in an interrupt program. To be set when a file transfer that has not been specified with the transfer setting instruction or the tool software is specified.

CY (SR9)

To be set when executed while the Ethernet cable is disconnected. The detail code set in SD29 is "10: Ethernet cable disconnected".
To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-64

FTPcCTL (FTP Client Transfer Control)

FTPcCTL (FTP Client Transfer Control)
 Ladder diagram

R0

X61

 DF 

UNITSEL FTPcCTL

U100 S1
"ID0" S1

U1 S2 "ENABLE" S2

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
FTPcCTL "ID0" "ENABLE"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a control target, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the control content (transfer enabled/disabled/canceled), or a character constant.

 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 configures the settings for enabling, disabling, or canceling transfers for an FTP client.
· Before executing this instruction, use the "FTPcSET (FTP Client Transfer Setting)" instruction or the programming tool software "FPWIN GR7" to configure transfer settings. (when control targets are specified with send numbers)
· Before executing this instruction, use the "FTPcLOG (FTP Client Logging/Trace Transfer Setting)" instruction or the programming tool software "FPWIN GR7" to configure transfer settings. (when control targets are specified with LOG numbers)
· It takes some time to accept the processing of the transfer cancel request. After executing the instruction, check the transfer status to see if the transfer stops. For details on checking the transfer status, refer to the "ETSTAT (Acquiring EtherNet/IP Information)" instruction.
 Process details
· The instruction controls whether to enable, disable, or cancel transfer for the target [S1] according to the specification of the control content [S2].
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

17-65

High-level Instructions (Ethernet Communication)

· For [S1] and [S2], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous.

· This instruction is not available in interrupt programs.

 Setting of the operands [S1] and [S2]

Setting item Settings

1) When specifying an individual transfer number

S1

Control target

2) When specifying an individual LOG number 3) When specifying all transfer numbers and all

LOG numbers

1) When enabling transfer

S2

Control content

2) When disabling transfer

3) When canceling transfer

Setting example

Settings

S1

Example 1

When enabling the sending of send number 5

"ID5"

Specify "IDx" with x being a value from 0 to 15. Specify "LOGx" with x being a value from 0 to 15. Specify "ALL". Specify "ENABLE". Specify "DISABLE". Specify "CANCEL".
S2 "ENABLE"

Example 2 When disabling all sending

"ALL"

"DISABLE"

Example 3 Example 4

When canceling the sending of LOG7
When enabling the sending of send number 10 (Note)

"LOG7"

DT0
DT0 DT1 DT2 DT3

Value 4 (Number of characters) H44(D) H49(I) H30(0) H31(1)

"CANCEL"

DT10
DT10 DT11 DT12 DT13 DT14

Value 6 (Number of characters) H4E(N) H45(E) H42(B) H41(A) H45(E) H4C(L)

(Note): For specifying a device for an operand which can specify character constants, store string data with SSET instruction excluding a double quotation mark.

 Operation of FTPc control relay
Name

Transfer enabled Transfer disabled Transfer canceled

ETSTAT [D] bit0

Transfer request

Not change

Not change

Not change

ETSTAT [D] bit1

Transfer active

Not change

Not change

Not change

ETSTAT [D] bit2

Transfer retry active

Not change

Not change

Not change

ETSTAT [D] bit3

Transfer done

Not change

Not change

Not change

ETSTAT [D] bit4

Transfer failed

Not change

Not change

Not change

ETSTAT [D] bit5

Transfer direction

Not change

Not change

Not change

-----

ETSTAT [D] bit14

Transfer cancel relay

Not change

Not change

ON

ETSTAT [D] bit15

Transfer disable relay

OFF

ON

Not change

(Note): The states of control relays can be checked by using the ETSTAT instruction to read and store the state in any operation memory.

17-66

FTPcCTL (FTP Client Transfer Control)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an item other than "IDx" or "LOGx" or "ALL" is specified for the control target (S1). (x: 0 to 15) To be set when an unset transfer setting is specified. To be set when an unset logging/trace transfer setting is specified. To be set when an item other than "ENABLE", "DISABLE" or "CANCEL" is specified for the control content (S2). To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256. To be set when a file transfer that has not been specified with the transfer setting instruction or the tool software is specified. To be set when a logging/trace transfer setting that has not been specified with the logging/trace transfer setting instruction or the tool software is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-67

High-level Instructions (Ethernet Communication)

HTTPcSV (HTTP Client Connected Server Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

S1

S2

HTTPcSV "SV=0,IPv4=192.168.1.1" "USER=user,PASS=pw" "TOUT=30"

S1

S2

S3

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
HTTPcSV "SV=0,IPv4=192.168.1.1" "USER=user,PASS=pw" "TOUT=30"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates the parameters for specifying a server, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the login setting parameters, or a character constant.

S3

Starting address of the device area that stores the string data that indicates the detailed setting parameters, or a character constant.

 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 " "

  

 Outline of operation
This instruction configures the settings for a server to which the FP7 CPU unit is connected using the HTTP client function.
 Process details
· The settings for the server to which the CPU unit is connected using the HTTP client function are specified in the CPU unit according to specified parameters.
· The instruction can be executed when the transfer request relays of the HTTPc control relay and the HTTPc logging/trace control relay are OFF (0: No request). As an execution condition of the instruction, insert a program that checks the states of the transfer request relays. The states of the transfer request relay and the logging transfer request relay can be read with the ETSTAT instruction. Store the states that are read in a device such as an internal relay. An operation error occurs if the instruction is executed when one of the transfer request relays is ON.
· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

Operation

The power supply for the PLC is switched from OFF to ON.

Setting using the configuration

The PLC is changed to PROG mode.

Changes to RUN mode without rewriting the configuration.
Changes to RUN mode after rewriting the configuration

Setting using instructions Setting using the configuration

· If an incorrect IP address is specified, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

17-68

HTTPcSV (HTTP Client Connected Server Setting)

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· For [S1] to [S3], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different.

· The number of characters should not exceed 256.

· Both upper and lower case characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous. However, the server host name, the user name, and the password are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates the parameters for specifying a server, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· Specify the HTTP server setting from SV0 in order. When the right order is skipped, an error occurs. It is possible to specify by overwriting when the setting has been already registered.

· Only one server can be specified at the same time.

· Specify an HTTP server number, the IP address or host name of an HTTP server, a port number, an open method, and the SSL3/TLS1 authentication setting within 256 one-byte characters in total.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

HTTP server number (Essential)

Specify HTTP servers. Specify the following keywords. SV0: Server 0, SV1: Server 1, SV2: Server 2, SV3: Server 3

Specify IP address or host name.

For an IP address, specify the keyword "IPv4=" or "IPv6=" at the beginning. For a

host name, specify "HOST=".

- For Ipv4

HTTP server's

IPv4=111.122.133.144

IP address

- For Ipv6

S1

or host name (Essential)

IPv6=1111:122:2:1555:0:0:1888 * For details of the range of IPv4 addresses that can be specified, refer to "19-10 IP

address setting specifications."

- For a host name HOST=HTTP.pidsx.com

Port number (Can be omitted)

Specify port number. Port number range: 1 to 65535 PORT=: Port number (Default: 80)

SSL3/TLS1 authentication (Can be omitted)

Specify whether or not to use SSL3/TLS1 authentication. SSL: Use SSL3/TLS1 NON: Not use (Default: Not use)

(Note 1): Input an HTTP server number, the IP address or host name of an HTTP server, a port number, and the SSL3/TLS1 authentication setting separated by a comma ",".
(Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the parameters for specifying servers in the order of the above table.

17-69

High-level Instructions (Ethernet Communication)

Setting example

Example 1 S1 "SV0,IPv4=192.255.2.10,PORT=80,SSL"

Settings

HTTP server number: 0, IP address: 192.255.2.10, Port number: 80, SSL3/TLS1 authentication: Use

Example 2 S1 "SV1,IPv6=1111:1222::1555:0:0:1888,PORT=8080,SSL"

Settings

HTTP server number: 1, IP address: 1111:1222::1555:0:0:1888, Port number: 8080, SSL3/TLS1 authentication: Use

Example 3 S1 "SV2,HOST=HTTP.pidsx.com,PORT=80,NON"

Settings

HTTP server number: 2, Hos name: HTTP.pidsx.com, Port number: 80, SSL3/TLS1 authentication: Not use

 Operand [S2] setting
· Specify the starting address of the device area that stores the login setting parameter, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· When "INITIAL" or "KEEP" is specified instead of parameters, the instruction operates according to the table of special keywords.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

User name (Can be omitted) S2 Password (Can be omitted)

Specify a user name. Specify the keyword "USER=" at the beginning. USER=XXX (Default: root)
Specify a password. Specify the keyword "PASS=" at the beginning. PASS=XXX (Default: root)

(Note 1): Input a user name and password separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the login setting parameters in the order of the above table.

Setting example

Example 1 S2 "USER=root,PASS=pidsx"

Setting range
Maximum 32 one-byte characters
Maximum 32 one-byte characters

Settings

User name: root, Password: pidsx

Example 2 S2 "USER=PANASONIC,PASS=SUNX"

Settings

User name: PANASONIC, Password: SUNX

 Operand [S2]: user name and password setting

Patterns

Specification method

Specify user name: Delete password

"USER=xxx,PASS="

Delete user name: Specify password

"USER=,PASS=xxx"

Delete user name: Delete password

"USER=,PASS="

Specify user name: Not change password

"USER=xxx"

Not change user name: Specify password

",PASS=xxx"

17-70

HTTPcSV (HTTP Client Connected Server Setting)

Setting example

Example 1 S2 "USER=root,PASS="

Settings

User name: root, Password: Delete

Example 2 S2 "USER=,PASS=SUNX"

Settings

User name: Delete, Password: SUNX

Example 3 S2 "USER=,PASS="

Settings

User name: Delete, Password: Delete

Example 4 S2 "USER=root"

Settings

User name: root, Password: Not change

Example 5 S2 ",PASS=SUNX"

Settings

User name: Not change, Password: SUNX

 Special keyword of operand [S2] setting
Special keyword Description

INITIAL

Set the default.

KEEP

The current setting is not changed.

Setting example

Example 1 S2 "INITIAL"

Settings

User name: root, Password: root

Example 2 S2 "KEEP"

Settings

User name: Not change, Password: Not change

 Operand [S3] setting

Setting item

Settings

Setting range

Timeout period (Can be omitted)

Specify a timeout period. TOUT=: Time setting (Default: 60 seconds)

30 to 300 seconds

S3

Number of retries (Can be omitted)

Specify the number of retries. RTRY=: Number of retries (Default: 3 times)

0 to 3

Retry interval (Can be omitted)

Specify the number of retries. RTTM=: Retry interval (Default: 600 seconds) *4

10 to 86400 seconds

(Note 1): Input a timeout period, number of retries and retry interval separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the detailed setting parameters in the order of the above table. (Note 4): The retry interval can be specified by 10 seconds. It is rounded down to the 100. (Example: When specifying 38 seconds, it
becomes 30 seconds.)

Setting example

Example 1 S3 "TOUT=30,RTRY=2,RTTM=500"

Settings

Timeout period: 30 seconds, Number of retries: Twice, Retry interval: 500 seconds

Example 2 S3 "TOUT=270,RTRY=0,RTTM=4900"

Settings

Timeout period: 270 seconds, Number of retries: 0 (Not retry), Retry interval: 4900 seconds

Example 3 S3 "TOUT=120,RTRY=3"

Settings

Timeout period: 120 seconds, Number of retries: 3, Retry interval: Not change

 Special keyword of operand [S3] setting
Special keyword Description

INITIAL

Set the default.

KEEP

The existing state is held and the setting is not changed.

Setting example

Example 1 S3 "INITIAL"

Settings

Timeout period: 60 seconds, Number of retries: 3, Retry interval: 600 seconds

Example 2 S3 "KEEP"

Settings

Timeout period: Not change, Number of retries: Not change, Retry interval: Not change

17-71

High-level Instructions (Ethernet Communication)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the same keyword is specified redundantly. To be set when the transfer request relay of HTTPc transfer control relay is 1: Requesting. To be set when "Add-on" is set to "Not use" in Built-in ET-LAN setting. To be set when server numbers are not specified in the right order. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256.

CY (SR9)

To be set when the instruction is executed with an incorrect IP address. The detail code set in SD29 is "1: Specification of incorrect IP address".
To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-72

HTTPcSET (HTTP Client Transfer Setting)

HTTPcSET (HTTP Client Transfer Setting)
 Ladder diagram

R0

X61

 DF 

HTTPcSET "ID=0" S1

UNITSEL

U100

U1

S1

S2

"SV0,UPLOAD,POST" "DT0,10" "/data.php"

S2

S3

S4

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
HTTPcSET "ID=0" "SV0,UPLOAD,POST" "DT0,10" "/data.csv"

 List of operands

Operand Description

S1

Starting address of the device area that stores the string data that indicates a transfer setting number, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the parameters for operation setting, or a character constant.

S3

Starting address of the device area that stores the string data that indicates source device settings, or a character constant.

S4

Starting address of the device area that stores the string data that indicates a destination URL, or a character constant.

 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
· This instruction configures the HTTP client transfer settings (0 to 15).

· Before executing this instruction, use the "HTTPcSV (HTTP Client Connected Server Setting)" instruction or the programming tool software "FPWIN GR7" to configure the settings of the destination server.

 Process details
· The HTTP client transfer settings of [S2] to [S4] are stored in the transfer setting area that is specified by [S1].

· The instruction can be executed when the transfer request relays of the HTTPc control relay and the HTTPc logging/trace control relay are OFF (0: No request). As an execution condition of the instruction, insert a program that checks the states of the transfer request relays. The states of the transfer request relay and the logging transfer request relay can be read with the ETSTAT instruction. Store the states that are read in a device such as an internal relay. An operation error occurs if the instruction is executed when one of the transfer request relays is ON.

· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

The power supply for the PLC is switched from OFF to ON.

The PLC is changed to PROG mode.

Changes to RUN mode without rewriting the configuration.
Changes to RUN mode after rewriting the configuration

Operation Setting using the configuration Setting using instructions
Setting using the configuration

· Data is actually sent or acquired when the HTTP client transfer request (HTTPcREQ) instruction is executed after the completion of the HTTP client transfer settings.

17-73

High-level Instructions (Ethernet Communication)

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· For [S1] to [S4], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different.

· The number of characters should not exceed 256.

· Both upper and lower case characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous. However, the folder name and the file name that are included in a path name are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates a transfer setting number, or a character constant.

Setting item

Settings

Setting range

S1

Transfer setting number

Specify a transfer setting number. ID=: Transfer setting number

0 to 15

(Note 1): Transfer setting numbers should be specified from number 0 in ascending order. An error occurs when transfer setting numbers are not specified in ascending order. If transfer settings have been already registered, this rule is not applied.

Setting example

Example 1 S1 "ID=1"

Settings

Transfer setting number: 1

Example 2 S1 "ID=8"

Settings

Transfer setting number: 8

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates the parameters for operation setting, or a character constant.

Setting item

Settings

Specification of HTTP server

Specify HTTP servers. (3 digits fixed)
SV0: Server 0 SV1: Server 1 SV2: Server 2 SV3: Server 3

Specify the target (device) and operation (Send or Get) of transfer.

S2

Target and operation UPLOAD

The target is Device, and the operation is Send.

of transfer

DOWNLOAD

The target is Device, and the operation is Get.

UPDOWN

The target is Device, and the operation is Send and Get.

Command used

Specify a command to be used for transfer. POST: Use POST command. GET: Use GET command.

* Only POST can be specified for Upload or Upload and Download.

(Note 1): Input each operation setting parameter separated by a comma ",". (Note 2): The operation setting parameters cannot be omitted. Specify them in the order of the above table.

17-74

HTTPcSET (HTTP Client Transfer Setting)

Setting example

Example 1 S2 "SV3,UPLOAD,POST"

Settings

HTTP server: 3, Target: Device, Operation: Send (Upload), Command used: POST (Fixed)

Example 2 S2 "SV0,UPLOAD,POST"

Settings

HTTP server: 0, Target: Device, Operation: Send (UPLOAD), Command used: POST (Fixed)

 Operand [S3] setting (UPLOAD operation for a device)
· Specify the starting address of the device area that stores the string data that indicates source device settings, or a character constant.

Setting item S3

Settings Source device setting

Specify the source device setting. - Global device Specify device code + device number. - Local device "PB" + PB number + "_" (underscore) + device code + device number

<Devices that can be specified>

Global device

Local device

WX

WX

WY

WY

WR

WR

WL

WL

DT

DT

LD

LD

Setting range

Number of transferred data (number of bytes)

Specify the number of transferred data (number of bytes). (1 to 7 digits)
* The number of bytes that can be simultaneously transferred is 1 MB for all 16 IDs.

(Note 1): Input each source device setting parameter separated by a comma ",". (Note 2): Specify the operation setting parameters in the order of the above table.

Setting example

1 to 1048576 (1 MB)

Example 1 S3 "WX16,32"

Settings

Device setting, Device division: Global, Device code: WX, Device number: 16, Number of bytes: 32 bytes

Example 2 S3 "DT123456,250"

Settings

Device setting, Device division: Global, Device code: DT, Device number: 123456, Number of bytes: 250 bytes

Example 3 S3 "WR0,64"

Settings

Device setting, Device division: Global, Device code: WR, Device number: 0, Number of bytes: 64 bytes

Example 4 S3 "WL10,128"

Settings

Device setting, Device division: Global, Device code: WL, Device number: 10, Number of bytes: 128 bytes

17-75

High-level Instructions (Ethernet Communication)

 Operand [S3] setting (DOWNLOAD operation for a device)
· Specify the starting address of the device area that stores the string data that indicates destination device settings, or a character constant.

Setting item S3

Settings Destination device Set

Specify the destination device setting. - Global device Specify device code + device number. - Local device "PB" + PB number + "_" (underscore) + device code + device number

<Devices that can be specified>

Global device

Local device

WX

WX

WY

WY

WR

WR

WL

WL

DT

DT

LD

LD

Setting range

Number of transferred data (number of bytes)

Specify the number of transferred data (number of bytes). (1 to 7 digits)
* The number of bytes that can be simultaneously transferred is 1 MB for all 16 IDs.

(Note 1): Input each setting parameter for the destination device setting separated by a comma ",". (Note 2): Specify the operation setting parameters in the order of the above table.

Setting example

1 to 1048576 (1 MB)

Example 1 S3 "WX16,32"

Settings

Device setting, Device division: Global, Device code: WX, Device number: 16, Number of bytes: 32 bytes

Example 2 S3 "DT123456,250"

Settings

Device setting, Device division: Global, Device code: DT, Device number: 123456, Number of bytes: 250 bytes

Example 3 S3 "WR0,64"

Settings

Device setting, Device division: Global, Device code: WR, Device number: 0, Number of bytes: 64 bytes

Example 4 S3 "WL10,128"

Settings

Device setting, Device division: Global, Device code: WL, Device number: 10, Number of bytes: 128 bytes

17-76

HTTPcSET (HTTP Client Transfer Setting)

 Operand [S3] setting (UPDOWN operation for a device)
· Specify the starting address of the device area that stores the string data that indicates source device settings, or a character constant.

· Downloaded data is stored immediately after uploaded data. The number of acquisitions (the number of bytes) is stored in the first two words.

Setting item Settings
Source device Set S3

Specify the source device setting. - Global device Specify device code + device number. - Local device "PB" + PB number + "_" (underscore) + device code + device number

<Devices that can be specified>

Global device

Local device

WX

WX

WY

WY

WR

WR

WL

WL

DT

DT

LD

LD

Setting range

Number of transferred data (number of bytes)

Specify the number of transferred data (number of bytes). (1 to 7 digits)
* The number of bytes that can be simultaneously transferred is 1 MB for all 16 IDs.

1 to 1048576 (1 MB)

Maximum number of acquisitions
(number of bytes)

Specify the maximum number of acquisitions (number of bytes). (1 to 7 digits)
* Data can be obtained up to the maximum number of acquisitions.
* The number of bytes that can be simultaneously acquired is 1 MB for all 16 IDs.

(Note 1): Input each source device setting parameter separated by a comma ",". (Note 2): Specify the operation setting parameters in the order of the above table.

Setting example

1 to 1048576 (1 MB)

Example 1 S3 "WX16,32,32"

Settings

Device setting, Device division: Global, Device code: WX, Device number: 16, Number of bytes: 32 bytes, Number of acquisitions: 32 bytes

Example 2 S3 "DT123456,250,250"

Settings

Device setting, Device division: Global, Device code: DT, Device number: 123456, Number of bytes: 250 bytes, Number of acquisitions: 250 bytes

Example 3 S3 "WR0,64,64"

Settings

Device setting, Device division: Global, Device code: WR, Device number: 0, Number of bytes: 64 bytes, Number of acquisitions: 64 bytes

Example 4 S3 "WL10,128,128"

Settings

Device setting, Device division: Global, Device code: WL, Device number: 10, Number of bytes: 128 bytes, Number of acquisitions: 128 bytes

17-77

High-level Instructions (Ethernet Communication)

 Operand [S4] setting (UPLOAD operation for a device)
· Specify the starting address of the device area that stores a destination URL, or a character constant.

· Specify a folder name and file name with its relative path from the home directory of the user who logs in to the HTTP server.

 Operand [S4] setting (DOWNLOAD operation for a device)
· Specify the starting address of the device area that stores the string data that indicates a source URL, or a character constant.

· Specify a folder name and file name with its relative path from the home directory of the user who logs in to the HTTP server.

 Operand [S4] setting (UPDOWN operation for a device)
· Specify the starting address of the device area that stores the string data that indicates a destination URL, or a character constant.

· Specify a folder name and file name with its relative path from the home directory of the user who logs in to the HTTP server.

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when transfer setting numbers are not specified in ascending order. To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256. To be set when an HTTP server that has not been specified with the destination server setting instruction or the tool software is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-78

HTTPcREQ (HTTP Client Transfer Request)

HTTPcREQ (HTTP Client Transfer Request)
 Ladder diagram

R0

X60 X61 X68

 DF 

UNITSEL

U100

U1

S1

S2

HTTPcREQ

U0

S

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Device address where the transfer number (0 to 15) is stored, or a constant.

 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 requests the transfer of the HTTP client.

· Before executing this instruction, use the "HTTPcSET (HTTP Client Transfer Setting)" instruction or the programming tool software "FPWIN GR7" to configure HTTP transfer settings.

 Process details
· The transfer request relay of the transfer number that is specified by [S] is turned ON.

· This instruction can be executed when the HTTP client preparation done flag (X68) is ON. As an execution condition of the instruction, insert a program that checks the status of the flag (X68). An operation error occurs if this instruction is executed when the flag (X68) is OFF.

· This instruction can be executed when the cable disconnection detection flag (X60) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X60). If this instruction is executed when the flag (X60) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· This instruction is not available in interrupt programs.

 Operand [S] setting

Setting item

Settings

S

Transfer number

Specify the device address storing a transfer number or a constant.

Setting range 0 to 15

17-79

High-level Instructions (Ethernet Communication)

 Time chart
· The following diagram shows the process in which a transfer request is executed and data transfer from a server to FP7 is completed successfully.
· The control relays (bit0 to bit15) can be monitored by using the ETSTAT instruction to read and store their state in arbitrary operation devices.

(1) (2) (3) (4)

(5)

(6)

Ethernet initialization active flag (X61)
HTTP client preparation done flag (X68)
Transfer request relay ETSTAT [D] bit0
Transfer active relay ETSTAT [D] bit1
Retry active relay ETSTAT [D] bit2
Execution done relay ETSTAT [D] bit3
Execution result relay ETSTAT [D] bit4
Transfer direction relay ETSTAT [D] bit5
Transfer cancel request relay ETSTAT [D] bit14
Transfer disable relay ETSTAT [D] bit15

Turns OFF when transfer is requested.

Normal completion Execution result relay: 0 Transfer done code: 0
Transfer direction relay ServerPLC: 1 PLCServer: 0

(1) RUN (Power on)

(4) Transfer request (Executes HTTPcREQ instruction)

(2) HTTP client preparation done

(3)

Transfer setting (Executes HTTPcSET instruction)

(5) HTTP client login succeeded (Starts transfer)

(6)

Transfer process done (Completes the execution of HTTPcREQ instruction)

 Control relay
Name

Bit No. Description

Transfer request relay

0

0: No request, 1: Request

Transfer active relay

1

0: Stop, 1: During transfer

Transfer retry active relay

2

0: No retry, 1: During retry

Execution done relay

3

0: During process, 1: Instruction execution complete

Execution result relay

4

0: Normal 1: Failed

Transfer direction relay (Note 1)

5

0: Send, 1: Receive

Reserved for system

6 to 13

-

Transfer cancel request relay (Note 2) 14

0: Not cancel, 1: Cancel

Transfer disable relay

15

0: Transfer enabled, 1: Transfer disabled

(Note 1): It is 0 (fixed) for logging and sending mails. (Note 2): It is 0 (fixed) for logging and HTTPc. (Note 3): The state of control relays can be read with ETSTAT instruction.

17-80

HTTPcREQ (HTTP Client Transfer Request)

 Completion codes
Name

Number of words Description

Execution done code

1

Execution done code

Transfer done code

1

Response code of HTTP client

(Note): The state of completion codes can be read with the ETSTAT instruction.

When the instruction is executed under one of the following conditions, a transfer error occurs and the corresponding error code is set in the execution done code.

State

Code State

Code

Destination server is not set.

1

Transfer prohibition setting

5

Transfer setting is not set.

2

Data decompression failed. (When accessing data with PUT) 8

Registering a process request failed.

4

Data decompression failed. (When accessing data with GET) 9

 HTTP client preparation done (WX6 bit 8)

Name

Bit No.

Description

HTTP client preparation done (X68)

8

0: HTTP client preparation incomplete, 1: HTTP client preparation complete

(Note): For details of Ethernet-related flags, refer to "19-10 Ethernet Function: IP Addresses."

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set in the case of out-of-range in indirect access (index modification). To be set when the HTTP client preparation done (X68) is OFF at the time of the execution of instruction. To be set when an out-of-range value is specified for parameters. To be set when the transfer request relay of a specified ID is "Request". To be set when executed in an interrupt program. To be set when a transfer setting that has not been specified with the transfer setting instruction or the tool software is specified.

CY (SR9)

To be set when the instruction is executed while the Ethernet cable is disconnected. The detail code set in SD29 is "10: Ethernet cable disconnected".
To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-81

High-level Instructions (Ethernet Communication)

HTTPcCTL (HTTP Client Transfer Control)
 Ladder diagram

R0

X61

 DF 

UNITSEL HTTPcCTL

U100 S1
"ID0" S1

U1 S2 "ENABLE" S2

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
HTTPcCTL "ID0" "ENABLE"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a control target, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the control content (transfer enabled/disabled/canceled), or a character constant.

 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 configures the settings for enabling or disabling transfers for an HTTP client.
· Before executing this instruction, use the "HTTPcSET (HTTP Client Transfer Setting)" instruction or the programming tool software "FPWIN GR7" to configure transfer settings.
· It takes some time to accept the processing of the transfer cancel request. After executing the instruction, check the transfer status to see if the transfer stops. For details on checking the transfer status, refer to the "ETSTAT (Acquiring Ethernet Unit Information: FTP/HTTP/SMTP)" instruction.
 Process details
· The instruction controls whether to enable, disable, or cancel transfer for the target [S1] according to the specification of the control content [S2].
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· For [S1] and [S2], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous.
· This instruction is not available in interrupt programs.

17-82

HTTPcCTL (HTTP Client Transfer Control)

 Setting of the operands [S1] and [S2]

Setting item Settings

S1

Control target

1) When specifying an individual transfer number 2) When specifying all transfer numbers

1) When enabling transfer

S2

Control content

2) When disabling transfer

3) When canceling transfer

Specify "IDx" with x being a value from 0 to 15. Specify "ALL". Specify "ENABLE". Specify "DISABLE". Specify "CANCEL".

Setting example

Settings

S1

S2

Example 1 When enabling the sending of send number 5 "ID5"

"ENABLE"

Example 2 When disabling all sending

"ALL"

"DISABLE"

Example 3 When canceling the transfer of ID7

"ID7"

"CANCEL"

DT0

DT10

Value

Value

Example 4

When enabling the sending of send number 10 (Note)

DT0 4 (Number of characters)
DT1 H44(D) H49(I)

DT10 DT11

6 (Number of characters)
H4E(N) H45(E)

DT2 H30(0) H31(1)

DT12 H42(B) H41(A)

DT3

DT13 H45(E) H4C(L)

DT14

(Note): For specifying a device for an operand which can specify character constants, store string data with SSET instruction excluding a double quotation mark.

 Operation of HTTPc control relay

Name

Transfer enabled

Transfer disabled

Transfer canceled

Transfer cancel relay

Not change

Not change

ON

Transfer disable relay

OFF

ON

Not change

Transfer request

Not change

Not change

Not change

Transfer active

Not change

Not change

Not change

Transfer retry active

Not change

Not change

Not change

Transfer done

Not change

Not change

Not change

Transfer failed

Not change

Not change

Not change

Transfer direction

Not change

Not change

Not change

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an item other than "IDx" or "ALL" is specified for the control target [S1]. (x: 0 to 15) To be set when a transfer setting that has not been specified with the transfer setting instruction or the tool software is specified. To be set when an item other than "ENABLE", "DISABLE" or "CANCEL" is specified for the control content [S2]. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code that is set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-83

High-level Instructions (Ethernet Communication)

SMTPcBDY (Mail Text Setting)

 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

S1

S2

SMTPcBDY

"ID5"

DT200

S1

S2

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
SMTPcBDY "ID5" DT200

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a setting number, or a character constant.

S2

Device address that stores mail text

 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 sets the specified text as mail text.

 Process details
· The text that is specified by [S2] is set in the mail text for the setting number that is specified by [S1].

· The instruction can be executed when the mail send request relay for the specified setting number is OFF (0: No request). As an execution condition of the instruction, insert a program that checks the state of the mail send request relay. The state of the send request relay can be read with the ETSTAT instruction. Store the state that is read in a device such as an internal relay. An operation error occurs if this instruction is executed when the send request relay is ON.

· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

The power supply for the PLC is switched from OFF to ON.

The PLC is changed to PROG mode.

Changes to RUN mode without rewriting the configuration.
Changes to RUN mode after rewriting the configuration

Operation Setting using the configuration Setting using instructions Setting using the configuration

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

17-84

SMTPcBDY (Mail Text Setting)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· Make the event mail setting before executing the instruction.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates a setting number (string) and a send trigger, or a character constant.

Setting item Settings

Setting range

S1

Setting number

Specify a setting number. Event mail send setting number: Idx

0 to 15

 Operand [S2] setting
· Specify the device address where stores the text is stored.

· When "IDx" is specified for [S1], the maximum size of the text is 4096 bytes. An operation error occurs when it exceeds 4096 bytes.

Setting example

Example)

Mail text example

Floor A: 25 degrees C. Floor B: 28 degrees C.

S1="ID5" S2=DT200

DT200

H002D

No. of bytes

DT201 H 6C(l) H 46(F) Data part DT202 H 6F(o) H 6F(o) Data part

DT203 H 20() H 72(r) Data part

DT204 DT205 DT206

H 3A(:) H 32(2) H 20()

H 41(A) H 20() H 35(5)

Data part Data part Data part

DT207 H 65(e) H 64(d) Data part

DT208 H 72(r) H 67(g) Data part

DT209 H 65(e) H 65(e) Data part DT210 H 20() H 73(s) Data part

DT211 H 2E(.) H 43(C) Data part

DT212 H 46(F) H 0D(CR) Data part

DT213 H 6F(o) H 6C(l) Data part

DT214 H 72(r) H 6F(o) Data part

DT215 H 42(B) H 20() Data part

DT216 H 20() H 3A(:) Data part

DT217 H 38(8) H 32(2) Data part

DT218 H 64(d) H 20() Data part

DT219 H 67(g) H 65(e) Data part

DT220 H 65(e) H 72(r) Data part

DT221 H 73(s) H 65(e) Data part

DT222 H 43(C) H 20() Data part DT223 H 00 H 2E(.) Data part

17-85

High-level Instructions (Ethernet Communication)

 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 slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when an out-of-range value is specified for parameters. To be set when executed in an interrupt program. To be set when the send request of the mail transmission control relay of a target ID number is 1: Requesting. To be set when the mail transmission setting for a target ID number is not set with the mail transmission setting instruction or the tool software.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-86

SMTPcBRD (Mail Text Read)

SMTPcBRD (Mail Text Read)

 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

S1

S2

SMTPcBRD

"ID0"

DT100

S

D

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
SMTPcBRD "ID0" DT0

 List of operands
Operand Description

S

Starting address of the device area that stores the string data that indicates a setting number, or a character constant.

D

Starting address of the device area that stores mail text

 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 contents of mail texts.
 Process details
· The instruction is used to read the text creation form that is set for mail text in the mail setting screen of the setting tool. When a mail text is not set, it cannot be read. Zero is stored in the number of bytes of the starting address.
· The mail text for the number that is specified by [S] is read and stored in the device address that is specified by [D].
· The instruction can be executed when the mail send request relay for the specified setting number is OFF (0: No request). As an execution condition of the instruction, insert a program that checks the state of the mail send request relay. The state of the mail send request relay can be read with the ETSTAT instruction. Store the state that is read in a device such as an internal relay. An operation error occurs if this instruction is executed when the send request relay is ON.
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· Make the event mail setting before executing the instruction.
· This instruction is not available in interrupt programs.

17-87

High-level Instructions (Ethernet Communication)

 Operand [S] setting
· Specify the starting address of the device area that stores the string data that indicates a setting number (string) and a send trigger, or a character constant.

Setting item S

Settings Setting number

Specify a setting number. Event mail send setting number: Idx

Setting range 0 to 15

 Operand [D] setting

· Specify the starting address of the device area that stores mail text.

Setting example

Example)

Mail text example

2014/%d/%d Temperature is %d degrees C.

S1="ID0" S2=DT100

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109 DT110 DT111 DT112 DT113 DT114 DT115
DT116 DT117 DT118 DT119 DT120

H0027

No. of bytes

H 30(0) H 32(2)

H 34(4) H 31(1)

H 25(%) H 2F(/)

H 2F(/) H 64(d)

H 64(d) H 25(%)

H 54(T) H 0D(CR)

H 6D(m) H 65(e)

H 65(e) H 70(p)

H 61(a) H 72(r)

H 75(u) H 74(t)

H 65(e) H 72(r)

H 69(i) H 20()

H 20() H 73(s)

H 64(d) H 25(%)

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(.)

 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 slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when an out-of-range value is specified for parameters. To be set when executed in an interrupt program. To be set when the send request of the mail transmission control relay of a target ID number is 1: Requesting. To be set when the mail transmission setting for a target ID number is not set with the mail transmission setting instruction or the tool software.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-88

SMTPcSV (Mail Server Setting)

SMTPcSV (Mail Server Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

SMTPcSV

S1

S2

"name=fp7,from=abc@xxx.com, "cram,account=

Pv4=192.168.1.1"

abc,pass=xxx"

"initial"

S1

S2

S3

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
SMTPcSV "name=fp7,from=abc@xxx.com,IPv4=192.168.1.1" "cram,account=abc,pass=xxx" "initial"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates sender information and mail sending server information, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the authentication setting parameters, or a character constant.

S3

Starting address of the device area that stores the string data that indicates the detailed setting parameters, or a character constant.

 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 " "

  

 Outline of operation
· This instruction sets the information of the connected mail sending server and the sender.
 Process details
· The mail sending server setting and the sender setting are configured in the CPU unit according to specified parameters.
· The instruction can be executed when the mail send request relays of the mail transmission control relay and the mail send logging/trace control relay are OFF (0: No request). As an execution condition of the instruction, insert a program that checks the state of the mail send request relay. The state of the mail send request relay can be read with the ETSTAT instruction. Store the state that is read in a device such as an internal relay. An operation error occurs if this instruction is executed when the send request relay is ON.
· The initial value is set with the instruction when the server setting is not specified.
· After this instruction is executed, the PLC operates as shown in the following table.

Conditions

Operation

The power supply for the PLC is switched from OFF to ON.

Setting using the configuration

The PLC is changed to PROG mode.

Changes to RUN mode without rewriting the configuration.
Changes to RUN mode after rewriting the configuration

Setting using instructions Setting using the configuration

· If an incorrect IP address is specified, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

17-89

High-level Instructions (Ethernet Communication)

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· When specifying a device area 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 characters can be used for operands. "Abcd", "ABCD" and "abcd" are all synonymous. However, the source name, the mail address, the host name, the user name, and the password are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates sender information and mail sending server information, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· Specify a source name, a source e-mail address, the IP address or the host name of a mail server, a port number, and the SSL3/TLS1 authentication setting within 256 one-byte characters in total.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

Source name (can be omitted) Specify a source name. Specify the keyword "NAME=" at the beginning.

Source e-mail address (essential)

Specify a source e-mail address. Specify the keyword "FROM=" at the beginning.

Specify IP address or host name.

For an IP address, specify the keyword "IPv4=" or "IPv6=" at the beginning. For a host name, specify "HOST=".

IP address or host name of

- For IPv4: IPv4=111.122.133.144

mail server (essential) S1

- For IPv6: IPv6=1111:122:2:1555:0:0:1888 * For details of the range of IPv4 addresses that can be specified, refer to

"19-10 IP address setting specifications".

- For a host name: HOST=smtp.pidsx.com

Port number (can be omitted)

Specify port number. (Default: 25) Setting range: 1 to 65535

SSL3/TLS1 authentication (Can be omitted)

Specify whether or not to use SSL3/TLS1 authentication. SSL= Use SSL3/TLS1 NON=Not use

(Note 1): Input a source name, a source e-mail address, the IP address or the host name of a mail server, a port number, and the SSL3/TLS1 authentication setting separated by a comma ",".
(Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the sender information in the order of the above table.

17-90

SMTPcSV (Mail Server Setting)

Setting example

Example 1 S1 "NAME=FP7_001,FROM=pana@pana.com,IPv4=192.255.2.10,PORT=25,SSL"

Settings

Source name: FP7_001, Source e-mail address: pana@pana.com IP address: 192.255.2.10, Port number: 25, SSL3/TLS1 authentication: Use

Example 2 S1 ",FROM=sunx@sunx.com,IPv6=1111:1222::a8dd:0:0:6666,PORT=100,SSL"

Settings

Source name: Not change, Source e-mail address: sunx@sunx.com IP address: 1111:1222::a8dd:0:0:6666, Port number: 100, SSL3/TLS1 authentication: Use

Example 3

S1

"NAME=FP7_002,FROM=pewsunx@pewsunx.com,HOST=SMTPmailserver.com, PORT=1000,NON"

Settings

Source name: FP7_002, Source e-mail address: pewsunx@pewsunx.com Host name: SMTPmailserver.com, Port number: 1000, SSL3/TLS1 authentication: Not use

Example 4 S1 "NAME=FP7_002,FROM=pewsunx@pewsunx.com,HOST=SMTPmailserver.com"

Settings

Source name: FP7_002, Source e-mail address: pewsunx@pewsunx.com Host name: SMTPmailserver.com, Port number: Not change, SSL3/TLS1 authentication: Not change

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates the authentication setting parameters, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· When "NOUSE" or "KEEP" is specified instead of parameters, the instruction operates according to the table of special keywords.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

Specify SMTP authentication method.

SMTP authentication method (Essential)

CRAM: CRAM-MD5 is used. PLAIN1: PLAIN1 (ID/PASS) is used. PLAIN2: PLAIN2 (ID/PASS) is used.

LOGIN: LOGIN is used.

S2

Account (Can be omitted)

Specify an account. ACCOUNT=XXX (Default: root)

Password (Can be omitted)

Specify a password. Specify the keyword "PASS=" at the beginning. PASS=XXX (Default: root)

(Note 1): Input an SMTP authentication method, an account, and a password separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): Specify the authentication setting parameters in the order of the above table.

Setting example

Example 1 S2 "CRAM,ACCOUNT=sunx,PASS=control"

Setting range
Maximum 32 one-byte characters Maximum 32 one-byte characters

Settings

SMTP authentication method: CRAM-MD5, Account: sunx, Password: control

Example 2 S2 "PLAIN2,ACCOUNT=FP0R,PASS=small"

Settings

SMTP authentication method: PLAIN2, Account: FP0R, Password: small

Example 3 S2 "LOGIN,ACCOUNT=FP2SH,PASS=middle"

Settings

SMTP authentication method: LOGIN, Account: FP2SH, Password: middle

 Operand [S2]: account name and password setting

Patterns

Specification method

Account is specified. : Password is deleted.

"CRAM,ACCOUNT=xxx,PASS="

Account is deleted. : Password is specified.

"PLAIN1,ACCOUNT=,PASS=xxx"

Account is deleted. : Password is deleted.

"PLAIN2,ACCOUNT=,PASS="

Account is specified. : Password is not changed.

"LOGIN,ACCOUNT=xxx"

Account is not changed. : Password is specified.

"CRAM,,PASS=xxx"

17-91

High-level Instructions (Ethernet Communication)

Setting example

Example 1 S2 "CRAM,ACCOUNT=root,PASS="

Settings

SMTP authentication method: CRAM-MD5, Account: root, Password: Delete

Example 2 S2 "PLAIN1,ACCOUNT=,PASS=SUNX"

Settings

SMTP authentication method: PLAIN1, Account: Delete, Password: SUNX

Example 3 S2 "PLAIN2,ACCOUNT=,PASS="

Settings

SMTP authentication method: PLAIN2, Account: Delete, Password: Delete

Example 4 S2 "LOGIN,ACCOUNT=root"

Settings

SMTP authentication method: LOGIN, Account: root, Password: Not change

Example 5 S2 "CRAM,,PASS=SUNX"

Settings

SMTP authentication method: CRAM, Account: Not change, Password: SUNX

 Special keyword of operand [S2] setting
Special keyword Description

NOUSE

The SMTP authentication setting is not used.

KEEP

The current setting is not changed.

Setting example

Example 1 S2 "NOUSE"

Settings

SMTP authentication method: Not use, Account: Not use, Password: Not change

Example 2 S2 "KEEP"

Settings

SMTP authentication method: Not change, Account: Not change, Password: Not change

 Operand [S3] setting
· Specify the starting address of the device area that stores the string data that indicates the detailed setting parameters, or a character constant.

· A part of parameters can be omitted. The settings are not changed when parameters are omitted partially.

· When omitting the part before a specified keyword, omit only "keyword" without omitting ",".

· When omitting the part after a specified keyword, omit both "," and "keyword".

· When "INITIAL" or "KEEP" is specified instead of parameters, the instruction operates according to the table of special keywords.

· It is prohibited to specify the same keyword redundantly. If specified, an error occurs.

Setting item

Settings

Setting range

Maximum sent mail size Specify the maximum size of a sent mail.

(Can be omitted)

MAIL SIZE=: Sent mail size (Default: 100)

1 to 10240 KB

Timeout period (Can be omitted)

Specify a timeout period. TOUT=: Time setting (Default: 60 seconds)

30 to 300 seconds

Number of retries

Specify the number of retries.

S3

(Can be omitted)

RTRY=: Number of retries (Default: 3 times)

0 to 3

Retry interval (Can be omitted)

Specify the number of retries. RTTM=: Retry interval (Default: 600 seconds) *1

10 to 86400 seconds

Language (Can be omitted)

Specify a language to be used for Subject and Text. JPN= Japanese (Default) ENG= English

(Note 1): Input the maximum sent mail size, timeout period, number of retries, retry interval and language separated by a comma ",". (Note 2): Upper and lower case characters can be used for specifying keywords. (Note 3): The retry interval can be specified in 10-second units. It is rounded down to the nearest 10. (Example: When specifying 38
seconds, 30 seconds are set.) (Note 4): Specify the authentication setting parameters in the order of the above table.

17-92

SMTPcSV (Mail Server Setting)

Setting example

Example 1 S3 "MAILSIZE=1000,TOUT=30,RTRY=2,RTTM=500,JPN"

Settings

Maximum size: 1000, Timeout period: 30 seconds, Number of retries: 2, Retry interval: 500 seconds, Language: Japanese

Example 2 S3 "MAILSIZE=10000,TOUT=270,RTRY=0,RTTM=4900,ENG"

Settings

Maximum size: 10000, Timeout period: 270 seconds, Number of retries: 0 (Not retry), Retry interval: 4900 seconds, Language: English

Example 3 S3 "MAILSIZE=500,TOUT=30,RTRY=3,RTTM=200"

Settings

Maximum size: 500, Timeout period: 30 seconds, Number of retries: 3, Retry interval: 200 seconds, Language: Not change

Example 4 S3 "MAILSIZE=5000,,RTRY=5,RTTM=3000,ENG"

Settings

Maximum size: 5000, Timeout period: Not change, Number of retries: 55, Retry interval: 3000 seconds, Language: English

 Special keyword of operand [S3] setting

Special keyword

Description

INITIAL

Set the default.

KEEP

The current setting is not changed.

Setting example

Example 1 S3 "INITIAL"

Settings

Maximum size: 100, Timeout period: 60 seconds, Number of retries: 3, Retry interval: 600 seconds, Language: Japanese

Example 2 S3 "KEEP"

Settings

Maximum size: Not change, Timeout period: Not change, Number of retries: Not change, Retry interval: Not change,
Language: Not change

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters. To be set when the same keyword is specified redundantly. To be set when even one request active relay of mail transmission control relay or mail transmission logging/trace control relay is 1: Requesting. To be set when "Add-on" is set to "Not use" in Built-in ET-LAN setting. To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256.

To be set when the instruction is executed with an incorrect IP address. The detail code set in SD29 is "1:

CY

Specification of incorrect IP address".

(SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-93

High-level Instructions (Ethernet Communication)

SMTPcADD (Destination Group Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

SMTPcADD "GRPNO=0" S1

"GRPNAME= Grp0"
S2

S1

S2

"TO=

"DOMAIN=

aaa@bbb.co.jp" bbb.co.jp"

S3

S4

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
SMTPcADD "GRPNO=0" "GRPNAME=Grp0" "TO=aaa@bbb.co.jp" "DOMAIN=bbb.co.jp"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a destination group number, or a character constant.

S2

Starting address of the device area that stores the string data that indicates a destination group name, or a character constant.

S3

Starting address of the device area that stores the string data that indicates a destination address (host name), or a character constant.

S4

Starting address of the device area that stores the string data that indicates a destination address (domain name), or a character constant.

 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
· This instruction configures the destination group setting.
· Before executing this instruction, use the "SMTPcSV (Mail Server Setting)" instruction or the programming tool software "FPWIN GR7" to configure the settings of the destination server.
 Process details
· This instruction specifies the destination group name specified by [S2] and the destination address specified by [S3] and [S4], for the destination group number specified by [S1].
· The instruction can be executed when the mail send request relays of the mail transmission control relay and the mail send logging/trace control relay are OFF (0: No request). As an execution condition of the instruction, insert a program that checks the state of the mail send request relay. The state of the mail send request relay can be read with the ETSTAT instruction. Store the state that is read in a device such as an internal relay. An operation error occurs if this instruction is executed when the send request relay is ON.
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

17-94

SMTPcADD (Destination Group Setting)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· When specifying a device area for [S1] to [S4], set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different.

· The number of characters should not exceed 256.

· Upper and lower case characters can be used for operands which character constant can be specified. "Abcd", "ABCD" and "abcd" are all synonymous. However, the destination group name, the destination address, the host name, and the domain name are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates a destination group number (string), or a character constant.

Setting item

Settings

Specify a destination group number.

S1

Destination group number

Specify the keyword "GRPNO=" at the beginning.

GRPNO=Destination group number

(Note): Upper and lower case characters can be used for specifying keywords.

Setting example

Example 1 S1 "GRPNO=0"

Setting range 0 to 7

Settings

Destination group number: 0

Example 2 S1 "GrpNo=7"

Settings

Destination group number: 7

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates a destination group name, or a character constant.

Setting item

Settings

Specify a destination group name.

S2

Destination group name

Specify the keyword "GRPNAME=" at the beginning.

GRPNAME=Destination group name

(Note): Upper and lower case characters can be used for specifying keywords.

Setting example

Example 1 S2 "GRPNAME=Grp0"

Setting range
Maximum 64 one-byte characters

Settings

Group name: Grp0

Example 2 S2 "GrpName=Grp1"

Settings

Group name: Grp1

17-95

High-level Instructions (Ethernet Communication)

 Operand [S3] setting
· Specify the starting address of the device area that stores the string data that indicates a destination address, or a character constant.

Setting item

Settings

S3

Destination address (Host name)

Specify a destination address (host name). Specify the keyword "TO=" at the beginning. TO=Destination address

(Note 1): The destination address of S3 can be specified with a hone name only or host name and domain name. (Note 2): When a domain name is omitted, the destination address is created by the addition of the domain name of S4. (Note 3): Multiple addresses can be specified by separating each address with ",". (Note 4): Upper and lower case characters can be used for specifying keywords.

Setting example

Example 1 S3 "TO=suzuki@sunx.co.jp"

Settings

Destination address: suzuki@sunx.co.jp, Domain name: Specified for [S3].

Example 2 S3 "TO=sato"

Settings

Destination address: sato@sunx.co.jp, Domain name: Omitted for [S3], specified as "DOMAIN=sunx.co.jp" for [S4].

Example 3 S3 "TO=suzuki@sunx.co.jp,yamamoto@pana.co.jp"

Settings

Destination address: Multiple addresses (suzuki@sunx.co.jp and yamamoto@pana.co.jp) are specified. Domain name: Specified for [S3].

Example 4 S3 "TO=yamamoto,ito"

Settings

Destination address: Multiple addresses (yamamoto@pana.co.jp and ito@pana.co.jp) are specified. Domain name: Omitted for [S3], specified as "DOMAIN=pana.co.jp" for [S4].

Example 5 S3 "TO=suzuki@sunx.co.jp,yamamoto,ito"

Settings

Destination address: Multiple addresses are specified. Domain name: Mix of specified/omitted for [S3], specified "DOMAIN= pana.co.jp" for [S4].

 Operand [S4] setting
Specify the starting address of the device area that stores the string data that indicates a destination address (domain name), or a character constant.

Setting item

Settings

Setting range

S4

Destination address (Domain name)

Specify a destination address (domain name). Specify the keyword "DOMAIN=" at the beginning.
DOMAIN=Domain name

Maximum 32 one-byte characters

(Note 1): When a domain name is omitted for the specification of the destination address of S3, a specified domain name is added. (Note 2): When all domain names are specified for the specification of the destination addresses of S3, the specification of the domain
name of S4 can be omitted. (Note 3): Only one domain name can be specified. (Note 4): Upper and lower case characters can be used for specifying keywords.

Setting example

Example 1 S4 "DOMAIN=sunx.co.jp"

Settings

Domain name: sunx.co.jp

Example 2 S4 "Domain=sunx.co.jp"

Settings

Domain name: sunx.co.jp

Example 3 S4 "DOMAIN="

Settings

Domain name: Omitted

17-96

SMTPcADD (Destination Group Setting)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an out-of-range value is specified for parameters.
To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN).
To be set when even one request active relay of mail transmission control relay or mail transmission logging/trace control relay is 1: Requesting.
To be set when the domain name for [S4] is omitted while the destination address [S3] is also specified with the domain name omitted.
To be set when executed in an interrupt program.
To be set when the number of characters for operand specifying character constant exceeds 256.
To be set when a mail sending server that has not been specified with the destination server setting instruction or the tool software is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-97

High-level Instructions (Ethernet Communication)

SMTPcSET (Mail Transmission Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

SMTPcSET

"ID=0, TRIG=BITON,R0"

"GRPNO= 0,SUBJECTAUTO"

S1

S2

S1 "Test"
S3

U1
S2 "INFO=NON,ATT =NONE"
S4

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
SMTPcSET "ID=0,TRIG=BITON,R0" "GRPNO=0,SUBJECTAUTO" "Test" "INFO=NON,ATT=NONE"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a setting number and a send trigger, or a character constant

S2

Starting address of the device area that stores the string data that indicates the destination group number and the subject of the mail to be sent, or a character constant.

S3

Starting address of the device area that stores the string data that indicates the text of the mail to be sent, or a character constant.

S4

Starting address of the device area that stores the string data that indicates the attached data specification of the mail to be sent, or a character constant.

 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
· This instruction configures the mail transmission settings.
· Before executing this instruction, use the "SMTPcADD (Destination Group Setting)" instruction or the programming tool software "FPWIN GR7" to configure event mail settings.
 Process details
· The mail transmission settings of [S1] to [S4] are stored in the mail transmission setting area.
· The instruction can be executed when the mail send request relay is OFF (0: No request). As an execution condition of the instruction, insert a program that checks the state of the mail send request relay. The state of the mail send request relay can be read with the ETSTAT instruction. Store the state that is read in a device such as an internal relay. An operation error occurs if this instruction is executed when the send request relay is ON.
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

17-98

SMTPcSET (Mail Transmission Setting)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· For [S1] to [S4], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous. However, the subject, the mail text, and the attachment file name are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates a setting number (string) and a send trigger, or a character constant.

Setting item Settings

Setting range

Setting number

Specify a transfer setting number. Specify the keyword "ID=" at the beginning.
ID=: Transfer setting number

0 to 15

S1

Specify a send trigger. Specify the keyword "TRIG=" at the beginning.

Send trigger TRIG=xxxxx

* For information on send triggers, refer to the section of "Send Trigger Setting".

(Note 1): Only one setting number and send trigger can be specified simultaneously. (Note 2): It is prohibited to specify the same keyword redundantly. If specified, an error occurs. (Note 3): Input each setting parameter separated by a comma ",". (Note 4): Each parameter cannot be omitted. Specify them in the order of the above table. The order of keywords cannot be changed. (Note 5): Upper and lower case characters can be used for specifying keywords. (Note 6): Setting numbers should be specified from number 0 in ascending order. An error occurs when transfer setting numbers are not
specified in ascending order. If transfer settings have been already registered, this rule is not applied.

 Operand [S1] send trigger setting

Setting Description

Specify the detection of bit device OFF to ON as a trigger. Specify "BITON" for the keyword "TRIG=", and set the bit device.
TRIG=BITON,xxxxx

Bit device

For global device

Specify device code + device number. Example) "X10", "R1024", "DT12345.6" Addressable devices: X, Y, R, L, T, C, S, P, E, DT.n, LD.n For system relays, specify "S".

For a local device

"PB" + PB number + "_" (underscore) + device code + device number Example) "PB1_X50", "PB80_R512", "PB200_DT102.4" Addressable devices: X, Y, R, L, T, C, P, E, DT.n, LD.n

Specify sent time. Specify "TIME" for the keyword "TRIG=", and set the time. TRIG=TIME,xxxx,yyyy

Time

- Setting format of cycle

Cycle

Set value of xxxx Set format of yyyy

Every minute /min

ss

Every hour /hour

mm:ss

Every day

/day

hh:mm:ss

Every month /mon

DD:hh:mm:ss

Every year /year

MM:DD:hh:mm:ss

Every week /week

hh:mm:ss-w

* Specify the format of yyyy as follows; ss = seconds (0 to 59), mm = minutes (0 to 59), hh = hours (0 to 23), DD (1 to 31) = days, MM = months (1 to 12), w = weeks (0 to 6)
* Specify w for every week as follows; 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday

17-99

High-level Instructions (Ethernet Communication)

Specify "CYCLIC" and the following strings in combination for the keyword "TRIG=". TRIG=CYCLIC,xxxx

Cycle

- Setting value of cycle time

Cycle unit Setting value

sec

30SEC

min

1MIN, 2MIN, 3MIN, 4MIN, 5MIN, 6MIN, 10MIN, 15MIN, 30MIN

Hour

1HOUR, 2HOUR, 3HOUR, 4HOUR, 6HOUR, 12HOUR, 24HOUR

* The shortest cycle is 30 seconds. * Only one cycle time can be set. Setting values such as "1MIN30SEC" cannot be set.

Instruction

Specify SMTPcREQ instruction as a trigger. Specify "PROGRAM" for the keyword "TRIG=". TRIG=PROGRAM

Specify "STATUS" and the following strings in combination for the keyword "TRIG=". TRIG=STATUS,xxxx

PLC status change

Multiple items can be specified. Separate each item with a comma (,).

Setting value

Meaning

PROG>RUN

When switching the switch PROG to RUN

RUN>PROG

When switching the switch RUN to PROG

ERR>STOP

Operation stop self-diagnostic error detected.

ERR>RUN

Operation continue self-diagnostic error detected.

ERRCLR

When error is cleared

Setting example
Example 1 S1 Settings
Example 2 S1 Settings
Example 3 S1 Settings
Example 4 S1 Settings
Example 5 S1 Settings
Example 6 S1 Settings
Example 7 S1 Settings
Example 8 S1 Settings
Example 9 S1 Settings
Example 10 S1 Settings
Example 11 S1 Settings
Example 12 S1
Settings

"ID=0,TRIG=BITON,DT100.1" Setting number: 0, Send trigger: Bit device (Global device: DT100 Bit 1 ) "ID=1,TRIG=TIME,/day,13:30:00" Setting number: 1, Send trigger: Time (Every day at 13:30) "ID=2,TRIG=TIME,/year,4:1:9:0:0" Setting number: 2 Send trigger: Time (Every year at 9:00 on April 1) "ID=3,TRIG=TIME,/week,23:50:00-5" Setting number: 3, Send trigger: Time (Every week at 23:50 on Friday) "ID=4,TRIG=CYCLIC,30SEC" Setting number: 4, Send trigger: Cycle (30-second cycle) "ID=5,TRIG=CYCLIC,10MIN" Setting number: 5, Send trigger: Cycle (10-minute cycle) "ID=6,TRIG=CYCLIC,12HOUR" Setting number: 6, Send trigger: Cycle (12-hour cycle) "ID=7,TRIG=PROGRAM" Setting number: 7, Send trigger: Instructions "ID=8,TRIG=STATUS,PROG>RUN" Setting Number: 8, Send trigger: PLC status change (When the switch changes PROG to RUN) "ID=9,TRIG=STATUS,RUN>PROG" Setting number: 9, Send trigger: PLC status change (When the switch changes RUN to PROG) "ID=10,TRIG=STATUS,ERR>STOP" Setting number: 10, Send trigger: PLC status change (When operation stop self-diagnostic error is detected.) "ID=11,TRIG=STATUS,ERR>RUN" Setting number: 11, Send trigger: PLC status change (When operation continue self-diagnostic error is detected.)

17-100

SMTPcSET (Mail Transmission Setting)

Example 13 Settings
Example 14
Settings

S1 "ID=12,TRIG=STATUS,ERRCLR"
Setting number: 12, Send trigger: PLC status change (When error is cleared.)
S1 "ID=13,TRIG=STATUS,ERR>STOP,ERR>RUN,ERRCLR"
Setting number: 13, Send trigger: PLC status change (When operation stop self-diagnostic error is detected.), PLC status change (When operation continue self-diagnostic error is detected.), PLC status change (When error is cleared.)

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates the destination group number (string) and the subject of the mail to be sent, or a character constant.

Setting item Settings

Setting range

Specify a destination group. Specify a destination group number for the

Destination group number

keyword "GRPNO=". GRPNO=n1+n2 ... +n8 * Up to eight different group numbers connected with pluses (+) can be

0 to 7

selected at the same time.

S2

Specify a mail subject.

- User-specified subject: SUBJECT=xxxxx

Subject

- Automatically-generated subject: SUBJECTAUTO

* For details of subjects generated automatically, refer to the section of "Subjects automatically generated."

(Note 1): Input each setting parameter separated by a comma ",". (Note 2): Each parameter cannot be omitted. Specify them in the order of the above table. The order of keywords cannot be changed. (Note 3): Upper and lower case characters can be used for specifying keywords. (Note 4): Up to 100 destinations can be set.

Subjects automatically generated

Subject automatically generated (Japanese)

Subject automatically generated (English)

 ON R100

bit on detect (R100)



Interval mail (1minute)

24 

Interval mail (24hour)

0 

Specified Time (Every Minute 0s)

0  0 

Specified Time (Every Hour 0m0s)

17  30  0 

Specified Time (Every Day 17h30m0s)

17  30  0 

Specified Time (Every Friday 17h30m00s)

PLC  ON

PLC status change (Power On)

PLC PROGRUN 

PLC status change (Prog > Run)

PLC RUNPROG 

PLC status change (Run > Prog)

PLC 

PLC status change (Operation stop error)

PLC 

PLC status change (Operation continuous error)

PLC 

PLC status change (Error release)

SMTPcREQ 

SMTPcREQ command

(Note 1): When multiple "PLC status change" settings have been specified as send triggers, the subject automatically generated is the PLC status change that is actually detected.
(Note 2): The language used for subjects automatically generated is specified in the mail server setting.

Setting example

Example 1 S2 "GRPNO=0,SUBJECT=Time Notify Mail"

Settings

Destination group number: 0, Subject: User-specified subject "Time Notify Mail"

Example 2 S2 "GRPNO=1+3+4+7,SUBJECT= Cyclic Notify Mail"

Settings

Destination group numbers: 1, 3, 4, 7, Subject: User-specified subject "Cyclic Notify Mail"

Example 3 S2 "GRPNO=0+1+2+3+4+5+6+7,SUBJECTAUTO"

Settings

Destination group numbers: 0 to 7, Subject: Automatically generated

17-101

High-level Instructions (Ethernet Communication)

 Operand [S3] setting
Specify the starting address of the device area that stores the string data that indicates the setting of the text of the mail to be sent, or a character constant.

Setting item S3

Settings
Mail text
Number of characters (counted as one-byte characters)

Specify the starting address of the device area that stores the setting of the text of the mail to be sent, or a character constant.
Maximum 4096 characters for CPU units Ver.4.1 or later, and Ver.3.4 to Ver.3.x. Maximum 256 characters for CPU units that are other than the above.

 Operand [S4] setting
· Specify the starting address of the device area that stores the string data that indicates the text auto addition setting and the attached data specification of the mail to be sent, or a character constant.

Setting item Settings
Event mail setting Specification of automatic addition

Specify whether to add event transfer information after a mail text specified by user or not.
INFO=NON: Not add automatically.
INFO=ADD: Add automatically.
* For details of information automatically added, refer to the section "Automatic additional information."

Specify data to be attached to a mail. Specify the keyword "ATT=" at the beginning.

S4
Specification of attached data

- No attached data Specify "NON" for the keyword "ATT". ATT=NONE
- Specify device (added to mail text) Specify "DATA" for the keyword "ATT" and specify the device to be added to the mail text. ATT=DATA,xxxxxxxxxxx * For information on how to specify devices, refer to the section "How to specify devices." * For details of information added to mail text, refer to the section "Device information added to mail text."
- Specify device (with attached file) Specify "DATA" for the keyword "ATT" and specify the device to be added and attached files. ATT=DATA,xxxxxxxxxxx,FILE=yyyyyyyyyyy * For information on how to specify devices, refer to the section "How to specify devices." * For information on how to specify attached files, refer to the section "How to specify attached files."
- Specify attached file Specify a file to be attached with full path after specifying "FILE" for the keyword "ATT". ATT=FILE,FileName * LOG folder names ("\LOG0" to "\LOG15") cannot be specified.

17-102

SMTPcSET (Mail Transmission Setting)

Automatic additional information

Character strings added to mails (Japanese)

Character strings added to mails (English)



Basic information



From:

CPU CPS41E

CPU Part Number:

IPv4 

IPv4 address:

IPv6 

IPv6 address:



Detailed information

 ON R100

bit on detect (R100)

1 

Interval mail (1minute)

24 

Interval mail (24hour)

0 

Specified Time (Every Minute 0s)

0  0 

Specified Time (Every Hour 0m0s)

17  30  0 

Specified Time (Every Day 17h30m0s)

Example: 17  30  0 

Specified Time (Every Friday 17h30m00s)

PLC  ON

PLC status change (Power On)

PLC PROGRUN 

PLC status change (Prog > Run)

PLC RUNPROG 

PLC status change (Run > Prog)

PLC 

PLC status change (Operation stop error)

PLC 

PLC status change (Operation continuous error)

PLC 

PLC status change (Error release)

SMTPcREQ Example: PB 

SMTPcREQ command (PB10, 100)

(Note 1): IPv4 address is output only when using IPv4 address, and IPv6 address is output only when using IPv6 address. (Note 2): The language to be output to mails is specified in the mail server setting.

Device information added to mail text

Character strings added to mails (Japanese)

Character strings added to mails (English)



Device get information

DT100

Device number: DT100

4 

Getting number: 4 devices



Exchange method:



1234, 5558, 764, 18270

(Note): The language to be output to mails is specified in the mail server setting.

17-103

High-level Instructions (Ethernet Communication)

 Operand [S4] Device setting

Set

Description

Specify the source device setting. - Global device Specify device code + device number. Example) "WX10", "WR1024", "DT123456" - Local device "PB" + PB number + "_" (underscore) + device code + device number Example) "PB1_WX50", "PB80_WR512", "PB200_DT1024"

Source Device Set
Number of transferred data (data amount)

<Devices that can be specified>

Global device

Local device

WX

WX

WY

WY

WR

WR

WL

WL

DT

DT

LD

LD

SD

Specify the number of transferred data (number of data). (1 to 1000) Specify a conversion method.

Conversion method
Line feed position

Parameter

BIN1w

: Unconverted 16-bit binary

US

: 16-bit unsigned decimal

SS

: 16-bit signed decimal

UL

: 32-bit unsigned decimal

SL

: 32-bit signed decimal

SF

: 32-bit single-precision floating point

DF

: 64-bit double-precision floating point

HEX1w

: 16-bit HEX

HEX2w

: 32-bit HEX

HEX4w

: 64-bit HEX

ASCII

: ASCII character (Output enclosed with "")

* BIN1w cannot be specified for adding to mail texts. For specifying BIN1w, select the method for adding attached files.

Specify line feed position.

- The setting range is 0 to 255.

0 : Output at the end of the file only

n : Output for each n data points

17-104

SMTPcSET (Mail Transmission Setting)

 Operand [S4] Attached file setting

Setting item

Description

Attached File Name

Output a device value, and specify the name of the file to be attached to the mail after the keyword "FILE=". FILE=xxxxxxxxx

File name automatic addition position

Specify the position of the automatic additional data added to a file name. TOP: Automatic additional data is added before a file name. END: Automatic additional data is added after a file name. * Automatic additional data is year, month, day, hour, minute and second "(yymmdd_hhmmss)".

(Note 1): When omitting "File name automatic addition position", automatic additional data is not added to the file name. (Note 2): Specify the operation setting parameters in the order of the above table.
Setting example

Example 1 S4 "INFO=NON,ATT=NONE"

Settings

Automatic additional information: Not add automatically, Specification of attached data: No attached file

Example 2 S4 "INFO=ADD,ATT=NONE"

Settings

Automatic additional information: Add automatically, Specification of attached data: No attached file

Example 3 S4 "INFO=NON,ATT=DATA,DT100,10,HEX1w"

Settings

Automatic additional information: Not add automatically, Specification of attached data: Specify device (attached to mail text) Device setting, Device division: Global, Device code: DT, Device number: 100 Number of transferred data: 10 (10 words), Conversion method: 16-bit HEX

Example 4 S4 "INFO=ADD,ATT=DATA,PB100_WR1000,50,US,FILE=PB100_WR1000_50.csv,TOP"

Settings

Automatic additional information: Add automatically, Specification of attached data: Specify device Device setting, Device division: Local, PB number: 100, Device code: WR, Device number: 1000 Number of transferred data: 50 (50 words), Conversion method: 16-bit unsigned decimal, Addition of attached file: FILE=PB100_WR1000_50.csv,
Automatic addition position: Automatic additional data is added before the file name.

Example 5 S4 "INFO=NON,ATT=FILE,\Folder\FileName.bin"

Settings

Automatic additional information: Not add automatically, Specification of attached data: specify file (\Folder\FileName.bin)

 Flag operations

Name

Description

To be set when an out-of-range value is specified for parameters.

To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN).

To be set when setting numbers are not specified in ascending order.

To be set when the same destination group number is specified redundantly.

SR7 SR8 (ER)

To be set when executed in an interrupt program.
To be set when the send request of the mail transmission control relay of a specified setting number is 1: Requesting.
To be set when the number of characters for an operand that allows specifying a character constant exceeds its upper limit. The upper limit is 4096 characters for CPU units Ver.4.1 or later, and Ver.3.4 to Ver.3.x, and 256 characters at maximum for other CPU units.

To be set when a mail sending server that has not been specified with the destination server setting instruction or the tool software is specified.

To be set when a destination group number that has not been specified with the destination group setting instruction or the tool software is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-105

High-level Instructions (Ethernet Communication)

SMTPcLOG (Logging/Trace Mail Setting)
 Ladder diagram

R0

X61

 DF 

UNITSEL

U100

U1

S1

S2

SMTPcLOG "LOG=0"

"GRPNO=0, SUBJECTAUTO"

"Send

log

files"

"INFO=NON, ATT=NONE"

S1

S2

S3

S4

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
SMTPcLOG "LOG=0" "GRPNO=0,SUBJECTAUTO" "Send log files" "INFO=NONE,ATT=NONE"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a target LOG number, or a character constant.

S2

Starting address of the device area that stores the string data that indicates a subject and a destination group number, or a character constant.

S3

Starting address of the device area that stores the string data that indicates mail text, or a character constant.

S4

Starting address of the device area that stores the string data that indicates the settings for text auto generation and file attachments, or a character constant.

 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
· This instruction configures the mail transmission settings for when determining a file in logging/trace.
· Before executing this instruction, use the "SMTPcADD (Destination Group Setting)" instruction or the programming tool software "FPWIN GR7" to configure logging/trace mail settings.
 Process details
· The logging/trace mail settings of [S2] to [S4] are stored in the logging/trace setting area that is specified by [S1].
· The instruction can be executed when the mail send request relay is OFF (0: No request). As an execution condition of the instruction, insert a program that checks the state of the mail send request relay. The state of the mail send request relay can be read with the ETSTAT instruction. Store the state that is read in a device such as an internal relay. An operation error occurs if this instruction is executed when the send request relay is ON.
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

17-106

SMTPcLOG (Logging/Trace Mail Setting)

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· For [S1] to [S4], specify the starting address of the device area that stores the string data that indicates the set parameters, or a character constant. When specifying a device area for an operand, set string data using the SSET instruction in advance. However, the ESSET instruction cannot be used because the format is different.

· The number of characters should not exceed 256.

· Both upper and lower case characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous. However, the subject, the mail text, and the attachment file name are case-sensitive.

· This instruction is not available in interrupt programs.

 Operand [S1] setting
· Specify the starting address of the device area that stores the string data that indicates a logging/trace number (string), or a character constant.

Setting item Settings

S1

Target LOG number

Specify a target LOG number (0 to 15). Specify the keyword "LOG=" at the beginning.
LOG=x

(Note): Upper and lower case characters can be used for specifying keywords.

Setting range 0 to 15

 Operand [S2] setting
· Specify the starting address of the device area that stores the string data that indicates a subject and a destination group number (string), or a character constant.

· More than one destination group number can be specified simultaneously (maximum 8). Numbers are specified with bits.

Setting item Settings

Setting range

Destination group number

Specify a destination group. (0 to 7) Specify the keyword "GRPNO=" at the beginning.
* Up to eight different group numbers connected with pluses (+) can be selected at the same time.

0 to 7

Specify a mail subject.

User-specified subject

Specify a mail subject.

S2 Subject

Specify a subject for the keyword "SUBJECT=". SUBJECT=xxxx Automatically-generated subject A mail subject is automatically generated. Specify the keyword "SUBJECTAUTO".

For a user-specified subject, up to 64 one-byte characters

SUBJECTAUTO

* For details of subjects generated automatically, refer to the section of "Subjects automatically generated."

(Note 1): Input each setting parameter for a subject and destination group numbers separated by a comma ",". (Note 2): A subject and destination group numbers cannot be omitted. Specify them in the order of the above table. The order of
keywords cannot be changed. (Note 3): Upper and lower case characters can be used for specifying keywords.

Setting example

Example 1 S2 "GRPNO=0,SUBJECT=LogFileSend"

Settings

Subject: LogFileSend, Destination group number: 0

Example 2 S2 "GrpNo=0+1+2+3+4+5,Subject=TestSend"

Settings

Subject: TestSend, Destination group numbers: 0,1,2,3,4,5

Example 3 S2 "GrpNo=0+1+2+3+4+5,SubjectAUTO"

Settings

Subject: Automatic, Destination group numbers: 0,1,2,3,4,5

17-107

High-level Instructions (Ethernet Communication)

Subjects automatically generated Subject automatically generated (Japanese)
 (LOG0)  (LOG1) 
 (LOG14)  (LOG15)

Subject automatically generated (English) Logging/Trace (LOG0) Logging/Trace (LOG1)  Logging/Trace (LOG14) Logging/Trace (LOG15)

 Operand [S3] setting
· Specify the starting address of the device area that stores the string data that indicates mail text, or a character constant.

· Enter a mail text within one-byte 256 characters.

Setting item S3

Settings

Body

Specify the starting address of the device area that stores the string data that indicates mail text, or a character constant.

Setting range
Maximum 256 one-byte characters

 Operand [S4] setting
Specify the starting address of the device area that stores the string data that indicates the settings for text auto generation and file attachments, or a character constant.

Setting item

Settings

Specify whether to generate a message automatically or not.

Add or not add character strings automatically generated by the unit

Specify the keyword "INFO=" at the beginning. Not generate a message automatically: INFO=NONE

Generate a message automatically: INFO=AUTO S4
Specify whether to attach files or not.

Attach or not attach files

Specify the keyword "ATT=" at the beginning. Not attach files: ATT=NONE

Attach files: ATT=FILE

(Note 1): Input each parameter for setting whether or not to generate a message automatically and whether or not to attach files separated by a comma ",".
(Note 2): The parameters for the automatic generation and file attachment cannot be omitted. Specify them in the order of the above table. The order of keywords cannot be changed.
(Note 3): Upper and lower case characters can be used for specifying keywords.

Setting example

Example 1 S4 "INFO=NONE,ATT=NONE"

Settings

Generate a message automatically: No, Attach files: No

Example 2 S4 "Info=AUTO,Att=FILE"

Settings

Generate a message automatically: Yes, Attach files: Yes

Automatic additional information Character strings added to mails (Japanese)
  CPU CPS41E IPv4  IPv6  (ID ) 

Character strings added to mails (English) Basic information
From: CPU Part Number: IPv4 address: IPv6 address: Logging Trace ID: File fixed Time:

17-108

SMTPcLOG (Logging/Trace Mail Setting)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when the send request relay of the mail send logging/trace control relay for a target LOG number is "1: Request". To be set when the LOGn send setting for a target LOG number is not registered. To be set when an out-of-range number is specified for a destination group number. To be set when an out-of-range value is specified for parameters. To be set when executed in an interrupt program. To be set when the number of characters for operand specifying character constant exceeds 256. To be set when an unset destination group number is specified. To be set when a mail sending server is not specified. To be set when a mail sending server that has not been specified with the destination server setting instruction or the tool software is specified. To be set when a destination group number that has not been specified with the destination group setting instruction or the tool software is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-109

High-level Instructions (Ethernet Communication)

SMTPcREQ (Mail Send Request)

 Ladder diagram

R0

X60 X61 X69

 DF 

UNITSEL

U100

U1

S1

S2

SMTPcREQ

U0

S

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].

 List of operands
Operand Description

S

Specify the device address where the transfer number (0 to 15) is stored, or a constant.

 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 requests to send a mail.

· Before executing this instruction, use the "SMTPcSET" instruction or the programming tool software "FPWIN GR7" to configure event mail settings.

 Process details
· The send request relay for the send number that is specified by [S] is turned ON.

· This instruction can be executed when the cable disconnection detection flag (X60) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X60). If this instruction is executed when the flag (X60) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.

· This instruction can be executed when the SMTP client preparation done flag (X69) is ON. As an execution condition of the instruction, insert a program that checks the status of the flag (X69). An operation error occurs if this instruction is executed when the flag (X69) is OFF.

· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.

 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

· This instruction is not available in interrupt programs.

 Operand [S] setting

Setting item Settings

S

Send number

Specify the device address storing a send number or a constant.

Setting range 0 to 15

17-110

SMTPcREQ (Mail Send Request)

 Time chart
· The following diagram shows the process in which a transfer request is executed and data transfer from a server to FP7 is completed successfully.

· The control relays (bit0 to bit15) can be monitored by using the ETSTAT instruction to read and store their state in arbitrary operation devices.

(1) (2) (3) (4)

(5)

(6)

Ethernet initialization active flag (X61)
SMTP client preparation done flag (X69)
Send request relay ETSTAT [D] bit0
Send active relay ETSTAT [D] bit1
Send retry active relay ETSTAT [D] bit2
Execution done relay ETSTAT [D] bit3
Execution result relay ETSTAT [D] bit4
Transfer cancel request relay ETSTAT [D] bit14
Transfer disable relay ETSTAT [D] bit15

Turns OFF when sending is requested.

Normal completion Execution result relay: 0 Transfer done code: 0

(1) RUN (Power on)

(4) Transfer request (Executes SMTPcREQ instruction)

(2) SMTP client preparation done (3) Transfer setting (Executes SMTPcSET instruction)

(5) SMTP client login succeeded (Starts transfer)

(6)

Transfer process done (Completes the execution of SMTPcREQ instruction)

 Control relay
Name

Bit No.

Description

Send request relay

0

0: No request, 1: Request

Send active relay

1

0: Stop, 1: During transfer

Send retry active relay

2

0: No retry, 1: During retry

Execution done relay

3

0: During process, 1: Instruction execution complete

Execution result relay

4

0: Normal 1: Failed

Transfer direction relay

5

0: Send, 1: Receive

Reserved for system

6 to 13

-

Send cancel request relay

14

0: Not cancel, 1: Cancel

Send disable relay

15

0: Transfer enabled, 1: Transfer disabled

(Note): The states of control relays can be read with the ETSTAT instruction.

17-111

High-level Instructions (Ethernet Communication)

 Completion codes
Name

Number of words Description

Execution done code

1

Execution done code

Send done code

1

Response code of SMTP client

(Note): The state of completion codes can be read with the ETSTAT instruction.

When the instruction is executed under one of the following conditions, a transfer error occurs and the corresponding error code is set in the execution done code.

State

Code

State

Code

Destination server is not set.

1

Transfer prohibition setting

5

Transfer setting is not set. Destination group is not set.

2

Data decompression failed. (When accessing data with PUT)

8

3

Data decompression failed. (When accessing data with GET)

9

Registering a process request failed.

4

 SMTP client preparation done (WX6 bit 9)

Name

Bit No. Description

SMTP client preparation done (X69)

9

0: SMTP client preparation incomplete, 1: SMTP client preparation complete

(Note): For details of Ethernet-related flags, refer to "19-10 Ethernet Function: IP Addresses."

 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 slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN). To be set when the SMTP client preparation done (X69) is OFF at the time of the execution of instruction. To be set when an out-of-range value is specified for parameters. To be set when the send disable relay is "Send disabled". To be set when the send request relay of a specified ID is "Request". To be set when executed in an interrupt program. To be set when a mail transmission setting that has not been specified with the mail transmission setting instruction or the tool software is specified.

To be set when the instruction is executed while the Ethernet cable is disconnected. The detail code set in SD29 is

SR9

"10: Ethernet cable disconnected".

(CY)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-112

SMTPcCTL (Mail Transmission Control)

SMTPcCTL (Mail Transmission Control)
 Ladder diagram

R0

UNITSEL

U100

U1

S1

S2

SMTPcCTL "ID0"

"ENABLE"

S1

S2

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
SMTPcCTL "ID0" "ENABLE"

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a control target, or a character constant.

S2

Starting address of the device area that stores the string data that indicates the control content (send enabled/disabled/canceled), or a character constant.

 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 configures the settings for enabling, disabling, or canceling the sending of mail.
· Before executing this instruction, use the "SMTPcSET" instruction or the programming tool software "FPWIN GR7" to configure event mail settings. (when control targets are specified with send numbers)
· Before executing this instruction, use the "SMTPcLOG" instruction or the programming tool software "FPWIN GR7" to configure logging/trace mail settings. (when control targets are specified with LOG numbers)
· It takes some time to accept the processing of the transfer cancel request. After executing the instruction, check the transfer status to see if the transfer stops. For details on checking the transfer status, refer to the "ETSTAT (Acquiring Ethernet Unit Information: FTP/HTTP/SMTP)" instruction.
 Process details
· The instruction controls whether to enable, disable, or cancel mail sending for the target [S1] according to the specification of the control content [S2].
· This instruction can be executed when the Ethernet initialization active flag (X61) is OFF. As an execution condition of the instruction, insert a program that checks the status of the flag (X61). If this instruction is executed when the flag (X61) is ON, the system relay SR9 (carry flag CY) is set and the instruction is terminated without being executed.
· When the instruction is completed successfully, the system relay SR9 (carry flag CY) and the system data register SD29 (Ethernet communication error code) are cleared.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.

17-113

High-level Instructions (Ethernet Communication)

· For [S1] and [S2], specify the starting address of the device storing the string data which indicates the set parameters or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous.

 Operand [S1] setting
Setting item Settings

1) When specifying an individual send number

Specify "IDx" with x being a value from 0 to 15.

S1

Control target 2) When specifying an individual LOG number

Specify "LOGx" with x being a value from 0 to 15.

3) When specifying all send numbers and all LOG numbers

Specify "ALL".

 Operand [S2] setting
Setting item Settings

S2

Control content

1) When enabling sending 2) When disabling sending 3) When canceling sending

Setting example

Settings

S1

Example 1

When enabling the sending of send number 5

"ID5"

Example 2 When disabling all sending

"ALL"

Example 3

When canceling the sending of LOG7

"LOG7"

DT0

Value

DT0 4 (Number of characters)

Example 4

When enabling the sending of send number 10 (Note)

DT1 H44(D) DT2 H30(0)

H49(I) H31(1)

DT3

Specify "ENABLE". Specify "DISABLE". Specify "CANCEL".

S2

"ENABLE"

"DISABLE"

"CANCEL"

DT10
DT10 DT11 DT12 DT13 DT14

Value 6 (Number of characters) H4E(N) H45(E) H42(B) H41(A) H45(E) H4C(L)

(Note): For specifying a device for an operand which can specify character constants, store string data with SSET instruction excluding a double quotation mark.

 Mail transmission control relay flag operation

Name

Transfer enabled

Transfer disabled

Transfer canceled

Send cancel relay Send disable relay

Not change OFF

Not change ON

ON Not change

Send request

Not change

Not change

Not change

Send active

Not change

Not change

Not change

Send retry active

Not change

Not change

Not change

Send done

Not change

Not change

Not change

Send failed

Not change

Not change

Not change

Send direction

Not change

Not change

(Note): The send cancel relay turns OFF when the SMTPc transfer request instruction is executed.

Not change

17-114

SMTPcCTL (Mail Transmission Control)

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when an item other than "IDx" or "LOGx" or "ALL" is specified for the control target (S1). (x: 0 to 15)
To be set when an item other than "ENABLE", "DISABLE" or "CANCEL" is specified for the control content (S2). To be set when the slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN).
To be set when the number of characters for operand specifying character constant exceeds 256. To be set when a mail transmission setting that has not been specified with the mail transmission setting instruction or the tool software is specified. To be set when a logging/trace mail setting that has not been specified with the logging/trace mail setting instruction or the tool software is specified.

CY (SR9)

To be set when executed during the initialization of Ethernet. The detail code set in SD29 is "11: Ethernet initialization active".

(Note): For details of the error codes stored in the system data SD29, refer to "20-2 List of System Data Registers."

17-115

High-level Instructions (Ethernet Communication)

ETSTAT (Acquiring EtherNet/IP Information)

 Ladder diagram

R0

UNITSEL U100

U1

S1

S2

ETSTAT

"EIP"

"ALL"

DT0

S1

S2

D

(Note 1): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.
(Note 2): By copying and pasting the following text in the instruction list box of FPWIN GR7, the operand part of the above program can be input.
ETSTAT "EIP" "ALL" DT0

 List of operands
Operand Description

S1

Starting address of the device area that stores the string data that indicates a read type, or a character constant.

S2

Starting address of the device area that stores the string data that indicates a target to be read, or a character constant.

D

Specify the starting address of the device area that stores the read information.

 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 " "











 Process details
· Reads the parameter information or status information specified by [S1] and [S2], and stores it in the area starting with [D].
· The number of words in the storage area starting with [D] varies according to the type of read data and the target.
 Precautions during programming
· Insert the UNITSEL instruction immediately before this instruction and specify the unit (built-in ET-LAN in the CPU unit) and the connection number.
· For [S1] and [S2], specify the starting address of the device storing the string data which indicates the set parameters or a character constant. When specifying a device area 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 characters can be used. "Abcd", "ABCD" and "abcd" are all synonymous.
· This instruction is not available in interrupt programs.

17-116

ETSTAT (Acquiring EtherNet/IP Information)

 Setting of [S1] and [S2]

Setting item Settings

S1

Read type

For specifying the read of the EtherNet/IP communication state

For specifying the communication state of EtherNet/IP

For specifying the cyclic communication registration node table

For specifying the cyclic communication normal node table

S2

Read target

For specifying the cyclic communication stop node

table

For specifying the cyclic communication abnormal node table

For specifying the RUN/IDLE bit monitor (PLC standby flag)
(Note): The RUN/IDLE bit monitor is available for the CPU unit Ver.4.11 or later.

Specify "EIP". Specify "ALL" or "ALL + Number". Specify "NODE". Specify "NORMAL". Specify "STOP". Specify "ERR". Specify "PLC".

 Setting of [S2] and targets to be read
· The read contents vary according to the character string set in [S2].

· The number of read words varies according to the maximum registered node number.

Name

Number of words
(Note 1)

Registered maximum node number
Cyclic Communication Registered node table (Note 3)
Cyclic Communication Normal node table (Note 3)
Cyclic Communication Stop node table (Note 3)
Cyclic Communication Abnormal node table (Note 3)
RUN/IDLE bit monitor (PLC standby flag) (Note 3)

1 0 to 16 0 to 16 0 to 16 0 to 16 0 to 16

Character string set in [S2] and read object (: Read, Blank: Not read)

ALL +

ALL

Number (1 to 16)

NODE

NORMAL STOP

(Note 2)

ERR

PLC























  







Number of read words (Note 1)

1 to 81

1 to 81

1 to 17

1 to 17

(Note 1): The number of read words varies according to the registered maximum node number.

Maximum node number

Number of valid words

1 to 17

1 to 17

1 to 17

0

0

1 to 16

1

17 to 32

2

33 to 48

3

49 to 64

4

:

:

225 to 239

15

241 to 256

16

(Note 2): When specifying "ALL + Number (1 to 16)" for [S2], the information for the number of effective words that is specified by the "Number" is read.

17-117

High-level Instructions (Ethernet Communication)

(Note 3): The bits in the following table are allocated to the node table numbers and RUN/IDLE bit monitor.

Bit No.

15 14 13 12 11 10 9

8

7

6

5

4

3

2

1

0

16 15 14 13 12 11 10 9

8

7

6

5

4

3

2

1

32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 Node No.
:

256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241

 Example of processing
Example 1) When specifying the reading of EtherNet/IP communication state

[S1]... "EIP" [S2]... "ALL" [D]...DT20

DT20 DT21 DT22 DT23 DT24 DT25

Value U15 0111 1111 1111 1111 0111 1000 1011 1111 0000 0111 1010 0000 0000 0000 0100 0000 0000 0000 0000 1111

Maximum registration node number Cyclic communication registration node table (Node nos. 1 to 16) Cyclic communication normal node table (Node nos. 1 to 16) Cyclic communication stop node table (Node nos. 1 to 16) Cyclic communication abnormal node table (Node nos. 1 to 16) RUN/IDLE bit monitor (PLC standby flag) (Node nos. 1 to 16)

Example 2) When specifying the reading of EtherNet/IP communication state
When the maximum registered node number is "0", only the value of [D] is updated and the values after [D+1] are not updated.

[S1]... "EIP" [S2]... "ALL" [D]...DT20

DT20

Value 0

Maximum registration node number

Example 3) When specifying the reading of cyclic communication registration node table When setting "ALL+2" for [S2], the information for 32 (=2x16) nodes (node numbers 1 to 32) is read.

[S1]... "EIP" [S2]... "ALL+2" [D]...DT20

DT20 DT21 DT22 DT23 DT24 DT25 DT26 DT27 DT28 DT29 DT30

Value 15 1st word 2nd word 1st word 2nd word 1st word 2nd word 1st word 2nd word 1st word 2nd word

Maximum registration node number Cyclic communication registration node table (Node nos. 1 to 16) Cyclic communication registration node table (Node nos. 17 to 32) Cyclic communication normal node table (Node nos. 1 to 16) Cyclic communication normal node table (Node nos. 17 to 32) Cyclic communication stop node table (Node nos. 1 to 16) Cyclic communication stop node table (Node nos. 17 to 32) Cyclic communication abnormal node table (Node nos. 1 to 16) Cyclic communication abnormal node table (Node nos. 17 to 32) RUN/IDLE bit monitor (PLC standby flag) (Node nos. 1 to 16) RUN/IDLE bit monitor (PLC standby flag) (Node nos. 1 to 32)

17-118

ETSTAT (Acquiring EtherNet/IP Information)

Example 4) When fixing the number of valid words (The communication states of node numbers 1 to 16 are displayed.)
[S1]... "EIP" [S2]... "ALL+1" [D]...DT20

When setting "ALL+1" for [S2], the information for only one word (node numbers 1 to 16) is read regardless of the maximum registered node number.

DT20 DT21 DT22 DT23 DT24 DT25

Value 100 1st word 1st word 1st word 1st word 1st word

Maximum registration node number Cyclic communication registration node table (Node nos. 1 to 16) Cyclic communication normal node table (Node nos. 1 to 16) Cyclic communication stop node table (Node nos. 1 to 16) Cyclic communication abnormal node table (Node nos. 1 to 16) RUN/IDLE bit monitor (PLC standby flag) (Node nos. 1 to 16)

Example 5) When specifying the reading of cyclic communication registration node table

[S1]... "EIP" [S2]... "NODE" [D]...WX100

WX100 WX101 WX102 WX103

Value 40 1111 1111 1111 1111 1111 1111 1111 1111 0000 0000 1111 1111

Maximum registration node number Cyclic communication registration node table (Node nos. 1 to 16) Cyclic communication registration node table (Node nos. 17 to 32) Cyclic communication registration node table (Node nos. 33 to 48)

Example 6) When specifying the reading of cyclic communication normal node table

[S1]... "EIP" [S2]... "NORMAL" [D]...WY100

WY100 WY101

Value 7 0000 0000 0111 1111

Maximum registration node number Cyclic communication normal node table (Node nos. 1 to 16)

Example 7) When specifying the reading of cyclic communication stop node table [S1]... "EIP" [S2]... "STOP" [D]...WR100

WR100 WR101

Value 8 0000 0000 1111 1111

Maximum registration node number Cyclic communication stop node table (Node nos. 1 to 16)

Example 8) When specifying the reading of cyclic communication abnormal node table

[S1]... "EIP" [S2]... "ERR" [D]...WR100

WR100 WR101

Value 5 0000 0000 0000 1000

Maximum registration node number Cyclic communication abnormal node table (Node nos. 1 to 16)

Example 9) When specifying the reading of RUN/IDLE bit monitor (PLC standby flag)

[S1]... "EIP" [S2]... "PLC" [D]...WR2000

WR2000 WR2001 WR2002 WR2003 WR2004

Value 50 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 0000 0000 0000 0011

Maximum registration node number RUN/IDLE bit monitor (Node nos. 1 to 16) RUN/IDLE bit monitor (Node nos. 17 to 32) RUN/IDLE bit monitor (Node nos. 33 to 48) RUN/IDLE bit monitor (Node nos. 49 to 64)

17-119

High-level Instructions (Ethernet Communication)

 Flag operations

Name

Description

To be set when the read area is out of the range.

To be set when the read type [S1] is set to an item other than "IPv4", "IPv6", "FTPc", "HTTPc", "SMTPc" or "EIP".

SR7 SR8 (ER)

To be set when the target to be read [S2] is set to an item other than "MAC", "CONNECT", "IDx", "LOGx", "IDALL", "LOGALL", "ALL", "NODE", "NORMAL", "STOP", "ERR" or "PLC".
To be set when a combination other than the combinations listed in the restrictions on combination is specified for the type [S1] and target [S2] to be read.

To be set when the unit specified by UNITSEL is not the built-in ET-LAN.

To be set when executed in an interrupt program.

17-120

EIPNDST (EtherNet/IP Node Status Acquisition Instruction)

EIPNDST (EtherNet/IP Node Status Acquisition Instruction)

 Ladder diagram

R0

X6B

 DF 

UNITSEL

U100

U1

S1

S2

EIPNDST

U1

DT100

DT2000

S

D1

D2

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Device area that stores the node number (1 to 256) of the EtherNet/IP device whose status is acquired, or a constant.

D1

Device address for storing the acquired status

D2

Device address for storing the execution result of the instruction

 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 " "

  

 Process details
· The status of the node for the node number that is specified by [S] is stored in the device that is specified by [D1], and the execution result of the instruction is stored in [D2].
· The node status is acquired when the trigger (execution condition) turns ON.
 Precautions during programming
· Execute this instruction after X6B (EtherNet/IP preparation done) turns ON. If the instruction is executed before X6B turns ON, the EtherNet/IP communication preparation incomplete error is returned as an execution result in [D2].
· Multiple EIPNDST instructions cannot be executed simultaneously. A multiple execution error occurs. Be sure to execute this instruction after confirming the completion of the previous execution.
 Operand [S] setting
Specify node numbers in the range of 1 to 256.

17-121

High-level Instructions (Ethernet Communication)

 Operand [D1] setting
The results of read node statuses are set as follows.

Bits

Name

Definition

0

Owned

Turns ON when FP7 is a target and connected from an originator.

1

Reserved

It is always 0.

2

Configured

Turns ON when the settings of the EtherNet/IP device are different from the factory default settings.

3

Reserved

It is always 0.

4 to 7

Extended Device Status

Shows the detailed status of EtherNet/IP device. It is a vendor-specific status or a status according to CIP. (Note 1)

8

Minor Recoverable Fault

Stores the error information of the EtherNet/IP device. Error contents vary depending on

9

Minor Unrecoverable Fault vendors.

10

Major Recoverable Fault

Recoverable Fault: In a recoverable state

11

Major Unrecoverable Fault Unrecoverable Fault: In an unrecoverable state

12 to 15 Reserved

It is always 0.

(Note 1): For bits 4 to 7, the following field definition contents for "Extended Device Status" are stored. FP7 does not return the codes that are indicated as "Not supported" in the following table.

Bits 4 to 7 Name

FP7

0000

During self-testing operation or unknown

Not supported

0001

During the update of firmware

Not supported

0010

More than one I/O connection is in a fault state

Not supported

0011

No I/O connection has been established

0100

Setting error of non-volatile memory

Not supported

0101

Major Fault. The bit 10 or 11 is ON.

Not supported

0110

More than one I/O connection is established and there is more than one connection that receives RUN mode.

0111

More than one I/O connection is established and all received connections are in the Idle mode.

1000 to 1001 Reserved

Not supported

1010 to 1111 Peculiar to vendors or products.

Not supported

 Operand [D2] setting
Specify the area that stores the execution result. One of the following execution codes is stored.

Name

Value

Description

Normal end

0

The acquisition of a specified node status is complete.

In progress

1

The acquisition of a specified node is in progress.

Timeout

2

Communication timeout (10 seconds)

[D]

Multiple executions

3

Multiple execution of the EIPNDST instruction

Communication error

4

In the case of communication errors

CIP error

5

In the case of an CIP error

EtherNet/IP communication preparation incomplete

6

When the preparation of EtherNet/IP communication is incomplete

[D2+1] [D2+2]

CIP general status CIP extended status

1 to 255 0 to 65535

If the value of [D] is "5", CIP general status and CIP extended status are stored. If the value of [D] is not "5", "0" is stored in [D2+1] and [D2+2].

(Note): For details of CIP general status and CIP extended status, refer to the specifications of CIP.

17-122

EIPNDST (EtherNet/IP Node Status Acquisition Instruction)

 Usage example
Example 1) Acquires the node status of node number 1.

- EtherNet/IP configuration setting

The EtherNet/IP devices that the node status is acquired should be registered in the scan list.

Node 1 2

IP Address 192.168.1.6 192.168.1.7

Valid/Invalid flag Invalid Enabled

There is no problem even if the valid/invalid flag is invalid when acquiring the node status. Select valid or invalid to determine whether to perform the cyclic communication or not.

 Sample program
· The UNITSEL instruction is used to specify the connection number of the built-in ET-LAN in the CPU unit.

· The acquisition result of the node status is stored in DT100 and the execution result is in DT2000. When the operation is complete successfully, 0 is stored in DT2000, and the node status is stored in DT100 and subsequent DTs.

SR13 X6B
( DF )
SR14 R1
R1 DT2000

MV.US HFFFF DT2000

S1

S2

UNITSEL

U100 S1

U1 S2
R1 < SET >

EIPNDST

U1

DT100 DT2000

S

D1

D2

=, US

U0

Process when completed successfully
R1 < RST >

EIPNDST instruction Execution result code preset
Communication port settings S1: CPU with built-in
ET-LAN (U100) S2: Connection 1 (U1)
Node status acquisition S: Node number (U1) D1: Storage location (DT100) D2: Execution result code
(DT2000)
Execution result confirmation When DT2000 equals 0, completed successfully

The initial preset is required to acquire the execution result of the EIPNDST instruction.

 Flag operations

Name

Description

To be set when the unit specified by UNITSEL is not the built-in ET-LAN.

SR7 SR8 (ER)

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration. To be set in the case of out-of-range in indirect access (index modification). To be set when executed in an interrupt program. To be set when the node specified by [S] does not exist.

To be set when the 3-word device area that starts from the device that is specified by [D2] cannot be allocated.

17-123

High-level Instructions (Ethernet Communication)

EIPMSATT (EIP Message Send Destination Setting)
 Ladder diagram

R0

UNITSEL U100

U1

S1

S2

EIPMSATT DT10

S

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 Available operation units
No operation unit.

 List of operands

Operand Description

S

Specify the starting device number that stores the message communication targets.

 Available devices (: Available)

16-bit device

32-bit device

Operand

WX WY WR WL WS SD DT

LD

UM

WI

WO

TS CS

TE CE

IX

S

   

 

Integer K  H

Real number

String

Index

modifier SF DF " "



 Outline of operation
· This instruction specifies the Ethernet unit to be targeted by the UNITSEL instruction.

· It sets the destination data of EIPMSEND instruction in the send buffer.

· The EIPMSATT instruction is used in combination with the EIPMBODY and EIPMSEND instruction.

· When this instruction is called while message communication is being performed, no operation is performed.

 Process details
· Sets the destination data specified by [S] in the send buffer.

Destination data

S

1st byte of IP address

S+1 2nd byte of IP address

S+2 3rd byte of IP address

S+3 4th byte of IP address

S+4 Service code

S+5 Class ID (Note 1) (Note 2)

S+6 Instance ID (Note 1) (Note 2)

S+7 Attribute ID (Note 1) (Note 2)
(Note 1): The setting range is 0000 to FFFEH. Omitted if set to FFFFH. (Note 2): For corresponding service codes, class IDs, instance IDs, attribute IDs, refer to relevant manuals for each EtherNet/IP device.

17-124

EIPMSATT (EIP Message Send Destination Setting)

 Example of processing
Example 1) When executing the Get_Attribute_Single service for an EtherNet/IP device (IP address: 192.168.1.10) to read the product code of the Identity object.

[S]... DT10

DT9 DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18

Value
U192 U168 U1 U10 000EH 0001H 0001H 0003H

Setting item Destination IP address Service code Class ID Instance ID Attribute ID

Set value 192.168.1.10 000EH 0001H 0001H 0003H

Example 2) When executing the Continuous Data Read service for an EtherNet/IP device (IP address: 192.168.2.1) to continuously read the device data of the PLC object.

[S]... DT100

DT99 DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108

Value
U192 U168 U2 U1 004BH 0065H 0001H FFFFH (Note 1)

Setting item

Set value

Destination IP address

192.168.2.1

Service code

004BH

Class ID

0065H

Instance ID

0001H

Attribute ID

--- (Note 1)

FFFFH is specified when this is omitted.

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when the unit specified by UNITSEL is not an Ethernet unit. To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration. To be set in case of out-of-range in indirect access (index modification). To be set when the device address of [S+7] is outside the device range.

17-125

High-level Instructions (Ethernet Communication)

EIPMBODY (EIP Message Body Setting)
 Ladder diagram

R0

UNITSEL U100

U1

S1

S2

EIPMBODY DT10

S

Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 Available operation units
No operation unit.

 List of operands

Operand Description

S

Specify the starting device number that stores the message body.

 Available devices (: Available)

16-bit device

32-bit 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

modifier SF DF " "



 Outline of operation
· This instruction specifies the Ethernet unit to be targeted by the UNITSEL instruction. · It sets the message body data of EIPMSEND instruction in the send buffer. · The EIPMBODY instruction is used in combination with the EIPMSATT and EIPMSEND instruction. · When this instruction is called while message communication is being performed, no operation is performed.

17-126

EIPMBODY (EIP Message Body Setting)

 Process details

· Sets the send buffer in the message body data specified by [S]. The data created by the CIPMSET instruction can be used as the contents of the message body data.

Message body data

High byte

Low byte

1word

Message body size (0 to 502 bytes)

2word

Message body data

...

(Note): For details about the commands and responses, refer to relevant manuals for each EtherNet/IP device.

 Examples of the maximum service data size

---: Omitted

Service code

Size Segment Class ID Segment Instance ID Segment Attirubte ID Service data

1 1byte

0x00 -

-

-

-

-

-

Max. 502 (bytes)

2 1byte

0x01 0x20

1byte

-

-

-

-

Max. 500 (bytes)

3 1byte

0x02 0x0021

2byte

-

-

-

-

Max. 498 (bytes)

4 1byte

0x02 0x20

1byte

0x24

1byte

-

-

Max. 498 (bytes)

5 1byte

0x03 0x20

1byte

0x0025

2byte

-

-

Max. 496 (bytes)

6 1byte 7 1byte 8 1byte 9 1byte 10 1byte 11 1byte 12 1byte 13 1byte

0x03 0x04 0x03 0x04 0x04 0x05 0x04 0x05

0x0021 0x0021 0x20 0x20 0x20 0x20 0x0021 0x0021

2byte 2byte 1byte 1byte 1byte 1byte 2byte 2byte

0x24 0x0025 0x24 0x24 0x0025 0x0025 0x24 0x24

1byte 2byte 1byte 1byte 2byte 2byte 1byte 1byte

0x30 0x0031 0x30 0x0031 0x30 0x0031

1byte 2byte 1byte 2byte 1byte 2byte

Max. 496 (bytes) Max. 494 (bytes) Max. 496 (bytes) Max. 494 (bytes) Max. 494 (bytes) Max. 492 (bytes) Max. 494 (bytes) Max. 492 (bytes)

14 1byte

0x05 0x0021

2byte

0x0025

2byte

0x30

1byte

Max. 492 (bytes)

15 1byte

0x06 0x0021

2byte

0x0025

(Note): The maximum data size per connection is 504 bytes.

2byte

0x0031

2byte

Max. 490 (bytes)

 Flag operations

Name

Description

To be set when the unit specified by UNITSEL is not an Ethernet unit.

SR7 SR8 (ER)

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration. 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.

To be set when the end of the message body data specified by [S] exceeds the device limit.

17-127

High-level Instructions (Ethernet Communication)

EIPMSEND (EIP Message Send)
 Ladder diagram
R0 UNITSEL U100 S1
EIPMSEND DT1000 D1

U1 S2 DT2000 D2

Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction. Set a desired value for [S2].

 Available operation units
No operation unit.

 List of operands

Operand Description

D1

Specify the device address storing received data.

D2

Specify the device address for setting execution results of instructions.

 Available devices (: Available)

16-bit device

32-bit 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

modifier SF DF " "

 

 Outline of operation
· This instruction sends an EIP message when the execution condition turns ON.
· This instruction specifies the Ethernet unit to be targeted by the UNITSEL instruction.
· A UCMM message set by the EIPMSATT and EIPMBODY instructions is sent.
· The response is stored.
· Call this instruction after X6B (EIP preparation done) turns ON. If it is called before X6B turns ON, the EIP communication preparation incomplete error is returned.
· The instruction cannot be used in interrupt programs.
· Multiple EIPMSEND instructions cannot be executed simultaneously. A multiple execution error occurs. The next execution must be executed after confirming the completion of an instruction.

17-128

EIPMSEND (EIP Message Send)

 Process details
· A UCMM message is sent, received data is stored in [D1] and execution results are stored in [D2]. The destination and the content to be sent are set by the EIPMSATT and EIPMBODY instructions.
D1: Received data size (byte) D1+1: Received data

D1

Received data size (1 to 504 bytes)

D1+1

D1+2

Received data

D1+x
(Note): When a timeout, multiple execution, or communication error occurs, values are not stored in the received data size and received data.

D2: Execution results
Name Normal end In progress Timeout Multiple executions Communication error CIP error EIP communication preparation incomplete Send message size error

Value Description 0 Message communication is complete. 1 Message communication is being performed. 2 Communication timeout (10 seconds) 3 Multiple executions of EIPMSEND instruction 4 In the case of communication errors 5 In the case of CIP errors 6 When the preparation of EIP communication is incomplete. 7 When the send message size exceeds 504 bytes.

D2+1: CIP general status D2+2: CIP extended status

Value

Description

D2+1

1 to 255 CIP general status (Note 1)

D2+2

0 to 65535 CIP extended status (Note 1)

(Note 1): If the value of [D] is not "5", "0" is stored in [D2+1] and [D2+2].

17-129

High-level Instructions (Ethernet Communication)

 Example of processing
Example) Performing message communication using the connection 1 of the built-in ET-LAN in the CPU unit · During the configuration setting, it is necessary to set the built-in ET-LAN connection and the EIP scan list. · The slot number for the built-in ET-LAN needs to be specified to be "100".

1) First, using the UNITSEL instruction, specify "100" as the slop number for the built-in ET-LAN (S1 = U100), and user connection 1 (S2 = U1).

UNITSEL

U100

U1

S1

S2

2) Set the destination data using the EIPMSATT instruction.

EIPMSATT DT100 S
3) Create a value to be set in the message body data using the CIPMSET instruction.

CIPMSET DT200

U5

DT500

S1

S2

D

4) Set the message body data using the EIPMBODY instruction.

EIPMBODY DT500
S
5) Perform message communication using the EIPMSEND instruction. Received data is stored in [D1] and execution results are stored in [D2].

EIPMSEND DT1000 DT2000

D1

D2

Results when message communication is completed successfully

DT1000

U6 (number of bytes)

Received data size

DT1001

H00

H8E

Received data

DT1002

H00

H00

DT1003

H00

HE

DT2000

U0

Execution results

 Example of program

SR14 X6B  DF 
1st scan EIP OFF preparation
done flag

UNITSEL CIPMSET DT200

U100 U5

U1 DT500

EIPMSATT DT100

R1
EIPMSEND execution relay
R1 DT2000=0

EIPMBODY DT500 R1
 SET 
EIPMSEND DT1000 DT2000
Processing when transmission is completed successfully R1  RST 

17-130

EIPMSEND (EIP Message Send)

 Flag operations

Name

Description

To be set when the unit specified by UNITSEL is not an Ethernet unit.

SR7 SR8 (ER)

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration. To be set in case of out-of-range in indirect access (index modification). Set when executed in an interrupt program. To be set when 253-word device cannot be assured from the device address specified by [D1].

To be set when 3-word device cannot be assured from the device of D2.

17-131

High-level Instructions (Ethernet Communication)

CIPMSET [CIP Message Data Setting (Merging)]
 Ladder diagram

R0

CIPMSET DT0

H0002

DT100

S1

S2

D

 Available operation units
No operation unit.

 List of operands

Operand Description

S1

Specify the starting device of send data to be added.

S2

Specify the data format of added send data or the device storing it.

D

Specify the starting device of send data to be created.

 Available devices (: Available)

16-bit device

32-bit 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

modifier SF DF " "

  

 Outline of operation
· This instruction is used to create data to be sent in the message communication of CIP.
· If there already exists CIP message data in the storage destination, the data is added to the existing CIP message data.

17-132

CIPMSET [CIP Message Data Setting (Merging)]

 Process details
· The data specified to be added by [S1] is added (merged) to the CIP message specified by [D] according to the format specified by [S2].

S1: Specify the starting device of the data to be added. When writing character string data, create data using the SSET instruction. For character string data, specify data that contains character string length.

S2: Specify the format and size of the data to be added.

Specified range: 0 to 502 (000H to 1F6H)

Set value

Description

0

Character string

Specify when the data to be added is character strings. Add data equivalent to "Starting device value of S1 + 2".

1 to 502

Other than character string

Specify when the data to be added is other than character strings.
Add data equivalent to "set value".

D: Specify the starting device of send data to be created. The number of bytes of the currently stored data is set in the starting device. When creating a new message data, set "0" in the starting device and then call this instruction. If the starting device is not 0, it is recognized that message data already exists and the new data is added next to the position shifted from the starting data by the number of bytes of the exiting data. When writing is completed, the added data size length is added to the CIP data length.

CIP message send data format

Value

D

CIP data length

D+1 onward CIP data

Complex data consisting of short type, double type, and string data type

Example) [D]: DT100

Data write starting position

 When there is no data

DT100

Value 0000H

DT101 41H (A) 42H (B)

DT102 43H (C) 44H (D)

 When there is data

DT100 DT101 DT102

Value 0002H 41H (A) 43H (C)

42H (B) 44H (D)

 Precautions during programming
· Even if the add source (S1) range overlaps with the add destination (D) range, data is added without causing any error.

17-133

High-level Instructions (Ethernet Communication)

 Example of processing
Example 1) Creating a new CIP message (Data other than character string data is written in 2 bytes.)

[S1]... DT10 [S2]... H0002 [D]...DT100

S1: Data to be added

S1: Format of the data to be added

D: CIP message storage destination

Value

DT0 00H:

05H

DT1 42H (B) 41H (A)

DT2 44H (D) 43H (C)

DT3 00H:

45H (E)

Value

S2

0002H

Value

DT100 0000H

DT101 34H

12H

Data length

Operation result
S1: Data to be added

Value

DT0 00H:

05H

DT1 42H (B) 41H (A)

DT2 44H (D) 43H (C)

DT3 00H:

45H (E)

Move data equivalent to 2 bytes

D: CIP message storage destination

DT100 DT101

Value 0002H 0005H

Data length

Example 2) Creating a new CIP message (Writing character string data "while the data size is set to 0")

[S1]... DT0 [S2]... H0000 [D]...DT100

S1: Data to be added

S1: Format of the data to be added

D: CIP message storage destination

Value

DT0 00H:

05H

DT1 42H (B) 41H (A)

DT2 44H (D) 43H (C)

Value

Value

S2

0000H

DT100 0000H



DT101 34H

12H

Writing character string data DT102 78H

56H

Data length

DT3 00H:

45H (E)

DT103 12H

90H

DT104 56H

34H

Operation result
S1: Data to be added

Value

DT0 00H:

05H

DT1 42H (B) 41H (A)

DT2 44H (D) 43H (C)

DT3 00H:

45H (E)

Move data of string length + 2 bytes

D: CIP message storage destination

Value

DT100 0007H

DT101 0005H

DT102 'B'

'A'

DT103 'D'

'C'

DT104 56H

'E'

Data length String length

17-134

CIPMSET [CIP Message Data Setting (Merging)]

Example 3) Adding data to the existing CIP message (Data other than character string data is written in 4 bytes.)

[S1]... DT1 [S2]... H0004 [D]...DT100

S1: Data to be added

S1: Format of the data to be added

D: CIP message storage destination

Value

DT1 00H:

03H

DT2 32H (2) 31H (1)

DT3 00H:

33H (3)

Value

S2

0004H

DT100 DT101 DT102 DT103

Value 0003H 0001H 12H 'A' 56H 34H

Data length Written data

DT104 90H 78H

Operation result
S1: Data to be added

Value

DT1 00H:

03H

DT2 32H (2) 31H (1)

DT3 00H:

33H (3)

Move data equivalent to 4 bytes

D: CIP message storage destination

DT100 DT101 DT102 DT103 DT104

Value

0003H0007H

0001H

03H

'A'

31H

00H:

90H

32H

Data length

Example 4) Adding data to the existing CIP message (Writing character string data "while the data size is set to 0")

[S1]... DT1 [S2]... H0000 [D]...DT100

S1: Data to be added

S1: Format of the data to be added

D: CIP message storage destination

Value

Value

Value

DT1 00H:

03H

S2

0000H

DT100 0003H

Data length

DT2 32H (2) 31H (1)

DT3 00H:

33H (3)

 Writing character string data

DT101 DT102 DT103 DT104

0001H 12H 'A' 56H 34H 90H 78H

Written data

Operation result
S1: Data to be added

Value

DT1 00H:

03H

DT2 32H (2) 31H (1)

DT3 00H:

33H (3)

Move data of string length + 2 bytes

D: CIP message storage destination

DT100 DT101 DT102 DT103 DT104

Value 0003H 0001H 03H '1' '3'

'A' 00H: '2'

Data length String length

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration. 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. To be set when the data size after the addition exceeds 502.

17-135

High-level Instructions (Ethernet Communication)

CIPMGET (CIP Message Data Getting)
 Ladder diagram

R0

CIPMGET DT0

H4

DT100 DT1000

S1

S2

D1

D2

 Available operation units
No operation unit.

 List of operands

Operand Description

S1

Specify the starting device of received data (CIP data type).

S2

Specify the data format of acquired data or the device storing it.

D1

Specify the device storing the byte offset position from the beginning of the received data which specifies the acquisition position.

D2

Specify the starting device of the device storing acquired data.

 Available devices (: Available)

16-bit device

32-bit device

Operand

WX WY WR WL WS SD

DT

LD UM

WI

WO

TS CS

TE CE

IX

S1    

 

S2    

 

D1    

 

D2    

 

Integer K U H
 

Real number
SF DF

String Index

modifi

" "

er

   

 Outline of operation
· This instruction acquires string data and numerical data from the data received in the message communication of CIP.
· Data other than string data is read from lower bytes.

17-136

CIPMGET (CIP Message Data Getting)

 Process details
· Data is separated and transferred to the memory specified by [D2] according to the number of data specified by [S2] from the position shifted by the offset of [D1] from the CIP message receive data specified by [S1].
S1: Specify the starting device of CIP message receive data.

Example) S1 = DT0

CIP message send data format

Value

D

CIP data length

D+1

Service code

D+2

General Status

D+3 onward CIP data

CIP receive header Complex data consisting of short type, double type, and string data type

DT0

DT1

As CIP message data

DT2

Stores the following three DT3 data 

1

DT4

AB

1234H

DT5

DT6

Value 0011H CIP receive header 0001H

02H

31H (1)

41H (A) 34H

00H: 42H (B)

DT7 ffH

12H

Data length
1st data: '1'
(Note): The starting one word of the character string is for the character string length. 2nd data: 'AB' (Note): The starting one word of the character string data is for the character string length. 3rd data: 1234H

S2: Specify the data format and data size of the data to be acquired.

Specified range: 0 to 504 (000H to 1F8H)

Set value 0 1 to 504

Description
Character string
Other than character string

Specify when acquired data is character strings. Acquire data equivalent to "Starting device value of S1 + 2".
Specify when acquired data is other than character strings. Acquire data equivalent to "set value".

17-137

High-level Instructions (Ethernet Communication)

D1: Specify the device that stores the data acquisition starting position. Update the data equivalent to the number of data acquired after the instruction is completed. Starting data length size is not included in the starting position.

Example) When acquiring the second data

Data acquisition starting position

[S1]... DT0 [D1]... DT10

 Before the instruction is issued

Value

DT10

000BH

 After the instruction is issued

DT10

Value 000FH

CIP message receive data example Value

DT0

000DH

Total data length

DT1 CIP receive header
DT2

DT3

0001H

1st data

DT4

02H

31H (1)

DT5

41H (A) 00H:

2nd data: Acquisition data

DT6

34H

42H (B)

DT7

ffH

12H

3rd data

Offset position

Value

DT0

DT1

1

0

DT2

3

2

DT3

5

4

DT4

7

6

DT5

9

8

DT6

B

A

DT7

D

C

The data length is not included in the offset position. The CIP head is also extracted.

D2: Specify the storage destination device for the acquired data.
 Precautions during programming
· With this instruction, delimitation of the CIP message data cannot be checked. Therefore, operation continues without detecting an error even an illegal offset position is specified. Fully grasp the content of a received CIP message, and then set the offset position and data size.
· Even if the acquisition source (S1) range overlaps with the storage location (D2) range, data is acquired without causing any error.

17-138

CIPMGET (CIP Message Data Getting)

 Example of processing
Example 1) Acquiring data sequentially from the start of the CIP message.

CIP message receive data example Value

DT0

000DH

Total data length

DT1

00CBH

DT2

0000H

CIP receive header

DT3

0001H

1st data

DT4

02H

31H (1)

DT5

41H (A) 00H:

2nd data

DT6

34H

42H (B)

DT7

ffH

12H

3rd data

Acquire data from the start of CIP message data. Data is acquired to the following device.  DT1000
 DT2000
 DT3000
 DT4000

(1) Acquiring CIP receive header information from its start

[S1]... DT0 [S2]... H4 [D1]...DT100 [D2]...DT1000

S2: Acquired data format

D1: Offset position

Value S2 0004H

Value DT100 0000H

Operation result
S1: CIP message receive data

Value DT0 000DH DT1 00CBH

DT2 0000H

DT3 0001H

DT4 02H

31H (1)

DT5 41H (A) 00H:

DT6 34H

42H (B)

DT7 ffH

12H

Offset position after updating

Value

DT0

DT1

1

0

DT2

3

2

DT3

5

4

DT4

7

6

DT5

9

8

DT6

B

A

DT7

D

C

Acquiring data equivalent to 4 bytes
CIP receive data 1st data 2nd data 3rd data

D2: Acquired data storage destination

DT1000 DT1001

Value 0000H ffffH

D1: Offset position

DT100

Value 0000H0004H

D2: Acquired data

DT1000 DT1001

Value 00CBH 0000H

17-139

High-level Instructions (Ethernet Communication)

(2) Acquiring character string data from the offset position

[S1]... DT0 [S2]... H0 [D1]...DT100 [D2]...DT2000

S2: Acquired data format

D1: Offset position

Value

Value

S2 0000H

DT100 0004H (Note)


Acquisition of the character string data

D2: Acquired data storage destination

DT2000 DT2001

Value 0000H ffffH

(Note): The [D1] offset position is updated to the start position of the 1st data when the CIPMGET instruction is issued in the above step (1).

Operation result
S1: CIP message receive data

Value DT0 000DH

DT1 00CBH

DT2 0000H

DT3 0001H

DT4 02H

31H (1)

DT5 41H (A) 00H:

DT6 34H

42H (B)

DT7 ffH

12H

Offset position after updating

Value

DT0

DT1

1

0

DT2

3

2

DT3

5

4

DT4

7

6

DT5

9

8

DT6

B

A

DT7

D

C

Acquiring data equivalent to the character string length + 24 bytes
CIP receive data 1st data 2nd data 3rd data

D1: Offset position

DT100

Value 0004H0007H

D2: Acquired data

Value

DT2000 0001H

DT2001 ffH

'1'

17-140

CIPMGET (CIP Message Data Getting)

(3) Acquiring character string data from the offset position

[S1]... DT0 [S2]... H0 [D1]...DT100 [D2]...DT3000

S2: Acquired data format

D1: Offset position

Value

Value

S2 0000H

DT100 0007H (Note)


Acquisition of the character string data

D2: Acquired data storage destination

DT3000 DT3001

Value 0000H 0000H

(Note): The [D1] offset position is updated to the start position of the 2nd data when the CIPMGET instruction is issued in the above step (2).

Operation result
S1: CIP message receive data

Value DT0 000DH

DT1 00CBH

DT2 0000H

DT3 0001H

DT4 02H

31H (1)

DT5 41H (A) 00H:

DT6 34H

42H (B)

DT7 ffH

12H

Offset position after updating

Value

DT0

DT1

1

0

DT2

3

2

DT3

5

4

DT4

7

6

DT5

9

8

DT6

B

A

DT7

D

C

Acquiring data equivalent to the character string length + 24 bytes
CIP receive data 1st data 2nd data 3rd data

D1: Offset position

DT100

Value 0007H000BH

D2: Acquired data

Value

DT3000 0002H

DT3001 `B`

`A`

17-141

High-level Instructions (Ethernet Communication)

(4) Acquiring data other than character string data from the offset position

[S1]... DT0 [S2]... H2 [D1]...DT100 [D2]...DT4000

S2: Acquired data format

D1: Offset position

D2: Acquired data storage destination

Value S2 0002H

Value DT100 000BH (Note)

DT4000 DT4001

Value 0000H 0000H

(Note): The [D1] offset position is updated to the start position of the 3rd data when the CIPMGET instruction is issued in the above step (3).

Operation result
S1: CIP message receive data

Value DT0 000DH

DT1 00CBH

DT2 0000H

DT3 0001H

DT4 02H

31H (1) Acquiring data equivalent to 2 bytes

DT5 41H (A) 00H:

DT6 34H

42H (B)

DT7 ffH

12H

Offset position after updating

Value

DT0

DT1

1

0

DT2

3

2

DT3

5

4

DT4

7

6

DT5

9

8

DT6

B

A

DT7

D

C

CIP receive data 1st data 2nd data 3rd data

D1: Offset position

DT100

Value 000BH000DH

D2: Acquired data

DT4000 DT4001

Value 1234H 0000H

 Flag operations

Name

Description

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration.

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 parameters.
To be set when [D1] (offset position) exceeds the value of the 1st word (total number of data) of [S1] (CIP message) before processing.
To be set when [D1] (offset position) exceeds the value of the 1st word (total number of data) of [S1] (CIP message) after processing.

17-142

CIPMGET (CIP Message Data Getting)

 CIP status codes

Status code

Status name

0x00

Success

0x01

Communications Related Problem

0x02

Resource unavailable

0x03

Invalid parameter value

0x04

Path segment error

0x05

Path destination unknown

0x06 0x07 0x08
0x09 0x0A
0x0B
0x0C 0x0D 0x0E 0x0F 0x10 0x11
0x12
0x13 0x14 0x15 0x16
0x17
0x18 0x19
0x1A
0x1B
0x1C
0x1D
0x1E

Partial transfer Connection lost Service not supported
Invalid attribute value Attribute list error
Already in requested mode/state Object state conflict Object already exists Attribute not settable Privilege violation Device state conflict Reply data too large
Fragmentation of a primitive value Not enough data Attribute not supported Too much data Object instance does not exist Service fragmentation out of sequence No stored attribute data Store operation failure
Routing failure, request packet too large Routing failure, response packet too large Missing attribute list entry data Invalid attribute value list
Embedded service error

Description Execution of the service by the specified object was successful. A connection-related service was unsuccessful along the connection path.
The resources required for the object to perform the requested service were not available. To select the correct value for this condition, refer to Status Code 20 (hexadecimal number). The path segment identifier or segment syntax was not interpreted by the processing node. Path processing is stopped if an error occurs in the path segment. The path references an object class, instance, or structural element that is not identified or contained in the processing node. Path processing is stopped if a path destination unknown error occurs. Only part of the expected data was transferred. The messaging connection was interrupted. The requested service was not implemented. Or, it was not defined for this object class/instance. Invalid attribute data was detected. An attribute in the Get_Attribute_List or Set_Attribute_List response has a non-zero status. The object is already in the mode/state being requested by the service.
The object cannot perform the requested service in the current mode/state. The requested instance of the object to be created already exists. A request to modify a non-modifiable attribute was received. A permission/privilege verification was unsuccessful. The device cannot perform the requested service in the current mode/state. The data transmitted in the response buffer is larger than the allocated response buffer. The service specified an operation that is going to fragment a primitive data value, i.e. half a REAL data type. The service did not supply enough data to perform the specified operation. The attribute specified in the request is not supported The service supplied more data than was expected. The specified object does not exist in the device.
The fragmentation sequence for this service is not active for this data.
The attribute data of this object was not stored before the requested service. The attribute data of this object was not stored due to a detected error during the attempt. The service request packet was too large for transmission on a network in the path to the destination. The routing device was forced to stop the service. The service response packet was too large for transmission on a network in the path from the destination. The routing device was forced to stop the service. The service did not provide an attribute from the attribute list required by the service to perform the requested behavior. The service returns the list of attributes that contains status information about invalid attributes. An embedded service resulted in an error.

17-143

High-level Instructions (Ethernet Communication)

Status code 0x1F
0x20
0x21
0x22
0x23 0x24 0x25
0x26
0x27 0x28 0x29 0x2A
0x2B 0x2C 0x2D 0x2E
0x2F to 0xCF 0xD0 to 0xFF

Status name Vendor specific error
Invalid parameter
Write-once value or medium already written Invalid Reply Received
Buffer Overflow Message Format Error Key Failure in path
Path Size Invalid
Unexpected attribute in list Invalid Member ID Member not settable Group 2 only server general failure Unknown Modbus Error Attribute not gettable Instance Not Deletable Service Not Supported for Specified Path 1
Reserved for Object Class specific errors

Description
A vendor-specific error was detected. The additional code field of the error response specifies the detected error. This general error code must only be used if none of the error codes displayed in this table or in an object class definition accurately represents the detected error.
A parameter associated with the request was invalid. This code is used if a parameter does not comply with the requirements of this specification and/or the requirements defined in an application object specification.
An attempt was made to write to a write-once medium (for example, WORM drive, PROM) that has already been written. Or, an attempt was made to modify a value that cannot be modified once established.
An invalid response is received (for example, reply service code does not correspond to the request service code), or the response message is shorter than the minimum expected response size. This status code can be used for other purposes of invalid responses.
The message received is larger than the receiving buffer can handle. The entire message was discarded.
The format of the received message is not supported by the server.
The key segment that was included as the first segment in the path does not correspond to the target module. The object-specific status must specify which part of the key check was unsuccessful.
The size of the path sent with the service request is either not large enough to allow the request to be forwarded to an object, or too much routing data has been included.
The attribute cannot be set at this time.
The member ID specified in the request does not exist in the specified class/instance/attribute.
A request to modify a non-modifiable member was received.
This error code is reported by DeviceNet Group 2 only. It is used only as substitute for those with a code space of 4K or less, for the service not supported, for the attribute not supported, and for the attribute not settable.
A CIP to Modbus translator has received an undefined Modbus exception code.
A request to read a non-readable attribute was received.
The requested object instance cannot be deleted.
The object supports the service, but not for the designated application path (for example, attribute). Note: This cannot be used in cases where more specific general status codes are applied. Example:0x0E (attributes are not settable) or 0x29 (members are not settable).
Reserved by CIP for future extensions.
This range of error codes is to be used to indicate errors specific to the object class. Use of this range should only be performed when none of the error codes presented in this table accurately reflect the error that was encountered.

17-144

EIPSTART (Cyclic Communication Start Request)

EIPSTART (Cyclic Communication Start Request)

 Ladder diagram

R0

UNITSEL U100

U1

S1

S2

EIPSTART DT100

U1

DT2000

S

n

D

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Specify the starting address of the device area that stores the start request node number table.

n

Specify the device address storing the maximum node number (1 to 256) or a constant.

D

Specify the device address storing execution 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

S1

   

 

S2

   

 

D

   

 

Integer K U H
 

Real number

String

Index

modification SF DF " "

  

 Process details
· The instruction requests the starting of the EtherNet/IP cyclic communication according to the start request node number table that is stored in the area that starts from [S].

· For [n], specify the maximum node number among the nodes to which the start of the EtherNet/IP cyclic communication is requested.

· The execution result is stored in [D].

 Operand [S] setting
· Specify the starting address of the device area that stores the start request node number table.

· Use a user program to create the start request node number table. Turn ON the bits (that is, set the bits to 1) that correspond to the node numbers to which the start request is made.

(Example) When [S] is set to WR100 and the start request is made to nodes number 1 and 2

Set bit 0 (R1000) and bit 1 (R1001) in WR100 to "1" and execute the EIPSTART instruction.

Bit No.

15 14 13 12 11 10 9

8

7

6

5

4

3

2

1

0

16 15 14 13 12 11 10 9

8

7

6

5

4

3

2

1

32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 Node No.
:

256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241

17-145

High-level Instructions (Ethernet Communication)

 Operand [n] setting
· Specify the device address storing the maximum node number or a constant.

· The number of valid words for the start request node number table varies (from 1 to 16 words) according to the maximum node number that is specified by [n].

Maximum node number 0 1 to 16 17 to 32 33 to 48 49 to 64 :
225 to 239 241 to 256

Number of valid words 0 1 2 3 4 : 15 16

 Operand [D] setting
Specify the device address storing execution results.

Code 0 1 2
3

State Normal end In progress Start failed
Multiple executions

Description The specified node start is complete. The specified node start processing is in progress. The specified node start failed.
Multiple execution of the EIPSTART instruction or the EIPSTOP instruction

 Relay operation
When the cyclic communication start request instruction is executed and the cyclic communication of the specified node starts normally, the cyclic communication normal node table for the node is turned ON and the cyclic communication stop node table for the node is turned OFF.
Example) Relay operation when the cyclic communication start request is made on a stopped node

(1)

EtherNet/IP start/stop controllable (X6B)

(2)

All nodes communicating normally relay (X6C)
Cyclic communication normal node table (*1)
Cyclic communication stop node table (*1)

(3)

(*1) The state can be checked by the ETSTAT instruction.

(1)

Cyclic Communication Start Request (EIPSTART)

(2)

Instruction reception impossible period

(3) The specified node start is complete.

 Flag operations

Name

Description

To be set when the unit specified by UNITSEL is not the built-in ET-LAN.

SR7 SR8 (ER)

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration. To be set when executed in an interrupt program. To be set when the value of [n] exceeds 256. To be set when the address that is specified by [S] + [Number of valid words for [n]] is out of the device range.

To be set in the case of out-of-range in indirect access (index modification).

17-146

EIPSTOP (Cyclic Communication Stop Request)

EIPSTOP (Cyclic Communication Stop Request)

 Ladder diagram

R0

UNITSEL U100

U1

S1

S2

EIPSTOP DT100

U1

DT2000

S

n

D

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S

Specify the starting address of the device area that stores the stop request node number table.

n

Specify the device address storing the maximum node number (1 to 256) or a constant.

D

Specify the device address storing execution 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

S1

   

 

S2

   

 

D

   

 

Integer K U H
 

Real number

String

Index

modification

SF DF " "

  

 Process details
· The instruction requests the stopping of the EtherNet/IP cyclic communication according to the stop request node number table that is stored in the area that starts from [S].

· For [n], specify the maximum node number among the nodes to which the stop of the EtherNet/IP cyclic communication is requested.

· The execution result is stored in [D].

 Operand [S] setting
· Specify the starting address of the device area that stores the stop request node number table.

· Use a user program to create the stop request node number table. Turn ON the bits (that is, set the bits to 1) that correspond to the node numbers to which the stop request is made.
(Example) When [S] is set to WR100 and the stop request is made to nodes number 1 and 2

Set bit 0 (R1000) and bit 1 (R1001) in WR100 to "1" and execute the EIPSTOP instruction.

Bit No.

15 14 13 12 11 10 9

8

7

6

5

4

3

2

1

0

16 15 14 13 12 11 10 9

8

7

6

5

4

3

2

1

Node No.

32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 :
256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241

17-147

High-level Instructions (Ethernet Communication)

 Operand [n] setting
· Specify the device address storing the maximum node number or a constant.

· The number of valid words for the stop request node number table varies (from 1 to 16 words) according to the maximum node number that is specified by [n].

Maximum node number 0 1 to 16 17 to 32 33 to 48 49 to 64 :
225 to 239 241 to 256

Number of valid words 0 1 2 3 4 : 15 16

 Operand [D] setting
Specify the device address storing execution results.

Code 0 1 2
3

State Normal end In progress Start failed
Multiple executions

Description The specified node stop is complete The specified node stop processing is in progress. The specified node stop failed.
Multiple execution of the EIPSTART instruction or the EIPSTOP instruction

 Relay operation
When the cyclic communication stop request instruction is executed and the cyclic communication of the specified node stops normally, the cyclic communication stop node table for the node is turned ON and the cyclic communication normal node table for the node is turned OFF.
Example) Relay operation when the cyclic communication stop request is made on a started node

(1)

EtherNet/IP start/stop controllable (X6B)
All nodes communicating normally relay (X6C)

(2)

Cyclic communication normal node table (*1)

Cyclic communication stop node table (*1)

(3)

(*1) The state can be checked by the ETSTAT instruction.

(1)

Cyclic Communication Stop Request (EIPSTOP)

(2)

Instruction reception impossible period

(3) The specified node stop is complete

 Flag operations

Name

Description

To be set when the unit specified by UNITSEL is not the built-in ET-LAN.

SR7 SR8 (ER)

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration. To be set when executed in an interrupt program. To be set when the value of [n] exceeds 256. To be set when the address that is specified by [S] + [Number of valid words for [n]] is out of the device range.

To be set in the case of out-of-range in indirect access (index modification).

17-148

EIP_IN (EtherNet/IP Input Refresh)

EIP_IN (EtherNet/IP Input Refresh)

 Ladder diagram

R0

X6B

UNITSEL

U100

U1

S1

S2

EIP_IN

U1

U1

DT2000

S1

S2

D

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S1

Specify the target node number of the input refresh.

S2

Specify the target connection number of the input refresh.

D

Specify the device address storing refresh 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

S1

   

 

S2

   

 

D

   

 

Integer
K U H    

Real number

String

Index

modification

SF DF " "











 Process details
· Only when the connection that is to be refreshed receives new data, this instruction refreshes data for the connection. "Input refresh" means that the data is copied from the receive buffers to the allocated devices.
 Precautions during programming
· Execute this instruction after the EtherNet/IP preparation done flag (X6B) turns ON. If the instruction is executed before the flag turns ON, the EtherNet/IP communication preparation incomplete error occurs.
· This instruction causes a processing load. Do not execute the instruction successively in one scan.
· Before executing this instruction, use the cyclic communication normal node table to confirm that the communication of the specified connection is performed normally. The cyclic communication normal node table can be checked by using the "ETSTAT (Acquiring EtherNet/IP Information)" instruction.
· Use this instruction only for the connections in which the refresh method of the "EtherNet/IP setting" is set to "Instruction" by the tool software. An operation error occurs if the batch refresh method or the division refresh method is specified.

17-149

High-level Instructions (Ethernet Communication)

 Operand [S1] setting
Specify a node number to be refreshed. An error occurs when a value over the maximum value specified by the scan list is specified. An error also occurs when a reserved node is specified.

Scan List

Setting value 1 to 256

 Operand [S2] setting
Specify a connection number to be refreshed. Specify a relative number within nodes for the connection number. An error occurs when a value over the maximum value specified by the scan list is specified.
Setting value
Connection number 1 to 256

 Operand [D] setting
· Specify the device address storing refresh results.

· When there is no new received data, the refresh operation is not performed.

Execution result 0 1 2

Description Refresh operation is complete successfully. No data is received. Refresh is not performed. EtherNet/IP communication preparation incomplete

17-150

EIP_IN (EtherNet/IP Input Refresh)

 Usage example
Example 1) Refreshing data from the receive buffer of connection number 1 of node number 1 (when the refresh is completed normally)

[S1]... "U1" [S2]... "U1" [D]...DT20

- EtherNet/IP configuration setting

Setting item Node number Connection
Input information (T>0) device allocation

Settings 1 1 LD20 to LD23 LD51 to LD52

Receive Buffer

Value

Value

Value

*

0

0011h

LD19

DT20

0

*

1

2233h

LD20

0011h

*

2

4455h

LD21

2233h

*

3

6677h

LD22

4455h

4

LD23

6677h

5

LD24

6

*

7

EEFFh

LD50

*

8

FFEEh

LD51

EEFFh

9

LD52

FFEEh

LD53
*: Receive buffers to which devices are allocated
Example 2) Refreshing data from the receive buffer of the connection 2 of the node number 5 (when there is no new data)

[S1]... "U5" [S2]... "U2" [D]...DT100

- EtherNet/IP configuration setting

Setting item Node number Connection
Input information (T>0) device allocation

Settings 5 2 LD111 to LD112 LD115 to LD116 LD118 to LD119

Receive Buffer

Value

*

0

CCDDh

*

1

EEFFh

2

3

*

4

3344h

*

5

5566h

6

*

7

99AAh

*

8

BBCCh

9

*: Receive buffers to which devices are allocated

LD110

x

LD111

x

LD112

LD113

LD114

x

LD115

x

LD116

LD117

x

LD118

x

LD119

LD120

Value
CCDDh EEFFh
3344h 5566h 99AAh BBCCh

DT100

Value 1

17-151

High-level Instructions (Ethernet Communication)

Example 3) Refreshing data by the periodic interrupt processing when the scan time is long and RPI is short (when every received data is acquired)

Scan time: 10 ms,

RPI (transmission interval for the EtherNet/IP cyclic communication): 500 µs

· When the scan time is longer than the setting time of RPI, the refresh cannot be executed during the processing. In this case, describe the EIP_IN instruction in a fixed cycle execution type PB and use interrupt processing to execute the refresh.

· If the interrupt cycle is set to the same value as that of RPI, the refresh instruction may be executed while the receive buffer is being written, and the operation may fail. Perform the processing after checking the refresh result.

EtherNet/IP configuration setting

Setting item

Settings

Node number

1

Connection

1

Input information (T>0) device allocation

LD0 to LD1

Every scan execution type program Block

X6B

EI

( ED )

(a) Processing that takes 10 ms or more

Fixed cycle execution type (0.1 ms) program Block
0.5-ms cyclic program

SR10 DT20.0

EIP_IN U1

U1 DT20



(b) Only when refresh is completed successfully, data can be adopted (LD0 and LD1 in this case).

 Flag operations

Name

Description

To be set when the unit specified by UNITSEL is not the built-in ET-LAN.

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration.

To be set in the 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 node that is specified by [S1] or the connection that is specified by [S2] does not exist.
Use this instruction only for the connections in which the refresh method of the EtherNet/IP setting is set to Instruction. An operation error occurs when the connection that other refresh method other than that has been specified is specified.

To be set when the connection for which the number of input data is 0 is specified.

To be set when the connection for which the number of refreshed data is 0 is specified.

17-152

EIP_OT (EtherNet/IP Output Refresh)

EIP_OT (EtherNet/IP Output Refresh)

 Ladder diagram

R0

X6B

UNITSEL

U100

U1

S1

S2

EIP_OT

U1

U1

DT2000

S1

S2

D

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection number 1) are specified by the UNITSEL instruction.

 List of operands
Operand Description

S1

Specify a target node number of output fresh.

S2

Specify a target connection number of output refresh.

D

Specify the device address storing refresh 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

S1

   

 

S2

   

 

D

   

 

Integer
K U H    

Real number

String

Index

modification SF DF " "

  

 Process details
· This instruction executes the output refresh for connections to be refreshed. "Output refresh" means that the data is copied from the allocated devices to the send buffers.
 Precautions during programming
· Execute this instruction after the EtherNet/IP preparation done flag (X6B) turns ON. If the instruction is executed before the flag turns ON, the EtherNet/IP communication preparation incomplete error occurs.
· This instruction causes a processing load. Do not execute the instruction successively in one scan.
· Before executing this instruction, use the cyclic communication normal node table to confirm that the communication of the specified connection is performed normally. The cyclic communication normal node table can be checked by using the "ETSTAT (Acquiring EtherNet/IP Information)" instruction.
· Use this instruction only for the connections in which the refresh method of the "EtherNet/IP setting" is set to "Instruction" by the tool software. An operation error occurs if the batch refresh method or the division refresh method is specified.

17-153

High-level Instructions (Ethernet Communication)

 Operand [S1] setting
· Specify the node number that data is set to the send buffer.
· The I/O map is used for sending data to a destination scanner device (PLC).

I/O map Scan List

Setting value 0 1 to 256

 Operand [S2] setting
Specify a connection number to be refreshed. Specify a relative number within nodes for the connection number.

I/O map number or connection number

Setting value 1 to 256

 Operand [D] setting
· Specify the device address storing refresh results.
· If this instruction is executed in a cycle faster than RPI, the output refresh may not be performed.

Execution result 0 1 2

Description
Refresh operation is complete successfully.
Refresh is not performed.
EtherNet/IP communication preparation incomplete

17-154

EIP_OT (EtherNet/IP Output Refresh)

 Usage example
Example 1) When performing the output refresh for the send buffer of the I/O map number 1 (Normal end)

[S1]... "U0" [S2]... "U1" [D]...DT10

- EtherNet/IP configuration setting

Setting item I/O map number
Device Allocation

Settings 1 LD10 to LD11 LD14 to LD16

Value

Send buffer Value

Value

LD10

2233h

0

DT10

0

LD11

4455h

1

2233h *

LD12

2

4455h *

LD13

3

LD14

AABBh

4

LD15

CCDDh

5

AABBh *

LD16

EEFFh

6

CCDDh *

LD17

7

EEFFh *

8
*: Send buffers to which devices are allocated
Example 2) When performing the output refresh for the send buffer of the connection number 5 of the node number 2 (Abnormal end)

[S1]... "U2" [S2]... "U5" [D]...DT100

- EtherNet/IP configuration setting

Setting item
Node number
Connection
Output Information (O>T) Device Allocation

Settings 2 5 LD101 to LD102
LD104 to LD107

LD100 LD101 LD102 LD103 LD104 LD105 LD106 LD107 LD108

Value
2233h 4455h
8899h AABBh CCDDh EEFFh

Send buffer Value

0

1

x

2

AABBh *

x

3

CCDDh *

4

x

5

AABBh *

x

6

CCDDh *

x

7

EEFFh *

x

8

1122h *

DT10

Value 1

*: Send buffers to which devices are allocated

17-155

High-level Instructions (Ethernet Communication)

 Flag operations

Name

Description

To be set when the unit specified by UNITSEL is not the built-in ET-LAN.

To be set when the EtherNet/IP function is set to Not Use in the Ethernet unit configuration.

To be set in the 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 I/O map, node, or connection that is specified by [S1] or [S2] does not exist.
Use this instruction only for the connections in which the refresh method of the EtherNet/IP setting is set to Instruction. An operation error occurs when the connection that other refresh method other than that has been specified is specified.

To be set when the connection for which the amount of output data is 0 is specified.

To be set when the connection for which the number of refreshed data is 0 is specified.

17-156

SEND (MC Protocol Master)

SEND (MC Protocol Master)

 Ladder diagram

R0

X90 Y90

 DF 

UNITSEL

U100

U1

S1

S2

SEND.US DT300

U2

H500

H64

DT0

i

S

n

D1

D2

D3

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection 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

Type and upper address of the destination device of the partner unit

D1

High byte Device type (Hexadecimal 2-digit)

Low byte Upper address of the device (Hexadecimal 2-digit)

D2 Lower address of the device for the partner unit. (Hexadecimal 4-digit)

D3

Starting address of the device area of the master unit that stores the execution result code (1 word)

Setting range 1 to 960 words 1 to 7168 bits
H0 to H8 H00 to HFF 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

Integer K U H

Real number

String

Index

modification

SF DF " "

S

   

 



n

   

 

 



D1

   

 

 



D2

   

 

  *1 *1



D3

   

 



*1) Only when "direct addressing" in the MC protocol mode is set, integers can be specified for a destination address.

 Available bit devices (: Available)

Operand

Bit device XYRL TCP

E SR IN OT

Specification of bit of word DT.n device LD.n

Index modifier

S

   







n

D1

D2

D3 (Note): Bit devices cannot be specified for the operands n, D1, D2, and D3.

17-157

High-level Instructions (Ethernet Communication)

 Outline of operation
· This instruction sends commands from the communication port of the unit to send/receive data to/from devices that support "MC protocol".
· 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.
· The communication mode can be selected in the configuration menu of the tool software FPWIN GR7.
· When the SEND instruction is executed, the data is read from the device that starts from [S] in the master unit and the data is stored in the address that starts from [D1] (upper address) + [D2] of the partner unit.
· The transfer method (register transfer/bit transfer) varies according to the device types that are specified by [S] and [D1].
· The execution result code is stored in the one-word area of the master unit that is specified by [D3].

 Specification of [S], [n], [D1], and [D2]
· The transfer method and the amount of sent data [n] vary according to the type of the device on FP7 that is specified by the operand [S].

Type of FP7 device specified for [S] Transfer method

16-bit devices WX, WY, WR, WL, DT, LD

Register transfer

Number of sent data [n]
1 to 960

Remarks

1-bit devices X, Y, R, L, DT.n, LD.n

Bit transfer

1 to 7168

When the amount of sent data is odd, 4-bit dummy code H0 is added.

· The amount of sent data [n] is specified in words for the register transfer and in bits for the bit transfer.
· For the operand [D1], specify hexadecimal data that consists of the destination device code and the device address of a partner unit. Example) When the device code is 3 (internal relay) and the upper hexadecimal 2 digit of the device address is H00, specify H300.
· For the "high byte of [D1]" that is the device code of the partner unit, specify one of the following values.

Unit

Device type

High byte of [D1]

Input

X

Hexadecimal

H0

Output

Y

Hexadecimal

H1

Bits

Link relay

B

Hexadecimal

H2

Internal relay

M

Decimal

H3

Latch relay

L

Decimal

H4

Data register

D

Decimal

H5

R

Decimal

H6

Words File register

ZR

Hexadecimal

H7

Link register

W

Hexadecimal

H8

· For the partner unit device address, specify six-digit hexadecimal (three-byte) data that consists of the low byte of [D1] and the value of [D2]. When the device address is in the range of H0 to H00FFFF, specify "H00" for the low byte of [D1].

 Execution result code [D3]

Code Description

Code Description

H 0 Normal end

H 4 Transmission timeout

H 1

The communication port is being used in the master communication.

H 5 Response reception timeout

H 2

The communication port is being used in the slave communication.

H 6 Reception error (Note 1)

H 3

The number of master communication instructions simultaneously used is exceeded.

H 7 I/O allocation shortage error (Note 2)

(Note 1): It occurs when an abnormal telegram is received. When there is a format error in the header of an individual protocol, the communication discards the received data and a response reception timeout occurs.

17-158

SEND (MC Protocol Master)

(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.
(Note 3): For details of the execution result codes that may be set if a communication error occurs, refer to "17-160."
 Sample program
· An MC protocol command (bulk write) is sent from the LAN port of the CPU unit, and the contents of the data registers DT300 to DT301 of FP7 are written to the addresses D000100 to D000101 of an external device.
· After it is confirmed that connection 1 is established in master mode (X90) and no transmissions are currently being executed for the same port (Y90), the SEND instruction is started.
· The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1).
· The SEND instruction is executed with the address (DT300) and the number of data (U2) of FP7, the code (H50) that indicates the device type and the upper address of the partner unite, and the lower address (H64=100) of the partner unit.
· It is possible to check if a send error occurs by the sent flag (Y70) when the sending flag (Y90) turns OFF.

R0 R100

X90
( DF )
Master communication clear to send flag

Y90

R100

Master communication send active flag

SEND execution relay

UNITSEL U100 U1

S1

S2

SEND.US DT300 U2 H500

S

n

D1

Y90

Y70

( DF/ )
Send active flag

Send result flag ON in abnormal state/OFF in normal state

H64 DT0

D2

D3

R101
< SET >
Send result hold relay

SEND execution conditions Clear to send flag: ON Send active flag: OFF
Communication port settings S1: CPU LAN port (U100) S2: Connection 1 (U1)
SEND instruction execution S: Header for sent data (DT300) n: Amount of sent data (U2) D1: MC device type (H5)
MC upper address (H00) D2: MC lower address (H64) D3: Execution result code (DT0)

(Note): The above program example holds the send result hold relay (R101). Insert a program that resets the relay after the relay is checked.
 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
Master communication sent flag
(Y70 - Y7F)

Sending data

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
Sent flag (Y70 - Y7F): Normal completion: OFF Abnormal completion: ON

Response reception processing

17-159

High-level Instructions (Ethernet Communication)

 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 the 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. (Note 2): The above I/O numbers are those for the connections 1 to 16.

 Precautions during programming
· Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target connection number for communication.

· Confirm the "master communication clear to send flag" of a corresponding connection is ON, and execute the SEND/RECV instruction. The master communication clear to send flag will not turn ON until the connection to the partner is established. It is recommended to specify to enable the auto open function in the connection setting of ET-LAN. Also, the connections can be connected with OPEN instruction.

· The SEND or RECV instruction cannot be executed for the connection for which the master communication is in progress. Confirm that the "master communication sending flag" is OFF, and execute the instructions.

· The SEND or RECV instruction cannot be executed for the connection for which the slave communication is in progress. (such as performing a data request from a host computer).

· Up to 16 instructions can be executed simultaneously for different COM ports and connections. (The total of simultaneous usage of SEND, RECV, pGPSEND, GPTRNS, and pPMSET instructions.)

 Exit codes for communication errors
When a wrong command is sent or an error occurs in the CPU unit, a different exit code is returned. Exit codes for errors are as follows.

Code 4031 C051 C056
C059
C059 C05B C05C C05F C05F C05F C05F C060
C061
C061 **50 (Note)

Occurrence timing Address is too long (Starting device + Number of written points) The number of devices is out of the settable range. The starting device is out of the settable range. Command search: There is no command which matches the receive data command in the MC protocol command table. Subcommand is out of the settable range. Device code is out of the settable range. Subcommand is in bit unit (0001) and device code is word device. Receive header check: "Network number" check Receive header check: "PC number" check Receive header check: "Destination unit I/O number" check Error in the number of written data Error in written contact data (except 0/1) Receive header check: The number of received data is less than the minimum number of received bytes that is needed for the header check. The number of received data is less than the minimum number of received bytes. Receive header check: When a value other than 0x5000 is specified for the sub header, the value consisting of the first byte of the sub header plus 0x80 is inserted in the high byte "**" of the error code.

17-160

SEND (MC Protocol Master)

 Flag operations

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 slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN).

SR7 SR8 (ER)

When there is not a connection that is specified with the UNITSEL instruction, the connection is closed. To be set when the data device specified by S is incorrect or exceeds the area. The amount of sent data specified by n is incorrect.

The device code and the destination upper address specified by D1 is out of the range.

The destination lower address specified by D2 is out of the range.

The device in which results are stored specified by D3 is incorrect.

17-161

High-level Instructions (Ethernet Communication)

RECV (MC Protocol Master)

 Ladder diagram

R0

X90 Y90

 DF 

UNITSEL

U100

U1

S1

S2

RECV.US H500

H64

U2 DT300 DT10

i

S1

S2

n

D1

D2

(Note): The above figure shows the case that S1=U100 (built-in ET-LAN in the CPU unit) and S2=U1 (connection 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

Type and upper address of the source device of the partner unit

S1

High byte Device type (Hexadecimal 2-digit)

Low byte Upper address of the device (Hexadecimal 2-digit)

S2 Lower address of the device for the partner unit. (Hexadecimal 4-digit)

n

Number of received data

D1 Starting address of the device area in the master unit that stores the received data

D2

Starting address of the device area of the master unit that stores the execution result code (1 word)

Setting range
H0 to H8 H00 to HFF H0 to HFFFF (0 to 65535) 1 to 960 words 1 to 7168 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

Integer K U H

Real number

String

Index

modification

SF DF " "

S1

   

 

 



S2(*1)    

 

  *1 *1



n

   

 

 



D1

   

 



D2

   

 



*1) Only when "direct addressing" in the MC protocol mode is set, integers can be specified for a destination address.

 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

S1 S2

n

D1

   







D2 (Note): Bit devices cannot be specified for the operands S1, S2, n, and D2.

17-162

RECV (MC Protocol Master)

 Outline of operation
· This instruction sends commands from the communication port of the unit to send/receive data to/from devices that support "MC protocol".
· 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.

· The communication mode can be selected in the configuration menu of the tool software FPWIN GR7.

· When the RECV instruction is executed, the data is read from the address that starts from [S1] (upper address) + [S2] in the partner unit and the data is stored in the area that starts from [D1] in the master unit.

· The transfer method (register transfer/bit transfer) varies according to the device types that are specified by [S1], [S2], and [D1].

· The execution result code is stored in the one-word area of the master unit that is specified by [D2].

 Precautions during programming
· Use the UNITSEL instruction immediately before the SEND/RECV instruction to specify a target connection number for communication.
· Confirm the "master communication clear to send flag" of a corresponding connection is ON, and execute the SEND/RECV instruction. The master communication clear to send flag will not turn ON until the connection to the partner is established. It is recommended to specify to enable the auto open function in the connection setting of ET-LAN. Also, the connections can be connected with OPEN instruction.
· The SEND or RECV instruction cannot be executed for the connection for which the master communication is in progress. Confirm that the "master communication sending flag" is OFF, and execute the instructions.
· The SEND or RECV instruction cannot be executed for the connection for which the slave communication is in progress. (such as performing a data request from a host computer).
· Up to 16 instructions can be executed simultaneously for different COM ports and connections. (The total of simultaneous usage of SEND, RECV, pGPSEND, GPTRNS, and pPMSET instructions)

 Specification of [S1], [S2], [n], and [D1]
· For the operand [S1], specify hexadecimal data that consists of the source device code and the upper device address of the partner unit. Example: When the device code is 3 (internal relay) and the two-digit hexadecimal of the upper device address is H00, specify H300.
· Specify one of the following values as the "high byte of [S1]" that indicates the device code of the partner unit.

Unit

Device type

Input

X

Output

Y

Bits

Link relay

B

Internal relay

M

Latch relay

L

Data register

D

R Words File register
ZR

Link register

W

Hexadecimal Hexadecimal Hexadecimal
Decimal Decimal Decimal Decimal Hexadecimal Hexadecimal

High byte of [S1] H0 H1 H2 H3 H4 H5 H6 H7 H8

· For the device address of the partner unit, specify six-digit hexadecimal (three-byte) data that consists of the low byte of [S1] and the value of [S2]. When the device address is in the range of H0 to H00FFFF, specify "H00" for the low byte of [S1].
· The number of received data [n] is specified in words for the register transfer and in bits for the bit transfer.

17-163

High-level Instructions (Ethernet Communication)

· The transfer method and the number of received data [n] vary according to the device code on FP7 that is specified by the operand [D1].

Type of FP7 device specified for [D1]
16-bit devices WX, WY, WR, WL, DT, LD

Transfer method
Register transfer

Number of received data[n]
1 to 960

Remarks

1-bit devices X, Y, R, L, DT.n, LD.n

Bit transfer

1 to 7168

When the number of the received data is odd, a 4-bit dummy code H0 is added.

 Execution result code [D2]
Code Description
H 0 Normal end

Code Description H 4 Transmission timeout

H 1

The communication port is being used in the master communication.

H 5 Response reception timeout

H 2

The communication port is being used in the slave communication.

H 6 Reception error (Note 1)

H 3

The number of master communication instructions simultaneously used is exceeded.

H 7 I/O allocation shortage error (Note 2)

(Note 1): It occurs when an abnormal telegram is received. When there is 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.
(Note 3): For details of the execution result codes that may be set if a communication error occurs, refer to "17-165."

 Sample program
· An MC protocol command (bulk read) is sent from the LAN port of the CPU unit, and data in the addresses D000100 to D000101 of an external device is read and stored in the data registers DT300 to DT301 of FP7.

· After it is confirmed that connection 1 is established in master mode (X90) and no transmissions are currently being executed for the same port (Y90), the RECV instruction is started.

· The UNITSEL instruction is used to specify a slot number (LAN port: U100) and the connection number (U1).

· The RECV instruction is executed with the code (H500) that indicates the device type and the upper address of the partner unit, the lower address (H64=100), the number of data (U2), and the storage address (DT300) of FP7.

· It is possible to check if a send error occurs by the sent flag (Y70) when the sending flag (Y90) turns OFF.

R0 R100

X90
( DF )
Master communication clear to send flag

Y90

R100

Master communication send active flag
UNITSEL

RECV execution relay
U100 U1

S1

S2

RECV.US H500 H64 U2

S1

S2

n

Y90

Y70

( DF/ )

Send active flag

Send result flag ON in abnormal state/OFF in normal state

DT300 DT0

D1

D2

R101
< SET >
Send result hold relay

RECV execution conditions Clear to send flag: ON Send active flag: OFF
Communication port settings S1: CPU LAN port (U100) S2: Connection 1 (U1)
RECV instruction execution S1: MC device type (H5)
MC upper address (H00) S2: MC lower address (H64=100) n: Amount of received data (U2) D2: Data storage location (DT300) D3: Execution result code (DT0)

(Note): The above program example holds the send result hold relay (R101). Insert a program that resets the relay after the relay is checked.

17-164

RECV (MC Protocol Master)

 Time chart

Master communication

clear to send flag

(X90

-

X9F)

Check that the flag is ON

Master

communication sending flag

Check that the flag is OFF

(Y90 - Y9F)

Execute RECV
Master communication sent flag
(Y70 - Y7F)

Sending data

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
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 the 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. (Note 2): The above I/O numbers are those for the connections 1 to 16.

 Exit codes for communication errors
When a wrong command is sent or an error occurs in the CPU unit, a different exit code is returned. Exit codes for errors are as follows.

Code 4031 C051 C056
C059
C059 C05B C05C C05F C05F C05F C05F C060
C061
C061 **50 (Note)

Occurrence timing Address is too long (Starting device + Number of written points) The number of devices is out of the settable range. The starting device is out of the settable range. Command search: There is no command which matches the receive data command in the MC protocol command table. Subcommand is out of the settable range. Device code is out of the settable range. Subcommand is in bit unit (0001) and device code is word device. Receive header check: "Network number" check Receive header check: "PC number" check Receive header check: "Destination unit I/O number" check Error in the number of written data Error in written contact data (except 0/1) Receive header check: The number of received data is less than the minimum number of received bytes that is needed for the header check. The number of received data is less than the minimum number of received bytes. Receive header check: When a value other than 0x5000 is specified for the sub header, the value consisting of the first byte of the subheader plus 0x80 is inserted in the high byte "**" of the error code.

17-165

High-level Instructions (Ethernet Communication)

 Flag operations

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 slot number [S1] specified with UNITSEL is not 100 (built-in ET-LAN).

SR7 SR8 (ER)

When there is not a connection that is specified with the UNITSEL instruction, the connection is closed. The device code and the source upper address specified by S1 is out of the range. The source lower address specified by S2 is out of the range.

The amount of sent data specified by n is incorrect.

The data device in the receiver data area in master unit specified by D1 is incorrect or exceeds the area.

The device in which results are stored specified by D2 is incorrect.

17-166

18
18 High-level Instructions (SD Memory Card)
Applicable Models: All Models except CPS21

High-level Instructions (SD Memory Card)

CDTWT (Operation Memory File Write in BIN Format)

 Ladder diagram

R0

SR3A

 DF 

CDTWT.US

DT110

U5

U10

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 memory device for operation in which data to be written is stored

n

Number of data to be written. Range: 0 to 65535

D

File number (3 digits) that is added to the file name of the file to be created or overwritten. Range: 0 to 999

 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

   

 

Integer K U H   

Real number

String

Index

modification

SF DF " "

*1

 

D

   

 

  



*1: Only 16-bit devices can be modified. (Integer constants cannot be specified.)

 Outline of operation
· Binary data of [n] words is read from the area starting with [S], and the data is written on an SD memory card as a binary format file.

· The folder name is \data, and the file name is dtxxx.bin. The number specified by the operand [D] is used for "xxx" of the file name.

· When there is no specified folder, create a folder. When the file already exists, overwrite it.

18-2

CDTWT (Operation Memory File Write in BIN Format)

 Example of processing
· Five words from the device DT110 specified by [S] are read, and are written in the folder \data in an SD memory card as a binary format file (bin.).
· The file name is "dt010.bin". The file number 10 specified by [D] is added.

[i]...US [S] ...DT110 [n] ...5 [D] ...10

DT108 DT109 DT110 DT111 DT112 DT113 DT114 DT115 DT116 DT117 DT118

H 0108 H 0109
H 0110 H 0111 H 0112 H 0113 H 0114 H 0115
H 0116 H 0117 H 0118

File dt010.bin (16-bit binary format) 10011101120113011401

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· When the set file attribute is read only, any data cannot be written.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· Confirm that the SD memory card access instruction execution done flag (SR3B) is turned OFF, and turn OFF the execution condition.

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done)
SR3C (SD memory card access instruction execution result)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

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 [n].

To be set when an out-of-range value is specified for [D].

18-3

High-level Instructions (SD Memory Card)

CDTRD (Data Read from BIN Format File to Operation Memory)
 Ladder diagram

R0

SR3A

 DF 

CDTRD.US

U10

U5

DT110

i

S

n

D

 Available operation units (: Available)

Operation unit

bit

US

SS

UL

SL

SF

DF

i





 List of operands
Operand Description

S

File number (3 digits) of the file in an SD memory card in which the data to be read is stored. Range: 0 to 999

n

Number of data to be read. Range: 0 to 65535

D

Starting address of the device for operation in which data to be read 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

   

 

n

   

 

D

   

 

*1: Only 16-bit devices can be modified. (Integer constants cannot be specified.)

Integer
K U H      

Real number

String

Index

modification

SF DF " "

*1

  

 Outline of operation
· This instruction reads [n] pieces of data from the binary format file in the SD memory card, and stores it in the device of the address starting with [D].

· The folder name is \data, and the file name is dtxxx.bin. "xxx" of the file name is the file number, and specified by operand [S].

 Example of processing
· A binary format file is read from the folder \data in the SD memory card, and is stored in the device for operation starting with [D].

· The file name of the binary format file is "dt010.bin". The file number 10 specified by [D] is added.

[i]...US [S] ...10

[n] ...5 [D] ...DT110

DT108 DT109 DT110 DT111 DT112 DT113 DT114 DT115 DT116 DT117 DT118

H 0108 H 0109
H 0110 H 0111 H 0112 H 0113 H 0114 H 0115
H 0116 H 0117 H 0118

File dt010.bin (16-bit binary format) 25022602270228022902

DT108 DT109 DT110 DT111 DT112 DT113 DT114 DT115 DT116 DT117 DT118

H 0108 H 0109
H 0225 H 0226 H 0227 H 0228 H 0229 H 0115
H 0116 H 0117 H 0118

18-4

CDTRD (Data Read from BIN Format File to Operation Memory)

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· During the execution of the CDTRD instruction, data values read from the SD memory card are written from the beginning of a specified data device area in order. Therefore, do not read the data in the range of data device processed by the CDTRD instruction after the start of the reading process until the completion.

· When the number of data of the stored file is less than the specified number of data to be read, data is read up to the number of data of the file.

· An error occurs when there is no folder, or no file with a specified file number in the folder.

 Flag operations
Name SR3A (SD memory card access instruction active) SR3B (SD memory card access instruction execution done) SR3C (SD memory card access instruction execution result)
SR7, SR8 (ER)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1
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 [n].
To be set when an out-of-range value is specified for [S].

18-5

High-level Instructions (SD Memory Card)

CWT (File Data Write Instruction)
 Ladder diagram

R0

SR3A

 DF 

CWT

DT2

U5

"\abc\data1.csv"

DT100

S

n

D1

D2

 List of operands

Operand Description

S

Starting address of the device where data to be written is stored (data format: unsigned 16-bit integer)

n

Number of written data (data format: unsigned 16-bit integer)

D1

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of the file in which data is written and the number of characters of the path name (data format: character data)

D2

Starting address of the device area that stores parameters related to information such as saving format (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

   

 

 



D1

   

 





D2

   

 



*1: Only 16-bit devices can be modified. (Integer constants and character constants cannot be specified.)

 Outline of operation
· This instruction reads [n] pieces of data stored in the device address starting with [S], and writes them in the file specified by [D1] in an SD memory card according to the parameter specified by [D2].

 [n]: Specification of the number of data to be written

Saving format

Setting value of [D2]

Setting range of [n]

16-bit data

U1, U2, U7, U11

0 to 65535

32-bit data

U3, U4, U5, U8

0 to 32767

64-bit data

U6, U9

0 to 16383

ASCII

U10

(Note): When "0" is specified for [n], one of the following results occurs: 1: In the case of creating a new file, a 0-byte file is created. 2: In the case of overwriting a file, a 0-byte file is created. 3: In the case of adding data to a file, only the date of the file is changed.

0 to 1999

 [D1]: Specification of folder name and file name

Setting device

Description

D1

Specify the number of characters of the folder name and the file name to be written. (Specify the full path.)

D1+1 and more

Specify the folder name and the file name to be written. Specify the full path. Up to 256 characters including a folder name and file name.

(Note 1): In the tool software FPWIN GR7, a path name (a folder name and a file name) can be entered directly as a character constant. (Note 2): To specify a memory area such as a data register DT, use the SSET instruction to store a path name (a folder name and a file
name) as character data.

18-6

CWT (File Data Write Instruction)

 [D2] to [D2+6]: Specification of writing format

Operand Items

Description

Setting value of D2

Written contents

U0

-

-

U1

Unsigned 16-bit

integer

D2

Writing format

U2 DEC
U3
U4

Signed 16-bit integer
Unsigned 32-bit integer
Signed 32-bit integer

U5

Floating point real 32bit

U6

numbers

64bit

U7

1 word

U8

HEX

2 words

U9

4 words

U10 ASCII

Character string

U11 BIN

16bit

Fixed number of digits
-
5

Extension -

6

10

11

.CSV

(comma-separated

13

text)

23

4

8

16

-

-

.BIN (BIN data)

0: New file mode

Deletes the file contents, and then writes data. When no file exists, creates a new file.

D2+1

Writing mode (Note 1)

1: Add mode
2: Writing position specification mode 1

Writes additional data from the end of a file. When no file exists, creates a new file.
Writes data from the position after the number of bytes stored in [S2+3] and [S2+4] from the head of the file.

D2+2 D2+3 D2+4 D2+5 D2+6

Option (Note 2)
Writing position (file pointer) Number of bytes from the head or end of the file (Note 3)
Number of written data

3: Writing position specification Writes data from the position after the number of bytes

mode 2

stored in [S2+3] and [S2+4] from the end of the file.

-
- Available when a writing position specification mode is selected for [D2+1]. - The setting of the writing position (file pointer) indicates the position in bytes from the head of the stored file. - In the case of writing position specification mode 1, when completing writing to an SD memory card, the end position of the newly-saved data counting from the head of the file is stored in the areas [D2+3] and [D2+4]. - In the case of writing position specification mode 2, when completing writing to an SD memory card, the end position of the newly-saved data counting from the end of the file is stored in the areas [D2+3] and [D2+4].
Stores the number of data that can be written as a result of writing to a file. Example 1) When the number of data to be written is 40 and free space for 100 pieces of data is available in the file, "40" (the number of written data) is stored. Example 2) When the number of data to be written is 40 and free space for 30 pieces of data is available in the file, "30" (the number of written data) is stored. Example 3) When the number of characters to be written is 40 and free space for 100 characters is available in the file, "40" (the number of written data) is stored. Example 4) When the number of characters to be written is 40 and free space for 30 characters is available in the file, "30" (the number of written characters) is stored.

(Note 1): Refer to "[D2+1]: Specification of writing mode." (Note 2): Refer to "[D2+2]: Specification of options." (Note 3): Refer to "[D2+3] and [D2+4]: Specification of writing position."

18-7

High-level Instructions (SD Memory Card)

 [D2+1]: Specification of writing mode
Example 1) When specifying the addition of data to a file

File name: DATA1

<Saved data> +

Example 2) When specifying a writing position from the head of a file

File name: DATA1

<Saved data>

Specified writing position (Set value 1h is specified.)

Example 3) When specifying a writing position from the end of a file

File name: DATA1

<Saved data>

Specified writing position (Set value 2h is specified.)

The end of the original file

The saved data is written from the specified writing position, and the additional data is added from the end of the file.

 [D2+2]: Specification of options
Specified bit Description

bit 0 to 7

Line break

- When outputting a CSV file, set line breaks other than the end of the file. 0: Do not insert line breaks except at the end of the file. 1 to 255: Insert a line break at each of the specified number of comma-separated data pieces. When U10 (ASCII) or U11 (BIN) is specified for [D2] saving method, the line break setting is invalid.

- When outputting a CSV file, specify the data to be added to the end of the written data.

bit 8

Postfix

0: Insert a line break (0Dh+0Ah). 1: Insert a comma (2Ch).

However, a comma is not inserted at the end of a line that is broken.

- When outputting a CSV file, specify whether to perform zero suppression or not.

bit 9

Zero suppression

0: Do not perform zero suppression. 1: Perform zero suppression. (Delete unnecessary zeros, and output right-aligned data.)

bit 10 to 15

Reserved for system (Zero is set.)

18-8

CWT (File Data Write Instruction)

Example of option settings
· The following table shows how data is written depending on the value of bits 0 to 7 of [D2+2] for the writing format [D2] = 7 (HEX 16 bits), bit 9 of [D2+2] = 0 (Do not perform zero suppression), and written data "1 2 3 4 5".

[D2+2] bit 0 to 7
0

Written data 0001 ,

0002

1

0001 0Dh0Ah 0002

2

0001 ,

0002

3

0001 ,

0002

4

0001 ,

0002

5

0001 ,

0002

6

0001 ,

0002

, 0Dh0Ah 0Dh0Ah , , , ,

0003 0003 0003 0003 0003 0003 0003

, 0Dh0Ah , 0Dh0Ah , , ,

0004 0004 0004 0004 0004 0004 0004

,

0005

0Dh0Ah 0005

0Dh0Ah 0005

,

0005

0Dh0Ah 0005

,

0005

,

0005

(Postfix, specified data)
(Postfix, specified data)
(Postfix, specified data)
(Postfix, specified data)
(Postfix, specified data)
(Postfix, specified data)
(Postfix, specified data)

Example of conversion when zero suppression is ON or OFF

[D2] Specification of writing format

Number of digits

Zero suppression: ON

1

Unsigned 16-bit integer

5

0

2

Signed 16-bit integer

6

0

-1

3

Unsigned 32-bit integer

10

0

4

Signed 32-bit integer

11

0

-1

0

Floating point real 5 numbers
32bit

-1

13

1E-10

1.234567

-3.402823E+38

0

Floating point real 6 numbers
64bit

-1

23

1E-10

1.234567

1.797693134862315E+308

7 HEX 1 word

4

0

8 HEX 2 words

8

0

9 HEX 4 words

16

0

(Note): "" in the table represents a space (H20).

Zero suppression: OFF
00000
00000 -00001
0000000000
0000000000 -0000000001 000000000000 -000000000001 00000001E-10 00001.234567 -3.402823E+38 00000000000000000000000 -0000000000000000000001 000000000000000001E-10 000000000000001.234567 1.797693134862315E+308 0000 00000000 0000000000000000

18-9

High-level Instructions (SD Memory Card)

 [D2+3] and [D2+4]: Specification of writing position (file pointer)

16-bit integer bin. format

01 00 17 00 59 01 D7 11 D5 DD 01 00 17 00 59 01 FF FF

16-bit integer

1,

23 ,

345 ,

csv. format (20H) (20H) (20H) (20H) (31H) (2CH) (20H) (20H) (20H) (32H) (33H) (2CH) (20H) (20H) (33H) (34H) (35H) (2CH)

ASCII csv. format

" ABCDE "

,

"

abcd

"

,

"

12

(22H) (41H) (42H) (43H) (44H) (45H) (22H) (2CH) (22H) (61H) (62H) (63H) (64H) (22H) (2CH) (22H) (31H) (32H)

W(Firlietinpgoipnotesrit)ion0

1

2

3

4

5

6

7

8

9

A

BC

DE

F 10 11 12

· The writing position (file pointer) is specified in hexadecimal format in bytes.
· The file pointer setting is available only when the writing position specification mode1 or mode 2 is specified.
· After the writing process into the file, the position of the end of written data is stored at the writing position (file pointer). If the writing operation is performed again in this state, the next data will be written.
· In case of the writing position specification mode 1, data is written in the file from the writing position (file pointer) counted from the head of the file.
· In case of the writing position specification mode 2, data is written in the file from the writing position (file pointer) counted from the end of the file.
· In the new file mode, data is always written from the head of a file. The writing position (file pointer) after the writing process is not stored.
· In the add mode, data is always written from the end of a file. The writing position (file pointer) after the writing process is not stored.
· The writing position is specified by one byte.

18-10

CWT (File Data Write Instruction)

 Example of processing (csv format file)
Example 1)
· Five pieces (five words) of unsigned 16-bit integer data are read from the area starting with device DT2, and the data pieces are written in CSV format into the file "\abc\data1.csv" in the SD memory card in new file mode.
· An empty line is inserted in the data by zero suppression, and a comma (2Ch) is inserted at the end.

[S]...DT2

[n]...5

[D1]..."\abc\data1.csv"

[D2]...DT100

DT0

U1

DT1

U12

DT2

U123

...Head of device

DT3

U1234

to be read

DT4

U12345

DT5

U5

DT6

U56

DT7

U567

DT8

U5678

DT9

U56789

DT100 DT101 DT102 DT103 DT104 DT105 DT106

U1 H 0000 H 0300
H 00000000
U0

...Writing format ...Writing mode ...Option (*) ...Writing position
...Amount of writing data

Writing file "data1.csv" 123, 1234,12345, 5, 56, " " indicates a space (20h)

DT105 DT106

U5

...Amount of writing data

(*) Option

bit0-7(0): Line break settings - Do not insert line breaks except at the end of the file

bit8(1): Postfix

- Insert a comma (2Ch)

bit9(1): Zero suppression - ON

Example 2)
· Five pieces (10 words) of unsigned 32-bit integer data are read from the area starting with device DT4, and the data pieces are written in CSV format into the file "\abc\data1.csv" in the SD memory card in new file mode.
· An empty line is inserted in the data by zero suppression, and a comma (2Ch) is inserted at the end.

[S]...DT4

[n]...5

[D1]..."\abc\data1.csv"

[D2]...DT100

DT0 DT2 DT4 DT6 DT8 DT10 DT12 DT14 DT16 DT18

U1234 U12345
U123456 U1234567 U12345678 U123456789
U1234 U12345
U123456 U1234567

...Head of device to be read

Writing file "data1.csv"

DT100 DT101 DT102

U3 H 0000 H 0200

...Writing format ...Writing mode

123456,1234567,12345678,123456789, 1234 (0Dh)(0Ah)

DT103 DT104

H 00000000 ...Writing position

DT105 DT106

U0

...Amount of writing data

DT105 DT106

U5

...Amount of writing data

(*) Option

bit0-7(0): Line break settings - Do not insert line breaks except at the end of the file

bit8(0): Postfix

- Insert a line break (0Dh+0Ah)

bit9(1): Zero suppression - ON

18-11

High-level Instructions (SD Memory Card)

Example 3)
· Five pieces (five words) of unsigned 16-bit integer data are read from the area starting with device DT2, and the data pieces are written in CSV format into the file "\abc\data1.csv" in the SD memory card in new file mode.
· Insert line breaks (0Dh+0Ah) at the third data delimiter and the end of the file.

[S]...DT2

[n]...5

[D1]..."\abc\data1.csv"

[D2]...DT100

DT0

U1

DT1

U12

DT2

U123

...Head of device

DT3

U1234

to be read

DT4

U12345

DT5

U5

DT6

U56

DT7

U567

DT8

U5678

DT9

U56789

Writing file "data1.csv"

DT100 DT101 DT102 DT103 DT104

U1 H 0000 H 0003
H 00000000

...Writing format ...Writing mode ...Option (*)
...Writing position

00123,01234,12345 (0Dh)(0Ah) 00005,00056 (0Dh)(0Ah)

DT105 DT106

U0

...Amount of writing data

DT105 DT106

U5

...Amount of writing data

(*) Option

bit0-7(3): Line break settings - Insert a delimiter and a break before the third data

bit8(0): Postfix

- Insert a line break (0Dh+0Ah)

bit9(0): Zero suppression - OFF

18-12

CWT (File Data Write Instruction)

Example 4)
· Five pieces (five characters) of ASCII data in the area starting with device DT2 are read from low bytes in order, and the data pieces are written in CSV format into the file "\abc\data1.csv" in the SD memory card in new file mode.
· Insert a comma (2Ch) at the end of the file.

[S]...DT2

[n]...5

[D1]..."\abc\data1.csv"

[D2]...DT100

DT0 "8" "7"

DT1 "0" "9"

DT2 "b" "a" ...Head of device

DT3 "d" "c" to be read

DT4

"f" "e"

DT5 "h" "g"

DT6

"j" "i"

DT7

"l" "k"

DT8 "n" "m"

DT9

H 0000

DT100 DT101 DT102 DT103 DT104 DT105 DT106

U10 H 0000 H 0100

...Writing format ...Writing mode ...Option (*)

H 00000000 ...Writing position

U0

...Amount of writing data

Writing file "data1.csv" "abcde",

DT105 DT106

U5

...Amount of writing data

(*) Option

bit0-7(0): Line break settings - Invalid

bit8(1): Postfix

- Insert a comma (2Ch)

bit9(0): Zero suppression - Invalid

18-13

High-level Instructions (SD Memory Card)

Example 5)
· Six pieces (six characters) of ASCII data are read from the area starting with device DT2, and the data pieces are written in CSV format from the file pointer position of the existing file "\abc\data1.csv" in an SD memory card.
· Insert a comma (2Ch) at the end of the file.

[S]...DT2

[n]...6

[D1]..."\abc\data1.csv"

[D2]...DT100

DT0 DT1 DT2 DT3 DT4 DT5 DT6 DT7 DT8 DT9 Byte address

"8" "7" "0" "9" "b" "a" "d" "c" "f" "e" "h" "g" "j" "i" "l" "k" "n" "m"
H 0000
High Low

...Head of device to be read

DT100

U10 ...Writing format (*) Option

DT101 H 0002 ...Writing mode bit0-7(0): Line break settings - Invalid

DT102 H 0100 ...Option (*)

bit8(1): Postfix

- Insert a comma (2Ch)

DT103 DT104

H 00000007 ...Writing position

bit9(0): Zero suppression

- Invalid

DT105 DT106

U0

...Amount of writing data

Writing file "data1.csv"
"abcdefghijklmnopqrstuvwxyz",

Writing file "data1.csv"
"abcdef"abcdef",pqrstuvwxyz",

File pointer

File pointer

DT103 DT104 DT105 DT106

H 00000010 ...Writing position

U6

...Amount of writing data

18-14

CWT (File Data Write Instruction)

Example 6)
· 10000 pieces (10000 words) of signed 16-bit integer data are read from the area starting with device DT10000, and the data pieces are written in CSV format into "\FP7\DT.CSV" in the SD memory card in new file mode.
· An empty line is inserted in the data by zero suppression. Line breaks (0Dh+0Ah) are inserted as delimiters for the 10th data and the end of the data.

[S]...DT10000 [n]...10000 [D1]..."\FP7\DT.CSV" [D2]...DT50

DT10000 DT10001 DT10002



DT19997 DT19998 DT19999 DT20000

K10000 K10001 K10002
K19997 K19998 K19999
U0

...Head of device to be read

DT50

U2

...Writing format

DT51 H 0000 ...Writing mode

DT52 H 020A ...Option (*)

DT53 DT54

H 00000000

...Writing position

DT55 DT56

U0

(*) Option

bit0-7(0Ah): Line break settings Insert line break after 10th data

bit8(0): Postfix

Insert line break (0Dh+0Ah)

bit9(1): Zero suppression

On

Writing file "\FP7\DT.CSV"
10000,10001,10002,10003,10004,10005,10006,10007,10008,10009 0Dh0Ah
10010,10011,10012,10013,10014,10015,10016,10017,10018,10019 0Dh0Ah   
19990,19991,19992,19993,19994,19995,19996,19997,19998,19999 0Dh0Ah

"" indicates a space (20h)

DT55 DT56

U10000 ...Amount of writing data

18-15

High-level Instructions (SD Memory Card)

 Example of processing (bin format file)
Example 1)
· Five pieces (five words) of 16-bit data are read from the area starting with device DT2, and the data pieces are written in the BIN format into the file "\abc\data1.bin" in the SD memory card in new file mode.

[S]...DT2

[n]...5

[D1]..."\abc\data1.bin"

DT0

U1

DT1

U12

DT2

U123 ...Head of device

DT3

U1234

to be read

DT4

U12345

DT5

U5

DT6

U56

DT7

U567

DT8

U5678

DT9

U56789

[D2]...DT100

DT100

U11

...Writing format

DT101 H 0000 ...Writing mode

DT102 H 0000 ...Option (*)

DT103 DT104

H 00000000

...Writing position

DT105

DT106

U0

...Amount of writing data

Writing file "data1.bin" 7B00D204393005003800

DT105 DT106

U5

...Amount of writing data

(*) Option

Invalid for 16-bit BIN format

Example 2)
· Five pieces (five words) of 16-bit data are read from the area starting with device DT2, and the data pieces are written in the BIN format from the file pointer position of the existing file "\abc\data1.bin" in an SD memory card.

[S]...DT2

[n]...5

[D1]..."\abc\data1.bin"

DT0

U1

DT1

U12

DT2

U123 ...Head of device

DT3

U1234

to be read

DT4

U12345

DT5

U5

DT6

U56

DT7

U567

DT8

U5678

DT9

U56789

DT100

U11 ...Writing format

DT101 H 0002 ...Writing mode

DT102 H 0000 ...Option (*)

DT103 DT104

H 00000004 ...Writing position

DT105 DT106

U0

...Amount of writing data

[D2]...DT100

Writing file "data1.bin" 111122227B00D2043930050038008888

File pointer

DT103 DT104

H 0000000E ...Writing position

DT105 DT106

U5

...Amount of writing data

(*) Option Invalid for 16-bit BIN format

18-16

CWT (File Data Write Instruction)

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· In the case of the saving format 10 (ASCII string), character strings written from D2 are enclosed in double quotation marks and output.

· A double quotation mark (") in character strings is converted to two double quotation marks ("").

· When the set file attribute is read only, any data cannot be written.

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done)
SR3C (SD memory card access instruction execution result)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1
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 an out-of-range value is specified in the reserved area for system.

18-17

High-level Instructions (SD Memory Card)

CRD (File Data Read Instruction)

 Ladder diagram

R0

SR3A

 DF 

CRD

"\abc\data1.csv"

DT50

U5

DT102

S1

S2

n

D

 List of operands
Operand Description

S1

Path name (folder name + file name: 1 to 256 characters) of the file from which data is read and the number of characters or the starting address of the stored device (data format: character data)

S2

Starting address of the device that stores the parameters related to the data to be read (data format: unsigned 16-bit integer)

n

Number of read data (data format: unsigned 16-bit integer)

D

Starting address of the device where the data to be read is stored (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

   

 



n

   

 

 



D

   

 



*1: Only 16-bit devices can be modified. (Integer constants and character constants cannot be specified.)

 Outline of operation
· This instruction reads [n] pieces of data from the file in an SD memory card specified by [S1] according to the parameter specified by [S2], and stores it in the device starting with [D].

· A comma and a line break code (LF or CR+LF) are recognized as delimiters between data pieces.

· When odd bytes are read from ASCII data, only the low byte of the last word is stored.

· When odd bytes are read from a binary data, H00 is stored for the high byte of the last word.

 [S1] and [S1+1]: Specification of folder name and file name

Setting device

Description

S1

Specify the number of characters of the file name to be read. (Specify the full path.)

S1+1 to S1+128

Specify the file to be read. - Specify the full path. Up to 256 characters including the folder name and the file name.

(Note 1): In the tool software FPWIN GR7, a path name (a folder name and a file name) can be entered directly as a character constant. (Note 2): To specify a memory area such as a data register DT, use the SSET instruction to store a path name (a folder name and a file
name) as character data.

 [n]: Specification of the number of read data

Saving format

Setting value of [S2]

16-bit data

U1, U2, U7, U11

32-bit data

U3, U4, U5, U8

64-bit data

U6, U9

ASCII

U10, U13

Setting range of [n] 0 to 65535 0 to 32767 0 to 16383 0 to 1999

18-18

CRD (File Data Read Instruction)

 [S2] to [S2+6]: Specification of the data format for the data to be read

Operand Description

Description

Setting value of S2

Read contents

U0

-

-

U1

Unsigned 16-bit integer

U2 DEC
U3

Signed 16-bit integer Unsigned 32-bit integer

U4

Signed 32-bit integer

S2

Reading format

U5

Floating point real

U6

numbers

32bit 64bit

U7

1 word

U8

HEX

2 words

U9

4 words

U10 ASCII

Character string (Use NULL as a delimiter.)

U11 BIN

16bit

U12 Reserved for system

U13 ASCII

Character string (Do not use NULL as a delimiter.)

Extension -
.CSV (comma-separated text)
.BIN Reserved for system .CSV (comma-separated text)

0: Normal mode:

Always reads data from the head of a file.

S2+1

Reading mode

1: Normal mode:
2: Reading position specification mode 1:

Always reads data from the head of a file. * The same operation as the case of 0.
Reads data from the position after the number of bytes stored in [S2+3] and [S2+4] from the head of the file.

S2+2 S2+3
S2+4

3: Reading position specification mode 2:

Reads data from the position after the number of bytes stored in [S2+3] and [S2+4] from the end of the file.

Reserved for system (Zero is set.)

Reading position (file pointer)

- Available only when reading position specification mode 1 or mode 2 is set for [S2+1].
- The reading position (file pointer) is specified in bytes.
- When the file reading process is completed, the reading position (file pointer) moves to the end of read data. If the reading operation is performed again in this state, the next data will be read. - In the case of reading position specification mode 1, data in the file is read from the reading position (file pointer) counted from the start of the file.
- In the case of the reading position specification mode 2, data in the file is read from the reading position (file pointer) counted from the end of the file.
- When the reading mode is set to the normal mode, the file reading position is disabled. Therefore, data is always read from the head of a file. In this case, the storage to the reading position (file pointer) is not performed after the reading process.

S2+5 S2+6

Number of read data

As a result of reading from a file, stores the number of data that could be read.
Example 1) When the number of data to be read is 40 and 100 pieces of data exist in the file, and the data is read starting from the head of the file, "40" (the number of read data) is stored.
Example 2) When the number of data to be read is 40 and 30 pieces of data exist in the file, and the data is read starting from the head of the file, "30" (the number of read data) is stored.
Example 3) When the number of data to be read is 40 and 100 character data exist in the file, and the data is read starting from the head of the file, "40" (the number of read characters) is stored.
Example 4) When the number of data to be read is 40 and 30 character data exist in the file, and the data is read starting from the head of the file, "30" (the number of read characters) is stored.

18-19

High-level Instructions (SD Memory Card)

 [S2+1]: Specification of reading mode
Example 1) When set to reading position specification mode 1

Head of file

File name: DATA1

(Target read data)

Reading position specification (S2+3,S2+4)

Example 2) When set to reading position specification mode 2

File name: DATA1

End of file (Target read data)

Reading position specification (S2+3,S2+4)

 Example of processing
Example 1)
· Five pieces (five words) of 16-bit BIN data are read from the file "\abc\data1.bin" in an SD memory card, and the data pieces are stored in the area starting with DT102.
· As the "Reading position specification mode 1" is selected, the file pointer moves after reading.

[S1]..."\abc\data1.bin"

[S2]...DT50

[n]...5

[D]...DT102

DT50 DT51 DT52 DT53 DT54 DT55
DT56

H 000B H 0002 H 0000

...Reading format ...Reading mode ...Reserved for system

H 00000000 ...Reading position

U0

...No. of read data

Data content of file "data1.bin" (16-bit BIN format) 1027112712271327142715271627172718271927

File pointer

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109

H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109

H 0000 H 0000
H 1027 H 1127 H 1227 H 1327 H 1427 H 0000
H 0000 H 0000

Data content of file "data1.bin" (16-bit BIN format) 1027112712271327142715271627172718271927
File pointer

18-20

CRD (File Data Read Instruction)

Example 2)
· Five pieces of data are read from the file "\abc\data1.csv" in an SD memory card, and the data pieces are stored in the area starting with DT102 as five pieces (five words) of 16-bit unsigned integer data.
· As the "Reading position specification mode 1" is selected, the file pointer moves after reading.

[S1]..."\abc\data1.csv" [S2]...DT50

[n]...5

DT50 DT51 DT52 DT53 DT54 DT55
DT56

U1 H 0002 H 0000

...Reading format ...Reading mode ...Reserved for system

H 00000000 ...Reading position

U0

...No. of read data

[D]...DT102

Data content of file "data1.csv" (16-bit DEC format) 12,123,1234,12345,5,56,567,5678,56789,1,

File pointer

DT100

U0

DT101

U0

DT102

U0

DT103

U0

DT104

U0

DT105

U0

DT106

U0

DT107

U0

DT108

U0

DT109

U0

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109

U0 U0
U12 U123 U1234 U12345
U5 U0
U0 U0

Data content of file "data1.csv" (16-bit DEC format) 12,123,1234,12345,5,56,567,5678,56789,1,

File pointer

18-21

High-level Instructions (SD Memory Card)

Example 3)
· Five pieces of data are read from the file "\abc\data1.csv" in an SD memory card, and the data pieces are stored in the area starting with DT102 as five pieces (ten words) of 32-bit unsigned integer data.
· As the "Reading position specification mode 1" is selected, the file pointer moves after reading.

[S1]..."\abc\data1.csv" [S2]...DT50

[n]...5

[D]...DT102

DT50 DT51 DT52 DT53 DT54
DT55 DT56

U3 H 0002 H 0000

...Reading format ...Reading mode ...Reserved for system

H 00000000 ...Reading position

U0

... No. of read data

Data content of file "data1.csv" (32-bit DEC format)
Byte address 123456,1234567,12345678,123456789,567890,5678901,..

File pointer

DT100

U0

DT102

U0

DT104

U0

DT106

U0

DT108

U0

DT110

U0

DT112

U0

DT114

U0

DT116

U0

DT118

U0

DT100 DT102 DT104 DT106 DT108 DT110 DT112 DT114 DT116 DT118

U0
U123456 U1234567 U12345678 U123456789 U567890
U0 U0
U0 U0

Data content of file "data1.csv" (32-bit DEC format)
123456,1234567,12345678,123456789,567890,5678901,..
File pointer

18-22

CRD (File Data Read Instruction)

Example 4) · Reads ten data (ten characters) of ASCII (000AH) data from the file "\abc\data1.csv" in a SD memory card.
(When using NULL as a delimiter) · When there are two consecutive double quotation marks (""), each one (") is read as one character. · The data is stored in the area starting with DT102 as character data. · As the "Reading position specification mode 1" is selected, the file pointer moves after reading.

[S1]..."\abc\data1.csv" [S2]...DT50 [n]...10

[D]...DT102

DT50 DT51 DT52 DT53 DT54 DT55
DT56

H 000A H 0002 H 0000

...Reading format ...Reading mode ...Reserved for system

H 00000000 ...Reading position

U0

...No. of read data

Data content of file "data1.csv" (ASCII string format) "ABC""DE""FGH","IJ","KLMNOP",

File pointer

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108

H 0000 H 0000 H 00 H 00 H 00 H 00 H 00 H 00 H 00 H 00 H 00 H 00
H 0000 H 0000

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108

H 0000
H 0000 "B" "A" """ "C" "E" "D" "F" """ "H" "G"
H 0000 H 0000

Data content of file "data1.csv" (ASCII string format) "ABC""DE""FGH","IJ","KLMNOP",
File pointer

18-23

High-level Instructions (SD Memory Card)

Example 5) · Reads four data (four characters) of ASCII (000AH) data from the file "\abc\data1.csv" in a SD memory card.
(When using NULL as a delimiter) · The data is stored in the area starting with DT102 as character data.
· As the "Reading position specification mode 1" is selected, the file pointer moves after reading.

[S1]..."\abc\data1.csv" [S2]...DT50

[n]...4

[D]...DT102

DT50 DT51 DT52 DT53 DT54 DT55
DT56

H 000A H 0002 H 0000

...Reading format ...Reading mode ...Reserved for system

H 00000000 ...Reading position

U0

...No. of read data

Data content of file "data1.csv" (ASCII string format) "ABC","DEF","GHI","JKL",

File pointer

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108
DT109

H 0000 H 0000 H 0000 H 00 H 00 H 00 H 00 H 00 H 00 H 00 H 00
H 00 H 00 H 0000 H 0000

DT100 H 0000 DT101 H 0000 DT102 H 0004 DT103 "B" "A" DT104 "D" "C" DT105 H 00 H 00 DT106 H 00 H 00
DT107 H 00 H 00 DT108 H 0000
DT109 H 0000

Data content of file "data1.csv" (ASCII string format) "ABC","DEF","GHI","JKL",
File pointer

18-24

CRD (File Data Read Instruction)

Example 6) · Reads three data (three characters) of ASCII (000DH) data from the file "\abc\data1.csv" in a SD memory
card. (When not using NULL as a delimiter) · The data is stored in the area starting with DT102 as character data.
· As the "Reading position specification mode 1" is selected, the file pointer moves after reading.

[S1]..."\abc\data1.csv" [S2]...DT50

[n]...3

[D]...DT102

DT50 DT51 DT52 DT53 DT54 DT55
DT56

H 000D H 0002 H 0000

...Reading format ...Reading mode ...Reserved for system

H 00000000 ...Reading position

U0

...No. of read data

Data content of file "data1.csv" (ASCII string format) "A[NULL]B","DEF","GHI","JKL",

File pointer

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108
DT109

H 0000 H 0000 H 0000 H 00 H 00 H 00 H 00 H 00 H 00 H 00 H 00
H 00 H 00 H 0000 H 0000

DT100 H 0000
DT101 H 0000 DT102 H 0003 DT103 [NULL] "A" DT104 H 00 "B" DT105 H 00 H 00 DT106 H 00 H 00
DT107 H 00 H 00 DT108 H 0000
DT109 H 0000

Data content of file "data1.csv" (ASCII string format) "A[NULL]B","DEF","GHI","JKL",
File pointer

18-25

High-level Instructions (SD Memory Card)

Example 7)
· 10000 pieces of data are read from the file "\FP7\DT.CSV" in an SD memory card, and the data pieces are stored in the area starting with DT10000 as 10000 pieces (10000 words) of 16-bit signed integer data. Because "normal mode 0" is selected, data is always read from the head of a file.

[S1]..."\FP7\DT.CSV" [S2]...DT50 [n]...10000 [D]...DT10000

DT50 DT51 DT52 DT53 DT54
DT55 DT56

U2 H 0000 H 0000

...Reading format ...Reading mode ...Reserved for system

H 00000000 ...Reading position

U0

...No. of read data

Data content of file "DT.CSV" (signed 16-bit DEC format)
_10000,_10001,_10002,_10003,.....,_199990Dh0Ah

File pointer

DT10000

U0

DT10001

U0

DT10002

U0







DT19997

U0

DT19998

U0

DT19999

U0

DT20000

U0

DT10000 DT10001 DT10002
  
DT19997 DT19998 DT19999 DT20000

K10000 K10001 K10002
K19997 K19998 K19999
U0

Data content of file "DT.CSV" (signed 16-bit DEC format)

_10000,_10001,_10002,_10003,.....,_199990Dh0Ah

File pointer

18-26

CRD (File Data Read Instruction)
 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well. · The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has
turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed. · When there are two consecutive double quotation marks ("") in character strings, each one (") is read as one character. Double quotation marks that singularly exist are ignored. · If a space, comma or line break is inserted at the position of file pointer after reading a CSV file, the file pointer output to the result data is at the data position next to the comma or line break. The space, comma or line break at the end of data is skipped. · When reading a CSV file, null fields (such as parts with successive commas) are skipped, and the data is not stored in devices. The next data to be read is stored in the next device (that is not a skipped null field). At that time, the skipped data is also counted as the number of data. · During the execution of the CRD instruction, data values read from an SD memory card are written from the beginning of a specified device area in order. Until the completion of the CRD instruction, do not read the data of the device specified by the CRD instruction. · When reading as ASCII data, data containing delimiters (commas or line break codes) may not be processed correctly. · Specify the points at which each data is separated for [S2+3] and [S2+4], reading positions (file pointers). "A" in the figure below shows the positions where data can be read properly. Example 1) 16-bit integer data (bin format file)
34 12 78 56
A N/A A N/A A

Example 2) ASCII data (csv format file)
"(22h) A(41h) "(22h) ,(2Ch) "(22h) A(41h) B(42h) "(22h) ,(2Ch) "(22h) 1(31h) 2(32h) A N/A N/A N/A A N/A N/A N/A N/A A N/A N/A

A: Position where data can be properly read

N/A: Position where data cannot be properly read

 Flag operations
Name

Description

SR3A (SD memory card access instruction active)

Turns ON when the instruction is executed. Turns OFF when the instruction is completed.

SR3B (SD memory card access instruction execution done)

Turns OFF when the instruction is executed. Turns ON when the instruction is completed.

SR3C (SD memory card access instruction execution result)
SR7, SR8 (ER)

Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1 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.
To be set when an out-of-range value is specified in the reserved area for system.

18-27

High-level Instructions (SD Memory Card)

CMKDIR (Directory Creation)
 Ladder diagram

R0

SR3A

 DF 

CMKDIR

DT0

S

 List of operands

Operand Description

Starting address of the device area that stores the path name (folder name) of the folder to be created and the number

S

of characters of the path name (data format: character data)

Specify the number of characters for [S], and path name (folder name) for [S+1] and successive operand.

 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

   

 

*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 creates a folder in an SD memory card.

· To specify the folder name, store the number of characters in [S], and store the characters that indicate the folder name as ASCII data in [S+1] and subsequent operands.

 Example of processing
Example 1) When creating a folder "\abc" in an SD memory card

DT0

U4

DT1 "a" "\"

DT2 "c" "b"

DT3 H 0000

DT4 H 0000

DT5 H 0000

Byte address High Low

 No. of characters of folder name  Folder name

SD memory
card

SD memory
card

Folder name\abc

Created folder

18-28

CMKDIR (Directory Creation)

Example 2) When creating a folder "\abc\def" in an SD memory card

DT0 DT1 DT2 DT3 DT4 DT5 Byte address

U8 "a" "\" "c" "b" "d" "\" "f" "e"
H 0000 High Low

No. of characters of folder name Folder name

SD memory
card

SD memory
card

Folder name\abc

Folder name\abc

Folder name\def Created folder

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· To create a folder in a lower hierarchy like the folder "\abc\def", create the folder of the upper hierarchy in advance. Folders cannot be created simultaneously.

· An error occurs when a folder that is not in upper hierarchies is specified.

· When a folder to be created already exists, the operation normally ends without treatment.

 Flag operations
Name

Description

SR3A (SD memory card access instruction active)

Turns ON when the instruction is executed. Turns OFF when the instruction is completed.

SR3B (SD memory card access instruction execution done)

Turns OFF when the instruction is executed. Turns ON when the instruction is completed.

SR3C (SD memory card access instruction execution result)

Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-29

High-level Instructions (SD Memory Card)

CRMDIR/CRMDIRFL (Directory Deletion)
 Ladder diagram

R0

SR3A

 DF 

CRMDIR

"\abc"

S

R0

SR3A

 DF 

CRMDIRFL

"\abc"

S

 List of operands
Operand Description

Starting address of the device area that stores the path name (folder name) of the folder to be deleted and the number

S

of characters of the path name (data format: character data)

Specify the number of characters for [S], and the path name (folder name) for [S+1] and subsequent operands.

 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

   

 

*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
· The directory in an SD memory card that is specified by [S] is deleted.

· To specify the folder name, store the number of characters in [S], and store the characters that indicate the folder name as ASCII data in [S+1] and subsequent operands.

 Example of processing
Example 1) When deleting a folder "\abc" in an SD memory card

DT0

U4

DT1 "a" "\"

DT2 "c" "b"

DT3 H 0000

DT4 H 0000

DT5

H 0000

Byte address High Low

No. of characters of folder name Folder name

SD memory
card

SD memory
card

Folder name\abc

Deleted folder

18-30

CRMDIR/CRMDIRFL (Directory Deletion)

Example 2) When deleting a folder "\abc\def" in an SD memory card

DT0 DT1 DT2 DT3 DT4 DT5 Byte address

U8 "a" "\" "c" "b" "d" "\" "f" "e"
H 0000 High Low

No. of characters of folder name  Folder name

SD memory
card

Folder name\abc Folder name\def

SD memory
card
Folder name\abc

Deleted folder

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· An error occurs when the folder to be deleted does not exist.

· In the case of the CRMDIR instruction, an error occurs when there are files or folders in the specified folder. Check the inside of the folder.

· In the case of the CRMDIRFL instruction, the specified folder can be deleted even when there are files in the folder. An error occurs when there is a folder in the specified folder.

· The CRMDIRFL instruction can be used for CPU unit CPS41*/CPS31* Ver.4.3 or later.

 Flag operations
Name

Description

SR3A (SD memory card access instruction active)

Turns ON when the instruction is executed. Turns OFF when the instruction is completed.

SR3B (SD memory card access instruction execution done)

Turns OFF when the instruction is executed. Turns ON when the instruction is completed.

SR3C (SD memory card access instruction execution result)

Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-31

High-level Instructions (SD Memory Card)

CFDEL (File Delete)
 Ladder diagram

R0

SR3A

 DF 

CFDEL

DT0

S

 List of operands

Operand Description

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of

S

the file to be deleted and the number of characters of the path name (data format: character data)

Specify the number of characters for [S], and path name (folder name + file name) for [S+1] and successive operand.

 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

   

 

*1: Only 16-bit devices can be modified. (Character constants cannot be specified.)

 Outline of operation
· The file in an SD memory card that is specified by [S] is deleted.

 Example of processing
Example) When deleting a file "\abc\data1" in an SD memory card

Integer K U H

Real number

String

Index

modification

SF DF " "

*1





(1) Number of characters

(2) Path name (folder name + file name)

DT0

U14

(1)

DT1 "a" "\"

DT2 "c" "b"

DT3 "d" "\"

DT4 "t" "a" (2)

DT5 "1" "a"

DT6 "c" "."

DT7 "v" "s"

(H) (L)

SD

SD

\abc

\abc

data1.csv

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.
· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.
· An error occurs when the file to be deleted does not exist.

18-32

CFDEL (File Delete)

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done)
SR3C (SD memory card access instruction execution result)
SR7, SR8 (ER)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1
To be set in case of out-of-range in indirect access (index modification).

18-33

High-level Instructions (SD Memory Card)

CPR (ASCII Data Write to File)
 Ladder diagram

R0

SR3A

 DF 

CPR.STR

DT0

DT100

i

S

D

 Available operation units (: Available)

Operation unit

bit

US

SS

UL

SL

SF

DF

STR

i



 List of operands

Operand Description

S

Character string data to be written or the starting address of the device area where the character string is stored

D

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of the file in which string data is written and the number of characters of the path name (data format: character 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

   

 

*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 adds the character string specified by [S] to the end of the file named with the character string specified by [D].

· When the file specified by [D] does not exist, create a new file.

 [S] to [S+1]: Specification of character string data
· Parameters related to the character string data written into a file name on an SD memory card

Setting device S
S+1

Description Number of character strings to be written Maximum 4096 characters Character string data to be written

 [D] to [D+1]: Specification of folder name and file name
· Starting device that stores the file name (folder name + file name: 1 to 256 characters) of the file to be written into an SD memory card and the number of characters of the file name

Setting device D
D+1

Description Specify the number of characters of the file name to be written. (Specify the full path.) Specify the file to be written. - Specify the full path. Up to 256 characters including the folder name and the file name.

18-34

CPR (ASCII Data Write to File)

 Example of processing
When writing a character string "2013/04/05,12:00:00,abcde01238" in a file "\abc\data1":

[i] ...STR [D] ...DT0 [S] ...DT100

File data1

DT0

U10

DT1 "a" "\"

DT2 "c" "b"

DT3 "d" "\"

DT4 "t" "a"

DT5 "1" "a"

Byte address High Low

2013/04/01,12:00:00,abcde01234 + CRLF 2013/04/02,12:00:00,abcde01235 + CRLF 2013/04/03,12:00:00,abcde01236 + CRLF 2013/04/04,12:00:00,abcde01237 + CRLF

DT100 DT101 DT102 DT103 DT104
DT105 DT106 DT107 DT108 DT109 DT110 DT111
DT112 DT113 DT114 DT115

U30 "0" "2" "3" "1" "0" "/" "/" "4" "5" "0" "1" "," ":" "2" "0" "0" "0" ":" "," "0" "b" "a" "d" "c" "0" "e" "2" "1" "8" "3"

File data1
2013/04/01,12:00:00,abcde01234 + CRLF 2013/04/02,12:00:00,abcde01235 + CRLF 2013/04/03,12:00:00,abcde01236 + CRLF 2013/04/04,12:00:00,abcde01237 + CRLF 2013/04/05,12:00:00,abcde01238 + CRLF

Byte address High Low

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

 Flag operations
Name

Description

SR3A (SD memory card access instruction active)

Turns ON when the instruction is executed. Turns OFF when the instruction is completed.

SR3B (SD memory card access instruction execution done)

Turns OFF when the instruction is executed. Turns ON when the instruction is completed.

SR3C (SD memory card access instruction execution result)

Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification). To be set when the character string specified by [S] exceeds 4096 characters.

18-35

High-level Instructions (SD Memory Card)

CRD1 (One Line Read from File)
 Ladder diagram

R0

SR3A

 DF 

CRD1.STR

DT0

DT100

DT50

i

S

D1

D2

 Available operation units (: Available)

Operation unit

bit

US

SS

UL

SL

SF

DF

STR

i



 List of operands

Operand Description

S

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of the file from which data is read and the number of characters of the path name (data format: character data)

D1

Starting address of the device area where character string data to be read is stored

D2

Starting address of the device area storing the parameters related to the position and the maximum number of bytes of data to be read

 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

   

 

D1

   

 

D2

   

 

*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 reads the file specified by [S] from the reading position specified by [D2] up to a specified maximum number of bytes until the detection of CR+LF, and stores it in the device address starting with [D1].

 [S] to [S1+1]: Specification of folder name and file name
· Starting device that stores the folder name (folder name + file name: 1 to 256 characters) of the folder stored in an SD memory card and the number of characters of the folder name

Setting device S
S+1

Description Specify the number of characters of the file name to be read. (Specify the full path.) Specify the file to be read. - Specify the full path. Up to 256 characters including the folder name and the file name.

18-36

CRD1 (One Line Read from File)

 [D2] to [D2+3]: Specification of reading position and maximum number of bytes

Setting device

Settings

Details

D2 D2+1

Reading position (file pointer)

Specify the byte position from the head of a file. Each line feed character (CR(0DH) or LF(0AH) is counted as one character.
After the execution of the instruction, [D2, D2+1] is updated with the value that the number of read bytes is added. If the reading operation is performed again in this state, the next data will be read.
The reading position can be specified by eight bits (by one byte).

D2+2

Maximum number of read bytes (Setting range: 1 to 4096)

Set the maximum number of bytes of data to be read. The setting range is 1 to 4096. When 0 is set, operation is performed as 4096. When a line feed character (CR(0DH), LF(0HA) or CR+LF) exists before reaching the specified maximum number of bytes, the reading operation ends at that point.

D2+3

Reserved for system

Zero is set.

 Example of processing
Example 1) When reading data from a file "\data1.txt" specifying the head of the file for the reading position

[i] ...STR [S1] ...DT0 [D1] ...DT100 [D2] ...DT50

DT0

U10

DT1 "d" "\"

DT2 "t" "a"

DT3 "1" "a"

DT4 "t" "."

DT5 "t" "x"

DT6 H 0000

DT7 H 0000

Byte address High Low

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109

H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000

DT50 DT51

H 00000000

...From the head of file

DT52 U100 ... Max. size: 100 bytes

DT53 H 0000 ...Reserved for system

DT54 H 0000

Contents of fie "data1.txt"

12345678 + CRLF a,ab,abc,abcd,abcde + CRLF

Position of file pointer

DT100 DT101 DT102 DT103 DT104
DT105 DT106 DT107 DT108 DT109

U8 "2" "1" "4" "3" "6" "5" "8" "7"
H 0000 H 0000
H 0000 H 0000 H 0000

Byte address High Low

Contents of fie "data1.txt"

DT50 DT51

H 0000000A

...Read data Reading position at the end

DT52 U100

DT53 H 0000

DT54 H 0000

12345678 + CRLF a,ab,abc,abcd,abcde + CRLF

18-37

High-level Instructions (SD Memory Card)

Example 2) When reading data from a file "\data1.txt" specifying the 4th byte from the head of the file for the reading position
[i] ...STR [S1] ...DT0 [D1] ...DT100 [D2] ...DT50

DT0

U10

DT1 "d" " \ "

DT2 "t" "a"

DT3 "1" "a"

DT4 "t" "."

DT5 "t" "x"

DT6 H 0000

DT7 H 0000

Byte address High Loe

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109

H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000

DT50 DT51 DT52 DT53 DT54

H 00000004
U100 H 0000 H 0000

...Position of 4th byte from the head of file
...Max. size: 100 bytes ...Reserved for system

Contents of file "data1.txt"

12345678 + CRLF a,ab,abc,abcd,abcde + CRLF

Position of file pointer

DT100 DT101 DT102 DT103 DT104
DT105 DT106 DT107 DT108 DT109

U4 "6" "5" "8" "7"
H 0000 H 0000 H 0000 H 0000
H 0000 H 0000 H 0000

Byte address High Low

Contents of file "data1.txt"

DT50 DT51

H 0000000A

...Read data Reading position at the end

DT52 U100

DT53 H 0000

DT54 H 0000

12345678 + CRLF a,ab,abc,abcd,abcde + CRLF

18-38

CRD1 (One Line Read from File)

Example 3) When reading data from a file "\abc\data1.txt" specifying the 10th byte from the head of the file for the reading position

[i] ...STR [S1] ...DT0 [D1] ...DT100 [D2] ...DT50

DT0

U14

DT1 "a" "\"

DT2 "c" "b"

DT3 "d" "\"

DT4 "t" "a"

DT5 "1" "a"

DT6 "t" "."

DT7 "t" "x"

DT8 H 0000

Byte address High Low

DT100 DT101 DT102 DT103 DT104 DT105 DT106 DT107 DT108 DT109

H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000

DT50 DT51

H 0000000A

 Position of 9th byte from the head of file

DT52

U10

 Max. size: 10 bytes

DT53 H 0000  Reserved for system

DT54 H 0000

Contents of file "data1.txt"

12345678 + CRLF a,ab,abc,abcd,abcde + CRLF

Position of file pointer

DT100 DT101 DT102 DT103 DT104
DT105 DT106 DT107 DT108 DT109

U10 "," "a" "b" "a" "a" "," "c" "b" "a" ","
H 0000
H 0000 H 0000
H 0000

Byte address High Low

DT50 DT51 DT52 DT53 DT54

H 00000014
U10 H 0000 H 0000

 Read data Reading position at the end

Contents of file "data1.txt"
12345678 + CRLF a,ab,abc,abcd,abcde + CRLF

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.
· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.
· During the execution of the CRD1 instruction, data read from the SD memory card is written from the beginning of the specified data device area in order. Therefore, do not read data in the range of the data device specified for data storage until the completion of this instruction.

18-39

High-level Instructions (SD Memory Card)

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done) SR3C (SD memory card access instruction execution result)
SR7, SR8 (ER)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1
To be set in case of out-of-range in indirect access (index modification).
To be set when the value of [D2+2] exceeds 4096 characters.
To be set when [D1]+[D2+2] is outside the device range.

18-40

CREN (File Rename)

CREN (File Rename)
 Ladder diagram

R0

SR3A

 DF 

CREN

DT0

DT50

S1

S2

 List of operands

Operand Description

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of

S1

the file to be renamed and the number of characters of the path name (data format: character data) Specify the number of characters for [S1], and path name (folder name + file name) for [S1+1] and successive

operand.

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of the file after being renamed and the number of characters of the path name (data format: character data)

S2

Specify the number of characters for [S2], and path name (folder name + file name) for [S2+1] and successive

operand.

Folder name can be omitted.

 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 changes the file name specified by [S1] to the file name specified by [S2].

 Example of processing
Example) When renaming a file "\abc\data1" to "\abc\data2"

(1) Number of characters

(2) Path name (folder name + file name)

DT0

U14

(1)

DT1 "a" "\"

DT2 "c" "b"

DT3 "d" "\"

DT4 "t" "a" (2)

DT5 "1" "a"

DT6 "c" "."

DT7 "v" "s"

(H) (L)

DT50

U9

(1)

DT51 "a" "d" DT52 "a" "t"
DT53 "." "2" (2)

DT54 "s" "c"

DT55 ** "v" DT56 ** **

(H) (L)

SD

SD

\abc data1.csv
\def

\abc data2.csv
\def

18-41

High-level Instructions (SD Memory Card)

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· The CREN instruction cannot be executed when the SD memory card access instruction is being executed.

· When the full path is specified for the file name and folder name after renaming, abnormality is detected and operation abends if it does not match the folder name before renaming (all path names).

 Flag operations
Name

Description

SD memory card access instruction active (SR3A)

Turns ON when the instruction is executed. Turns OFF when the instruction is completed.

SD memory card access instruction execution done (SR3B)

Turns OFF when the instruction is executed. Turns ON when the instruction is completed.

SD memory card access instruction execution result (SR3C)

Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-42

CCOPY (File Copy)

CCOPY (File Copy)
 Ladder diagram

R0

SR3A

 DF 

CCOPY

DT0

DT50

DT90

S1

S2

S3

 List of operands

Operand Description

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of

S1

the file to be copied and the number of characters of the path name (data format: character data) Specify the number of characters for [S1], and specify the path name (folder name + file name) for [S1+1] and

successive operands.

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of

S2

the copy destination file and the number of characters of the path name (data format: character data) Specify the number of characters for [S2], and path name (folder name + file name) for [S2+2] and successive

operand.

S3

Setting of copy format

 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

   

 





S3

   

 

  



*1: Only 16-bit devices can be modified. (Integer constants and character constants cannot be specified.)

 Outline of operation
· This instruction copies the file specified by [S1] to the file specified by [S2] according to the parameter specified by [S3].

· When a folder is specified for [S1], copies all files directly under the folder of [S1] into the area directly under the folder specified by [S2].

· Folders in further lower levels than the folder of [S1] are not copied.

· Read-only files are not overwritten.

· When [S1] and [S2] are exactly the same, an error occurs regardless of the value of [S3].

· When specifying a file for [S1] and a folder for [S2], copies the file specified by [S1] into the folder specified by [S2].

 [S3]: Specification of copy format

Operand Specified bit

Description

bit 0 S3

0: Overwrites if there is a file with the same name in destination. 1: Abends without overwriting if there is a file with the same name in destination.

bit 1 to 15

(Reserved for system)

18-43

High-level Instructions (SD Memory Card)

 Example of processing
Example) When copying a file "abc\data1" to "\def\test1"

(1) Number of characters

(2) Path name (folder name + file name)

DT0

U14

(1)

DT1 "a" "\"

DT2 "c" "b"

DT3 "d" "\"
DT4 "t" "a" (2)
DT5 "1" "a"
DT6 "c" "."
DT7 "v" "s"

(H) (L)

DT50

U14

(1)

DT51 "d" "\"

DT52 "f" "e"

DT53 "t" "\"
DT54 "s" "e" (2)
DT55 "1" "t"
DT56 "c" "."
DT57 "v" "s"

(H) (L)

DT90

H 0000

SD

SD

\abc

\abc

data1.csv \def

data1.csv \def
test1.csv

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· When a folder is specified for [S1] and a file for [S2], "file name error" occurs.

 Flag operations
Name

Description

SR3A (SD memory card access instruction active)

Turns ON when the instruction is executed. Turns OFF when the instruction is completed.

SR3B (SD memory card access instruction execution done)

Turns OFF when the instruction is executed. Turns ON when the instruction is completed.

SR3C (SD memory card access instruction execution result)

Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-44

CMV (File Move)

CMV (File Move)
 Ladder diagram

R0

SR3A

 DF 

CMV

DT0

DT50

DT90

S1

S2

S3

 List of operands

Operand Description

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of

S1

the file to be moved and the number of characters of the path name (data format: character data) Specify the number of characters for [S1], and specify the path name (folder name + file name) for [S1+1] and

successive operands.

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of

S2

the move destination file and the number of characters of the path name (data format: character data) Specify the number of characters for [S2], and path name (folder name + file name) for [S2+2] and successive

operand.

S3

Setting of the movement type.

 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

   

 





S3

   

 

  



*1: Only 16-bit devices can be modified. (Integer constants and character constants cannot be specified.)

 Outline of operation
· This instruction moves the file specified by the character string data starting with [S1] as the file specified by the character string data starting with [S2].

· When a folder is specified for [S1], moves all files directly under the folder of [S1] to the area directly under the folder specified by [S2].

· Folders in further lower levels than the folder of [S1] are not moved.

· Read-only files remain as read-only files after move.

· A free space larger than the file size is necessary in a card for internal operation.

· When specifying a file for [S1] and a folder for [S2], moves the file specified by [S1] to the folder specified by [S2].

 [S3]: Specification of movement type

Operand

Specified bit Description

bit 0 S3

0: Overwrites if there is a file with the same name in destination. 1: Abends without overwriting if there is a file with the same name in destination.

bit 1 to 15

(Reserved for system)

18-45

High-level Instructions (SD Memory Card)

 Example of processing
Example) When moving a file "abc\data1" to "\def\test2"

(1) Number of characters

(2) Path name (folder name + file name)

DT0

U14

(1)

DT1 "a" "\"

DT2 "c" "b"

DT3 "d" "\"
DT4 "t" "a" (2)
DT5 "1" "a"
DT6 "c" "."
DT7 "v" "s"

(H) (L)

DT50

U10

(1)

DT51 "d" "\"

DT52 "f" "e"

DT53 "t" "\" (2)

DT54 "s" "e"

DT55 "2" "t"

(H) (L)

DT90

H 0000

SD

SD

\abc data1.csv
\def

\abc
\def test2.csv

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

· When the folder specified by [S2] does not exist, "No file/folder" error occurs.

· When there is not enough free space, "memory card capacity shortage" error occurs.

· When a folder is specified for [S1] and a file for [S2], "file name error" occurs.

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done)
SR3C (SD memory card access instruction execution result)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-46

CFREE (Acquiring SD Memory Card Free Space)

CFREE (Acquiring SD Memory Card Free Space)
 Ladder diagram

R0

SR3A

 DF 

CFREE.UL

DT10

i

D

 Available operation units (: Available)

Operation unit

bit

US

SS

UL

SL

SF

DF

i



 List of operands

Operand Description

D

Starting address of the device area where the acquired free space amount is stored in bytes

 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 stores the free space amount of the SD memory card in the area specified by [D] in bytes. Example) When there are 4 GB of free space in an SD memory card
[i]...UL [D] ...DT10

DT10 DT11 DT12 DT13 DT14 DT15

H 0000 H 0000 H 0001 H 0000 H 0000 H 0000

H 1 0000 0000 (4,294,967,296 byte)

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done)
SR3C (SD memory card access instruction execution result)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-47

High-level Instructions (SD Memory Card)

CFREEK (Acquiring SD Memory Card Free Space)
 Ladder diagram

R0

SR3A

 DF 

CFREE.UL

DT10

i

D

 Available operation units (: Available)

Operation unit

bit

US

SS

UL

SL

SF

DF

i



 List of operands

Operand Description

D

Starting address of the device area where the acquired free space amount is stored in k (kilo) bytes

 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 stores the amount of free space on an SD memory card in the area specified by [D] in k(kilo) bytes.
Example) When there are 4 GB of free space in an SD memory card

[i]...UL [D] ...DT10

DT10 DT11

H 00400000

DT12 H 0000

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done)
SR3C (SD memory card access instruction execution result)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-48

CFLS (Acquiring File Status)

CFLS (Acquiring File Status)
 Ladder diagram

R0

SR3A

 DF 

CFLS.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

Starting address of the device area that stores the path name (folder name + file name: maximum 256 characters) of the file whose status is acquired and the number of characters of the path name (data format: character data)

D

Starting address of the device area that stores the acquired file status

 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: 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 acquires the status of the file name specified by [S], and stores the result in 10-word area ([D] to [D]+9) from [D].

 Details of stored contents

Obtained result storage device

Obtained contents

Bit position

Description

0

For read-only file: ON

1

For hidden file: ON

2

For system file: ON

D

File attribute

3

For volume label: ON

4

For directory: ON

5

For archive: ON

6 to 15

(Reserved: 0 (fixed))

D+1

(Reserved)

D+2 File size: Stored in decimal.
D+3

D+4

Year (0 to 99)

D+5

Month (1 to 12)

D+6

Last modified time:

Day (1 to 31)

D+7

Stored in decimal.

Hour (0 to 23)

D+8

Minute (0 to 59)

D+9

Second (0 to 59)

18-49

High-level Instructions (SD Memory Card)

 Example of processing
Example) When acquiring the status of the file "\abc\data1" · File attribute: Read only · File size: 123456 bytes · Last modified time: 12:34:56 (Hr:Min:Sec) on Jan. 23, 2012

DT0

U14

(1)

DT1 "a" "\"

DT2 "c" "b"

DT3 "d" "\"

DT4 "t" "a" (2)

DT5 "1" "a"

DT6 "c" "."

DT7 "v" "s"

(H) (L)

DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 DT20

H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000 H 0000

DT10 DT11 DT12 DT13 DT14 DT15 DT16 DT17 DT18 DT19 DT20

H 0001 H 0000
U123456
U12 U1 U23 U12 U34 U56 H 0000

 Precautions during programming
· Refer to "19-9 Common Precautions for SD Memory Card Access Instructions" as well.

· The SD memory card access instruction active flag (SR3A) turns ON after the execution condition has turned ON until the completion of the execution of the instruction. During this period, other SD memory card access instructions cannot be executed.

 Flag operations
Name
SR3A (SD memory card access instruction active)
SR3B (SD memory card access instruction execution done)
SR3C (SD memory card access instruction execution result)

Description
Turns ON when the instruction is executed. Turns OFF when the instruction is completed.
Turns OFF when the instruction is executed. Turns ON when the instruction is completed.
Reports the result when the instruction is completed. Normal completion: 0, Abnormal completion: 1

SR7, SR8 (ER)

To be set in case of out-of-range in indirect access (index modification).

18-50

PanaSD (Panasonic SD Memory Card Lifetime Information Read)

PanaSD (Panasonic SD Memory Card Lifetime Information Read)
 Ladder diagram

R0  DF 

PanaSD

DT10

DT11

DT15

D1

D2

D3

 List of operands
Operand Description

D1

The device address storing an execution result code

D2

The starting address of the device area that stores the acquisition time of SD memory card lifetime information

D3

The device address storing the number of rewrites information

 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

   

 

D3

   

 

Integer K U H

Real number

String

Index

modification

SF DF " "



 Outline of operation
· This instruction is used to read the lifetime information of a Panasonic SD memory card.

· This instruction and SD memory card access instructions can be used simultaneously.

· This instruction stores the execution result of this instruction in the area starting with [D1], [D2] and [D3].

· The duplicate execution of this instruction is not possible.

· Do not use this instruction frequently. Executing this event by a differential instruction is recommended.

· This instruction is exclusive to industrial SD memory cards made by Panasonic. This instruction cannot be used for other SD memory cards.

· The SD memory cards that this instruction supports are as follows.

 Supported SD memory cards

Type

Series

Conventional products

SLC

EX

FX

MLC

GD

JD, PC

(Note): The EX and GD series can be used for CPU units Ver.4.0 or later.

18-51

High-level Instructions (SD Memory Card)

 Area storing execution results

Operand Items

Description

An execution code is stored.

HFFFF: Being executed

H0: Normal end

[D1]

Execution result code (Note 1)

H1: Double startup error

H2: SD memory card cover open error

H3: SD memory card not mounted error

H4: Unsupported SD memory card error

[D2] [D2+1] [D2+2]

Acquisition time

Year, month
Day, hour
Minute, second

The acquisition time of the SD memory card lifetime information is stored in 3-word BCD format. Example) The date and time October 3, 2014 at 15:55:30 is stored as shown below. [D2 ] H1410 [D2+1] H0315 [D2+2] H5530

The ratio (%) of the average number of rewrites of management blocks to the maximum

[D3]

Number of rewrites information

number of possible rewrites is expressed by the following formula: [Number of rewrites (average of all management blocks)] / [Maximum number of possible

rewrites] x 100

(Note 1): The most significant bit of the execution result code can be used as an instruction active flag.

 Example of processing
Example 1) When the execution result of the PanaSD instruction is Normal

[D1]...DT10 [D2]...DT11 to DT13 [D3]...DT15

When instruction is executed

DT10 DT11 DT12 DT13 DT14 DT15

H FFFF

When SD card information is being read
DT10 H FFFF DT11 DT12 DT13 DT14 DT15

Reading SD card is complete (normal completion)

DT10

H 0 Execution result code

:0

DT11 H 1410 Year and month

:1410

DT12 H 0318 Day and hour

:318

DT13 H 5530 Minute and second

:5530

DT14

DT15 H 0052 No. of rewrites information (%) :82

Example 2) When the execution result of the PanaSD instruction is Error

[D1]...DT10 [D2]...DT11 to DT13 [D3]...DT15

When instruction is executed

DT10 DT11 DT12 DT13 DT14 DT15

H FFFF

When SD card information is being read
DT10 H FFFF DT11 DT12 DT13 DT14 DT15

Reading SD card is complete (unsupported SD card error)

DT10

H 3 Execution result code

:3

DT11

H 0 Year and month

:0

DT12

H 0 Day and hour

:0

DT13

H 0 Minute and second

:0

DT14

DT15

H 0 No. of rewrites information (%) :0

 Flag operations

Name

Description

SR7 SR8 (ER)

To be set when the range between [D2] to [D2+2] is out of the accessible range. To be set when executed in an interrupt program.

18-52

19
19 Precautions During Programming

Precautions During Programming

19-1 Common Precautions

The FP7 series differs from the existing FP series in the following points:

 Operations of the carry flag and comparison flags (: Change, -: Do not change)

Type of instruction

Mnemonic

Name of instruction

Carry flag SR9(CY)

System relay number

Comparison flags

SRA (>)

SRB (=)

Data comparison instruction

CMP WIN BCMP

Data compare Band compare Block comparison

-





-





-

-



BTT

16-bit data specified bit test

-

-



Bit comparison instructions

STC

Carry-flag set



-

-

CLC

Carry-flag reset



-

-

String operation instructions

ACHK SCMP

ASCII data check String compare

-

-



-





SRC(<)   

· When operation is executed, the carry flag SR9 (CY) and comparison flags SRA (>), SRB (=), and SRC (<) are respectively activated by the instructions listed above.

· The flags do not change even if the operation result is "0" in the case of overflow or underflow with instructions other than listed above.

 Operation at the time of overflow and underflow
· The carry flag SR9 (CY) does not change even in the case of overflow or underflow.

· Note that overflow or underflow may result if incorrect operation unit is specified.

 Error flag
· Operation error flags are not cleared even in the case of normal operation.

· Use ERR instruction for clearing error flags.

 Operation device areas
· When the operation unit is 32 bits (UL, SL, SF) or 64 bits (DF), if an area near the end of an operation device is specified, the device memory with a consecutive address within PLC is overwritten. Specify an operand so that areas are not incorrectly read or written.

Example) When a transfer instruction is used, and the operation unit is specified as 32 bits, if WY511 is selected for the transfer instruction [D], the starting area of WL0 is overwritten.

DT0

H 0011

DT1

H 2233

DT2

H 4455

DT3

H 6677

DT4

H 8899

WY509 WY510 WY511
WL0 WL1

H 1111 H 2222 H 2233 H 4455 H 5555

19-2

Clock and Time Data

19-2 Clock and Time Data

 Built-in calendar timer of the CPU unit
· The calendar timer should be adjusted in the "Set PLC Date and Time" menu of the tool software FPWIN GR7, or using the TIMEWT instruction.

· The set values are stored in the system data registers SD50 through 56, as listed below.

Device No. SD50 SD51 SD52 SD53 SD54
SD55
SD56

Name of instruction
Calendar timer (year)
Calendar timer (month)
Calendar timer (day)
Calendar timer (hours)
Calendar timer (minutes)
Calendar timer (seconds)
Calendar timer (day-of-the-week)

Data range 00 to 99 01 to 12 01 to 31 0 to 23 0 to 59
0 to 59
0 to 6

Remarks The two lower digits of year in A.D. can be adjusted (up to 2099). Leap years can be set in this operation. Take leap years into account during setting. A year that can be divided by 4 is a leap year, and the days of February can be set to 29.
0: Sun., 1: Mon., 2: Tue., 3: Wed., 4: Thu., 5: Fri., 6: Sat.

 Instructions that handle clock or time data

Mnemonic Operand(s)

Functions

HMSS

S,D

(Time data)  (Seconds data)

SHMS

S,D

(Seconds data)  (Time data)

CADD

S1,S2,D

(Clock data) + (Time data)  (Clock data)

CSUB

S1,S2,D

(Clock data) - (Time data)  (Clock data)

TMSEC

S,D

(Clock data)  (Seconds data from the base time)

SECTM

S,D

(Seconds data from the base time)  (Clock data)

TIMEWT

S

(Clock data)  (SD50 to SD56)

SUMMER

S1,S2, S3,D

(Clock data)  (Clock data)

 Format of clock data

One-word 16-bit binary data are allocated to each unit (year, month, day, hours, minutes and seconds), and the overall clock data are handled in the unit of 6 words.

Example) DT0 is specified for operand

Word

Range

DT0 Year

00 to 99

DT1 Month

01 to 12

DT2

Day

01 to 31

DT3 Hour

0 to 23

DT4 Minutes

0 to 59

DT5 Seconds

0 to 59

 Format of time data

· One-word 16-bit binary data are allocated to each unit (hours, minutes and seconds), and the overall time data are handled in the unit of 3 words.

· Hours data can be specified in the range from 0 to 9999.

Example) DT0 is specified for operand

Word

Range

DT0 DT1 DT2

Hour Minutes Seconds

0 to 9999 0 to 59 0 to 59

19-3

Precautions During Programming

19-3 Data Table for String Instructions
 Structure of data table
· Data handled by a string instruction store the number of characters in the initial word, and character data in the subsequent words.
· The maximum available size for string data is 4,096 bytes.

[S] [S+1] [S+2] [S+3] [S+4]


No. of characters Character 2 (Byte 1) Character 1 (Byte 0) Character 4 (Byte 3) Character 3 (Byte 2) Character 6 (Byte 5) Character 5 (Byte 4) Character 8 (Byte 7) Character 7 (Byte 6)


 No. of characters in a character string Character data

Higher bytes

Lower bytes

Example) A string data table is specified with the number of characters: 5, and character data: "ABCDE"

DT0

5 (no. of characters)

 No. of characters in a character string

DT1

H42 (B)

H41 (A)

DT2

H44 (D)

DT3

H43 (C) H45 (E)

Character data

DT4





Higher bytes

Lower bytes

 Conversion of string data using the SSET instruction
· Using the SSET instruction, a given string can be easily converted into a string data table. · The maximum size of string data that can be specified for the SSET instruction is 256 bytes. Example) Convert string data "ABCDE" The number of characters is stored in DT0, and ASCII-converted character data are stored in DT1 and subsequent data registers.
R0
SSET "ABCDE" DT0

19-4

Floating Point Real Number Operation

19-4 Floating Point Real Number Operation
For floating point real number operations, the outcome of the operation with an infinitesimal or infinite operation result or with an infinitesimal or infinite input value is as follows.
 Infinitesimal operation result
Instruction SIN COS TAN ASIN ACOS ATAN ATAN2 SINH COSH TANH EXP LN LOG PWR SQR

Input value -

- -/2 



-



-

-

-

-

 





(Note 1): Instructions indicated with "-" do not result in an infinitesimal value. (Note 2): Instructions indicated with  result in an operation error. (Note 3): An operation error is output if the input value is out of the available range.

 Infinite operation result

Instruction SIN COS TAN ASIN ACOS ATAN ATAN2 SINH COSH TANH EXP LN LOG PWR SQR

Input value -

- /2 



-



-

-

-

-

 





(Note 1): Instructions indicated with "-" do not result in an infinite value. (Note 2): Instructions indicated with  result in an operation error. (Note 3): An operation error is output if the input value is out of the available range.

 Infinitesimal (-) input value

Instruction SIN COS TAN ASIN ACOS ATAN ATAN2 SINH COSH TANH EXP LN LOG PWR SQR

Input value nan nan nan 

 -/2



-

+

-1.0 +0.0  





(Note 1): Instructions indicated with "nan" result in an indefinite value. (Note 2): Instructions indicated with  result in an operation error. (Note 3): An operation error is output if the input value is out of the available range.

 Infinite (+) input value

Instruction SIN COS TAN ASIN ACOS ATAN ATAN2 SINH COSH TANH EXP LN LOG PWR SQR

Input value nan nan nan 



/2



+

+

+1.0 +  





(Note 1): Instructions indicated with "nan" result in an indefinite value. (Note 2): Instructions indicated with  result in an operation error.
(Note 3): An operation error is output if the input value is out of the available range.

19-5

Precautions During Programming
19-5 Changing Timer/Counter Set Value in the RUN Mode
(1) Method to rewrite a constant in a program
R0
TMX 0 U 30

T0

Y10

 Set value (constant) in a program
A constant in a program can be rewritten under the following conditions. - Operation mode: RAM/ROM operation only - Rewriting method: (1) Use the tool software
 Use the tool software FPWIN GR7
<Procedure> In this example, a set value of Timer 0 is changed from U30 to U50. 1) Place the cursor over the set value for Timer 0 ("U30"). 2) Enter a new constant "U50" and press the return key. 3) Press <Ctrl> + <F1> keys to execute [Convert PBs]. 4) Press [Yes (Y)] after a confirmation message is displayed.
 Post-change operation and precautions
· Timer/counter in operation continues the pre-change operation. The timer/counter starts operation based on the changed set value after the execution condition is turned OFF and then ON again in the next time.
· When a constant in a program is rewritten, the program itself is overwritten. Therefore, when the unit is switched to another mode and then returned to RUN, or when it is powered off and then on again, the program is preset with the changed set value.

19-6

Changing Timer/Counter Set Value in the RUN Mode

(2) Method to rewrite a value in the set value area

X100

TMX 5

T5

Timer set value

U 30

TS 5 30

Y100

Transferred to the TS area when the unit is switched to the RUN mode

 Changing a value in the set value area TS/CS
The set value area TS/CS can be rewritten under the following conditions.
- Operation mode: RAM/ROM operation
Rewriting method: (1) Use the tool software; (2) Use a programmed high-level instruction
 Post-change operation and precautions
· Timer/counter in operation continues the pre-change operation. The timer/counter starts operation based on the changed set value after the execution condition is turned OFF and then ON again in the next time.
· The program itself is not overwritten even if a value in the set value area TS/CS is changed. Therefore, operations as described below follow when the unit is switched to another mode and then returned to RUN, or when it is powered off and then on again.
1) When a set value is specified by a U constant:
The constant is preset in the set value area TS/CS. The changed value is disabled.
2) When a set value is specified by a set value area number:
In the case of the timer, "0" is preset in the set value area TS.
In the case of the counter, a value changed in a method as described in the next page is preset in the set value area CS.

19-7

Precautions During Programming
 Method (1) Use the tool software FPWIN GR7
<Procedure> 1) From the menu bar, select "Online"  "Device monitor". The "Device monitor" dialog box is displayed.

2) Double-click on the "Device" column. The "Register monitor device" dialog box is displayed. 3) Under the device type, select TS (timer set value) or CS (counter set value) and enter a given device number. The entered number is displayed in the "Device monitor" dialog box. 4) Enter a given value under "Current value" and press the return key. The set value area is updated.
 Method (2) Use a programmed high-level instruction
· When a set value for the timer/counter is to be changed due to input conditions or for other reasons, rewrite the value of the set value area TS of the timer/counter to be changed, using a high-level instruction as described below.
[Example] When the input R0 is ON, change the set value to U20 When R0 is ON, the timer set value is changed from 5 to 2 seconds.
R0
MV.UL U 20 TS0

R1
TMX 0 U 50

T0

Y100

· The set value can be changed by specifying the data register DT as the set value area, and modifying the value to be transferred using the MV instruction, etc. It is also possible to specify the number of the set value area (TS/CS) as an operand for the set value area.

19-8

Use of Duplicate Outputs
19-6 Use of Duplicate Outputs
 What is "duplicate outputs"?
· "Duplicate outputs" refers to cases where the same output is duplicately specified in a single sequence program.
· If the same output is specified for the "OT" and "KP" instructions, it is considered to be duplicate outputs. · Even if the same output is used for other multiple instructions, such as SET, RST, or high-level instructions
(for example, data transfer), it is not regarded as duplicate outputs. · Usually, an error occurs if the unit is switched to the RUN mode with duplicate outputs. The ERROR LED
goes ON and the self-diagnosis flag SR0 turns ON.
 How to check for duplicate outputs
· You can check for duplicate outputs in a program using the tool software FPWIN GR7 in the following method.
1) From the menu bar, select "Debug"  "Project total check". The "Project total check" dialog box is displayed. 2) Press the [Execute (E)] button. If duplicate outputs are identified, the PB name, address, and error details (duplicate outputs definition error) are displayed. 3) Select a given line and press the [Jump] button. The cursor moves to the instruction where duplicate outputs are involved.
 Enabling duplicate outputs
· If you need to duplicately use the same output due to the content of the program, duplicate outputs can be enabled.
· In such cases, switch "Duplicate output authorization" to ON under "CPU configuration"  "Select operation".
· When this is done, an error will not occur when the program is executed.
· 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.
19-9

Precautions During Programming

 Processing of duplicate uses of the same output
· If the same coil is specified in instructions output to internal relays or output relays (for example, the OT, KP, SET, RST and/or transfer instructions), contents thereof are rewritten at each step during operation.
[Example] Processing when the SET, RST and OT instructions are used (with X100 to X102 all ON)

X0

R0

SET

R0 

This part of the program is processed as R0 = ON.

X1

R0

RST



This part of the program is processed as R0 = OFF.

X2

R0

SET



This part of the program is processed as R0 = ON.

 Determination of operation result
· If the same output is duplicately used by several instructions such as the OT, KP, SET, RST and/or transfer instruction, the output obtained at the I/O refresh is determined by the final operation result.
[Example] The same output relay Y100 is used in the OT, SET and RST instructions

X101

Y100

 Y100 : ON

X100

Y100
SET

 Y100 : ON

X102

Y100
RST

 Y100 : OFF

19-10

Leading Edge Detection Method

19-7 Leading Edge Detection Method

 Instructions using the leading edge detection operation
(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-right shift register) instruction (6) High-level instructions executed only at the leading edge (instructions specified with P and a number)
 What is "leading edge detection method"?
· An instruction with a leading edge detection method operates only in the scan where its trigger (execution condition) is detected switching from OFF to ON.
1) Standard operation

Execution condition

ON OFF

Operation of instruction Executed in every scan

ON OFF

2) Leading edge detection operation Execution condition

ON OFF

Operation of instruction

ON OFF

Executed in one scan only
 How to perform leading edge detection
· The condition of the previous execution and the condition of the current execution are compared, and the instruction is executed only if the previous condition was OFF and the current condition is ON.
· In any other cases, the instruction is not executed.
 Precautions when using an instruction which performs leading edge detection
· This type of instruction is not executed after powering on or at the start of the RUN mode, because the OFF to ON change of the execution condition is not detected.
· Take care that, when such instructions are used in combination with any of the instructions listed in (1) to (6) below, which change the order of execution of instructions, operations may change depending on input timing.
[Be careful when leading edge detection type instructions are used in combination with:] (1) MC - MCE instructions (2) JP - LBL instructions (3) LOOP - LBL instructions (4) CNDE instructions (5) Step ladder instructions (6) Subroutine instructions

19-11

Precautions During Programming

 Operation and precautions when RUN starts
· The leading edge detection instruction is not executed when the mode has been switched to the RUN mode, or when the power supply is booted in the RUN mode, and if the trigger (execution condition) is already ON.
RUN (Power ON)

Execution condition

Operation of instruction

Not executed

Executed

· If you need to execute an instruction when the trigger (execution condition) is ON prior to switching to the RUN mode, make a program as below using SR14 (special internal relay). (SR14 is a special internal relay which is OFF during the first scan and turns ON at the second scan onwards.)
[Example 1] DF (leading edge differential) instruction

X100

Y100

DF

X100 SR14

Add SR14
DF

Y100

RUN (Power ON)
X100

Y100

Differential output is obtained because the input condition of the differential instruction changes from OFF to ON in the second scan, even if X100 has been set ON earlier.

19-12

Leading Edge Detection Method

[Example 2] CT (counter) instruction X100
X101

CT 200 U10

X100 SR14 X101

Add SR14
CT 200 U10

RUN (Power ON)
X100
CT200 count operation

This is counted because the counter input condition changes from OFF to ON in the second scan, even if X100 has been set ON earlier.

19-13

Precautions During Programming

 Precautions when using a control instruction
· The condition of the previous execution and the condition of the current execution are compared, and the leading edge detection instruction is executed only if the previous condition was OFF and the current condition is ON. In any other case, the instruction is not executed.
· Therefore, take care that, when a leading edge detection instruction is used in combination with an instruction which changes the order of instruction execution, such as MC - MCE or JP - LBL, operations may change as follows depending on input timing.
[Example 1] DF (leading edge differential) instruction is used between MC - MCE
X100
MC

X101
DF

Y100

MCE

Timing chart 1

X100 X101 Y100

Previous execution of differential instruction
Timing chart 2

Differential output is not obtained because X101 as the input condition for the differential instruction has not been changed from OFF to ON after the previous execution.

X100 X101 Y100

Previous execution of differential instruction

Differential output is obtained because X101 as the input condition for the differential instruction has been changed from OFF to ON after the previous execution.

19-14

[Example 2] CT (counter) instruction is used between JP - LBL R0
JP 1

X100 X101

CT 200 U10

Leading Edge Detection Method

LBL 1

Timing chart 1

R0
X100
Count operation

Final timing of the previous non-execution of JP instruction

This is not counted because X0 as the trigger (execution condition) for counter input has not been changed after the final timing of the previous non-execution of JP instruction.

Timing chart 2

R0
X100 Count operation

Final timing of the previous non-execution of JP instruction

This is counted because counter input has been changed from OFF to ON after the final timing of the previous non-execution of JP instruction

19-15

Precautions During Programming

19-8 Precautions for Programming

 Programs which are not executed correctly
· Do not write the following programs as they will not be executed correctly. [Example 1] If X101 is set on earlier, Y100 does not go on even when X100 is turned ON.

X100

ANS X101

Y100

DF

X102

[Example 2] Regardless of the ON or OFF state of X100, TMX5 is activated if X101 is turned ON.

X100

ANS X101

Y100

TMX 5 U 30

X102

[Example 3] If X102 is set ON earlier, Y101 does not go ON even when X100 is turned ON.

X100

PSHS X101

Y100

X102

DF

ANS

X103

Y101

· When a combination of contacts are set as the trigger (execution condition) of a differential instruction or timer instruction, do not use the ANS instruction, RDS instruction, or POPS instruction.

19-16

Precautions for Programming

 Examples for correcting invalid programs
· The invalid programs above can be respectively corrected in the following manner. <Program for correcting example 1>

X100 X101

Y100

DF

X100

X102

<Program for correcting example 2> X100 X101
TMX 5

U 30

X100 X102

Y100

<Program for correcting example 3> X100 X101

X100 X102
DF

X100

X103

Y100 Y101

19-17

Precautions During Programming

19-9 Common Precautions for SD Memory Card Access Instructions

 Operations of instructions
· At the start of instruction execution, checks are conducted, whether an SD memory card is inserted or not, if the cover is closed, and whether the card is write-protected or not.
· During the execution, the SD memory card access instruction active flag (SR3A) is ON, and the execution done flag (SR3B) is OFF.
· During the execution, the SD memory card access instruction active flag (SR3A) is ON, and the execution done flag (SR3B) is OFF.
· The execution is performed through multiple scans.
· On the completion of the execution, the SD memory card access instruction execution result flag (SR3C) turns ON or OFF according to the result, and the execution end code is stored in the system data register SD30.
· Use the execution result flag to judge whether the SD memory card access instruction is completed normally or abnormally when the execution done flag turns ON. The contents of errors are stored in the system data register SD30.
· Only one type of SD memory card access instruction can be executed at the same time. To execute more than one instruction, perform exclusive control using flags such as the SD memory card access instruction active flag.
· If another SD memory card access instruction is being executed when starting an instruction, that instruction cannot be executed.
 Flag operations

SD memory card access instruction execution conditions

The execution is performed through multiple scans.

SR3ASD memory card access instruction active flag SR3BSD memory card access instruction done flag SR3C SD memory card access instruction result flag SD30SD memory card access instruction result code

Zero is set.

Abnormal completion = 1 Normal completion = 0
The end code is set.

All the above flags and register are set when the instruction is executed.

The completion is announced at the end of scan.

(Note): When detecting errors, no SD memory card, SD memory card write protected, or improper SD memory card file name length, the completion is announced at the start of instruction execution without turning ON the active flag.

19-18

Common Precautions for SD Memory Card Access Instructions

 List of error codes
Error code Description

Cause

0 1 2
3
4 5 6 7 8
9
10
11
12 -1 to -99

Normal end No SD memory card SD memory card write protection
Specified file name error
No specified file File already exists File read error File write error
File access position error
SD memory card capacity shortage
Reading format error
File access competition
The specified directory is not empty. Others

No SD memory card is inserted, or the cover is open.
The SD memory card is write protected.
Code that cannot be specified for a file name is used. There are too many hierarchies for the specified folder.
The specified file does not exist.
The specified file already exists.
Write protect attributes are set for the specified file.
The reading position or writing position is incorrect.
Cannot be executed because there is not enough free space on the SD memory card.
Error in the conversion format when reading a file.
A file that is being logged is specified. A file that is being accessed via FTP is specified.
A directory or a file exists under the directory to be deleted.

Types of detected instructions and the timing
All SD memory card access instructions. At the time of execution. Write, delete, move, copy and rename instructions
Folder access and file access instructions
Folder access and file access instructions Move, copy and rename instructions At the time of read Write, delete, move, copy and rename instructions CWT/CRD, CRD1. At the time of execution.
Write, delete, move, copy and rename instructions
CRD. At the time of execution.
Write, delete, move, copy and rename instructions
CRMDIR. At the time of execution.
All instructions

 How to specify folder/file names in SD memory card access instructions

· Specify the full path (up to 256 characters). Do not specify the drive name.

<Example>

When specifying abc.txt directly under the root directory

When specifying def.txt under the folder A

\abc.txt

\a\def.txt

· When using the SSET instruction;

SSET "\abc.txt" DT0

Specify as above, and specify DT0 in the file name specification of SD memory card access instruction.

· When specifying a non-existent folder with CWT, CMKDIR or CPR instruction, only a sub folder directly under the parent folder can be automatically created. Two or more new folders cannot be created with one instruction. If specifying more than two files, no specified file error occurs.

19-19

Precautions During Programming

 SD memory card control specifications
File system Maximum length of file name Maximum volume size Maximum file size Maximum number of files (8.3 format): Root directory Maximum number of files (8.3 format): Sub directory Maximum number of files (long format): Root directory Maximum number of files (long format): Sub directory

SD

SDHC

FAT16

FAT32

Supports long file names. (VFAT)

2 GB

32 GB

2 GB

4 GB

512

65535

65534

65534

170

21845

56634

65534

Items Long file name
File name/Directory name

Description 256 bytes for full path (when specifying route with \. It is 255 bytes when omitting route\.)
ASCII characters (H20 to H7E) / One-byte katakana (HA1 to HDF)
Japanese (S-JIS code) (H'8140~H'9FFC,H'E040~H'EAA4)

 Common precautions
· Error flags are not cleared even when normal operation is performed. Use ERR instruction for clearing error flags.
· An SD memory card access instruction cannot be executed when another SD memory card access instruction is already being executed. Do not execute the SD memory card access instruction until the active instruction is complete.
· It may take several scans for the processing.
· They cannot be used in interrupt programs.
· Character string data is set in the order of the number of characters and character data.

S

No. of characters

Number of characters stored in character strings

S+1 Char.2( byte 1) Char.1(byte 0)

S+2 Char.4(byte 3) Char.3(byte 2) S+3 Char.6(byte 5) Char.5(byte 4)

Character data

S+4 Char.8(byte 7) Char.7(byte 6)





Byte address High

Low

<Example> When specifying 5 for the number of characters, and "ABCDE" for character data

DT0 DT DT2 DT3 DT4

5

"B"

"A"

"D"

"C"

"E"

Byte address High

Low

· Specify the extension for a file name.

19-20

Ethernet Function: IP Addresses

19-10 Ethernet Function: IP Addresses

 IP address setting specifications

Address range

Remarks

000.000.000.001 to 000.255.255.255

Although this range can be set, try not to use it wherever possible.

001.000.000.000 to 126.255.255.255

128.000.000.000 to 223.255.255.255

 List of conditional IP addresses
: Available, ×: Not available, : Self IP address is not available, default gateway is available

Setting using instructions

Address range

IPv4SET (Self IP address setting)

CONSET
(Destination address setting)

FTPcSV HTTPcSV SMTPcSV (Server address setting)

000.000.000.000



×

×

127.000.000.000 to 127.255.255.255

×





224.000.000.000 to 224.255.255.255

×





:

×





239.000.000.001 to 239.255.255.255

×





240.000.000.001 to 240.255.255.255

×





:

×





247.000.000.001 to 240.255.255.255

×





248.000.000.001 to 248.255.255.255

×





:

×





255.000.000.001 to 255.255.255.254

×





255.255.255.255

×



×

(Note): When an IP address that cannot be set is specified with an instruction, an operation error will not occur and the error flags of CY (SR9) and SD29 will be set.

 Net mask setting
Masked bits should be left-justified for net mask setting. The following specifications are invalid.

Input notation

Binary notation

255.255.253.0

11111111.11111111.11111101.00000000

 Default gateway setting
· Setting may not be possible depending on the combination of IP address and default gateway.
· Specify "000.000.000.000" when default gateway is not to be used.
· Setting is not possible in the following case.
(IP address AND netmask) (Default gateway address AND netmask)
 Judgment based on the combination of IP address and net mask
· The following combination is not possible.
· IP address AND (Inverse all bits of net mask: 1's complement) = 0
· IP address OR (net mask) = 255.255.255.255
· Only when the router IP address is other than 000.000.000.000, the above combination judgment is performed for the routing setting.
*The combination above may occur when masks are set to omission using IPv4SET instruction. Example) When the net mask is 255.255.0.0, set the IP address = 0.0.255.255 using IPv4SET.
The set values for IP address, net mask and default gateway are initialized when communication process is performed using the combination above. Default values are as follows. IP address =192.168.1.5, Net mask = 255.255.255.0, Default gateway = 192.168.1.1

19-21

Precautions During Programming

19-11 Ethernet Function: I/O Allocation

 I/O relays that are related to Ethernet functions
For using each function of the built-in ET-LAN, the following I/O areas are occupied.

Unit Type

Application

Number of occupied words (Number of occupied points)

Input

Output

Common occupied area

1 word (16 points) WX6

-

CPU Unit

CPU unit Built-in ET-LAN

User connections 1 to 16

3 words (48 points) WX7 to WX9

3 words (48 points) WY7 to WY9

User connections 17 to 216

Maximum 26 words (416 points) WX11 to WX36

Maximum 26 words (416 points) WX11 to WX36

(Note 1): Input/output contacts of the CPU unit are allocated for using the functions of each cassette. Regardless of use of such functions, input occupies 10 words (160 points, WX0 to WX9) and output occupies 10 words (160 words, WY0 to WY9).
(Note 2): Occupied area in the area of user connections 17 to 216 varies according to the number of used connections. (Note 3): The starting numbers of I/O contacts of each unit including the CPU unit can be changed by the setting of the tool software.

 Common occupied areas that are used for Ethernet functions
When using the Ethernet-related functions, flags for confirming the initialization, connection of network and the completion of preparation are allocated.

Address X60 X61 X62 X63 X64 X65 X66 X67 X68 X69 X6A X6B X6C X6D X6E X6F

Application Disconnection detection relay Ethernet initialization active IP address established TCP-NODELAY option FTP server preparation done FTP client preparation done Reserved for system Reserved for system HTTP client preparation done Mail send (SMTP client) preparation done Reserved for system EtherNet/IP preparation done EtherNet/IP cyclic communication/all nodes EtherNet/IP cyclic communication/all nodes EtherNet/IP abnormal node EtherNet/IP start/stop

1 = Disconnect 1 = During initialization 1 = Establish 1 = Enabled 1 = Preparation done 1 = Preparation done

0 = Connect 0 = Completed 0 = Not establish 0 = Disable 0 = Unusable 0 = Unusable

1 = Preparation done 1 = Preparation done

0 = Unusable 0 = Unusable

1 = Preparation done 1 = Communicating (normal) 1 = Stop 1 = Exists 1 = Controllable

0 = Other than preparation done 0 = Other than the above 0 = Other than the above 0 = Does not exist 0 = Not controllable

19-22

20
20 Appendix

Appendix

20-1 List of System Relays

WS0 Device No. SR0 SR1 SR2 SR3 SR4 SR5 SR6 SR7
SR8
SR9

Name Self-diagnostic error flag Unit alarm occurrence Unit error occurrence Unit warning occurrence Unit verify error occurrence Unit installation error detection Memory configuration mismatch detection relay Operation error flag (hold type)
Operation error flag (non-hold type)
Carry flag (CY flag)

Description
Turns ON when a self-diagnostic error occurs. The self-diagnostic error code is saved in system data register SD0.
Turns ON when a unit alarm is detected. The slot number of the unit where an alarm has occurred is saved in the system data register SD1.
Turns ON when a unit error is detected. The slot number of the unit where an error has occurred is saved in the system data register SD2.
Turns ON when a unit warning is detected. The slot number of the unit where a warning has occurred is saved in the system data register SD3.
Turns ON when an I/O verification error is detected. The slot number of the unit where an I/O verification error has occurred is saved in the system data register SD4.
Turns ON when a unit installation error is detected. The slot number of the unit where an error has occurred is saved in system data register SD5.
Turns ON when memory configuration mismatch is detected. Information about the setting where an error has occurred is saved in system data register SD6.
Turns ON when an operation error occurs after the unit has started operating, and remains ON while the unit operation continues. The program block (PB) number where an error has occurred is saved in the system data SD7, and the address is saved in system data registers SD8 to SD9. It indicates the first operation error that has occurred.
Turns ON every time an operation error occurs. The program block (PB) number where an operation error has occurred is saved in system data register SD10, and the address is saved in system data registers SD11 to SD12. Every time a new error occurs, the data are updated. It does not turn OFF even if the instruction is normally completed after the occurrence of the error(s). In order to check if any error has occurred in a specific instruction, either see address data saved in the SD, or clear error flags using ERR instruction immediately before the specific instruction, and check error flags immediately after executing the instruction.
Used in shift instruction and rotate instruction with a carry flag. The flag can also be operated in carry set instruction and carry reset instruction. It is not set in overflow or underflow of operation results. Turns ON when an error occurs during the execution of Ethernet communication instruction. The error code is stored in the system data register SD29.

SRA

> flag

Executes comparison instruction, and turns ON if the result is larger.

SRB

= flag

Executes comparison instruction, and turns ON if the result is equal. Executes comparison instruction, and turns ON if the result is '0'.

SRC

< flag

Executes comparison instruction, and turns ON if the result is smaller.

SRD SRE SRF

Auxiliary timer instruction flag Error batch alarm relay
Constant scan error flag

Executes the auxiliary timer instruction (SPTM), and turns ON after the lapse of a set time. Turns OFF when the execution condition turns OFF.
Turns ON when any of the error alarm relays E0 to E4095 turns ON. Turns OFF when execution conditions go OFF.
Turns ON if scan time exceeds the setting during constant scan. It also turns ON if '0' is set in FP7 configuration.

20-2

List of System Relays

WS1 Device No. SR10 SR11 SR12 SR13
SR14
SR15
SR16 SR17
SR18

Name Normally ON relay Normally OFF relay Scan relay Initial pulse relay (ON)
Initial pulse relay (OFF)
Step ladder Initial pulse relay (ON) PB initial relay (ON) PB initial relay (OFF)

Description
Normally ON.
Normally OFF.
Turns ON and OFF alternately at each scan. Turns ON for only the first scan after operation (RUN) has been started, and turns OFF for the second and subsequent scans. Turns OFF for only the first scan after operation (RUN) has been started, and turns ON for the second and subsequent scans.
Turns ON in the first scan only, following startup of any single process, during step ladder control.
Turns ON at the start of execution of a program block. Turns OFF in the next scan.
Turns OFF at the start of execution of a program block. Turns ON in the next scan.

0.01-sec clock pulse relay Clock pulse with a 0.01-second cycle.

SR19

0.02-sec clock pulse relay Clock pulse with a 0.02-second cycle.

SR1A

0.1-sec clock pulse relay

Clock pulse with a 0.1-second cycle.

SR1B

0.2-sec clock pulse relay

Clock pulse with a 0.2-second cycle.

SR1C

1-sec clock pulse relay

Clock pulse with a 1-second cycle.

SR1D

2-sec clock pulse relay

Clock pulse with a 2-second cycle.

SR1E SR1F

1-min clock pulse relay Not used

Clock pulse with a 1-minute cycle.

20-3

Appendix

WS2 Device No. SR20 SR21 SR22 SR23
SR24
SR25
SR26 SR27 SR28

Name

Description

CPU operation mode
Operation program memory RTC data error Power supply unit service lifetime warning
RTC backup battery error flag (hold type)
RTC backup battery error flag (non-hold type)
SNTP time updating failure
SNTP time update completed (Not used)

ON: RUN mode OFF: PROG mode
ON: SD memory card OFF: ROM
Turns ON if an error is detected in calendar timer data when the unit is powered on.
Turns ON when it is detected that a power supply unit is close to its lifetime.
Turns ON when an RTC backup battery error is detected. Even if you choose not to send notification of a battery error in the configuration menu, this is ON when the battery runs out. Once a battery error has been detected, this is held even after recovery has been made. It goes OFF if the power supply is turned off.
Turns ON when an RTC backup battery error is detected. Turns OFF in normal conditions. Even if you choose not to send notification of a battery error in the system register, this is ON when the battery runs out.
Turns ON if acquisition of time data has failed during time synch via LAN port. Turns OFF in normal conditions.
Turns OFF when time is being updated with SNTP, and turns ON when the update is completed. (Note 1)

SR29

Forcing flag

Turns ON when forced input/output operation is being performed.

SR2A

Interrupt enable

Turns ON when the interrupt trigger is enabled.

SR2B SR2C SR2D SR2E

Interrupt error flag
Interrupt enable flag
Fixed cycle execution type PB active (Not used)

Turns ON when an interrupt error occurs. Turns ON when an Interrupt program is being executed. This flag is available only in a fixed cycle execution type PB or in an INT program.
Turns ON when a fixed cycle execution type PB (program block) is being executed.

SR2F

Rewriting during RUN done Turns ON for only the first scan following the completion of rewriting during RUN.

(Note 1): Available in the CPU unit Ver.3.03 or later.

20-4

List of System Relays

WS3 Device No. SR30 SR31 SR32 SR33 SR34 SR35 SR36 SR37 SR38 SR39
SR3A
SR3B
SR3C
SR3D SR3E SR3F
WS5 Device No. SR50 SR51 SR52 SR53 SR54 SR55

Name

Description

SD slot cover status flag
SD memory card mounting flag
SD memory card recognition completed flag SD memory card recognition result flag SD memory card write protection flag
SD memory card type
SD memory card file system

ON: Cover opened OFF: Cover closed
ON: SD memory card mounted OFF: SD memory card not mounted
ON: Completed recognition of an SD memory card OFF: Other than the above
ON: Error OFF: Normal
ON: Protected OFF: Not protected
ON: SD OFF: SDHC
ON: FAT16 OFF: FAT32

FTP server login

Turns ON while the unit is logged in to an FTP server.

Logging trace execution Logging trace start
SD memory card access instruction active
SD memory card access instruction execution done
SD memory card access instruction execution result
SD card logged graph data aggregation in progress

ON: Being executed OFF: Stopped
ON: Starts OFF: Stopped
This relay is used to check whether other SD memory card access instructions are being executed or not. ON: Being executed OFF: Stopped
This relay is used to check the completion of an SD memory card access instruction with the change of this flag (ON to OFF), and used to turn OFF the trigger of the instruction. ON: Completed OFF: Being executed
The execution result of an SD memory card access instruction is stored. If an error occurs, the error code is stored in system data register SD30. ON: Error OFF: Normal
ON: Data aggregation in progress
OFF: Data aggregation completed

(Not used)

SD memory card access active Power OFF

Turns ON if the CPU unit is powered off while accessing an SD memory card.

Name
MW unit error alarm relay (1st unit)
MW unit error alarm relay (2nd unit)
MW unit error alarm relay (3rd unit)
MW unit error alarm relay (4th unit)
MW unit error alarm relay (5th unit)
MW unit error alarm relay (6th unit)

Description
These relays turn ON when an error occurs in the FP7MW unit. Error codes and unit numbers are stored in system data registers SD90 to SD95.

20-5

Appendix

WS10 (Logging trace control relays: For LOG0)

Device No.

Name

Description

SR100

Logging trace execution

Turns ON when the logging trace is performed. Other relays in LOGn turn OFF during the startup operation. Storing data in the buffer memory is executed while this relay turns ON.

SR101

SD memory card logging active

Turns ON when writing files to a SD card becomes enabled after the logging trace execution relay turned ON (buffer logging was enabled).

SR102

Logging trace done

Turns ON after the completion of file writing when stopping the logging trace is requested or it is automatically stopped.

SR103

Logging over-speed relay

· Turns ON when the buffer logging speed exceeds the writing speed to an SD memory card in logging operations. Turns ON when the amount of data previously stored and the amount of data stored this time increase.
· Turns ON at the timing of buffer logging, and turns OFF at the timing of buffer logging or the end of scan.

SR104

Buffer overflow

· Turns ON when the buffer memory has been used up in logging operations. At that time, new data cannot be stored.
· The value of the buffer overflow counter SD120 is incremented (+1). In that case, writing to an SD memory card does not stop.
· Turns OFF at the end of scan when buffer vacancy occurs while writing to an SD memory card is performed. The buffer overflow counter SD120 is cleared to 0.
· After buffer vacancy occurred, data logging is executed at the timing of logging to the buffer.

SR105

Logging trace error

Turns ON when an error is detected during the logging trace and stops the logging trace.

SR106

No free space on the SD memory Turns ON when an SD memory card is running out of free space during the

card

logging trace, and stops the logging trace.

SR107

Device and trigger setting error

Turns ON when an error is detected in setting values during the startup operation. The error relay SR105 also turns ON. At that time, the execution relay SR100 does not turn ON as the logging trace function cannot be started.

SR108

Tracing stop trigger monitor

Monitors a registered trace stop trigger during tracing. Turns ON when conditions are met.

SR109

Trace data acquisition completed

Turns ON after logging data for a specified number of times after detecting the tracing stop trigger during the execution of trace.

SR10A to SR10F

(Not used)

20-6

List of System Relays

WS11 to WS25 (Logging trace control relays: For LOG1 to LOG15)

Device No.

Name

Description

SR110 to SR119

Logging trace control relay for LOG1

SR120 to SR129

Logging trace control relay for LOG2

SR130 to SR139

Logging trace control relay for LOG3

SR140 to SR149

Logging trace control relay for LOG4

SR150 to SR159

Logging trace control relay for LOG5

SR160 to SR169

Logging trace control relay for LOG6

SR170 to SR179

Logging trace control relay for LOG7

SR180 to SR189

Logging trace control relay for LOG8

For the details of each control relay, refer to the previous page.

SR190 to SR199

Logging trace control relay for LOG9

SR200 to SR209

Logging trace control relay for LOG10

SR210 to SR219

Logging trace control relay for LOG11

SR220 to SR229

Logging trace control relay for LOG12

SR230 to SR239

Logging trace control relay for LOG13

SR240 to SR249

Logging trace control relay for LOG14

SR250 to SR259

Logging trace control relay for LOG15

20-7

Appendix

WS90 Device No. SR900
SR901
SR902
SR903
SR904
SR905
SR906
SR907 SR908 to SR90F

Name Operation history No. 0 active relay Operation history No. 1 active relay Operation history No. 2 active relay Operation history No. 3 active relay Operation history No. 4 active relay Operation history No. 5 active relay Operation history No. 6 active relay Operation history No. 7 active relay (Not used)

Description
ON: Activated OFF: Stopped

WS91 Device No. SR910
SR911
SR912
SR913
SR914
SR915
SR916
SR917 SR918 to SR91F

Name
Operation history No. 0 device setting error relay
Operation history No. 1 device setting error relay
Operation history No. 2 device setting error relay
Operation history No. 3 device setting error relay
Operation history No. 4 device setting error relay
Operation history No. 5 device setting error relay
Operation history No. 6 device setting error relay
Operation history No. 7 device setting error relay
(Not used)

Description
ON: Abnormal OFF: Normal

20-8

WS100 to WS149

Device No.

Name

SR1000 to SR1499

Program Block PB active relay

List of System Relays

Description

Active program blocks can be monitored. SR1000 to SR1499 are allocated to 500 PBs.

Device No.

PB No.

SR1000

PB 000

SR1001

PB 001

SR1002

PB 002

-----

-----

SR1009

PB 009

SR1010

PB 010

SR1011

PB 011

-----

-----

-----

-----

SR1498

PB498

SR1499

PB499

20-9

Appendix

20-2 List of System Data Registers

SD0 to SD28

Device No.

Name

Description

SD0

Self-diagnostic error code

When a self-diagnostic error occurs, the error code is stored.

SD1

Alarm occurrence unit slot No.

Saves the slot number of the unit where an alarm has occurred.

SD2

Error occurrence unit slot No.

Saves the slot number of the unit where an error has occurred.

SD3

Warning occurrence unit slot No. Saves the slot number of the unit where a warning has occurred.

SD4

Verify error occurrence unit slot No. Saves the slot number of the unit where a verification error has occurred.

SD5

Installation error detection slot No. Saves the slot number of the unit where an installation error was detected.

Saves information about the setting where an error has occurred when memory configuration mismatch is detected.

Bit No.

Description

0

Logging trace setting

SD6

Memory configuration mismatch

1

details

2

FTPc setting HTTPc setting

3

Mail c setting

4

EIP setting

5

W-PLC link setting

6

W2-PLC link setting

SD7

Operation error occurrence PB number (hold type)

Saves the PB number where the first operation error occurred after starting operation.

Operation error occurrence

SD8

address (hold type)

(32-bit lower address)

Operation error occurrence

SD9

address (hold type)

(32-bit upper address)

Saves the address where the first operation error occurred after starting operation. Monitor as 32-bit data.

SD10

Operation error occurrence PB number (non-hold type)

Saves the PB number where an operation error has occurred. This register is updated every time an error occurs. This register is set to 0 at the beginning of a scan.

SD11 SD12

Operation error occurrence address (non-hold type) (32-bit lower address)
Operation error occurrence address (non-hold type) (32-bit upper address)

Saves the address where an operation error has occurred. This register is updated every time an error occurs. This register is set to 0 at the beginning of a scan. Monitor as 32-bit data.

SD13 to SD18

(Not used)

SD19 SD20 SD21

RING counter (2.5 ms) RING counter (10 s) RING counter (100 s)

The stored value is incremented by 1 every time a unit of time elapses. (H0 to HFFFF) The current values of SD19 to SD21 can be read only when SD19 to SD21 are specified and read by the MV instruction. When another instruction is used to read their values, the values at the beginning of a scan are read.

SD22 SD23 SD24

Scan time (current value) Scan time (minimum value) Scan time (maximum value)

Saves the current value.
Saves the minimum value.
Saves the maximum value.

[Stored value (decimal)] x 10 s. The scan time display shows the operation cycle time only in RUN mode. The maximum and minimum values are cleared when the mode is switched between RUN and PROG.

SD25 to SD26

(Not used)

SD27

Execution cycle of fixed cycle execution type PBs

Saves the execution cycle of fixed cycle execution type PBs.

SD28

(Not used)

(Note 1): SD0 to SD5 are available only when the corresponding system relays SR0 to SR5 are ON.

20-10

List of System Data Registers

SD29 Device No.
SD29

Name

Description

Ethernet communication error code

Saves the error code when the Ethernet communication instruction is executed.

SR9

SD29

0: Normal 0: Normal

1: Incorrect IP address is specified.

2: Incorrect subnet mask is specified.

3: Incorrect default gateway is specified.

4: Incorrect IP addresses are combined.

1: Error

10: Ethernet cable is disconnected. 11: Ethernet is being initialized.

12: IP address is not established.

13: Client is not started.

14: Connection is being processed.

15: Connection is occupied.

20-11

Appendix

SD30 to SD39

Device No.

Name

SD30

SD memory card access instruction Execution result

SD31 to SD39

(Not used)

SD40 to SD49

Device No.

Name

SD40

Slot number

SD41

COM port number or user connection number

SD42 to SD49

(Not used)

Description

Saves an error code if an error occurs when an SD memory card access instruction is being executed.

Value Name

Detailed information

0

Normal end

1

No SD memory card

No SD memory card is inserted, or the cover is open.

2

SD memory card write-protected

The SD memory card is write protected.

Code that cannot be specified for a

3

Specified file name error

file name is used. There is too many hierarchies for the

specified folder.

4

No specified file

The specified file does not exist.

5

File already exists

The specified file already exists.

6

File read error

7

File write error

Write protect attributes are set for the specified file.

8

File access position error

The reading position or writing position is incorrect.

9

SD memory card capacity shortage

Cannot be executed because there is not enough free space on the SD memory card.

10

Reading format error

Error in the conversion format when reading a file.

A file that is being logged is

11

File access competition

specified. A file that is being accessed via FTP

is specified.

12

The specified directory is A directory or a file exists under the

not empty.

directory to be deleted.

-1 to -99

Others

Description
Saves the slot number that is specified by the operand [S1] for the UNITSEL instruction. CPU with built-in SCU: U0 to U2 CPU with built in ET-LAN: U100 Serial Communication Unit (SCU): U1 to U64
Saves the COM port number or the user connection number that is specified by the operand [S2] for the UNITSEL instruction. CPU with built in SCU: U0 to U2 CPU with built-in ET-LAN: U1 to U216 Serial Communication Unit (SCU): U1 to U4

20-12

List of System Data Registers

SD50 to SD99

Device No.

Name

SD50

Calendar timer (year)

SD51

Calendar timer (month)

SD52

Calendar timer (day)

SD53

Calendar timer (hours)

SD54

Calendar timer (minutes)

SD55

Calendar timer (seconds)

SD56

Calendar timer setting (day-of-the-week)

SD60

Total number of error alarm relays that are turned ON

SD61

First turned-ON error alarm relay

Description
· The year, month, day, hour, minute, second and day-of-the-week data for the calendar timer is stored as 16-bit binary data. The built-in calendar timer operates correctly until the year 2099 and supports leap years.
· The calendar timer can be set (time synch) by writing desired values using the programming tool or a program based on calendar setting instruction (TIMEWT).
Saves the total number of error alarm relays that are turned ON. The upper limit is 4096 relays. When SD60 is specified for the RST instruction, all data in the error alarm buffer is cleared. Saves the number of the error alarm relay that has been turned ON first. When SD61 is specified for the RST instruction, relays in the error alarm buffer are cleared.

SD62

2nd to 19th turned-ON error alarm

to SD79 relays

Saves the numbers of the error alarm relays that are turned ON. When a device number is specified for the RST instruction, the corresponding relay in the error alarm buffer is cleared. The following table shows the relationship between the device numbers of system data registers (SD) and error alarm relays.

Device No.

Error alarm relay

SD62

2nd

SD63

3rd

SD64

4th

SD65

5th

SD66

6th

SD67

7th

SD68

8th

SD69

9th

SD70

10th

SD71

11th

SD72

12th

SD73

13th

SD74

14th

SD75

15th

SD76

16th

SD77

17th

SD78

18th

SD79

19th

SD80 SD81 SD82 SD83 SD84 SD85 SD86 to SD89 SD90 SD91 SD92 SD93 SD94
SD95

For error alarm relays

Calendar timer (year) Calendar timer (month) Calendar timer (day) Calendar timer (hours) Calendar timer (minutes) Calendar timer (seconds)

Store the time when an error alarm relay that is stored in SD61 turns ON.

(Not used)

FP7MW unit error alarm register No. 1 FP7MW unit error alarm register No. 2 FP7MW unit error alarm register No. 3 FP7MW unit error alarm register No. 4 FP7MW unit error alarm register No. 5
FP7MW unit error alarm register No. 6

Store an error code in the high-order byte and a unit number in the low-order byte when an error occurs in the FP7MW unit.

bit no. 15

8 7

0

Error code Unit No.

SD96 to SD99

(Not used)

20-13

Appendix

SD100 to SD115 and SD120 to SD135 (For logging trace control)

Device No.

Name

Description

SD100

Buffer free space for LOG0

SD101

Buffer free space for LOG1

SD102

Buffer free space for LOG2

SD103

Buffer free space for LOG3

SD104

Buffer free space for LOG4

SD105

Buffer free space for LOG5

SD106

Buffer free space for LOG6

SD107 SD108

Buffer free space for LOG7 Buffer free space for LOG8

Stores free space of buffer memory during logging. Unit: kB

SD109

Buffer free space for LOG9

SD110

Buffer free space for LOG10

SD111

Buffer free space for LOG11

SD112

Buffer free space for LOG12

SD113

Buffer free space for LOG13

SD114

Buffer free space for LOG14

SD115

Buffer free space for LOG15

SD120

Buffer overflow counter for LOG0

SD121

Buffer overflow counter for LOG1

SD122

Buffer overflow counter for LOG2

SD123

Buffer overflow counter for LOG3

SD124

Buffer overflow counter for LOG4

SD125

Buffer overflow counter for LOG5

SD126 SD127 SD128 SD129

Buffer overflow counter for LOG6 Buffer overflow counter for LOG7 Buffer overflow counter for LOG8 Buffer overflow counter for LOG9

· Saves the number of times buffer overflow flags (e.g. SR104 for LOG0) turn ON.
· For checking the number of times logging data is lost during the buffer overflow, register the buffer overflow counter as logging data.

SD130

Buffer overflow counter for LOG10

SD131

Buffer overflow counter for LOG11

SD132

Buffer overflow counter for LOG12

SD133

Buffer overflow counter for LOG13

SD134

Buffer overflow counter for LOG14

SD135

Buffer overflow counter for LOG15

20-14

List of System Data Registers

SD220 to SD254

Device No.

Name

SD220

Operation history No. 0 history count

SD221

Operation history No. 1 history count

SD222

Operation history No. 2 history count

SD223

Operation history No. 3 history count

SD224

Operation history No. 4 history count

SD225

Operation history No. 5 history count

SD226

Operation history No. 6 history count

SD227

Operation history No. 7 history count

SD228 to SD229

(Not used)

SD230

Operation history No. 0 vacant buffer count

SD231

Operation history No. 1 vacant buffer count

SD232

Operation history No. 2 vacant buffer count

SD233

Operation history No. 3 vacant buffer count

SD234

Operation history No. 4 vacant buffer count

SD235

Operation history No. 5 vacant buffer count

SD236

Operation history No. 6 vacant buffer count

SD237

Operation history No. 7 vacant buffer count

SD238 to SD239

(Not used)

SD240

Operation history No. 0 update counter

SD241

Operation history No. 1 update counter

SD242

Operation history No. 2 update counter

SD243

Operation history No. 3 update counter

SD244

Operation history No. 4 update counter

SD245

Operation history No. 5 update counter

SD246

Operation history No. 6 update counter

SD247

Operation history No. 7 update counter

SD248 to SD254

(Not used)

Description Store the number of accumulated operation histories.
Store the number of vacant buffers for operation histories.
Save the current count plus 1 each time an operation history is accumulated.

20-15

Appendix

20-3 List of Error Codes

 Self-diagnostic error code
Error codes 1 to 6

Code

Name

Operation

1

CPU hardware error 1

Stop

2

CPU hardware error 2

Stop

I/O bus power supply error

3

(including the case without the Stop

end cover)

4

Over the limit on unit installation

Stop

5

Project data error

Stop

6

Expansion unit power supply synchronization error

Stop

Error contents and steps to take
There may be a hardware problem. Please contact your dealer.
There may be an error in the I/O bus. For example, the end unit may not be attached. Check the installation state of the unit again. This error also occurs when an expansion cable is removed during operation.
The unit installation limit may be exceeded. Check the configuration again.
Turns ON when there is an error in project data.
Turns ON when there is an error in the expansion block side such that the power to the expansion unit is not ON or the expansion cable is not connected correctly when the power turns on. The waiting time until the power turns on can be set in the I/O map configuration dialog box.

Error codes 20 to 27

Code

Name

20

Syntax error

Operation
Stop Auto clear

Error contents and steps to take
A sequence program with a syntax error has been written. Change to PROG. mode and correct the error.

21

Duplicated output

Stop Auto clear

The same relay is used more than once in the OT instruction or other instructions. Change to PROG. mode and check the program. Or, set the duplicated output to "enable" in the CPU configuration.
This error code occurs for the following devices and instructions: - Operation devices (X, Y, R, L), timer/counter instructions, SSTP instruction

For instructions which must be used in a pair, one instruction is either missing or in an incorrect position. Change to PROG. mode and enter the two instructions which must be used in a pair in the correct positions.

22

Not paired

Stop Auto clear

This error code occurs for the following instructions and cases: - MC and MCE are not paired. - LBL for LOOP or for JP does not exist in the same area (regular program area, subroutine area, or interrupt program area). - A subroutine does not exist for CALL or FCALL. - STPE does not exist for SSTP.

An instruction that must be written in a specific area has been written in a different area. Change to PROG. mode and check the program.

24

Program area error

Stop Auto clear

This error code occurs for the following instructions and cases: - LBL, LOOP, JP, MC, or MCE exists in a step ladder area. - MC is nested more than 16 levels deep. - CNDE is in an area other than the regular program area. - EDPB is in an area other than empty areas. - ED is in a subroutine area or in an interrupt program area. - SBL is in an area other than empty areas or subroutine areas. - An interrupt program is in an area other than empty areas or interrupt program areas. - RET is in an area other than subroutine areas. - IRET is in an area other than interrupt program areas. - STPE is in an area other than step ladder areas.

In the program, high-level instructions, which are every scan execution

type or differential execution type, are programmed to be triggered by one

25

High-level instruction execution Stop

combination error

Auto clear

contact. (e.g. F0 (MV) and P0 (PMV) are programmed using the same trigger continuously.) Correct the program so that the every scan

execution type instructions and differential execution type instructions are

triggered separately.

27

Compile memory full error

Stop Auto clear

The program is too large to compile in the program memory. Change to PROG. mode and reduce the total number of steps for the program.

(Note): For errors that are indicated with "Auto clear" in the operation column, the error is cleared when the power is turned off or when the mode is switched to RUN mode after the error condition is corrected.

20-16

List of Error Codes

Error codes 40 to 55

Code

Name

Operation

Error contents and steps to take

40

Copy failed Cover opened

Stop

The copy cannot be executed because the card cover is open. Close the

Auto clear cover.

41

Copy failed No SD card

Stop

The copy cannot be executed because there is no SD memory card. Insert

Auto clear an SD memory card.

Copy failed

42

SD card read error

(FAT/File error)

Stop

The copy cannot be executed because the SD memory card is broken.

Auto clear Insert a normal SD memory card.

43

Copy failed No file

Stop

The copy cannot be executed because there is no file in the SD memory

Auto clear card. Check if any project file is stored.

44

Copy failed Password inconsistency (Limited distribution function)

Stop Auto clear

The copy cannot be executed because the password for the project file stored in the SD memory card does not coincide with the password for the execution project stored in the internal ROM. Check the password setting.

45

Copy failed Incorrect project data

Stop

The copy cannot be executed because the project data stored in the SD

Auto clear memory card is abnormal. Check the contents of the project data.

50

SD operation disabled Cover opened

Stop

The SD memory card operation cannot be executed because the card

Auto clear cover is open. Close the cover.

51

SD operation disabled No SD card

Stop

The SD memory card operation cannot be executed because there is no SD

Auto clear memory card. Insert an SD memory card.

SD operation disabled

52

SD card read error

(FAT/File error)

Stop

The SD memory card operation cannot be executed because the SD

Auto clear memory card is broken. Insert a normal SD memory card.

53

SD operation disabled No file

Stop

The SD memory card operation cannot be executed because there is no file

Auto clear in the SD memory card. Check if any project file is stored.

54

SD operation disabled Password inconsistency (Limited distribution function)

Stop Auto clear

The SD memory card operation cannot be executed because the password for the project file stored in the SD memory card does not match the password for the execution project stored in the internal ROM. Check the password setting.

55

SD operation disabled Incorrect project data

Stop Auto clear

The SD memory card operation cannot be executed because the project data stored in the SD memory card is abnormal. Check the contents of the project data.

60

Acquired I/O map overlaps or exceeds

Stop

There is an error in the I/O map that is acquired in the CPU unit. Check the

Auto clear registration contents.

61

Registered I/O map overlaps or exceeds

Stop

There is an error in the I/O map that is registered in the CPU unit. Check the

Auto clear registration contents.

62

Interrupt Error 1

Stop Auto clear

There may be a hardware problem. Please contact your dealer.

63

Interrupt Error 2

Stop

The interrupt program definition by INTPG instruction may be disappeared

Auto clear by rewriting during RUN. Check the program.

(Note): For errors that are indicated with "Auto clear" in the operation column, the error is cleared when the power is turned off or before the same operation is performed again after the error condition is corrected.

20-17

Appendix

Error codes 80 to 106

Code

Name

Operation

Error contents and steps to take

80

Unit alarm occurrence

Selection (Default: Stop)

An alarm has occurred on an attached unit. Check the condition of the unit for the slot number that is stored in system data register SD1.

81

Unit error occurrence

Selection (Default: Stop)

A unit error has occurred on an attached unit. Check the condition of the unit for the slot number that is stored in system data register SD2. Check the settings of the CPU configuration.

82

Unit verify error detected

Selection (Default: Stop)

Wiring condition of the unit has changed compared to when the power was turned on. Check the condition of the unit for the slot number that is stored in system data register SD4.

83

The number of registered units Selection

mismatched

(Default: Stop)

The number of units is different from what is registered in the I/O map. Check the I/O map and the installation states of the units.

84

Unit initialization completion timeout

Selection (Default: Stop)

An error has occurred in the initialization operation of the unit. Check the condition of the unit.

85

Target unit mismatched for unit Selection

configuration data

(Default: Stop)

The unit does not match the configuration data of the unit. Check the I/O map and the configuration data.

86

Operation error

Selection (Default: Stop)

An operation error has occurred. The cause of the operation error varies depending on the instructions. Refer to the Programming Manual and other manuals to correct the cause of the error. The PB and address where an operation error has occurred are stored in system data registers SD7 to SD12.

100

Bus current error

Selection (Default: Continue)

There may be a bus error. Please contact your dealer.

104

Service power supply current error

Selection (Default: Continue)

An error was detected on the power supply terminal for GT. Check if the terminal is correctly connected.

105

CPU temperature error 1

106

CPU temperature error 2

Selection (Default: Continue)
Selection (Default: Continue)

A temperature rise was detected in the hardware. Normally, select "Continue."

(Note 1): For errors that are indicated with "Selection" in the operation column, "Stop" or "Continue" can be selected in the configuration menu.

20-18

List of Error Codes

Error codes 120 to 129, 132 to 134,1000 to 2999

Code

Name

Operation

120

RTC data error

Continue

121

Power supply unit service lifetime warning

Continue

122

Battery voltage drop

Continue

123

Gold capacitor voltage drop Continue

124

SNTP time acquisition failure Continue

125

Logging settings mismatch Continue

126

Logging data error

Continue

127

Comment data error

Continue

128

PLC link area duplicate error Continue

129

Memory configuration mismatch

Continue

132

Operation history buffer error Continue

133

Operation history configuration data error

Continue

Operation historical data

134

error (when settings are

Continue

loaded from the SD card)

1000 to 1999

Errors by ERR instruction

Stop

2000 to 2999

Errors by ERR instruction

Continue

(Note 1): If an RTC data error is detected, April 1, 2012 is set.

Error contents and steps to take An error in the clock data of the calendar timer was detected. An alarm has indicated that the power supply unit reaches its lifetime. Replace the power supply unit. The voltage of the optional battery has decreased. Replace the battery. If the battery is not used, specify "Not announce" for the battery error alarm in the CPU configuration. An alarm has indicated that the gold capacitor voltage in the CPU unit is low. Recharge the CPU unit. The acquisition of time data has failed during time synch via LAN port. An error has been detected in logging data settings. An error has been detected in logging data. An error has been detected in comment data. There are duplicate areas for any of the following areas of the network devices for the PLC link: - PLC link area - PLC link operation state that is transferred automatically - Error information
A mismatch has been detected in the memory configuration.
An error has been detected in operation history buffers.
An error has been detected in operation history configuration data. Check the operation history settings.
An error has been detected in the operation historical data stored on the SD card.
An error that has been set by the ERR instruction has occurred in a user program. Take countermeasures according to the specified detection condition.

20-19

Appendix

 MEWTOCOL-COM communication error codes

Code Name

Description of error

!26

Unit number setting error

A command that cannot be used for global (station number FF) was received.

!40

BCC error

Transmission error occurred in received data.

!41

Format error

Command that does not match the format was received.

!42

NOT support error

An unsupported command was received.

!43

Multiple frames procedure error Another command was received during the multiple-frame processing.

!60

Parameter error

Specified parameter does not exist, or cannot be used.

!61

Data error

There is an error in the contact, data area, data number, size, range or format specification.

!62

Registration over error

The number of registration exceeded the restriction, or operation is performed without registration.

!63

PC mode error

Invalid command was executed in RUN mode or when copying data in an SD memory card.

!64

External memory error

There is an abnormality in hardware. There may be an abnormality in the internal ROM (F-ROM).
At the time of ROM transfer, a specified content exceeds the capacity.
A reading/writing error occurred.

!65

Protect error

Write operation was performed to a program or system register when the unit is protected (password setting).

!66

Address error

The code format of address data is incorrect, or the range specification is incorrect.

!67

Missing program error/Missing Reading message or starting/reading sampling trace was executed when no

data error

program/data is registered.

!68

Rewriting is disabled while in RUN mode

Editing an instruction that cannot be rewritten during RUN (ED, SUB, RET, INT, IRET, SSTP or STPE) is attempted. Nothing is written to the control unit.

!71

Exclusive access control error

A command that cannot be processed simultaneously with the command in process was executed.

!78

No SD card error

SD card is not inserted.

!80

Guarantee data abnormality error

Guarantee data (CRC code) is incorrect.

!81

No effective data error

There is no effective data.

!90

Logging trace error

Invalid command was executed during the logging trace operation.

!92

Unsupported SD card error

It is not an industrial SD card by Panasonic.

 MEWTOCOL7-COM communication error codes

Code Name

Description of error

41

Format error

A command that does not match the format was received.

42

NOT support error

An unsupported command was received.

60

Parameter error

Specified parameter does not exist, or cannot be used.

61

Data error

There is an error in the contact, data area, data number, size, range or format specification.

62

Registration over error

The number of registration exceeded the restriction, or operation is performed without registration.

63

PC mode error

An invalid command was executed in RUN or PROG mode.

71

Exclusive access control error

A command that cannot be processed simultaneously with the command in process was executed.

80

Guarantee data abnormality error

Guarantee data (CRC code) is incorrect.

91

Expansion slave unit missing error

A slot number in which an expansion slave unit is not installed was specified.

20-20

ASCII Code Table, JIS8 Code Table

20-4 ASCII Code Table, JIS8 Code Table

 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

0010 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

/

?

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

 Reference Table: JIS8 codes

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.

20-21

Appendix 20-22

Index
/
/ ..............................................................................3-7

OT .......................................................................... 3-20

OT .......................................................................... 3-20
A
ABCD ....................................................................14-16 ABIN ......................................................................14-21 ABS ...........................................................................7-4 ACHK ....................................................................14-34 ACOS ......................................................................11-6 ADD ........................................................................... 6-2 AHEX ..................................................................... 14-11 ALT .......................................................................... 3-24 AN .............................................................................3-2 AN/ ............................................................................3-2 AN< .......................................................................3-106 AN<= .....................................................................3-106 AN<> .....................................................................3-106 AN= .......................................................................3-106 AN> .......................................................................3-106 AN>= .....................................................................3-106 AN ............................................................................ 3-5 AN ............................................................................ 3-5 AND ......................................................................... 6-30 ANS .........................................................................3-14 ASIN ........................................................................11-5 ATAN .......................................................................11-7 ATAN2 .....................................................................11-8 ATOB ..................................................................... 14-35
B
BAND ....................................................................10-51 BCC ......................................................................... 14-2 BCD ........................................................................... 7-6 BCDA ....................................................................14-13 BCDADD .................................................................6-18 BCDDEC .................................................................6-28 BCDDIV ...................................................................6-24 BCDINC ................................................................... 6-26 BCDMUL .................................................................6-22 BCDSUB .................................................................6-20 BCMP ........................................................................4-8 BCU ......................................................................... 10-5 BDIS ........................................................................7-18 BIN ............................................................................7-7 BINA ......................................................................14-19 BITL ......................................................................... 8-12 BITR ........................................................................8-10

Index
BKEXT .................................................................... 5-22 BKMV...................................................................... 5-10 BKMV16.................................................................. 5-24 BSL ........................................................................... 8-8 BSR .......................................................................... 8-6 BSWAP................................................................... 5-29 BTI ............................................................................ 9-6 BTM ........................................................................ 5-14 BTOA .................................................................... 14-23 BTR........................................................................... 9-4 BTS........................................................................... 9-2 BTT ........................................................................... 9-7 BUFW ..................................................................... 8-38 BUNI ....................................................................... 7-16
C
C ............................................................................ 2-17 CADD...................................................................... 12-4 CALL....................................................................... 3-90 CCOPY ................................................................. 18-41 CDTRD ................................................................... 18-4 CDTWT................................................................... 18-2 CE........................................................................... 2-30 CFDEL .................................................................. 18-30 CFLS..................................................................... 18-47 CFREE.................................................................. 18-45 CFREEK ............................................................... 18-46 CIPMGET ........................................................... 17-136 CIPMSET............................................................ 17-132 CLC........................................................................... 9-9 CLOSE.................................................................. 17-35 CMKDIR................................................................ 18-26 CMP.......................................................................... 4-2 CMPR ..................................................................... 8-30 CMPW .................................................................... 8-32 CMV...................................................................... 18-43 CNDE...................................................................... 3-75 COLM ..................................................................... 7-24 COMB ..................................................................... 6-38 Common Information for Subroutine Instructions.... 3-88 COMOUT .............................................................. 3-105 CONFIG ................................................................ 15-53 CONSET............................................................... 17-27 COPY...................................................................... 5-12 COS ........................................................................ 11-3 COSH ................................................................... 11-10 CPR ...................................................................... 18-32 CRC ........................................................................ 14-5 CRD ...................................................................... 18-18 CRD1 .................................................................... 18-34 CREN.................................................................... 18-39 CRMDIR ............................................................... 18-28 CS........................................................................... 2-29 CSTP ...................................................................... 3-77 CSUB...................................................................... 12-5 CT ........................................................................... 3-40 CT16 ....................................................................... 3-48 CWT........................................................................ 18-6
D
DEC ........................................................................ 6-17
20-23

Index
DECO ........................................................................7-8 DEFBUF ..................................................................8-34 DEFRBUF ................................................................8-42 DEG .......................................................................11-18 DF .................................................................... 2-38, 3-8 DF/ .............................................................................3-8 DFI .............................................................................3-8 DFIX ......................................................................11-42 DFLT ......................................................................11-31 DGT .........................................................................5-16 DI .............................................................................3-99 DINT ......................................................................11-36 DISF ......................................................................11-25 DIST ........................................................................7-15 DIV ...........................................................................6-10 DIV FP2 ...................................................................6-14 DIVMOD ..................................................................6-12 DROFF ..................................................................11-48 DT .................................................................. 2-22, 2-23 DT*.n ............................................................. 2-22, 2-24 DTOS .....................................................................11-24 DTR .......................................................................10-45
E
E .............................................................................2-20 ECAL .......................................................................3-92 ED ............................................................................3-73 EDPB .......................................................................3-74 EFCAL .....................................................................3-92 EI 3-99 EIPIN ...................................................................17-149 EIPMBODY ..........................................................17-126 EIPMSATT ...........................................................17-124 EIPMSEND ..........................................................17-128 EIPNDST .............................................................17-121 EIPOT ..................................................................17-153 EIPSTART ...........................................................17-145 EIPSTOP .............................................................17-147 EJECT .....................................................................3-76 ELEFT..................................................................14-103 ELEN .....................................................................14-97 EMIDR .................................................................14-105 EMIDW ................................................................14-107 ENCO ......................................................................7-12 ENDCOM ...............................................................3-105 EPRINT..................................................................14-84 ERIGHT ...............................................................14-101 ERR ........................................................... 13-10, 16-23 ESADD ..................................................................14-95 ESCMP ..................................................................14-93 ESREP.................................................................14-109 ESSET ...................................................................14-82 ESSRC ..................................................................14-98 ETIMEstr ................................................................14-90 ETSTAT
EtherNet IP .......................................... 17-65, 17-116 FTP/HTTP/SMTP...................... 17-13, 17-82, 17-113 IP/MAC/Destination..............................................17-4 EVENTC ................................................................10-26 EVENTT.................................................................10-29 EXP .......................................................................11-12 EXT ............................................................................7-5 EZPID ....................................................................10-37

F
FABS..................................................................... 11-22 FCAL....................................................................... 3-90 FIFR ........................................................................ 8-36 FILTR .................................................................... 10-55 FINT ...................................................................... 11-19 FIX ........................................................................ 11-39 FLT........................................................................ 11-29 FNEG .................................................................... 11-21 FRINT ................................................................... 11-20 FTPcCTL............................................................... 17-65 FTPcLOG ................................................... 17-59, 17-65 FTPcREQ.............................................................. 17-62 FTPcSET .............................................................. 17-51 FTPcSV...................................................... 17-46, 17-51
G
GBIN ....................................................................... 7-22 GETSTNO............................................................. 13-15 GPB ...................................................................... 3-104 GPRECV ............................................................... 15-12 GPSEND ................................................................. 15-4 GPTRNS ................................................................. 15-4 GRY ........................................................................ 7-20
H
H ............................................................................ 2-36 HEXA ...................................................................... 14-9 HMSS...................................................................... 12-2 HTTPcCTL ............................................................ 17-82 HTTPcREQ ........................................................... 17-79 HTTPcSET ...................................... 17-73, 17-79, 17-82 HTTPcSV ................................................... 17-68, 17-73
I
I0 ................................................................... 2-31, 3-47 ICLR...................................................................... 3-101 IMASK ................................................................... 3-100 IN ............................................................................ 2-22 INC.......................................................................... 6-16 INT ........................................................................ 11-33 INTPG ..................................................................... 3-94 INV ............................................................................ 7-2 IPv4SET ................................................................ 17-20 IRET........................................................................ 3-94
J
JP............................................................................ 3-64
K
K ............................................................................ 2-35 KP ........................................................................... 3-21

20-24

L
L ............................................................................2-18 LBL
JP ........................................................................3-64 LOOP................................................................... 3-69 LCRD ....................................................................... 5-32 LCWT ......................................................................5-30 LD...................................................................2-22, 2-25 LD*.n ..............................................................2-22, 2-26 LEFT ...................................................................... 14-74 LEN .......................................................................14-67 LENGTH ................................................................14-68 LIFR ......................................................................... 8-40 LIMT ......................................................................10-49 LINE ........................................................................7-26 LN .......................................................................... 11-13 LOG ....................................................................... 11-14 LOGED ....................................................................13-3 LOGST ....................................................................13-2 LOOP ......................................................................3-69 LRSR ....................................................................... 3-58
M
MAX ......................................................................... 10-6 MC ........................................................................... 3-60 MCE ........................................................................3-60 MEAN ....................................................................10-14 MIDR .....................................................................14-76 MIDW ....................................................................14-78 MIN ........................................................................10-10 MLCLIP .....................................................................6-8 MUL ........................................................................... 6-6 MV .............................................................................5-2 MV/ ............................................................................5-4 MV2 ...........................................................................5-6 MV3 ...........................................................................5-8
N
NEG ........................................................................... 7-3 NOP ......................................................................... 3-19 NSTL .......................................................................3-77 NTPcREQ .............................................................. 17-41 NTPcSV ................................................................. 17-37
O
OPEN ....................................................................17-33 OPHCLR .................................................................13-7 OPHED .................................................................... 13-6 OPHSAVE ...............................................................13-8 OPHST ....................................................................13-5 OR ....................................................................3-2, 6-32 OR/ ............................................................................3-2 OR< .......................................................................3-106 OR<= ..................................................................... 3-106 OR<> ..................................................................... 3-106 OR= .......................................................................3-106 OR> .......................................................................3-106 OR>= ..................................................................... 3-106 OR ...........................................................................3-5 OR ...........................................................................3-5

Index
ORS ........................................................................ 3-15 OT.................................................................... 2-22, 3-2
P
P ............................................................................ 2-19 PanaSD ................................................................ 18-49 PERRD ................................................................. 13-19 pGPSEND............................................................... 15-4 PID........................................................................ 10-32 PINGREQ ............................................................. 17-24 PMGET ................................................................. 15-47
MEWNET-F ...................................................... 16-15 MEWNET-W ....................................................... 16-8 MEWNET-W2 ................................................... 16-11 PMSET ................................................................. 15-42 MEWNET-W ..................................................... 16-17 MEWNET-W2 ................................................... 16-20 POPIX..................................................................... 5-37 POPS...................................................................... 3-16 POSSET ............................................................... 13-16 pPMSET ............................................................... 15-42 MEWNET-W ..................................................... 16-17 MEWNET-W2 ................................................... 16-20 PRINT ................................................................... 14-51 PSHS ...................................................................... 3-16 PSTRD.................................................................. 13-17 PUSHIX .................................................................. 5-36 PWR ..................................................................... 11-15
R
R ............................................................................ 2-15 RAD ...................................................................... 11-17 RAMP ................................................................... 10-47 RBUFW................................................................... 8-44 RCL......................................................................... 8-28 RCR ........................................................................ 8-26 RDET ...................................................................... 17-2 RDS ........................................................................ 3-16 RECV
MC protocol .................................................... 17-162 MEWTOCOL..................................................... 15-24 MODBUS .......................................................... 15-36 RET......................................................................... 3-89 RIGHT................................................................... 14-72 ROFF .................................................................... 11-45 ROL ........................................................................ 8-24 ROR........................................................................ 8-22 RST................................................................ 3-22, 5-19
S
SADD.................................................................... 14-66 SBL ......................................................................... 3-89 SCAL .................................................................... 10-21 SCMP ................................................................... 14-64 SD........................................................................... 2-26 SECTM ................................................................... 12-7 SEGT ...................................................................... 7-10 SEND.................................................. 15-18, 16-2, 16-5
MC protocol .................................................... 17-157 MEWTOCOL................................... 15-18, 16-2, 16-5 MODBUS .......................................................... 15-30
20-25

Index
SET ..........................................................................3-22 SF ............................................................................2-37 SHL ............................................................................8-4 SHMS ......................................................................12-3 SHR ...........................................................................8-2 SIN ...........................................................................11-2 SINH ........................................................................11-9 SMPL .......................................................................13-4 SMTPcADD ...........................................................17-94 SMTPcBDY............................................................17-84 SMTPcBRD ...........................................................17-87 SMTPcCTL ..........................................................17-113 SMTPcLOG .........................................................17-106 SMTPcREQ .........................................................17-110 SMTPcSET ............................................................17-98 SMTPcSV .................................................. 17-89, 17-94 SORT .....................................................................10-18 SPTM .......................................................................3-36 SQR .......................................................................11-16 SR.................................................................. 2-16, 3-54 SRC .........................................................................10-2 SREP .....................................................................14-80 SSET .....................................................................14-47 SSRC .....................................................................14-70 SSTP .......................................................................3-77 ST ..............................................................................3-2 ST/ .............................................................................3-2 ST< ........................................................................3-106 ST<= ......................................................................3-106 ST<> ......................................................................3-106 ST= ........................................................................3-106 ST> ........................................................................3-106 ST>= ......................................................................3-106 ST ............................................................................3-5 ST ............................................................................3-5 STARTPG ..............................................................3-102 STC ...........................................................................9-8 STDDEV ................................................................10-24 STOD .....................................................................11-23 STOPPG ................................................................3-102 STPE .......................................................................3-77 SUB ...........................................................................6-4 SUMMER ...............................................................12-10 SWAP ......................................................................5-28
T
T .............................................................................2-16 TAN .........................................................................11-4 TANH .....................................................................11-11 TE ............................................................................2-30 TIMEstr ...................................................... 14-60, 14-91 TIMEWT...................................................................12-8

TM........................................................................... 3-25 TM16 ....................................................................... 3-34 TMSEC ................................................................... 12-6 TS ........................................................................... 2-29
U
U ............................................................................ 2-36 UCLR .................................................................... 13-21 UDC ........................................................................ 3-51 UM .......................................................................... 2-26 UNIF...................................................................... 11-27 UNIT........................................................................ 7-14 UNITSEL ................................................................. 15-2
W
WBSL...................................................................... 8-20 WBSR ..................................................................... 8-18 WDTRES .............................................................. 13-12 WI............................................................................ 2-28 WIN ........................................................................... 4-5 WL........................................................................... 2-27 WO.......................................................................... 2-28 WR.......................................................................... 2-27 WSHL...................................................................... 8-16 WSHR ..................................................................... 8-14 WX .......................................................................... 2-27 WY .......................................................................... 2-27
X
X ............................................................................ 2-14 XCH ........................................................................ 5-26 XNR ........................................................................ 6-36 XOR ........................................................................ 6-34
Y
Y ............................................................................ 2-14
Z
ZONE .................................................................... 10-53 ZRST.............................................................. 3-86, 5-20

20-26

Record of changes

Date DEC 2012 JUN 2013 FEB 2019
SEP 2019
MAR 2020 APR 2020
OCT 2020 APR 2021

The number of each manual is recorded at the bottom of the cover page.

Manual No. WUME-FP7CPUPGR-01

1st Edition

Record of Changes

WUME-FP7CPUPGR-02 2nd Edition

WUME-FP7CPUPGR-03 3rd Edition

WUME-FP7CPUPGR-04

- Moved the descriptions of instructions from the FP7 Multi-wire Link Unit User's Manual (Published JUN 2017) to this manual. SEND, RECV, PMGET, PMSET/pPMSET, ERR
- Added the SD card access instruction execution result error. - Added lists of error codes. - Fixed errors.
4th Edition

WUME-FP7CPUPGR-05

- Added instructions on operation history: OPHST, OPHED, OPHCLR, OPHSAVE
- Added lists of system relays. - Added lists of system data registers. - Added lists of error codes. - Fixed errors.
5th Edition

- Added instructions on Ethernet Communication: EIPMSATT, EIPMBODY, EIPMSEND, CIPMSET, CIPMGET
- Fixed errors.

WUME-FP7CPUPGR-06

6th Edition

WUME-FP7CPUPGR-07

- Added specifications of the PMSET (pPMSET) instruction. - Added parameters as measures against PLC link noise. - Added specifications of the CONFIG instruction.
7th Edition
- Fixed errors.

WUME-FP7CPUPGR-08

8th Edition
- Added CRD (File Data Read Instruction) specifications. - Fixed errors.

Please contact ..........

Panasonic Industrial Devices SUNX Co., Ltd.
https://panasonic.net/id/pidsx/global

Please visit our website for inquiries and about our sales network.

April, 2021

© Panasonic Industrial Devices SUNX Co., Ltd. 2021 WUME-FP7CPUPGR-08


Panasonic Industrial Devices SUNX Co., Ltd. Adobe PDF Library 15.0