Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

SH 080785 Engm

Download as pdf or txt
Download as pdf or txt
You are on page 1of 316

MELSEC-Q/L Structured Programming Manual

(Special Instructions)
SAFETY PRECAUTIONS
(Read these precautions before using this product.)
Before using MELSEC-Q or -L series programmable controllers, please read the manuals included with each product and the
relevant manuals introduced in those manuals carefully, and pay full attention to safety to handle the product correctly.
Make sure that the end users read the manuals included with each product, and keep the manuals in a safe place for future
reference.

CONDITIONS OF USE FOR THE PRODUCT


(1) Mitsubishi programmable controller ("the PRODUCT") shall be used in conditions;
i) where any problem, fault or failure occurring in the PRODUCT, if any, shall not lead to any major or serious accident;
and
ii) where the backup and fail-safe function are systematically or automatically provided outside of the PRODUCT for the
case of any problem, fault or failure occurring in the PRODUCT.
(2) The PRODUCT has been designed and manufactured for the purpose of being used in general industries.
MITSUBISHI SHALL HAVE NO RESPONSIBILITY OR LIABILITY (INCLUDING, BUT NOT LIMITED TO ANY AND ALL
RESPONSIBILITY OR LIABILITY BASED ON CONTRACT, WARRANTY, TORT, PRODUCT LIABILITY) FOR ANY
INJURY OR DEATH TO PERSONS OR LOSS OR DAMAGE TO PROPERTY CAUSED BY the PRODUCT THAT ARE
OPERATED OR USED IN APPLICATION NOT INTENDED OR EXCLUDED BY INSTRUCTIONS, PRECAUTIONS, OR
WARNING CONTAINED IN MITSUBISHI'S USER, INSTRUCTION AND/OR SAFETY MANUALS, TECHNICAL
BULLETINS AND GUIDELINES FOR the PRODUCT.
("Prohibited Application")
Prohibited Applications include, but not limited to, the use of the PRODUCT in;
• Nuclear Power Plants and any other power plants operated by Power companies, and/or any other cases in which the
public could be affected if any problem or fault occurs in the PRODUCT.
• Railway companies or Public service purposes, and/or any other cases in which establishment of a special quality
assurance system is required by the Purchaser or End User.
• Aircraft or Aerospace, Medical applications, Train equipment, transport equipment such as Elevator and Escalator,
Incineration and Fuel devices, Vehicles, Manned transportation, Equipment for Recreation and Amusement, and
Safety devices, handling of Nuclear or Hazardous Materials or Chemicals, Mining and Drilling, and/or other
applications where there is a significant risk of injury to the public or property.
Notwithstanding the above, restrictions Mitsubishi may in its sole discretion, authorize use of the PRODUCT in one or
more of the Prohibited Applications, provided that the usage of the PRODUCT is limited only for the specific
applications agreed to by Mitsubishi and provided further that no special quality assurance or fail-safe, redundant or
other safety features which exceed the general specifications of the PRODUCTs are required. For details, please
contact the Mitsubishi representative in your region.

1
INTRODUCTION
Thank you for purchasing the Mitsubishi MELSEC-Q or -L series programmable controllers.
Before using this product, please read this manual and the relevant manuals carefully and develop familiarity with the
programming specifications to handle the product correctly.
When applying the program examples introduced in this manual to an actual system, ensure the applicability and confirm that
it will not cause system control problems.

2
CONTENTS
SAFETY PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
CONDITIONS OF USE FOR THE PRODUCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2
MANUALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
TERMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9

CHAPTER 1 OVERVIEW 10

CONTENTS
1.1 Purpose of This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2 Explanation Content in This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Modules and Versions Applicable to Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

CHAPTER 2 INSTRUCTION TABLES 15


2.1 How to Read Instruction Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Module Dedicated Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Analog instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Positioning instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Serial communication instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Network dedicated instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3 PID Control Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PID control instruction (inexact differential) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PID control instruction (exact differential) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.4 Socket Communication Function Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.5 Built-in I/O Function Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Positioning function dedicated instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Counter function dedicated instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6 Data Logging Function Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.7 SFC Control Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

CHAPTER 3 CONFIGURATION OF INSTRUCTIONS 29

CHAPTER 4 HOW TO READ INSTRUCTIONS 31

CHAPTER 5 MODULE DEDICATED INSTRUCTION 33


5.1 Analog Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
OFFGAN instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Setting value reading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Setting value restoration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.2 Positioning Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Absolute position restoration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Positioning start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Teaching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
PFWRT instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Setting data initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.3 Serial Communication Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
On-demand function transmission. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Nonprocedural protocol communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Bidirectional protocol communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Communication status check. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

3
Receive data clear. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
BUFRCVS instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Initial setting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
CSET instruction (programmable controller CPU monitor) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
PUTE instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Mode switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Pre-defined protocol communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.4 Network Dedicated Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Reading from the buffer memory of an intelligent device station. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Writing to the buffer memory of an intelligent device station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
RIRCV instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
RISEND instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Reading from the auto-refresh buffer memory of the master station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Writing to the auto-refresh buffer memory of the master station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Network parameter setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
READ instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Message (user-specified data) communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Transient request to another station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Read from other station devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Write to other station devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
RRUN instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
RSTOP instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Reading clock data from another station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Writing clock data to another station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Reading from buffer memory of intelligent function module on remote I/O station . . . . . . . . . . . . . . . . . . . . . . 182
Writing to buffer memory of intelligent function module on remote I/O station . . . . . . . . . . . . . . . . . . . . . . . . . 185
Setting parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Connection opening or closing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Fixed buffer communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Reading or clearing error information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
UINI instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
E-mail communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

CHAPTER 6 PID CONTROL INSTRUCTION 227


6.1 PID Control Instruction (Inexact Differential) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Data setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
PID operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
PIDSTOP instruction and PIDRUN instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Operation parameter change. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
6.2 PID Control Instruction (Exact Differential) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Data setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
PID operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
PIDSTOP instruction and PIDRUN instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Operation parameter change. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249

CHAPTER 7 SOCKET COMMUNICATION FUNCTION INSTRUCTION 252


7.1 Opening/Closing Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
7.2 SOCRCV Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
7.3 Sending Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
7.4 SOCCINF Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264

4
7.5 Changing Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
7.6 Changing Receive Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
7.7 SOCRDATA Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

CHAPTER 8 BUILT-IN I/O FUNCTION INSTRUCTION 272


8.1 Positioning Function Dedicated Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Positioning start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
OPR start. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
JOG start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

CONTENTS
Absolute position restoration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
IPSTOP instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Speed change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Target position change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
8.2 Counter Function Dedicated Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Current value read. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Ring counter upper/lower limit value write. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Preset value write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Latch counter value read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Sampling counter value read. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Coincidence output point write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Frequency measurement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Rotation speed measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Pulse measurement read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
PWM output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

CHAPTER 9 DATA LOGGING FUNCTION INSTRUCTION 299


9.1 Trigger Logging Set/Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

CHAPTER 10 SFC CONTROL INSTRUCTION 301


10.1 SFC Step Comment Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
10.2 SFC Transition Condition Comment Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

INDEX 306

INSTRUCTION INDEX 308

REVISIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310
WARRANTY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
TRADEMARKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312

5
MANUALS
RELEVANT MANUALS
The manuals related to this product are listed below. Order each manual as needed, referring to the following lists.

■Structured programming
Manual name Description
Manual number (model code)
MELSEC-Q/L/F Structured Programming Manual Methods and languages for structured programming
(Fundamentals)
<SH-080782ENG>
MELSEC-Q/L Structured Programming Manual (Common Specifications and functions of common instructions, such as sequence instructions, basic
Instructions) instructions, and application instructions, that can be used in structured programs
<SH-080783ENG>
MELSEC-Q/L Structured Programming Manual (Application Specifications and functions of application functions that can be used in structured programs
Functions)
<SH-080784ENG>

■Operation of GX Works2
Manual name Description
Manual number (model code)
GX Works2 Version 1 Operating Manual (Common) System configuration, parameter settings, and online operations of GX Works2, which are
<SH-080779ENG> common to Simple projects and Structured projects
GX Works2 Version 1 Operating Manual (Structured Project) Operations, such as programming and monitoring in Structured projects, of GX Works2
<SH-080781ENG>
GX Works2 Beginner's Manual (Structured Project) Basic operations, such as programming, editing, and monitoring in Structured projects, of GX
<SH-080788ENG> Works2. This manual is intended for first-time users of GX Works2.

■Detailed specifications of instructions


• Analog instruction
Series Manual name Description
Q L Manual number (model code)

●  Analog-Digital Converter Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080055> and troubleshooting of the Q64AD, Q68ADV, and Q68ADI
●  Channel Isolated High Resolution Analog-Digital Converter System configuration, performance specifications, functions, handling, wiring,
Module / Channel Isolated High Resolution Analog-Digital and troubleshooting of the Q64AD-GH and Q62AD-DGH
Converter Module (With Signal Conditioning Function) User's
Manual
<SH-080277>
●  Channel Isolated Analog-Digital Converter Module/Channel System configuration, performance specifications, functions, handling, wiring,
Isolated Analog-Digital Converter Module (With Signal and troubleshooting of the Q68AD-G and Q66AD-DG
Conditioning Function) User's Manual
<SH-080647ENG>
●  MELSEC-Q High Speed Analog-Digital Converter Module System configuration, performance specifications, functions, handling, wiring,
User's Manual and troubleshooting of the Q64ADH
<SH-080987ENG>
●  MELSEC-Q High Speed Digital-Analog Converter Module System configuration, performance specifications, functions, handling, wiring,
User's Manual and troubleshooting of the Q64DAH
<SH-081101ENG>
●  Digital-Analog Converter Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080054> and troubleshooting of the Q62DAN, Q64DAN, Q68DAVN, and Q68DAIN
●  Channel Isolated Digital-Analog Converter Module User's System configuration, performance specifications, functions, handling, wiring,
Manual and troubleshooting of the Q62DA-FG
<SH-080281E>
●  Channel Isolated Digital-Analog Converter Module User's System configuration, performance specifications, functions, handling, wiring,
Manual and troubleshooting of the Q66DA-G
<SH-080648ENG>
●  RTD Input Module Channel Isolated RTD Input Module User's System configuration, performance specifications, functions, handling, wiring,
Manual and troubleshooting of the Q64RD and Q64RD-G
<SH-080142>

6
Series Manual name Description
Q L Manual number (model code)

●  Thermocouple Input Module Channel Isolated Thermocouple/ System configuration, performance specifications, functions, handling, wiring,
Micro Voltage Input Module User's Manual and troubleshooting of the Q64TD and Q64TDV-GH
<SH-080141>
●  Channel Isolated Thermocouple Input Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080795ENG> and troubleshooting of the Q68TD-G-H01/Q68TD-G-H02
●  Channel Isolated RTD Input Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080722ENG> and troubleshooting of the Q68RD3-G
●  Load Cell Input Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080821ENG> and troubleshooting of the Q61LD
●  MELSEC-Q Current Transformer Input Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-081033ENG> and troubleshooting of the Q68CT
 ● MELSEC-L Analog-Digital Converter Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080899ENG> and troubleshooting of the analog-digital converter module
 ● MELSEC-L Dual Channel Isolated High Resolution Analog- System configuration, performance specifications, functions, handling, wiring,
Digital Converter Module User's Manual and troubleshooting of the L60AD4-2GH
<SH-081103ENG>
 ● MELSEC-L Digital-Analog Converter Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080900ENG> and troubleshooting of the digital-analog converter module
 ● MELSEC-L Analog Input/Output Module User's Manual System configuration, specifications, settings, and troubleshooting of the
<SH-081167ENG> analog input/output module

• Positioning instruction
Series Manual name Description
Q L Manual number (model code)

●  Type QD75P/QD75D Positioning Module User's Manual System configuration, performance specifications, functions, handling, wiring,
(Details) and troubleshooting of the QD75P1N/QD75P2N/QD75P4N/QD75D1N/
<SH-080058> QD75D2N/QD75D4N/QD75P1/QD75P2/QD75P4/QD75D1/QD75D2/QD75D4
●  Type QD75M Positioning Module User's Manual (Details) System configuration, performance specifications, functions, handling,
<IB-0300062> procedures before operation, and troubleshooting of the QD75M1/QD75M2/
QD75M4
●  Type QD75MH Positioning Module User's Manual (Details) System configuration, performance specifications, functions, handling,
<IB-0300117> procedures before operation, and troubleshooting of the QD75MH1/
QD75MH2/QD75MH4
 ● MELSEC-L LD75P/LD75D Positioning Module User's Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080911ENG> and troubleshooting of the LD75P1/LD75P2/LD75P4/LD75D1/LD75D2/
LD75D4

• Serial communication instruction


Series Manual name Description
Q L Manual number (model code)

●  Q Corresponding Serial Communication Module User's The overview for use of the module, applicable system configuration,
Manual (Basic) specifications, procedures before operation, fundamental data communication
<SH-080006> with external devices, maintenance, inspection, and troubleshooting
 ● MELSEC-L Serial Communication Module User's Manual The overview for use of the module, applicable system configuration,
(Basic) specifications, procedures before operation, fundamental data communication
<SH-080894ENG> with external devices, maintenance, inspection, and troubleshooting
● ● MELSEC-Q/L Serial Communication Module User's Manual The specifications and usage of special functions of the module, settings for
(Application) special functions, and data communication with external devices
<SH-080007>

• Network dedicated instruction


Series Manual name Description
Q L Manual number (model code)

●  MELSEC-Q CC-Link System Master/Local Module User's System configuration, performance specifications, functions, handling, wiring,
Manual and troubleshooting of the QJ61BT11N
<SH-080394E>
 ● MELSEC-L CC-Link System Master/Local Module User's System configuration, performance specifications, functions, handling, wiring,
Manual and troubleshooting of the built-in CC-Link and CC-Link system master/local
<SH-080895ENG> modules
●  CC-Link IE Controller Network Reference Manual System configuration, performance specifications, functions, handling, wiring,
<SH-080668ENG> and troubleshooting of the CC-Link IE Controller Network

7
Series Manual name Description
Q L Manual number (model code)

●  MELSEC-Q CC-Link IE Field Network Master/Local Module The specifications, procedures before operation, system configuration,
User's Manual installation, settings, functions, programming, and troubleshooting of the CC-
<SH-080917ENG> Link IE Field Network and the CC-Link IE Field Network master/local module
 ● MELSEC-L CC-Link IE Field Network Master/Local Module The specifications, procedures before operation, system configuration,
User's Manual installation, settings, functions, programming, and troubleshooting of the CC-
<SH-080972ENG> Link IE Field Network and the CC-Link IE Field Network master/local module
●  Q Corresponding MELSECNET/H Network System Reference The specifications, settings and procedures before operation, parameter
Manual (PLC to PLC network) setting, programming, and troubleshooting of the MELSECNET/H PLC-to-PLC
<SH-080049> network system
●  Q Corresponding MELSECNET/H Network System Reference System configuration, performance specifications, and programming of the
Manual (Remote I/O network) MELSECNET/H network system (remote I/O network)
<SH-080124>
●  Q Corresponding Ethernet Interface Module User's Manual The specifications of the Ethernet module, data communication procedure with
(Basic) external devices, line connection (open/close), fixed buffer communication,
<SH-080009> random access buffer communication, and troubleshooting
 ● MELSEC-L Ethernet Interface Module User's Manual (Basic) The specifications of the Ethernet module, data communication procedure with
<SH-081105ENG> external devices, line connection (open/close), fixed buffer communication,
random access buffer communication, and troubleshooting
● ● MELSEC-Q/L Ethernet Interface Module User's Manual The e-mail function of the Ethernet module, programmable controller CPU
(Application) status monitoring, communication function using the MELSECNET/H or
<SH-080010> MELSECNET/10 as a relay station, communication with data link instructions,
and the use of file transfer (FTP server) function

• PID control instruction


Series Manual name Description
Q L Manual number (model code)

● ● MELSEC-Q/L/QnA Programming Manual (PID Control The dedicated instructions for PID control
Instructions)
<SH-080040>

• Socket communication function instruction


Series Manual name Description
Q L Manual number (model code)

●  QnUCPU User's Manual (Communication via Built-in Ethernet Functions for the communication via built-in Ethernet port of the CPU module
Port)
<SH-080811ENG>
 ● MELSEC-L CPU Module User's Manual (Built-In Ethernet The built-in Ethernet function of the CPU module
Function)
<SH-080891ENG>

• Built-in I/O function instruction


Series Manual name Description
Q L Manual number (model code)

 ● MELSEC-L CPU Module User's Manual (Built-In I/O Function) The general-purpose I/O function, interrupt input function, pulse catch function,
<SH-080892ENG> positioning function, and high-speed counter function of the CPU module

• Data logging function instruction


Series Manual name Description
Q L Manual number (model code)

● ● QnUDVCPU/LCPU User's Manual (Data Logging Function) Specifications of the data logging function, and operating method of the LCPU
<SH-080893ENG> logging configuration tool

• SFC control instruction


Series Manual name Description
Q L Manual number (model code)

● ● MELSEC-Q/L/QnA Programming Manual (SFC) The programming methods required to create SFC program, specifications
<SH-080041> and functions

8
TERMS
This manual uses the generic terms and abbreviations listed in the following table to discuss the software packages and
programmable controller CPUs. Corresponding module models are also listed if needed.
Term Description
Application function A generic term for the functions, such as functions and function blocks, defined in IEC61131-3.
(The functions are executed with a set of common instructions in a programmable controller.)
Basic model QCPU A generic term for the Q00JCPU, Q00CPU, and Q01CPU
Built-in Ethernet port LCPU A generic term for the L02CPU, L02CPU-P, L06CPU, L06CPU-P, L26CPU, L26CPU-P, L26CPU-BT, and
L26CPU-PBT
Built-in Ethernet port QCPU A generic term for the Q03UDVCPU, Q03UDECPU, Q04UDVCPU, Q04UDPVCPU, Q04UDEHCPU,
Q06UDVCPU, Q06UDPVCPU, Q06UDEHCPU, Q10UDEHCPU, Q13UDVCPU, Q13UDPVCPU,
Q13UDEHCPU, Q20UDEHCPU, Q26UDVCPU, Q26UDPVCPU, Q26UDEHCPU, Q50UDEHCPU, and
Q100UDEHCPU
CC-Link IE A generic term for CC-Link IE Controller Network system and CC-Link IE Field Network system
Common instruction A generic term for the sequence instructions, basic instructions, application instructions, data link instructions,
multiple CPU dedicated instructions, multiple CPU high-speed transmission dedicated instructions, and
redundant system instructions
CPU module A generic term for QCPU (Q mode) and LCPU
GX Works2 Product name of the software package for the MELSEC programmable controllers
High Performance model QCPU A generic term for the Q02CPU, Q02HCPU, Q06HCPU, Q12HCPU, and Q25HCPU
High-speed Universal model QCPU A generic term for the Q03UDVCPU, Q04UDVCPU, Q06UDVCPU, Q13UDVCPU, and Q26UDVCPU
IEC61131-3 The abbreviation for the IEC 61131-3 international standard
LCPU A generic term for the L02SCPU, L02SCPU-P, L02CPU, L02CPU-P, L06CPU, L06CPU-P, L26CPU, L26CPU-P,
L26CPU-BT, and L26CPU-PBT
MELSECNET/H The abbreviation for MELSECNET/H network system
Personal computer A generic term for personal computer on which Windows operates
Process CPU A generic term for the Q02PHCPU, Q06PHCPU, Q12PHCPU, and Q25PHCPU
QCPU (Q mode) A generic term for the Basic model QCPU, High Performance model QCPU, Process CPU, Redundant CPU,
and Universal model QCPU.
Redundant CPU A generic term for the Q12PRHCPU and Q25PRHCPU
Special instruction A generic term for the module dedicated instructions, PID control instructions, socket communication function
instructions, built-in I/O function instructions, and data logging function instructions
Universal model Process CPU A generic term for the Q04UDPVCPU, Q06UDPVCPU, Q13UDPVCPU, and Q26UDPVCPU
Universal model QCPU A generic term for the Q00UJCPU, Q00UCPU, Q01UCPU, Q02UCPU, Q03UDCPU, Q03UDVCPU,
Q03UDECPU, Q04UDHCPU, Q04UDVCPU, Q04UDPVCPU, Q04UDEHCPU, Q06UDHCPU, Q06UDVCPU,
Q06UDPVCPU, Q06UDEHCPU, Q10UDHCPU, Q10UDEHCPU, Q13UDHCPU, Q13UDVCPU,
Q13UDPVCPU, Q13UDEHCPU, Q20UDHCPU, Q20UDEHCPU, Q26UDHCPU, Q26UDVCPU,
Q26UDPVCPU, Q26UDEHCPU, Q50UDEHCPU, and Q100UDEHCPU

9
1 OVERVIEW

1.1 Purpose of This Manual


This manual explains the instructions for the network module, intelligent function module, PID control, socket communication
function, built-in I/O function, and data logging function among common instructions and special instructions necessary for
creating programs using the structured programming technique. Manuals for reference are listed in the following table
according to their purpose.
For information such as the contents and number of each manual, refer to the list of 'Related manuals'.
Page 6 RELEVANT MANUALS

Operation of GX Works2
Purpose Overview Details
Installation Learning the operating environment  GX Works2 Installation Instructions
and installation method
Learning a USB driver installation   GX Works2 Version 1 Operating Manual
method (Common)
Operation of GX Learning all functions of GX Works2  GX Works2 Version 1 Operating Manual 
Works2 (Common)
Learning the project types and 
available languages in GX Works2
Learning the basic operations and   GX Works2 Beginner's Manual (Simple
operating procedures when creating a Project)
simple project for the first time
Learning the basic operations and   GX Works2 Beginner's Manual
operating procedures when creating a (Structured Project)
structured project for the first time
Learning the operations of available   GX Works2 Version 1 Operating Manual
functions regardless of project type. (Common)
Learning the functions and operation  GX Works2 Version 1 Operating Manual  GX Works2 Version 1 Operating Manual
methods for programming (Common) (Simple Project)
 GX Works2 Version 1 Operating Manual
(Structured Project)
Learning data setting methods for   GX Works2 Version 1 Operating Manual
intelligent function module (Intelligent Function Module)

Operations in each programming language


For details of instructions used in each programming language, refer to the following.
Page 11 Details of instructions in each programming language
Purpose Overview Details
Simple Project Ladder  GX Works2 Beginner's Manual (Simple  GX Works2 Version 1 Operating Manual
Project) (Simple Project)
SFC  GX Works2 Beginner's Manual (Simple
Project)*1
ST  GX Works2 Beginner's Manual  GX Works2 Version 1 Operating Manual
(Structured Project) (Structured Project)
Structured Project Ladder  GX Works2 Beginner's Manual (Simple  GX Works2 Version 1 Operating Manual
Project) (Simple Project)
SFC  GX Works2 Beginner's Manual (Simple
Project)*1
Structured ladder/FBD  GX Works2 Beginner's Manual  GX Works2 Version 1 Operating Manual
(Structured Project) (Structured Project)
ST

*1 MELSAP3 and FX series SFC only

1 OVERVIEW
10 1.1 Purpose of This Manual
Details of instructions in each programming language
Purpose Overview Details 1
All languages Learning details of programmable   Use's Manual (Hardware Design,
controller CPU error codes, special Maintenance and Inspection) for the CPU
relays, and special registers module used
Using ladder Learning the types and details of   MELSEC-Q/L Programming Manual
diagram common instructions (Common Instruction)
Learning the types and details of   Manual for the intelligent function module
instructions for intelligent function used
modules
Learning the types and details of   Manual for the network module used
instructions for network modules
Learning the types and details of   MELSEC-Q/L/QnA Programming Manual
instructions for the PID control function (PID Control Instructions)
Learning the types and details of the   MELSEC-Q Programming/Structured
process control instructions Programming Manual (Process Control
Instructions)
Using SFC Learning details of specifications,   MELSEC-Q/L/QnA Programming Manual
language functions, and instructions of SFC (SFC)
(MELSAP3)
Using structured Learning the fundamentals for creating   MELSEC-Q/L/F Structured Programming
ladder/FBD or a structured program Manual (Fundamentals)
structured text
Learning the types and details of   MELSEC-Q/L Structured Programming
language
common instructions Manual (Common Instructions)
Learning the types and details of  MELSEC-Q/L Structured Programming  Manual for the intelligent function module
instructions for intelligent function Manual (Special Instructions) used
modules
Learning the types and details of  Manual for the network module used
instructions for network modules
Learning the types and details of  MELSEC-Q/L/QnA Programming Manual
instructions for the PID control function (PID Control Instructions)
Learning the types and details of   MELSEC-Q/L Structured Programming
application functions Manual (Application Functions)
Learning the types and details of the   MELSEC-Q Programming/Structured
process control instructions Programming Manual (Process Control
Instructions)

1 OVERVIEW
1.1 Purpose of This Manual 11
1.2 Explanation Content in This Manual
This manual explains the programming methods and data used for control of the following modules and PID control using
structured programming technique.
Function/module for explaining an Processing performed by the instruction Reference
instruction
Analog module • Switches the mode. (Offset/gain setting mode or normal mode) Page 33 Analog
• Reads the user range setting offset/gain value. Instruction
• Restores the user range setting offset/gain value.
Positioning module • Restores the absolute position of the specified axis. Page 39 Positioning
• Starts positioning of the specified axis. Instruction
• Executes teaching of the specified axis.
• Writes parameters/positioning data and block start data to a flash ROM.
• Initializes setting data.
Serial communication module • Sends and receives data to and from an external device. Page 51 Serial
• Registers and reads user frames. Communication
Instruction
CC-Link system master/local module • Reads and writes data from and to an intelligent device station on the CC-Link Page 98 Network
system. Dedicated
• Reads and writes data from and to the auto-refresh buffer memory at the master Instruction
station.
• Sets the network parameters.
CC-Link IE network module • Sends and receives data to and from an external device.
• Reads and writes data from and to another station on the CC-Link IE or
MELSECNET/H network module
MELSECNET/H network system.
Ethernet interface module • Reads and clears error information.
• Sends and receives e-mails.
PID control instruction • Sets PID control data and performs PID operation for inexact differential and exact Page 227 PID
differential. CONTROL
• Stops and starts operation of the specified loop. INSTRUCTION
• Changes the parameter of the specified loop.
Socket communication function • Opens/closes a connection. Page 252 SOCKET
• Reads receive data. COMMUNICATION
• Changes the receive mode. FUNCTION
INSTRUCTION
Built-in I/O function Positioning • Starts positioning of the specified axis. Page 272 BUILT-IN
function • Starts OPR of the specified axis. I/O FUNCTION
• Starts JOG operation of the specified axis. INSTRUCTION
• Restores the absolute position of the specified axis.
• Stops the operating axis.
• Changes the speed and the target position of the specified axis.
Counter function • Updates the current value of the specified CH.
• Sets a ring counter lower limit value and a ring counter upper limit value.
• Sets a preset value/latch counter value/sampling counter value.
• Sets the coincidence output No. n point.
• Measures the frequency/rotation speed.
• Stores the measured pulse value.
• Outputs the PWM wave form.
Data logging function • Generates a trigger on the data logging of the specified data logging configuration Page 299 DATA
number. LOGGING
• Resets the LOGTRG instruction of the specified data logging configuration FUNCTION
number. INSTRUCTION
SFC control • Reads comment of an active step in the specified SFC block. Page 301 SFC
• Reads comment of transition condition associated with an active step in the CONTROL
specified SFC block. INSTRUCTION

• Precautions on using instructions


For details of the specifications, functions, and operating timing of each instruction, refer to the related
manuals of each module.
MANUALS

1 OVERVIEW
12 1.2 Explanation Content in This Manual
1.3 Modules and Versions Applicable to Instructions
This section describes the modules and versions applicable to the instructions explained in this manual. For details of
1
applicable versions, refer to each instruction in Chapter 5
Function/module for explaining an instruction Applicable version/serial
number
Analog module Q64AD, Q68ADV, Q68ADI, Q64AD-GH, Q62AD-DGH, Q68AD-G, Applicable to all versions
Q66AD-DG, Q64ADH, Q64DAH, Q62DAN, Q64DAN, Q68DAVN,
Q68DAIN, Q62DA, Q64DA, Q68DAV, Q68DAI, Q62DA-FG, Q66DA-G,
Q64RD, Q64RD-G, Q64TD, Q64TDV-GH, Q68TD-G-H01, Q68TD-G-
H02, Q68RD3-G, Q61LD, Q68CT, L60AD4, L60AD4-2GH, L60DA4,
L60AD2DA2, L60ADVL8, L60ADIL8, L60DAVL8, L60DAIL8
Positioning module QD75P1N, QD75P2N, QD75P4N, QD75D1N, QD75D2N, QD75D4N, Applicable to all versions
QD75P1, QD75P2, QD75P4, QD75D1, QD75D2, QD75D4, QD75M1,
QD75M2, QD75M4, QD75MH1, QD75MH2, QD75MH4, LD75P1,
LD75P2, LD75P4, LD75D1, LD75D2, LD75D4
Serial communication module QJ71C24N, QJ71C24N-R2, QJ71C24N-R4, QJ71C24, QJ71C24-R2, The modules that can use the
LJ71C24, LJ71C24-R2 UINI instruction are limited.
Page 89 Mode switching
CC-Link system master/local module QJ61BT11N, LJ61BT11 Applicable to all versions
QJ61BT11 The modules that can use the
RLPASET instruction are limited.
The instruction is applicable to
the module of which the function
version is B and the first five
digits of the serial number are
'03042' or higher.
Page 118 Network
parameter setting
CC-Link IE Controller Network module QJ71GP21-SX, QJ71GP21S-SX Applicable to all versions
CC-Link IE Field Network module QJ71GF11-T2, LJ71GF11-T2 Applicable to all versions
MELSECNET/H network module QJ71LP21, QJ71LP21-25, QJ71LP21S-25, QJ71LP21G, QJ71BR11, Applicable to all versions
QJ72LP25-25, QJ72LP25G, QJ72BR15
Ethernet interface module QJ71E71-100, QJ71E71-B5, QJ71E71-B2, LJ71E71-100 Applicable to all versions
CPU module supporting the PID control Q00JCPU, Q00UJCPU, Q00CPU, Q00UCPU, Q01CPU, Q01UCPU, The modules that can use the
instruction Q02CPU, Q02HCPU, Q02UCPU, Q03UDCPU, Q03UDVCPU, instruction are limited.
Q03UDECPU, Q04UDHCPU, Q04UDVCPU, Q04UDPVCPU, Page 227 PID Control
Q04UDEHCPU, Q06HCPU, Q06UDHCPU, Q06UDVCPU, Instruction (Inexact
Q06UDPVCPU, Q06UDEHCPU, Q10UDHCPU, Q10UDEHCPU, Differential),Page 240 PID
Q12HCPU, Q12PRHCPU, Q13UDHCPU, Q13UDVCPU, Control Instruction (Exact
Q13UDPVCPU, Q13UDEHCPU, Q20UDHCPU, Q20UDEHCPU, Differential)
Q25HCPU, Q25PRHCPU, Q26UDHCPU, Q26UDVCPU,
Q26UDPVCPU, Q26UDEHCPU, Q50UDEHCPU, Q100UDEHCPU,
L02SCPU, L02SCPU-P, L02CPU, L02CPU-P, L06CPU, L06CPU-P,
L26CPU, L26CPU-P, L26CPU-BT, L26CPU-PBT
Built-in Ethernet port QCPU, Built-in Ethernet Q03UDVCPU, Q03UDECPU, Q04UDVCPU, Q04UDPVCPU, The modules that can use the
port LCPU (Built-in Ethernet function) Q04UDEHCPU, Q06UDVCPU, Q06UDPVCPU, Q06UDEHCPU, socket communication function
Q10UDEHCPU, Q13UDVCPU, Q13UDPVCPU, Q13UDEHCPU, instruction are limited when
Q20UDEHCPU, Q26UDVCPU, Q26UDPVCPU, Q26UDEHCPU, using the Built-in Ethernet port
Q50UDEHCPU, Q100UDEHCPU, L02CPU, L02CPU-P, L06CPU, QCPU.
L06CPU-P, L26CPU, L26CPU-P, L26CPU-BT, L26CPU-PBT The instruction is applicable to
the module of which the function
version is B and the first five
digits of the serial number are
'11012' or higher.
The instruction is applicable to
all versions when using the Built-
in Ethernet port LCPU.
LCPU (Built-in I/O function) L02SCPU, L02SCPU-P, L02CPU, L02CPU-P, L06CPU, L06CPU-P, Applicable to all versions
L26CPU, L26CPU-P, L26CPU-BT, L26CPU-PBT
Data logging function Q03UDVCPU, Q04UDVCPU, Q04UDPVCPU, Q06UDVCPU, Applicable to all versions
Q06UDPVCPU, Q13UDVCPU, Q13UDPVCPU, Q26UDVCPU,
Q26UDPVCPU, L02CPU, L02CPU-P, L06CPU, L06CPU-P, L26CPU,
L26CPU-P, L26CPU-BT, L26CPU-PBT

1 OVERVIEW
1.3 Modules and Versions Applicable to Instructions 13
Function/module for explaining an instruction Applicable version/serial
number
CPU module supporting the SFC control Q02CPU, Q02HCPU, Q02PHCPU, Q03UDCPU, Q03UDVCPU, The modules that can use the
instruction Q03UDECPU, Q04UDHCPU, Q04UDVCPU, Q04UDPVCPU, instruction are limited.
Q04UDEHCPU, Q06HCPU, Q06PHCPU, Q06UDHCPU, Q06UDVCPU, Page 301 SFC Step
Q06UDPVCPU, Q06UDEHCPU, Q10UDHCPU, Q10UDEHCPU, Comment Read
Q12HCPU, Q12PHCPU, Q12PRHCPU, Q13UDHCPU, Q13UDVCPU,
Q13UDPVCPU, Q13UDEHCPU, Q20UDHCPU, Q20UDEHCPU,
Q25HCPU, Q25PHCPU, Q25PRHCPU, Q26UDHCPU, Q26UDVCPU,
Q26UDPVCPU, Q26UDEHCPU, Q50UDEHCPU, Q100UDEHCPU

• How to check the applicable version or serial number


Intelligent function modules: User's Manual or Reference Manual for the module listed in 'Manuals'
CPU modules supporting PID control: User's Manual (Function Explanation, Program Fundamentals) of the
CPU module to be used
Built-in Ethernet port QCPU: QnUCPU User's Manual (Communication via Built-in Ethernet Port)
• Manual for reference
MANUALS

1 OVERVIEW
14 1.3 Modules and Versions Applicable to Instructions
2 INSTRUCTION TABLES

2.1 How to Read Instruction Tables


The instruction tables found from Page 16 Module Dedicated Instruction to Page 28 SFC Control Instruction have been made
2
according to the following format:

Ò Ó Ô Õ Ö × Ø

Description
Classifies instructions by application.
Indicates the instructions used in a program.
Indicates the arguments of the instruction.
Symbol Name Description
(s), (s1) Source Stores data before operation.
(d), (d1) Destination Indicates the destination of data after operation.
n, n1  Specifies the number of devices and the number of transfers.
(Jn*)  Specifies the network number.
(Un*)  Specifies the start I/O number of a module.

Indicates the processing details of each instruction.


Details of executing condition of each instruction are as follows:
Symbol Executing condition
Indicates an 'executed while ON' type instruction that is executed only while the precondition is ON. When
the precondition is OFF, the instruction is not executed and does not perform processing.
Indicates an 'executed once at ON' type instruction that is executed only at the rising pulse (OFF  ON) of
the precondition of the instruction.

Indicates the execution target module of each instruction. For details of the icons, refer to Chapter Page 31 HOW TO READ
INSTRUCTIONS.
Indicates the references on which the instructions are explained.

2 INSTRUCTION TABLES
2.1 How to Read Instruction Tables 15
2.2 Module Dedicated Instruction
Analog instruction
Classification Instruction Argument Processing details Executing Reference
name condition
Mode switching G_OFFGAN (Un*), (s) • Moves to the offset/gain setting mode. Page 33
• Moves to the normal mode. G(P)_OFFGAN
GP_OFFGAN

Setting value reading G_OGLOAD (Un*), (s), (d) • Reads the user range settings offset/gain Page 35
value to the programmable controller CPU. G(P)_OGLOA
GP_OGLOAD D

Setting value restoration G_OGSTOR (Un*), (s), (d) • Restores the user range settings offset/gain Page 37
value stored in the programmable controller G(P)_OGSTO
GP_OGSTOR CPU. R

2 INSTRUCTION TABLES
16 2.2 Module Dedicated Instruction
Positioning instruction
Classification Instruction Argument Processing details Executing Reference
name condition
Absolute position restoration Z_ABRST1 (Un*), (s), (d) Restores the absolute position of the specified Page 39

Z_ABRST2 (Un*), (s), (d)


axis. Z_ABRST1,
Z_ABRST2, 2
Z_ABRST3,
Z_ABRST4
Z_ABRST3 (Un*), (s), (d)

Z_ABRST4 (Un*), (s), (d)

Positioning start ZP_PSTRT1 (Un*), (s), (d) Starts positioning of the specified axis. Page 43
ZP_PSTRT1,
ZP_PSTRT2 (Un*), (s), (d) ZP_PSTRT2,
ZP_PSTRT3,
ZP_PSTRT4
ZP_PSTRT3 (Un*), (s), (d)

ZP_PSTRT4 (Un*), (s), (d)

Teaching ZP_TEACH1 (Un*), (s), (d) Performs teaching for the specified axis. Page 45
ZP_TEACH1,
ZP_TEACH2 (Un*), (s), (d) ZP_TEACH2,
ZP_TEACH3,
ZP_TEACH4
ZP_TEACH3 (Un*), (s), (d)

ZP_TEACH4 (Un*), (s), (d)

Writing to flash ROM ZP_PFWRT (Un*), (s), (d) Writes the positioning module parameters, Page 47
positioning data, and block start data to the ZP_PFWRT
flash ROM.
Setting data initialization ZP_PINIT (Un*), (s), (d) Initializes the positioning module setting data. Page 49
ZP_PINIT

2 INSTRUCTION TABLES
2.2 Module Dedicated Instruction 17
Serial communication instruction
Classification Instruction Argument Processing details Executing Applicable Reference
name condition module
On-demand function G_ONDEMAND (Un*), (s1), (s2), Sends data using the on-demand Page 51
transmission (d) function of MC protocol. Serial G(P)_ONDE
MAND
GP_ONDEMAN (Un*), (s1), (s2), Modem
D (d)
Nonprocedural protocol G_OUTPUT (Un*), (s1), (s2), Sends the specified number of data. Page 54
communication (d) Serial G(P)_OUTP
UT
GP_OUTPUT (Un*), (s1), (s2), Modem
(d)
G_INPUT (Un*), (s), (d1), Reads the received data. Page 57
(d2) G_INPUT
Bidirectional protocol G_BIDOUT (Un*), (s1), (s2), Sends the specified number of data. Page 59
communication (d) Serial G(P)_BIDOU
T
GP_BIDOUT (Un*), (s1), (s2), Modem
(d)
G_BIDIN (Un*), (s), (d1), Reads received data. Page 61
(d2) G(P)_BIDIN
GP_BIDIN (Un*), (s), (d1),
(d2)
Communication status G_SPBUSY (Un*), (d) Reads the data transmission/reception Page 63
check status using the instruction. Serial G(P)_SPBU
GP_SPBUSY (Un*), (d) SY
Modem

Receive data clear ZP_CSET (Un*), (s1), (s2), Clears receive data without stopping Page 64
(d1), (d2) transmission using the nonprocedural Serial ZP_CSET
protocol.
Modem

Data transmission/ Z_BUFRCVS (Un*), (s), (d) Receives data with an interrupt Page 66
reception program using the nonprocedural Serial Z_BUFRCVS
protocol or bidirectional protocol.
Modem
G_PRR (Un*), (s), (d) Sends data by user frame according to Page 68
the specification in user frame G(P)_PRR
GP_PRR (Un*), (s), (d) specification area for transmission
using the nonprocedural protocol.

Initial setting ZP_CSET (Un*), (s1), (s2), Sets the unit (word/byte) of the number Page 72
(d1), (d2) of the data to be sent or received. Serial ZP_CSET

Modem

Programmable controller ZP_CSET (Un*), (s1), (s2), Registers and cancels the Page 75
CPU monitor (d1), (d2) programmable controller CPU Serial ZP_CSET
monitoring for using the programmable
Modem
controller CPU monitoring function.
Flash ROM user frame G_PUTE (Un*), (s1), (s2), Registers a user frames to the flash Page 83
registration/reading (d) ROM. Serial G(P)_PUTE
GP_PUTE (Un*), (s1), (s2), Modem
(d)
G_GETE (Un*), (s1), (s2), Reads a user frames from the flash Page 86
(d) ROM. G(P)_GETE
GP_GETE (Un*), (s1), (s2),
(d)
Mode switching ZP_UINI (Un*), (s), (d) Switches the mode, transmission Page 89
specification, and host station number. Serial ZP_UINI

Pre-defined protocol G_CPRTCL (Un*), n1, n2, (s), Executes the protocols and functional Page 95
communication (d) protocols written to the flash ROM. Serial G(P)_CPRT
CL
GP_CPRTCL (Un*), n1, n2, (s),
(d)

2 INSTRUCTION TABLES
18 2.2 Module Dedicated Instruction
Network dedicated instruction
Classification Instruction Argument Processing details Executing Applicable Reference
name condition module
Reading from the buffer J_RIRD (Jn*), (s), (d1), Reads data for the specified number of Page 98
CC IE C
memory of an intelligent
device station
JP_RIRD
(d2)

(Jn*), (s), (d1),


points from the buffer memory or
device of the specified station.
J(P)_RIRD,
G(P)_RIRD 2
(d2) CC IE C

CC IE F

G_RIRD (Un*), (s), (d1),


(d2) CC-Link

CC IE C

GP_RIRD (Un*), (s), (d1),


(d2) CC-Link

CC IE C

CC IE F

Writing to the buffer J_RIWT (Jn*), (s1), (s2), Writes data for the specified number of Page 102
memory of an intelligent (d) points to the buffer memory or device of CC IE C J(P)_RIWT,
device station the specified station. G(P)_RIWT
JP_RIWT (Jn*), (s1), (s2),
(d) CC IE C

CC IE F

G_RIWT (Un*), (s1), (s2),


(d) CC-Link

CC IE C

GP_RIWT (Un*), (s1), (s2),


(d) CC-Link

CC IE C

CC IE F

Reading from the buffer G_RIRCV (Un*), (s1), (s2), Automatically performs handshaking Page 106
memory of an intelligent (d1), (d2) with the specified station and reads CC-Link G(P)_RIRCV
device station GP_RIRCV (Un*), (s1), (s2), data from the buffer memory of the
(with handshake) (d1), (d2) specified station.
This instruction is applicable with a
module having a handshake signal,
such as the AJ65BT-R2(N).
Writing to the buffer G_RISEND (Un*), (s1), (s2), Automatically performs handshaking Page 110
memory of an intelligent (d1), (d2) with the specified station and writes CC-Link G(P)_RISEN
device station GP_RISEND (Un*), (s1), (s2), data to the buffer memory of the D
(with handshake) (d1), (d2) specified station.
This instruction is applicable with a
module having a handshake signal,
such as the AJ65BT-R2(N).
Reading from the auto- G_RIFR (Un*), n1, n2, n3, Reads data from the auto-refresh buffer Page 114
refresh buffer memory of (d) memory of the specified station. CC-Link G(P)_RIFR
the master station GP_RIFR (Un*), n1, n2, n3, This instruction is applicable with a
(d) module having an auto-refresh buffer,
such as the AJ65BT-R2.
Writing to the auto- G_RITO (Un*), n1, n2, n3, Writes data to the auto-refresh buffer Page 116
refresh buffer memory of (d) memory of the specified station. CC-Link G(P)_RITO
the master station GP_RITO (Un*), n1, n2, n3, This instruction is applicable with a
(d) module having an auto-refresh buffer,
such as the AJ65BT-R2.
Network parameter G_RLPASET (Un*), (s1), (s2), Sets network parameter to the master Page 118
setting (s3), (s4), (s5), station and starts up the data link. CC-Link G(P)_RLPAS
(d) ET
GP_RLPASET (Un*), (s1), (s2),
(s3), (s4), (s5),
(d)

2 INSTRUCTION TABLES
2.2 Module Dedicated Instruction 19
Classification Instruction Argument Processing details Executing Applicable Reference
name condition module
Device data read/write J_READ (Jn*), (s1), (s2), Reads data from a word device of Page 125
(d1), (d2) another station. CC IE C J(P)_READ,
G(P)_READ
JP_READ (Jn*), (s1), (s2), CC IE F
(d1), (d2)
NET/H
G_READ (Un*), (s1), (s2),
(d1), (d2) Ether
GP_READ (Un*), (s1), (s2),
(d1), (d2)
J_SREAD (Jn*), (s1), (s2), Reads data from a device of another Page 130
(d1), (d2), (d3) station (with completion device). J(P)_SREAD
,
JP_SREAD (Jn*), (s1), (s2),
G(P)_SREA
(d1), (d2), (d3)
D
G_SREAD (Un*), (s1), (s2),
(d1), (d2), (d3)
GP_SREAD (Un*), (s1), (s2),
(d1), (d2), (d3)
J_WRITE (Jn*), (s1), (s2), Writes data to a device of another Page 134
(s3), (d1) station. J(P)_WRITE,
G(P)_WRITE
JP_WRITE (Jn*), (s1), (s2),
(s3), (d1)
G_WRITE (Un*), (s1), (s2),
(s3), (d1)
GP_WRITE (Un*), (s1), (s2),
(s3), (d1)
J_SWRITE (Jn*), (s1), (s2), Writes data to a device of another Page 140
(d1), (d2), (d3) station (with completion device). J(P)_SWRIT
JP_SWRITE (Jn*), (s1), (s2), E,
(d1), (d2), (d3) G(P)_SWRIT
E
G_SWRITE (Un*), (s1), (s2),
(d1), (d2), (d3)
GP_SWRITE (Un*), (s1), (s2),
(d1), (d2), (d3)
Message (user-specified J_SEND (Jn*), (s1), (s2), Sends data to another station. Page 144
data) communication (d) CC IE C J(P)_SEND,
G(P)_SEND
JP_SEND (Jn*), (s1), (s2), CC IE F
(d)
NET/H
G_SEND (Un*), (s1), (s2),
(d) Ether
GP_SEND (Un*), (s1), (s2),
(d)
J_RECV (Jn*), (s), (d1), Reads received data from another Page 150
(d2) station J(P)_RECV,
(for main program). G(P)_RECV
JP_RECV (Jn*), (s), (d1),
(d2)
G_RECV (Un*), (s), (d1),
(d2)
GP_RECV (Un*), (s), (d1),
(d2)
Z_RECVS (Un*), (s1), (s2), Reads received data from another Page 154
(d) station Z_RECVS
(for interrupt program)

2 INSTRUCTION TABLES
20 2.2 Module Dedicated Instruction
Classification Instruction Argument Processing details Executing Applicable Reference
name condition module
Transient request to J_REQ (Jn*), (s1), (s2), Executes remote RUN/STOP for Page 157
another station (d1), (d2) another station. CC IE C J(P)_REQ,
Reads/writes clock data from another G(P)_REQ
JP_REQ (Jn*), (s1), (s2),
station. CC IE C
(d1), (d2)

CC IE F 2
NET/H

Ether

G_REQ (Un*), (s1), (s2),


(d1), (d2) CC IE C

GP_REQ (Un*), (s1), (s2),


(d1), (d2) CC IE C

CC IE F

NET/H

Ether

Read from other station J_ZNRD (Un*), n1, (s), n2, Reads data from a device of a Page 165
devices (d1), (d2) programmable controller on another CC IE C J(P)_ZNRD
station.
JP_ZNRD (Un*), n1, (s), n2, NET/H
(In units of words)
(d1), (d2)
Ether
Write to other station J_ZNWR (Un*), n1, (s), n2, Writes data to a device of a Page 168
devices (d1), (d2) programmable controller on another J(P)_ZNWR
station.
JP_ZNWR (Un*), n1, (s), n2,
(d1), (d2) (In units of words)

Remote RUN Z_RRUN_J (Jn*), (s1), (s2), Executes remote RUN for a CPU Page 171
(s3), (s4), (d) module on another station. CC IE C Z(P)_RRUN_
J,
ZP_RRUN_J (Jn*), (s1), (s2), NET/H
Z(P)_RRUN_
(s3), (s4), (d)
U
Z_RRUN_U (Un*), (s1), (s2),
(s3), (s4), (d)
ZP_RRUN_U (Un*), (s1), (s2),
(s3), (s4), (d)
Remote STOP Z_RSTOP_J (Jn*), (s1), (s2), Executes remote STOP for a CPU Page 174
(s3), (s4), (d) module on another station. CC IE C Z(P)_RSTOP
_J,
ZP_RSTOP_J (Jn*), (s1), (s2), NET/H
(s3), (s4), (d) Z(P)_RSTOP
_U
Z_RSTOP_U (Un*), (s1), (s2),
(s3), (s4), (d)
ZP_RSTOP_U (Un*), (s1), (s2),
(s3), (s4), (d)
Reading clock data from Z_RTMRD_J (Jn*), (s1), (s2), Reads clock data from a CPU module Page 177
another station (s3), (d1), (d2) on another station. CC IE C Z(P)_RTMR
ZP_RTMRD_J (Jn*), (s1), (s2), D_J,
NET/H
Z(P)_RTMR
(s3), (d1), (d2)
D_U
Z_RTMRD_U (Un*), (s1), (s2),
(s3), (d1), (d2)
ZP_RTMRD_U (Un*), (s1), (s2),
(s3), (d1), (d2)
Writing clock data to Z_RTMWR_J (Jn*), (s1), (s2), Writes clock data to a CPU module on Page 179
another station (s3), (s4), (d) another station. CC IE C Z(P)_RTMW
ZP_RTMWR_J (Jn*), (s1), (s2), R_J,
NET/H
Z(P)_RTMW
(s3), (s4), (d)
R_U
Z_RTMWR_U (Un*), (s1), (s2),
(s3), (s4), (d)
ZP_RTMWR_U (Un*), (s1), (s2),
(s3), (s4), (d)

2 INSTRUCTION TABLES
2.2 Module Dedicated Instruction 21
Classification Instruction Argument Processing details Executing Applicable Reference
name condition module
Reading from buffer Z_REMFR (Jn*), n1, n2, n3, Reads data from the buffer memory of Page 182
memory of intelligent n4, n5, (d1), (d2) an intelligent function module on the NET/H Z(P)_REMF
function module on remote I/O station. R
ZP_REMFR (Jn*), n1, n2, n3,
remote I/O station CC IE F
n4, n5, (d1), (d2)

NET/H

Writing to buffer memory Z_REMTO (Jn*), n1, n2, n3, Writes data to the buffer memory of an Page 185
of intelligent function n4, n5, (d1), (d2) intelligent function module on the NET/H Z(P)_REMT
module on remote I/O remote I/O station. O
ZP_REMTO (Jn*), n1, n2, n3,
station CC IE F
n4, n5, (d1), (d2)

NET/H

Setting parameter G_CCPASET (Un*), (s1), (s2), Set parameters for master/local Page 188
(s3), (s4), (d) modules (master station). CC IE F G(P)_CCPA
SET
GP_CCPASET (Un*), (s1), (s2),
(s3), (s4), (d)
Connection opening or ZP_OPEN (Un*), (s1), (s2), Opens a connection. Page 194
closing (d) Ether ZP_OPEN
ZP_CLOSE (Un*), (s1), (s2), Closes a connection. Page 198
(d) ZP_CLOSE
Fixed buffer ZP_BUFRCV (Un*), (s1), (s2), Reads received data. Page 201
communication (d1), (d2) (for main program). Ether ZP_BUFRCV
Z_BUFRCVS (Un*), (s), (d) Reads received data. Page 204
(for interrupt program) Z_BUFRCVS
ZP_BUFSND (Un*), (s1), (s2), Sends data. Page 206
(s3), (d) ZP_BUFSND
Reading or clearing error ZP_ERRCLR (Un*), (s), (d) Clears error information. Page 209
information Ether ZP_ERRCLR
ZP_ERRRD (Un*), (s), (d) Reads error information. Page 212
ZP_ERRRD
Re-initialization/station Z_UINI (Un*), (s), (d) • Executes re-initialization. Page 214
number setting/changing • Sets the host station number. CC IE C Z(P)_UINI
switch setting • Changes the switch setting.
ZP_UINI (Un*), (s), (d)
CC IE C

Ether

E-mail communication ZP_MRECV (Un*), (s), (d1), Reads received e-mail. Page 218
(d2) Ether ZP_MRECV
ZP_MSEND (Un*), (s1), (s2), Sends an e-mail. Page 221
(d) ZP_MSEND

2 INSTRUCTION TABLES
22 2.2 Module Dedicated Instruction
2.3 PID Control Instruction
PID control instruction (inexact differential)
Classification Instruction
name
Argument Processing details Executing
condition
Reference
2
Data setting S_PIDINIT (s) Sets data to be used for PID operation. Page 227
S(P)_PIDINIT
SP_PIDINIT (s)

PID operation S_PIDCONT (s) Performs PID operation based on the set value Page 232
(SV) and process value (PV). S(P)_PIDCON
SP_PIDCONT (s) T

PID operation stop S_PIDSTOP n Stops the PID operation for the specified loop Page 236
number. S_PIDSTOP,
SP_PIDSTOP n S_PIDRUN

PID operation start S_PIDRUN n Starts the PID operation for the specified loop
number.
SP_PIDRUN n

Operation parameter change S_PIDPRMW n, (s) Changes operation parameter of the specified Page 237
loop number. S(P)_PIDPRM
SP_PIDPRMW n, (s) W

PID control instruction (exact differential)


Classification Instruction Argument Processing details Executing Reference
name condition
Data setting PIDINIT (s) Sets data to be used for PID operation. Page 240
PIDINIT(P)
PIDINITP (s)

PID operation PIDCONT (s) Performs PID operation based on the set value Page 244
(SV) and process value (PV). PIDCONT(P)
PIDCONTP (s)

PID operation stop PIDSTOP n Stops the PID operation for the specified loop Page 248
number. PIDSTOP,
PIDSTOPP n PIDRUN

PID operation start PIDRUN n Starts the PID operation for the specified loop
number.
PIDRUNP n

Operation parameter change PIDPRMW n, (s) Changes operation parameter of the specified Page 249
loop number. PIDPRMW(P)
PIDPRMWP n, (s)

2 INSTRUCTION TABLES
2.3 PID Control Instruction 23
2.4 Socket Communication Function Instruction
Classification Instruction Argument Processing details Executing Reference
name condition
Opening/closing connection SP_SOCOPEN (Un*), (s1), (s2), Establishes a connection. Page 252
(d) SP_SOCOPEN
SP_SOCCLOS (Un*), (s1), (s2), Shuts a connection off. Page 255
E (d) SP_SOCCLOS
E
Reading receive data SP_SOCRCV (Un*), (s1), (s2), Reads receive data. (Reading at the end Page 257
(d1), (d2) process) SP_SOCRCV
S_SOCRCVS (Un*), (s), (d) Reads receive data. (Reading at the instruction Page 259
execution) S_SOCRCVS
Sending data SP_SOCSND (Un*), (s1), (s2), Sends data. Page 261
(s3), (d) SP_SOCSND
Reading connection information SP_SOCCINF (Un*), (s1), (s2), Reads connection information. Page 264
(d) SP_SOCCINF
Changing destination SP_SOCCSET (Un*), (s1), (s2) Changes a destination of a UDP/IP connection. Page 266
SP_SOCCSET
Changing receive mode SP_SOCRMOD (Un*), (s1), (s2) Changes the receive mode of a connection. Page 268
E SP_SOCRMO
DE
Reads data from the receive S_SOCRDATA (Un*), (s1), (s2), Reads data from the receive data area. Page 270
data area. n, (d) S(P)_SOCRDA
SP_SOCRDAT TA
A

2 INSTRUCTION TABLES
24 2.4 Socket Communication Function Instruction
2.5 Built-in I/O Function Instruction
Positioning function dedicated instruction
Classification Instruction
name
Argument Processing details Executing
condition
Reference
2
Positioning start IPPSTRT1 n Specifies a data number to be executed from Page 272
"Positioning Data" No. 1 to No. 10 which are IPPSTRT1,
IPPSTRT1P n previously set in GX Works2, and starts the IPPSTRT2
positioning.

IPPSTRT2 n

IPPSTRT2P n

IPDSTRT1 (s) Regardless of "Positioning Data" No. 1 to No. Page 273


10 which are previously set in GX Works2, IPDSTRT1,
IPDSTRT1P (s) starts the positioning using the data stored in IPDSTRT2
the devices starting from the one specified for
control data.
IPDSTRT2 (s)

IPDSTRT2P (s)

IPSIMUL n1, n2 Starts the positioning of the axis 1 "Positioning Page 275
Data" number and the axis 2 "Positioning Data" IPSIMUL(P)
IPSIMULP n1, n2 number simultaneously.

OPR start IPOPR1 (s) Specifies a method and starts the OPR of the Page 276
specified axis. IPOPR1,
IPOPR1P (s) IPOPR2

IPOPR2 (s)

IPOPR2P (s)

JOG start IPJOG1 (s1), (s2) Starts the JOG operation of the specified axis. Page 278
IPJOG1,
IPJOG2 (s1), (s2) IPJOG2

Absolute position restoration IPABRST1 (s), (d) Executes the absolute position restoration of Page 280
the specified axis. IPABRST1,
IPABRST2 (s), (d) IPABRST2

Stop IPSTOP1  Stops the axis in operation. Page 282


IPSTOP1,
IPSTOP2  IPSTOP2

Speed change IPSPCHG1 (s) Changes the speed of the specified axis. Page 283
IPSPCHG1,
IPSPCHG1P (s) IPSPCHG2

IPSPCHG2 (s)

IPSPCHG2P (s)

Target position change IPTPCHG1 (s) Changes the target position of the specified Page 285
axis. IPTPCHG1,
IPTPCHG1P (s) IPTPCHG2

IPTPCHG2 (s)

IPTPCHG2P (s)

2 INSTRUCTION TABLES
2.5 Built-in I/O Function Instruction 25
Counter function dedicated instruction
Classification Instruction Argument Processing details Executing Reference
name condition
Current value read ICCNTRD1  Stores the most recent value for the current Page 287
value of the specified CH. ICCNTRD1,
ICCNTRD1P  ICCNTRD2

ICCNTRD2 

ICCNTRD2P 

Ring counter upper/lower limit ICRNGWR1 (s1), (s2) Sets a ring counter lower limit value and upper Page 288
value write limit value of the specified CH. ICRNGWR1,
ICRNGWR1P (s1), (s2) ICRNGWR2

ICRNGWR2 (s1), (s2)

ICRNGWR2P (s1), (s2)

Preset value write ICPREWR1 (s) Sets a preset value of the specified CH. Page 290
ICPREWR1,
ICPREWR1P (s) ICPREWR2

ICPREWR2 (s)

ICPREWR2P (s)

Latch counter value read ICLTHRD1 n, (d) Stores a latch counter value of the specified Page 291
CH. ICLTHRD1,
ICLTHRD1P n, (d) ICLTHRD2

ICLTHRD2 n, (d)

ICLTHRD2P n, (d)

Sampling counter value read ICSMPRD1 (d) Stores a sampling counter value of the Page 292
specified CH. ICSMPRD1,
ICSMPRD1P (d) ICSMPRD2

ICSMPRD2 (d)

ICSMPRD2P (d)

Coincidence output point write ICCOVWR1 n, (s) Sets a coincidence output No. n point of the Page 293
specified CH. ICCOVWR1,
ICCOVWR1P n, (s) ICCOVWR2

ICCOVWR2 n, (s)

ICCOVWR2P n, (s)

Frequency measurement ICFCNT1 (d) Measures the frequency of the specified CH. Page 294
ICFCNT1,
ICFCNT2 (d) ICFCNT2

Rotation speed measurement ICRCNT1 (d) Measures the rotation speed of the specified Page 295
CH. ICRCNT1,
ICRCNT2 (d) ICRCNT2

2 INSTRUCTION TABLES
26 2.5 Built-in I/O Function Instruction
Classification Instruction Argument Processing details Executing Reference
name condition
Pulse measurement read ICPLSRD1 (d) Stores the measured pulse value of the Page 296
specified CH. ICPLSRD1,
ICPLSRD1P (d) ICPLSRD2

ICPLSRD2 (d)
2
ICPLSRD2P (d)

PWM output ICPWM1 (s1), (s2) Outputs the PWM waveform of the specified Page 297
CH. ICPWM1,
ICPWM2 (s1), (s2) ICPWM2

2 INSTRUCTION TABLES
2.5 Built-in I/O Function Instruction 27
2.6 Data Logging Function Instruction
Classification Instruction Argument Processing details Executing Reference
name condition
Trigger logging set/reset LOGTRG n Generates the trigger conditions in a trigger Page 299
logging. Stores the data sampling results to the LOGTRG
data logging file for the number of times Instruction,
specified in the trigger logging configuration of LOGTRGR
the programming tool. Instruction
LOGTRGR n Resets the trigger conditions

2.7 SFC Control Instruction


Classification Instruction Argument Processing details Executing Reference
name condition
SFC step comment read S_SFCSCOMR n1, n2, n3, (d1), Reads comment of an active step in the Page 301
(d2) specified SFC block by the specified number. S(P)_SFCSCO
MR
SP_SFCSCOM n1, n2, n3, (d1),
R (d2)
SFC transition condition S_SFCTCOMR n1, n2, n3, (d1), Reads comment of transition condition Page 303
comment read (d2) associated with an active step in the specified S(P)_SFCTCO
SFC block by the specified number. MR
SP_SFCTCOM n1, n2, n3, (d1),
R (d2)

2 INSTRUCTION TABLES
28 2.6 Data Logging Function Instruction
3 CONFIGURATION OF INSTRUCTIONS
Instructions available in the CPU module can be divided into an instruction name and an argument.
The application of an instruction name and an argument are as follows:
• Instruction name
Indicates the function of the instruction.
• Argument
Indicates the I/O data used in the instruction. 3
Arguments are classified into I/O number, source data, destination data, number of devices, executing condition, and
execution result.

I/O number
I/O number is data that set a module in which the instruction is to be executed.
Set the I/O number by start I/O number or a network number of the module depending on the instruction.

■Setting the start I/O number (Un) of the module


Set the higher two digits when expressing the start I/O number in three digits for the module in which the instruction is to be
executed. Set the start I/O number in a numeric value or character string according to the data type available with the
instruction.
• Setting the start I/O number in word (unsigned)/16-bit string or word (signed) data type
Set the start I/O number of the module for 'n' of 'Un'.

Ex.
For the module whose start I/O number is 020H: 02

• Setting the start I/O number in string data type


Set the start I/O number in the format of "Un" (n: start I/O number of the module).

Ex.
For the module whose start I/O number is 020H: "02"

■Network number (Jn) setting


Set the network number of the network module/Ethernet module in which the instruction is to be executed. Set a network
number indicated below, in word (unsigned)/16-bit string or word (signed) data type, for 'n' of 'Jn'.
• 1 to 239: Network number
• 254: Network specified in "Valid module during other station access" on the GX Works2 network parameter screen

Ex.
When the network number is 1: 1

3 CONFIGURATION OF INSTRUCTIONS
29
Source (s)
A source is data used in an operation.
The following source types are available depending on the device specified in an instruction:
Type Description
Constant Specifies a numeric value used in an operation. Constants are set during
programming so that they cannot be changed while the program is being
executed. Perform index modification when using them as variable data.
Bit device and word device Specifies the device in which the data used in the operation are stored. Data
must be stored to the specified device before executing the operation. By
changing the data to be stored to the specified device while a program is
being executed, the data used in the instruction can be changed.

The instructions explained in this manual use special data. Refer to the explanation for each instruction and use data
correctly.

Destination (d)
Data after the operation are stored to a destination.
Set a device in which data are to be stored to a destination.
The instructions explained in this manual use special data. Refer to the explanation for each instruction and use data
correctly.

Number of devices and number of transfers (n)


Data such as a channel number, loop number, read data length, and logging setting number are set to the number of devices
and number of transfers (n).

Executing condition (EN)


An input variable EN inputs an executing condition of an instruction.

Execution result (ENO)


An output variable ENO outputs an execution result.

For details of the configuration of instructions for labels and structures, refer to the following.
 MELSEC-Q/L/F Structured Programming Manual (Fundamentals)

3 CONFIGURATION OF INSTRUCTIONS
30
4 HOW TO READ INSTRUCTIONS
Chapter 5 provides detailed explanation on each instruction in the layout as shown below.

Ó
Ô
Õ

Indicates an outline of an instruction.


Indicates an instruction to be explained.

4 HOW TO READ INSTRUCTIONS


31
Indicates the instruction execution target module. If one instruction is to be executed in two or more modules, applicable
modules are indicated using icons.
Module Icon Module Icon
Serial communication Built-in Ethernet port QCPU
Serial QnUDE(H)

Modem interface High-speed Universal model QCPU, Universal model


Modem Process CPU QnUDV

CC-Link LCPU
CC-Link LCPU

CC-Link IE Controller Network Universal model QCPU


CC IE C Universal

CC-Link IE Field Network High Performance model QCPU


High
CC IE F performance

MELSECNET/H Process CPU


NET/H Process

Ethernet Redundant CPU


Ether Redundant

Written formats in the structured ladder/FBD and structured text language.


Indicates the instruction name and executing condition of the instruction.
Executing Non-conditional Executed while ON Executed once at Executed while Executed once at
condition execution ON OFF OFF
Symbols on the No symbol
corresponding page

Indicates the names of input and output arguments, and the data type of each argument. For details of each data type, refer
to the following.
 MELSEC-Q/L/F Structured Programming Manual (Fundamentals)
Devices that can be used in the instruction are marked with .
The following table shows applicable classification for usable devices.
Device Internal device (system, File Link direct device Intelligent Index Constant*5 Others *5
classification user) register J\*4*6 function register Zn
Bit Word R, ZR Bit Word module
U\G
Usable device *1 X, Y, M, L, T*3, ST*3, R, ZR J\X J\W U\G Z K, H, E, $, P, I, J, U, DX,
SM, F, B, SB, C*3, D, W, J\Y J\SW DY, N, BL,
FX, FY*2*2 SD, SW, J\B TR, BL\S, V
FD*2, @ J\SB

*1 For description of each device, refer to the User's Manual (Function Explanation, Program Fundamentals) of the CPU module currently
being used.
*2 FX and FY can be used in bit data only, and FD can be used in word data only in the PID control instruction.
*3 T, ST, and C can be used in word data only (cannot be used in bit data).
*4 These devices can be used in CC-Link IE, MELSECNET/H, and MELSECNET/10.
*5 The Constant and Others columns describe settable devices.
*6 Link direct devices (J\) cannot be used for LCPU.
Indicates the processing performed by the instruction.
Indicates data such as control data, send data or receive data, that are used for an input argument or output argument in an
instruction.
The setting side indicates the following:
• User : Data set by user before dedicated instruction execution
• System : Data stored by the programmable controller CPU after dedicated instruction execution. The setting does not need
to be set by the user. If the setting is set by the user, data cannot be read normally.
Indicates the program examples of structured ladder/FBD/ST.

4 HOW TO READ INSTRUCTIONS


32
5 MODULE DEDICATED INSTRUCTION

5.1 Analog Instruction


OFFGAN instruction

G(P)_OFFGAN

Structured ladder/FBD ST
G_OFFGAN

EN ENO
ENO:= G_OFFGAN (EN, Un*, s);
Un*
5
s

The following instruction can go in the dotted squares.


G_OFFGAN, GP_OFFGAN

■Executing condition
Instruction Executing condition
G_OFFGAN

GP_OFFGAN

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Mode switching ANY16
0: To normal mode
1: To offset/gain setting mode
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction converts the mode of analog modules. (normal mode to offset/gain setting mode, offset/gain setting mode to
normal mode)

5 MODULE DEDICATED INSTRUCTION


5.1 Analog Instruction 33
Program example
• The following program converts the mode of the A/D converter module mounted on the I/O numbers from X/Y00 to X/Y0F
to the offset/gain setting mode when Var_Flag turns ON, and gets it back to the normal mode when Var_Flag turns OFF.
[Structured ladder/FBD]

Sets mode
when Var_Flag
turns ON
Converts mode

Process in offset/gain setting mode

Sets mode
when Var_Flag
turns OFF

Converts mode

Process in normal mode

[ST]
(* Convert to the offset/gain setting mode *)
IF(Var_Flag=TRUE)THEN (* Var_Flag ON *)
MOVP(TRUE,1,Var_ControlData); (* Sets mode *)
G_OFFGAN(TRUE,H00,Var_ControlData); (* Converts mode *)
END_IF;
IF(X0A=TRUE)THEN

(* Process in offset/gain setting mode *)


END_IF;

(* Convert to the normal mode *)


IF(Var_Flag=FALSE)THEN (* Var_Flag OFF *)
MOVP(TRUE,0,Var_ControlData); (* Sets mode *)
G_OFFGAN(TRUE,H00,Var_ControlData); (* Converts mode *)
END_IF;
IF(X0A=FALSE)THEN

(* Process in normal mode *)


END_IF;

5 MODULE DEDICATED INSTRUCTION


34 5.1 Analog Instruction
Setting value reading

G(P)_OGLOAD

Structured ladder/FBD ST
G_OGLOAD

EN ENO
ENO:= G_OGLOAD (EN, Un*, s, d);
Un* d

The following instruction can go in the dotted squares.


G_OGLOAD, GP_OGLOAD

■Executing condition
5
Instruction Executing condition
G_OGLOAD

GP_OGLOAD

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..35]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d)  

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads the user range settings offset/gain values of analog modules to the CPU.

Setting data
For the control data, refer to the manual for each module used.

5 MODULE DEDICATED INSTRUCTION


5.1 Analog Instruction 35
Program example
• The following program reads out the offset/gain value of the A/D converter module mounted on the I/O numbers from X/Y00
to X/Y0F when the flag turns ON.
[Structured ladder/FBD]

Specifies voltage
when instruction
flag turns ON
Turns execution flag ON

Performs readout

Normal completion
Turns execution flag OFF

Error completion
Process on error completion

[ST]
IF(Var_Flag_Inst=TRUE)THEN (* Instruction flag ON *)

MOV(TRUE,0,Var_ControlData[2]); (* Specifies voltage *)


SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;

IF(Var_Flag_Exe=TRUE)THEN (* Execution flag ON *)


G_OGLOAD(TRUE, H00, Var_ControlData, Var_Result); (* Performs readout *)
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)
ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


36 5.1 Analog Instruction
Setting value restoration

G(P)_OGSTOR

Structured ladder/FBD ST
G_OGSTOR

EN ENO
ENO:= G_OGSTOR (EN, Un*, s, d);
Un* d

The following instruction can go in the dotted squares.


G_OGSTOR, GP_OGSTOR

■Executing condition
5
Instruction Executing condition
G_OGSTOR

GP_OGSTOR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..35]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d)  

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction restores the user range settings offset/gain values stored in the programmable controller CPU to the analog
modules.

Setting data
For the control data, refer to the manual for each module used.

5 MODULE DEDICATED INSTRUCTION


5.1 Analog Instruction 37
Program example
• The following program restores the offset/gain setting value to the A/D converter module mounted on the I/O numbers from
X/Y10 to X/Y1F when the flag turns ON.
[Structured ladder/FBD]

Turns execution
flag ON

Restores setting value

Normal completion
Turns execution
flag OFF

Process on error completion Error completion

[ST]
IF(Var_Flag_Inst=TRUE)THEN (* Instruction flag ON *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;

IF(Var_Flag_Exe=TRUE)THEN (* Execution flag ON *)


G_OGSTOR(TRUE, H01, Var_ControlData, Var_Result); (* Restores setting value *)

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)
ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


38 5.1 Analog Instruction
5.2 Positioning Instruction
Absolute position restoration

Z_ABRST1, Z_ABRST2, Z_ABRST3, Z_ABRST4

Structured ladder/FBD ST
Z_ABRST1

EN ENO
ENO:= Z_ABRST1 (EN, Un*, s,d);
Un* d

The following instruction can go in the dotted squares. 5


Z_ABRST1, Z_ABRST2, Z_ABRST3, Z_ABRST4

■Executing condition
Instruction Executing condition
Z_ABRST1, Z_ABRST2, Z_ABRST3,
Z_ABRST4

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..7]
Output argument ENO Execution result Bit
(TRUE: Normal, FALSE: Error)
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   
(d)    

Processing details
This instruction restores the absolute position of the specified axis. (Refer to the following)
• Z_ABRST1: Axis 1
• Z_ABRST2: Axis 2
• Z_ABRST3: Axis 3
• Z_ABRST4: Axis 4

5 MODULE DEDICATED INSTRUCTION


5.2 Positioning Instruction 39
Setting data
Device Item Setting data Setting range Setting side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
• 0: Normal completion
• Other than 0: Error completion (error code)
(s)[2] Receive signal from servo Write the following signal status read from the servo amplifier b0: 0/1 User
amplifier to the input module. b1: 0/1
• b0: ABS data bit0 b2: 0/1
• b1: ABS data bit1
• b2: Send data READY flag
(s)[3] Send signal to servo amplifier The ON/OFF status of the following data, that are calculated  System
by the dedicated instructions on the basis of "receive signal
from servo amplifier" and output to the amplifier, are stored.
• b0: Servo ON
• b1: ABS transfer mode
• b2: ABS request flag
(s)[4] Status Communication status with the servo amplifier 0 User/System
• 0: Communication completed(Set by the user at the start of
communication)
• Other than 0: During communication (Stored by the system.)
(s)[5] System area   

(s)[7]

Program example
The following program restores the absolute position of the axis 1.
The devices from X47 to X49 and from Y50 to Y52 are used for the communication with the servo amplifier.
X47: ABS data bit0
X48: ABS data bit1
X49: Send data READY flag
Y50: Servo ON
Y51: ABS transfer mode
Y52: ABS request flag

5 MODULE DEDICATED INSTRUCTION


40 5.2 Positioning Instruction
[Structured ladder/FBD]

Absolute position
restoration pulse

Turns absolute
position restoration
memory ON
Clears completion
status

Turns the servo ON with


the data to be sent to the
servo amplifier
Sets completion
status to error code

Turns absolute position


restoration memory OFF

5
Sets ABS data
Sets ABS data in data b0
received from the servo

Sets ABS data in data b1

Sets send data ready


flag in data b2

Restores absolute
position

5 MODULE DEDICATED INSTRUCTION


5.2 Positioning Instruction 41
[ST]
PLS(SM400, Var_Flag_Inst); (* Absolute position restoration pulse *)

IF((Var_Flag_Inst=TRUE) & (X0=FALSE))THEN


SET(TRUE, Var_Flag_Mem); (* Turns absolute position restoration memory ON *)
MOV(TRUE, 0, Var_ControlData[4]); (* Clears completion status *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
MOV(TRUE, Var_ControlData[3], K1Y50); (* Turns the servo ON with the data to be sent to the servo amplifier *)
ELSE (* Error completion *)
MOV(TRUE, Var_ControlData[4], Var_ErrorCode); (* Sets completion status to error code *)
END_IF;

IF(Var_ControlData[4]=0)THEN
RST(TRUE, Var_Flag_Mem); (* Turns absolute position restoration memory OFF *)
END_IF;
END_IF;

IF(Var_Flag_Mem=TRUE)THEN (* absolute position restoration memory ON *)


(* Sets ABS data *)
BSET(X47, 0, Var_ControlData[2]); (* Sets ABS data in data b0 received from the servo *)
BSET(X48, 1, Var_ControlData[2]); (* Sets ABS data in data b1 received from the servo *)
BSET(X49, 2, Var_ControlData[2]); (* Sets send data ready flag in data b2 received from the servo *)

Z_ABRST1(TRUE, "00", Var_ControlData, Var_Result); (* Restores absolute position *)


END_IF;

5 MODULE DEDICATED INSTRUCTION


42 5.2 Positioning Instruction
Positioning start

ZP_PSTRT1, ZP_PSTRT2, ZP_PSTRT3, ZP_PSTRT4

Structured ladder/FBD ST
ZP_PSTRT1

EN ENO
ENO:= ZP_PSTRT1 (EN, Un*, s,d);
Un* d

The following instruction can go in the dotted squares.


ZP_PSTRT1, ZP_PSTRT2, ZP_PSTRT3, ZP_PSTRT4

■Executing condition
5
Instruction Executing condition
ZP_PSTRT1, ZP_PSTRT2, ZP_PSTRT3,
ZP_PSTRT4

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..2]
Output argument ENO Execution result Bit
(TRUE: Normal, FALSE: Error)
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   
(d)    

Processing details
This instruction starts positioning of the specified axis. (Refer to the following.)
• ZP_PSTRT1: Axis 1
• ZP_PSTRT2: Axis 2
• ZP_PSTRT3: Axis 3
• ZP_PSTRT4: Axis 4

5 MODULE DEDICATED INSTRUCTION


5.2 Positioning Instruction 43
Setting data
Device Item Setting data Setting range Setting side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
• 0: Normal completion
• Other than 0: Error completion (error code)
(s)[2] Start No. Specify the following data number to be started by the PSTRT 1 to 600, User
instruction. 7000 to 7004,
• 1 to 600: Positioning data number 9001 to 9004
• 7000 to 7004: Block start
• 9001: Machine OPR
• 9002: Fast OPR
• 9003: Current value change
• 9004: Multiple axes concurrent start

Program example
• The following program executes the positioning start of the positioning data number 1 when X100 turns ON.
[Structured ladder/FBD]

Positioning start
pulse

Sets start signal


number 1

Turns positioning
start instruction
memory ON

Performs
positioning start

Turns positioning
start instruction
memory OFF
[ST]
PLS(X100, Var_Flag_Inst); (* Positioning start pulse *)

IF(Var_Flag_Inst=TRUE)THEN
MOVP(TRUE, 1, Var_ControlData[2]); (* Sets start signal number 1 *)
SET(TRUE, Var_Flag_Mem); (* Turns positioning start instruction memory ON *)
END_IF;

IF(Var_Flag_Mem=TRUE)THEN (* Positioning start instruction memory ON *)


ZP_PSTRT1(TRUE, "00", Var_ControlData, Var_Result); (* Performs positioning start *)
RST(TRUE, Var_Flag_Mem); (* Turns positioning start instruction memory OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


44 5.2 Positioning Instruction
Teaching

ZP_TEACH1, ZP_TEACH2, ZP_TEACH3, ZP_TEACH4

Structured ladder/FBD ST
ZP_TEACH1

EN ENO
ENO:= ZP_TEACH1 (EN, Un*, s,d);
Un* d

The following instruction can go in the dotted squares.


ZP_TEACH1, ZP_TEACH2, ZP_TEACH3, ZP_TEACH4

■Executing condition
5
Instruction Executing condition
ZP_TEACH1, ZP_TEACH2, ZP_TEACH3,
ZP_TEACH4

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
00 to FE: Higher two digits when expressing the I/O
number in three digits)
s Variable that stores control data Array of ANY16 [0..3]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   
(d)    

Processing details
This instruction performs teaching for the specified axis. (Refer to the following)
• ZP_TEACH1: Axis 1
• ZP_TEACH2: Axis 2
• ZP_TEACH3: Axis 3
• ZP_TEACH4: Axis 4

Setting data
Device Item Setting data Setting range Setting side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
• 0: Normal completion
• Other than 0: Error completion (error code)
(s)[2] Teaching data selection Set the address (positioning address/circular address) to 0, 1 User
which the current feed value is written.
0: Write the current feed value to the positioning address
1: Write the current feed value to the circular address
(s)[3] Positioning data No. Set the positioning data number for which teaching is 1 to 600 User
performed.

5 MODULE DEDICATED INSTRUCTION


5.2 Positioning Instruction 45
Program example
• The following program performs teaching for the positioning data number 3 of the axis 1 when X39 turns ON.
[Structured ladder/FBD]

Teaching instruction
pulse

Turns teaching
instruction memory
ON

Sets teaching data

Sets positioning
data number

Performs teaching

Turns teaching
instruction memory
OFF

[ST]
PLS(X39, Var_Flag_Inst); (* Teaching instruction pulse *)

IF((Var_Flag_Inst=TRUE)&(X0C=FALSE))THEN
SET(TRUE, Var_Flag_Mem); (* Turns teaching instruction memory ON *)
END_IF;

IF(Var_Flag_Mem=TRUE)THEN (* Teaching instruction memory ON *)


MOVP(TRUE, H0, Var_ControlData[2]); (* Sets teaching data *)
MOVP(TRUE, K3, Var_ControlData[3]); (* Sets positioning data number *)

ZP_TEACH1(TRUE, "00", Var_ControlData, Var_Result); (* Performs teaching *)

IF((Var_Result[0]=TRUE)&(Var_Result[1]=FALSE))THEN
RST(TRUE, Var_Flag_Mem); (* Turns teaching instruction memory OFF *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


46 5.2 Positioning Instruction
PFWRT instruction

ZP_PFWRT

Structured ladder/FBD ST
ZP_PFWRT

EN ENO
ENO:= ZP_PFWRT (EN, Un*, s,d);
Un* d

The following instruction can go in the dotted squares.


ZP_PFWRT

■Executing condition
5
Instruction Executing condition
ZP_PFWRT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..1]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   
(d)    

Processing details
This instruction writes the positioning module parameters, positioning data, and block start data to the flash ROM.

Setting data
Device Item Setting data Setting range Setting side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
• 0: Normal completion
• Other than 0: Error completion (error code)

5 MODULE DEDICATED INSTRUCTION


5.2 Positioning Instruction 47
Program example
• The following program writes the parameters, positioning data, and block start data stored in buffer memory to the flash
ROM when X3D turns ON.
[Structured ladder/FBD]

Write to flash ROM instruction pulse

Turns write to flash ROM instruction memory ON

Waits output of programmable controller ready for the


positioning module

Writes data to flash ROM

Turns write to flash ROM instruction memory OFF

[ST]
PLS(X3D, Var_Flag_Inst); (* Write to flash ROM instruction pulse *)

IF((Var_Flag_Inst=TRUE)&(X0C=FALSE))THEN
SET(TRUE, Var_Flag_Mem); (* Turns write to flash ROM instruction memory ON *)
END_IF;

IF((Var_Flag_Mem=TRUE)&(Y0=FALSE))THEN
OUT_T(TRUE, TC1, 2); (* Waits output of programmable controller ready for the positioning module *)
END_IF;

IF(TS1=TRUE)THEN (* Write to flash ROM instruction memory ON *)


ZP_PFWRT(TRUE, "00", Var_ControlData, Var_Result); (* Writes data to flash ROM *)

IF((Var_Result[0]=TRUE)&(Var_Result[1]=FALSE))THEN
RST(TRUE, Var_Flag_Mem); (* Turns write to flash ROM instruction memory OFF *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


48 5.2 Positioning Instruction
Setting data initialization

ZP_PINIT

Structured ladder/FBD ST
ZP_PINIT

EN ENO
ENO:= ZP_PINIT (EN, Un*, s,d);
Un* d

The following instruction can go in the dotted squares.


ZP_PINIT

■Executing condition
5
Instruction Executing condition
ZP_PINIT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..1]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   
(d)    

Processing details
This instruction initializes the positioning module setting data.

Setting data
Device Item Setting data Setting range Setting side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
• 0: Normal completion
• Other than 0: Error completion (error code)

5 MODULE DEDICATED INSTRUCTION


5.2 Positioning Instruction 49
Program example
• The following program initializes the parameters of buffer memory and those of flash ROM when X3C turns ON.
[Structured ladder/FBD]

Parameter initialization instruction pulse

Turns parameter initialization instruction


memory ON

Waits output of programmable controller


ready for the positioning module

Performs initialization of parameters

Turns parameter initialization instruction


memory OFF

[ST]
PLS(X3C, Var_Flag_Inst); (* Parameter initialization instruction pulse *)

IF((Var_Flag_Inst=TRUE)&(X0C=FALSE))THEN
SET(TRUE, Var_Flag_Mem); (* Turns parameter initialization instruction memory ON *)
END_IF;

IF((Var_Flag_Mem=TRUE)&(Y0=FALSE))THEN
OUT_T(TRUE, TC0, 2); (* Waits output of programmable controller ready for the positioning module *)
END_IF;

IF(TS0=TRUE)THEN (* Parameter initialization instruction memory ON *)


ZP_PINIT(TRUE, "00", Var_ControlData, Var_Result); (* Performs initialization of parameters *)

IF((Var_Result[0]=TRUE)&(Var_Result[1]=FALSE))THEN
RST(TRUE, Var_Flag_Mem); (* Turns parameter initialization instruction memory OFF *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


50 5.2 Positioning Instruction
5.3 Serial Communication Instruction
On-demand function transmission

G(P)_ONDEMAND
Serial Modem

Structured ladder/FBD ST
G_ONDEMAND

EN ENO
ENO:= G_ONDEMAND (EN, Un*, s1, s2, d);
Un* d
s1

5
s2

The following instruction can go in the dotted squares.


G_ONDEMAND, GP_ONDEMAND

■Executing condition
Instruction Executing condition
G_ONDEMAND

GP_ONDEMAND

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..2]
s2 Start number of the device that stores send data ANY16
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends data using the on-demand function of MC protocol.

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 51
Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Transmission channel Set the transmission channel. 1, 2 User
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
(s1)[1] Transmission result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Number of send data Set the number of send data. 1 or more User

Program example
• The following program sends data of devices from D10 to D11 using the on-demand function. (For the Q series C24 whose
I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]

On-demand transmission
instruction pulse

Sets transmission
channel to 1

Sets number of send data


to 2 words

Sets send data


to D10 to D11

Turns normal completion


flag OFF

Turns error completion


flag OFF

Turns execution flag ON

Performs on-demand
function transmission

Turns normal completion


flag ON

Turns error completion


flag ON

Turns execution flag OFF

5 MODULE DEDICATED INSTRUCTION


52 5.3 Serial Communication Instruction
[ST]
PLS(X53, Var_Flag_Inst); (* On-demand transmission instruction pulse *)
IF(Var_Flag_Inst=TRUE)THEN (* Instruction flag ON *)
MOV(TRUE, 1, Var_ControlData[0]); (* Sets transmission channel to 1 *)
MOV(TRUE, 2, Var_ControlData[2]); (* Sets number of send data to 2 words *)
MOV(TRUE, H1234, D10); (* Sets send data to D10 to D11 *)
MOV(TRUE, H5678, D11);
RST(TRUE, Var_Flag_Normal); (* Turns normal completion flag OFF *)
RST(TRUE, Var_Flag_Error); (* Turns error completion flag OFF *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;
IF(Var_Flag_Exe=TRUE)THEN (* Execution flag ON *)
GP_ONDEMAND(TRUE, H0, Var_ControlData, D10, Var_Result); (* Performs on-demand function transmission *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)
5
END_IF;

• The communication status can be checked by the SPBUSY instruction.


Page 63 Communication status check
• Specify the capacity of the send data (stored in devices from D10 to D11 in the program example above)
and the number of send data within the user-defined buffer memory range assigned for the on-demand
function.

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 53
Nonprocedural protocol communication

G(P)_OUTPUT
Serial Modem

Structured ladder/FBD ST
G_OUTPUT

EN ENO
ENO:= G_OUTPUT (EN, Un*, s1, s2, d);
Un* d
s1
s2

The following instruction can go in the dotted squares.


G_OUTPUT, GP_OUTPUT

■Executing condition
Instruction Executing condition
G_OUTPUT

GP_OUTPUT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..2]
s2 Start number of the device that stores send data ANY16
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends data in the message format specified by the user using the nonprocedural protocol.

Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Transmission channel Set the transmission channel. 1, 2 User
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
(s1)[1] Transmission result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Number of send data Set the number of send data. 1 or more User

5 MODULE DEDICATED INSTRUCTION


54 5.3 Serial Communication Instruction
Program example
• The following program sends data of devices from D11 to D15 using the nonprocedural protocol. (For the Q series C24
whose I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Transmission
instruction pulse

Sets send data

Sets completion code

5
Sets transmission
channel to 1

Sets number of send


data to 5 words

Sends data

Turns normal completion


flag ON

Stores error code

Turns error completion


flag ON

Turns normal completion


flag OFF

Turns error completion


flag OFF

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 55
[ST]
PLS(X20, Var_Flag_Inst); (* Transmission instruction pulse*)

IF (Var_Flag_Inst=TRUE) THEN
MOV(TRUE, H4241, D11); (* Sets send data *)
MOV(TRUE, H4443, D12);
MOV(TRUE, H4645, D13);
MOV(TRUE, H0047, D14);
MOV(TRUE, H0AD, D15);
MOV(TRUE, 1, Var_ControlData[0]); (* Sets transmission channel to 1 *)
MOV(TRUE, 5, Var_ControlData[2]); (* Sets number of send data to 5 words *)
G_OUTPUT(TRUE, H0, Var_ControlData, D11, Var_Result); (* Sends data *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
MOV(TRUE, Var_ControlData[1], Var_ErrorCode);(* Stores error code *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

IF (X21=TRUE) THEN
RST( TRUE, Var_Flag_Normal ); (* Turns normal completion flag OFF *)
RST( TRUE, Var_Flag_Error ); (* Turns error completion flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


56 5.3 Serial Communication Instruction
G_INPUT
Serial Modem

Structured ladder/FBD ST
G_INPUT

EN ENO
ENO:= G_INPUT (EN, Un*, s, d1, d2);
Un* d1

s d2

The following instruction can go in the dotted squares.


G_INPUT

■Executing condition
Instruction Executing condition 5
G_INPUT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..3]
Output argument ENO Execution result Bit
d1 Start number of the device that stores read data ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction receives data in the message format specified by the user using the nonprocedural protocol.

Setting data
Device Item Setting data Setting range Setting side
(s)[0] Reception channel Set the reception channel. 1, 2 User
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
(s)[1] Reception result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s)[2] Number of receive data The number of receive data are stored. 0 or more System
(s)[3] Allowable number of words for Set the allowable number of words for receive data to be 1 or more User
receive data stored in (d1).

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 57
Program example
• The following program stores data which are received using the nonprocedural protocol in the devices starting from D10.
(For the Q series C24 whose I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Sets receive
channel to 1

Sets allowable number


of words for receive data
to 10 words
Receives data

Stores receive data

Turns error completion


flag ON

Turns error completion


flag OFF

[ST]
IF((X3=TRUE) OR (X4=TRUE))THEN
MOVP(TRUE, 1, Var_ControlData[0]); (* Sets receive channel to 1 *)
MOVP(TRUE, 10, Var_ControlData[3]); (* Sets allowable number of words for receive data to 10 words *)
G_INPUT(TRUE, H0, Var_ControlData, D10, Var_Result); (* Receives data *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
MOV(TRUE, Var_ControlData[2], Z2);
BMOV(TRUE, D10, K0Z2, D110); (* Stores receive data *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

IF(X100=TRUE)THEN
RST(TRUE, Var_Flag_Error); (* Turns error completion flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


58 5.3 Serial Communication Instruction
Bidirectional protocol communication

G(P)_BIDOUT
Serial Modem

Structured ladder/FBD ST
G_BIDOUT

EN ENO
ENO:= G_BIDOUT (EN ,Un* ,s1 ,s2 ,d);
Un* d
s1
s2

The following instruction can go in the dotted squares.


G_BIDOUT, GP_BIDOUT 5
■Executing condition
Instruction Executing condition
G_BIDOUT

GP_BIDOUT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 (0..2)
s2 Start number of the device that stores send data ANY16
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of Bit (0..1)
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends data using the bidirectional protocol.

Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Transmission channel Set the transmission channel. 1, 2 User
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
(s1)[1] Transmission result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Number of send data Set the number of send data. 1 or more User

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 59
Program example
• The following program sends desired data stored in devices from D11 to D15 using the bidirectional protocol. (For the Q
series C24 whose I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Transmission
instruction pulse

Sets send data

Sets transmission
channel to 1

Sets number of send


data to 5 words

Sends data

Turns normal completion


flag ON

Stores error code

Turns error completion


flag ON

Turns normal completion


flag OFF

Turns error completion


flag OFF

[ST]
PLS(X20, Var_Flag_Inst); (* Transmission instruction pulse *)

IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE, H4241, D11); (* Sets send data *)
MOV(TRUE, H4443, D12);
MOV(TRUE, H4645, D13);
MOV(TRUE, H0047, D14);
MOV(TRUE, H0AD, D15);
MOV(TRUE, 1, Var_ControlData[0]); (* Sets transmission channel to 1 *)
MOV(TRUE, 5, Var_ControlData[2]); (* Sets allowable number of words for send data to 5 words *)
G_BIDOUT(TRUE, H0, Var_ControlData, D11, Var_Result); (* Sends data *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

IF(X21=TRUE)THEN
RST(TRUE, Var_Flag_Normal); (* Turns normal completion flag OFF *)
RST(TRUE, Var_Flag_Error); (* Turns error completion flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


60 5.3 Serial Communication Instruction
G(P)_BIDIN
Serial Modem

Structured ladder/FBD ST
G_BIDIN

EN ENO
ENO:= G_BIDIN (EN, Un*, s, d1, d2);
Un* d1

s d2

The following instruction can go in the dotted squares.


G_BIDIN, GP_BIDIN

■Executing condition
Instruction Executing condition 5
G_BIDIN

GP_BIDIN

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..3]
Output argument ENO Execution result Bit
d1 Start number of the device that stores read data ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction receives data using the bidirectional protocol.

Setting data
Device Item Setting data Setting range Setting side
(s)[0] Reception channel Set the reception channel. 1, 2 User
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
(s)[1] Reception result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s)[2] Number of receive data The number of received data are stored. 1 or more System
(s)[3] Allowable number of words for Set the allowable number of words for receive data to be 1 or more User
receive data stored in (d1).

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 61
Program example
• The following program receives data using the bidirectional protocol and stores the data in the devices starting from D10.
(For the Q series C24 whose I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Sets receive channel


to 1

Sets allowable number


of words for receive data
to 10 words
Receives data

Stores receive data

[ST]
IF(X3=TRUE)THEN
MOVP(TRUE, 1, Var_ControlData[0]); (* Sets receive channel to 1 *)
MOVP(TRUE, 10, Var_ControlData[3]); (* Sets allowable number of words for receive data to 10 *)
G_BIDIN(TRUE, H00, Var_ControlData, D10, Var_Result); (* Receives data *)
END_IF;

IF((Var_Result[0]=TRUE)&(Var_Result[1]=FALSE))THEN
BMOV(TRUE, D10, Var_ControlData[2], D110); (* Stores receive data *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


62 5.3 Serial Communication Instruction
Communication status check

G(P)_SPBUSY
Serial Modem

Structured ladder/FBD ST

G_SPBUSY
ENO:= G_SPBUSY (EN, Un*, d);
EN ENO

Un* d

The following instruction can go in the dotted squares.


G_SPBUSY, GP_SPBUSY 5
■Executing condition
Instruction Executing condition
G_SPBUSY

GP_SPBUSY

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
Output argument ENO Execution result Bit
d Variable that stores read communication status ANY32

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(d)   

Processing details
This instruction reads the data transmission/reception status.

Program example
• The following program reads out the communication status of the target module. (For the Q series C24 whose I/O signals
are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Reads communication
status

[ST]
G_SPBUSY(Var_Flag, H00, D0); (* Reads communication status *)

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 63
Receive data clear

ZP_CSET
Serial Modem

Structured ladder/FBD ST
ZP_CSET

EN ENO
ENO:= ZP_CSET (EN, Un*, s1, s2, d1, d2);
Un* d1
s1 d2
s2

The following instruction can go in the dotted squares.


ZP_CSET

■Executing condition
Instruction Executing condition
ZP_CSET

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Channel number that requests receive data clear ANY16
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
s2 Variable that stores control data Array of ANY16 [0..111]
Output argument ENO Execution result Bit
d1 Dummy ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(d1)     
(d2)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
Clears receive data without stopping transmission using the nonprocedural protocol.

5 MODULE DEDICATED INSTRUCTION


64 5.3 Serial Communication Instruction
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] Execution type Specify '0'. 0 User
(s2)[1] Completion status The instruction completion status is stored.  System
• 0: Normal completion
• Other than 0: Error completion (error code)
(s2)[2] Request type Specify the request. 4 User
4: Receive data clear request
(s2)[3] For system   System

(s2)[111]

Program example
• The following program clears the receive data in the Q series C24 side. (For the Q series C24 whose I/O signals are X/Y00
to X/Y1F)
[Structured ladder/FBD] 5
Clears execution
type to 0

Sets request type

Clears data

Turns normal completion


flag ON

Turns error completion


flag ON

Stores error code

Turns normal completion


flag OFF

Turns error completion


flag OFF

[ST]
IF(X20=TRUE)THEN
MOVP(TRUE, 0, Var_ControlData[0]); (* Clears execution type to 0 *)
MOVP(TRUE, 4, Var_ControlData[2]); (* Sets request type *)
ZP_CSET(TRUE, "U0", 1, Var_ControlData, Var_Dummy, Var_Result); (* Clears data *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

IF(X21=TRUE)THEN
RST(TRUE, Var_Flag_Normal); (* Turns normal completion flag OFF *)
RST(TRUE, Var_Flag_Error); (* Turns error completion flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 65
BUFRCVS instruction

Z_BUFRCVS
Serial Modem

Structured ladder/FBD ST
Z_BUFRCVS

EN ENO
ENO:= Z_BUFRCVS (EN, Un*, s, d);
Un* d

The following instruction can go in the dotted squares.


Z_BUFRCVS

■Executing condition
Instruction Executing condition
Z_BUFRCVS

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Reception channel number ANY16
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
Output argument ENO Execution result Bit
d Start number of the device that stores read data ANY16
* Receive data are read from the receive area of
buffer memory.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction receives data with an interrupt program during communication using the nonprocedural protocol or
bidirectional protocol.

Setting data
Device Item Setting data Setting range Setting side
(d)+0 Receive data length The number of data read from the number of receive data 0 or more System
storage area is stored.
(d)+1 Receive data Data read from the receive data storage area are stored in  System
 ascending address order.
(d)+n

5 MODULE DEDICATED INSTRUCTION


66 5.3 Serial Communication Instruction
Program example
• The following program receives data with an interrupt program.
[Structured ladder/FBD]

Turns normal completion


flag ON

Turns error completion


flag ON

Executes interrupt
receive program

5
[ST]
(* Set the normal/error confirmation flag for the main program *)
(* The main program resets flags *)
SET(DX3, Var_Flag_Normal); (* Turns normal completion flag ON *)
SET(DX4, Var_Flag_Error); (* Turns error completion flag ON *)
(* Receives data from CH1 and stores the data in devices starting from D200 *)
Z_BUFRCVS(SM400, "00", 1, D200); (* Executes interrupt receive program *)

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 67
G(P)_PRR
Serial Modem

Structured ladder/FBD ST
G_PRR

EN ENO
ENO:= G_PRR (EN, Un*, s, d);
Un* d

The following instruction can go in the dotted squares.


G_PRR, GP_PRR

■Executing condition
Instruction Executing condition
G_PRR

GP_PRR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..4]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends data by user frame according to the specification in user frame specification area for transmission
during communication using the nonprocedural protocol.

5 MODULE DEDICATED INSTRUCTION


68 5.3 Serial Communication Instruction
Setting data
Device Item Setting data Setting range Setting side
(s)[0] Transmission channel Set the transmission channel. 1, 2 User
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
(s)[1] Transmission result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s)[2] CR/LF addition specification Specify whether to add CR/LF codes to the send data. 0, 1 User
0: CR/LF not added
1: CR/LF added
(s)[3] Transmission pointer Specify the position in the user frame specification area for 1 to 100 User
transmission from where the frame number data are to be
sent.
(s)[4] Number of send data Set the number of user frames to be sent. 1 to 100 User

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 69
Program example
• The following program sends desired data and the user frames from number 1 to number 5 which are registered in the
transmission frame setting. (For the Q series C24 whose I/O signals are X/Y80 to X/Y9F)
[Structured ladder/FBD]

Transmission instruction pulse

Sets number of send data

Sets desired send data

Sets send data to buffer memory

User frame 0

User frame 1

User frame 2

User frame 3

User frame 4

User frame 5

Sets user frames to buffer memory

Sets transmission channel to 1

Clears transmission result

Sets CR/LF to 'CR/LF not added'

Sets transmission pointer

Sets number of send data

Performs user frame transmission

Turns normal completion flag ON

Turns error completion flag ON

5 MODULE DEDICATED INSTRUCTION


70 5.3 Serial Communication Instruction
[ST]
PLS(X50, Var_Flag_Inst); (* Transmission instruction pulse *)

IF((Var_Flag_Inst=TRUE) & (X9E=TRUE) & (X9F=FALSE))THEN


MOV(TRUE, 4, Var_TransData[0]); (* Sets number of send data *)
MOV(TRUE, H1234, Var_TransData[1]); (* Sets desired send data *)
MOV(TRUE, H56AB, Var_TransData[2]);
TO(TRUE, Var_TransData[0], H8, H400, 3); (* Sets send data to buffer memory *)

MOV(TRUE, H3F2, Var_Frame[0]); (* Sets user frame 0 *)


MOV(TRUE, H3F3, Var_Frame[1]); (* Sets user frame 1 *)
MOV(TRUE, H8001,Var_Frame[2]); (* Sets user frame 2 *)
MOV(TRUE, H8000,Var_Frame[3]); (* Sets user frame 3 *)
MOV(TRUE, H41B, Var_Frame[4]); (* Sets user frame 4 *)
MOV(TRUE, 0, Var_Frame[5]); (* Sets user frame 5 *)
TO(TRUE, Var_Frame[0], H8, H0BA, 6); (* Sets user frames to buffer memory *)
END_IF;

IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE, 1, Var_ControlData[0]); (* Sets transmission channel to 1 *)
MOV(TRUE, 0, Var_ControlData[1]); (* Clears transmission result *) 5
MOV(TRUE, H0, Var_ControlData[2]); (* Sets CR/LF to 'CR/LF not added' *)
MOV(TRUE, H1, Var_ControlData[3]); (* Sets transmission pointer *)
MOV(TRUE, H5, Var_ControlData[4]); (* Sets number of send data *)
GP_PRR(TRUE, H08, Var_ControlData, Var_Result); * Performs user frame transmission *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 71
Initial setting

ZP_CSET
Serial Modem

Structured ladder/FBD ST
ZP_CSET

EN ENO
ENO:= ZP_CSET (EN, Un*, s1, s2, d1, d2);
Un* d1
s1 d2
s2

The following instruction can go in the dotted squares.


ZP_CSET

■Executing condition
Instruction Executing condition
ZP_CSET

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Reception channel number ANY16
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
s2 Variable that stores control data Array of ANY16 [0..111]
Output argument ENO Execution result Bit
d1 Dummy ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(d1)     
(d2)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction changes the setting values for sending/receiving data using communication protocols.

5 MODULE DEDICATED INSTRUCTION


72 5.3 Serial Communication Instruction
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] Execution type Specify '0'. 0 User
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s2)[2] Request type Specify the request. 1 User
1: Change of unit (word/byte) and buffer memory assignment
(s2)[3] Word/byte unit specification Specify the unit of the number of send/receive data. 0, 1, 2 User
0: Current setting value
1: In units of words
2: In units of bits
(s2)[4] Buffer memory start address for Specify the start address of the buffer memory used by the on- 0H, User
on-demand function demand function 400H to 1AFFH,
0H: Current setting value is used. 2600H to 3FFFH
400H to 1AFFH, 2600H to 3FFFH: Start address
(s2)[5] Buffer memory size for on- Specify the size (the number of words) of the buffer memory to 0H, User 5
demand function be used by the on-demand function. 1H to 1A00H
0H: Current setting value is used.
1H to 1A00H: Size
(s2)[6] Send area start address Specify the start address of the send area used for the 0H, User
nonprocedural/bidirectional protocol. 400H to 1AFFH,
0H: Current setting value is used. 2600H to 3FFFH
400H to 1AFFH, 2600H to 3FFFH: Start address
(s2)[7] Send area size Specify the size (the number of words) of the send area used 0H, User
by the nonprocedural/bidirectional protocol. 1H to 1A00H
0H: Current setting value is used.
1H to 1A00H: Size
* The start area of the send area (1 word) is used for the
number of send data specification area.
(s2)[8] Receive area start address Specify the start address of the receive area used for the 0H, User
nonprocedural/bidirectional protocol. 400H to 1AFFH,
0H: Current setting value is used. 2600H to 3FFFH
400H to 1AFFH, 2600H to 3FFFH: Start address
(s2)[9] Receive area size Specify the size (the number of words) of the receive area 0H, User
used for the nonprocedural/bidirectional protocol. 1H to 1A00H
0H: Current setting value is used.
1H to 1A00H: Size
* The start area of the receive area (1 word) is used for the
number of receive data storage area.
(s2)[10] For system   System

(s2)[111]

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 73
Program example
The following program changes the send buffer area of the CH1 side interface. (For the Q series C24 whose I/O signals are X/
Y00 to X/Y1F)
• Sets send buffer to C00H to FFFH.
• Sets receive buffer to 600H to 7FFH.
[Structured ladder/FBD]

Clears D0 to D111
to 0

Sets execution
type

Sets request type

Sets word/byte
unit to word

Sets on-demand
start address

Sets on-demand
buffer size

Sets send buffer


start address

Sets send buffer


size

Sets receive buffer


start address

Sets receive buffer


size

Performs
initialization

Turns normal
completion flag ON

Turns error
completion flag ON

[ST]
IF(Var_Flag_Inst=TRUE)THEN
FMOVP(TRUE,0,112, Var_ControlData[0]); (* Resets D0 to D111 to 0 *)
MOVP(TRUE, 0, Var_ControlData[0]); (* Sets execution type *)
MOVP(TRUE, 1, Var_ControlData[2]); (* Sets request type *)
MOVP(TRUE, 1, Var_ControlData[3]); (* Sets word/byte unit to word *)
MOVP(TRUE, H400, Var_ControlData[4]); (* Sets on-demand start address *)
MOVP(TRUE, 0, Var_ControlData[5]); (* Sets on-demand buffer size *)
MOVP(TRUE,H0C00, Var_ControlData[6]); (* Sets send buffer start address *)
MOVP(TRUE, H400, Var_ControlData[7]); (* Sets send buffer size *)
MOVP(TRUE, H600, Var_ControlData[8]); (* Sets receive buffer start address *)
MOVP(TRUE, H200, Var_ControlData[9]); (* Sets receive buffer size *)
ZP_CSET(TRUE, "U0", 1, Var_ControlData, Var_Dummy, Var_Result); (* Performs initialization *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


74 5.3 Serial Communication Instruction
CSET instruction (programmable controller CPU monitor)

ZP_CSET
Serial Modem

Structured ladder/FBD ST
ZP_CSET

EN ENO
ENO:= ZP_CSET (EN, Un*, s1, s2, d1, d2);
Un* d1
s1 d2
s2

The following instruction can go in the dotted squares.


ZP_CSET 5
■Executing condition
Instruction Executing condition
ZP_CSET

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Reception channel number ANY16
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
s2 Variable that stores control data Array of ANY16 [0..111]
Output argument ENO Execution result Bit
d1 Dummy ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(d1)     
(d2)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction registers and cancels the programmable controller CPU monitoring.

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 75
Setting data
■Registering the programmable controller CPU monitoring
Device Item Setting data Setting Setting side
range
(s2)[0] Execution type Specify '0'. 0 User
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s2)[2] Request type Specify the request. 2 User
2: Registration of programmable controller CPU
monitoring
(s2)[3] Cycle time unit Specify the unit of cycle time. 0 to 2 User
0: 100ms
1: Second
2: Minute
(s2)[4] Cycle time Specify the cycle time. 1H to FFFFH User
1H to FFFFH: Cycle time
(s2)[5] Programmable controller CPU monitoring function Specify the monitoring function. 1,2 User
1: Constant cycle transmission
2: Condition agreement transmission
(s2)[6] Programmable controller CPU monitoring Specify the transmission method. 0, 1 User
transmission method 0: Data transmission (device data, CPU error
information)
1: Notification
(s2)[7] Constant cycle User frame output start pointer Specify the start pointer of the table to which the user 0, 1 to 100 User
transmission frame number for constant cycle transmission is set.
0: No specification (at condition agreement
transmission and notification)
1 to 100: Start pointer
(s2)[8] Number of user frame Specify the number of user frame transmissions 0, 1 to 100 User
transmissions (outputs) for constant cycle transmission.
0: No specification (at condition agreement
transmission and notification)
1 to 100: Number of transmissions
(s2)[9] Modem connection data No. Specify the data number for modem function 0, User
connection when making notification in constant BB8H to
cycle transmission. BD5H,
0: No specification (at data transmission and 8001H to
condition agreement transmission) 801FH
BB8H to BD5H: Connection data number (flash
ROM)
8001H to 801FH: Connection data number (buffer
memory)
(s2)[10] Number of registered word blocks Specify the number of blocks of the word device to 0 to 10 User
be monitored.
(s2)[11] Number of registered bit blocks Specify the number of blocks of the bit device to be 0 to 10 User
monitored.
(s2)[12] Programmable controller CPU error monitoring Specify whether to also execute programmable 0, 1 User
(programmable controller CPU status monitoring) controller CPU error monitoring.
0: Not monitored
1: Monitored

5 MODULE DEDICATED INSTRUCTION


76 5.3 Serial Communication Instruction
Device Item Setting data Setting Setting side
range
(s2)[13] Programmable Device code Specify the code of the device to be monitored. 90H to CCH User
controller CPU 0: No device monitored (Device code)
monitoring Other than 0: Device code
setting
(s2)[14] Monitoring start device Specify the start number of the monitoring device in 0 or more User
(s2)[15] this block.
1st
(s2)[16] * 1st block Number of registered points Specify the number of registered points (read points) 0, 1 or more User
of this block.
0: No device monitored
1 or more: Number of registered points
* For a bit device, specify the number of points in
units of words.
(s2)[17] Condition Monitoring Specify the monitoring condition of this block. 0 to 65535 User
agreement condition 0: No specification (at constant cycle transmission)
transmission 1 or more: Monitoring condition
(s2)[18] Monitoring Specify the monitoring condition value for this block. 0 to 000AH, User
condition value 0 or more: Monitoring condition 0101H to
* Specify '0' at constant cycle transmission. 010AH 5
(s2)[19] User frame Specify the start pointer of the table to which the user 0, 1 to 100 User
output start frame number for condition agreement transmission
pointer for this block is set.
0: No specification (at constant cycle transmission
and notification)
1 to 100: Start pointer
(s2)[20] Number of user Specify the number of user frame transmissions 0, 1 to 100 User
frame (outputs) for condition agreement transmission for
transmissions this block.
0: No specification (at constant cycle transmission
and notification)
1 to 100: Number of transmissions
(s2)[21] Modem Specify the data number for modem function 0, User
connection data connection when making notification in condition BB8H to
No. agreement transmission for this block. BD5H,
0: No specification (at data transmission and 8001H to
constant cycle transmission) 801FH
BB8H to BD5H: Connection data number (flash
ROM)
8001H to 801FH: Connection data number (buffer
memory)
(s2)[22] Programmable controller CPU monitoring setting The same item arrangement as the first  User
 programmable controller CPU monitoring setting
(s2)[102] 2nd to 10th item.
* 2nd to 10th block

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 77
Device Item Setting data Setting Setting side
range
(s2)[103] CPU status Condition Fixed value Specify a fixed value to monitor the CPU status. 1 User
(s2)[104] monitoring agreement
0
setting transmission
(s2)[105] * Error 0
(s2)[106] monitoring 1
(s2)[107] 5
11th
(s2)[108] * 11th block 1
(s2)[109] User frame Specify the start pointer of the to which the user 0, 1 to 100 User
output start frame number for condition agreement transmission
pointer for this block is set.
0: No specification (at constant cycle transmission
and notification)
1 to 100: Start pointer
(s2)[110] Number of user Specify the number of user frame transmissions 0, 1 to 100 User
frame (outputs) for condition agreement transmission for
transmissions this block.
0: No specification (at constant cycle transmission
and notification)
1 to 100: Number of transmissions
(s2)[111] Modem Specify the data number for modem function 0, User
connection data connection when making notification in condition BB8H to
No. agreement transmission for this block. BD5H,
0: No specification (at data transmission and 8001H to
constant cycle transmission) 801FH
BB8H to BD5H: Connection data number (flash
ROM)
8001H to 801FH: Connection data number (buffer
memory)

5 MODULE DEDICATED INSTRUCTION


78 5.3 Serial Communication Instruction
■Canceling the programmable controller CPU monitoring
Device Item Setting data Setting range Setting side
(s2)[0] Execution type Specify '0H'. 0 User
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s2)[2] Request type Specify the request. 3 User
3: Cancel of the programmable controller CPU monitoring
(s2)[3] For system   System

(s2)[111]

Program example
• Program to register the programmable controller CPU monitoring
The following program registers the programmable controller CPU monitoring and sends the monitoring result from the CH1
side interface.
5
The following setting is to send content of devices from M0 to M15 and devices from D100 to D109 to the external device
through the constant cycle transmission. (Cycle time: 3 minutes)
(For the Q series C24 whose I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Instruction pulse

Sets execution type

Sets request type

Sets cycle time unit


to minute

Sets cycle time


to 3 minutes
Sets programmable controller
CPU monitoring function to
constant cycle transmission
Sets transmission method
to data transmission

Sets output start pointer

Sets number of user


frame transmissions

Turns data set flag ON

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 79
Sets number of registered
word blocks

Sets number of registered


bit blocks

Sets device code

Sets start number of


monitoring device

Sets number of registered


points

Sets device code

Sets start number of


monitoring device

Sets number of registered points


(For bit device, specify it in units
of words)

Turns execution flag ON

Turns data set flag OFF

Registers programmable
controller CPU monitoring

Turns normal completion


flag ON
Turns error completion
flag ON

Turns execution flag OFF

5 MODULE DEDICATED INSTRUCTION


80 5.3 Serial Communication Instruction
[ST]
PLS(X24, Var_Flag_Inst); (* Instruction pulse *)

IF((Var_Flag_Inst=TRUE) & (Var_Flag_Normal=FALSE))THEN


MOV(TRUE, 0, Var_ControlData[0]); (* Sets execution type *)
MOV(TRUE, 2, Var_ControlData[2]); (* Sets request type *)
MOV(TRUE, 2, Var_ControlData[3]); (* Sets cycle time unit to minute *)
MOV(TRUE, 3, Var_ControlData[4]); (* Sets cycle time to 3 minutes *)
MOV(TRUE, 1, Var_ControlData[5]); (* Sets programmable controller CPU monitoring function to constant cycle transmission. *)
MOV(TRUE, 0, Var_ControlData[6]); (* Sets transmission method to data transmission *)
MOV(TRUE, 1, Var_ControlData[7]); (* Sets output start pointer *)
MOV(TRUE, 2, Var_ControlData[8]); (* Sets number of user frame transmissions *)
SET(TRUE, Var_Flag_Set); (* Turns data set flag ON *)
END_IF;

IF(Var_Flag_Set=TRUE)THEN
MOV(TRUE, 1, Var_ControlData[10]); (* Sets number of registered word blocks *)
MOV(TRUE, 1, Var_ControlData[11]); (* Sets number of registered bit blocks *)
(* Sets the 1st block of the CPU monitoring to D100 to D109 *)
MOV(TRUE, H0A8, Var_ControlData[13]); (* Sets device code *)
MOV(TRUE, 100, Var_ControlData[14]);(* Sets start number of monitoring device *) 5
MOV(TRUE, 0, Var_ControlData[15]);
MOV(TRUE, 10, Var_ControlData[16]); (* Sets number of registered points *)
(* Sets the 2nd block of the CPU monitoring to M0 to M15 *)
MOV(TRUE, H90, Var_ControlData[22]); (* Sets device code *)
MOV(TRUE, 0, Var_ControlData[23]);(* Sets start number of monitoring device *)
MOV(TRUE, 0, Var_ControlData[24]);
MOV(TRUE, 1, Var_ControlData[25]); (* Sets number of registered points. (For bit device, specify it in units of words.) *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
RST(TRUE, Var_Flag_Set); (* Turns data set flag OFF *)
END_IF;

IF(Var_Flag_Exe=TRUE)THEN
ZP_CSET(TRUE, "U0", 1, Var_ControlData, Var_Dummy, Var_Result); (* Registers the programmable controller CPU monitoring *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;

RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)


END_IF;

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 81
• Program to cancel the programmable controller CPU monitoring
The following program cancels the programmable controller CPU monitoring of the CH1 side interface.
(For the Q series C24 whose I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Instruction pulse

Sets execution type

Sets request type

Cancels programmable
controller CPU
monitoring

Turns normal completion


flag ON

Turns error completion


flag ON

[ST]
PLS(X25, Var_Flag_Inst); (* Instruction pulse *)

IF((Var_Flag_Inst=TRUE) & (Var_Flag_Normal=FALSE))THEN


MOV(TRUE, 0, Var_ControlData[0]); (* Sets execution type *)
MOV(TRUE, 3, Var_ControlData[2]); (* Sets request type *)
ZP_CSET(TRUE, "U0", 1, Var_ControlData, Var_Dummy, Var_Result); (* Cancels programmable controller CPU monitoring *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


82 5.3 Serial Communication Instruction
PUTE instruction

G(P)_PUTE
Serial Modem

Structured ladder/FBD ST
G_PUTE

EN ENO
ENO:= G_PUTE (EN, Un*, s1, s2, d);
Un* d
s1
s2

The following instruction can go in the dotted squares.


G_PUTE, GP_PUTE 5
■Executing condition
Instruction Executing condition
G_PUTE

GP_PUTE

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..3]
s2 Start number of the device that stores read ANY16
registration data
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d1)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction registers a user frame.

Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Registration/ Specify whether to register/delete the user frame of the number 1, 3 User
deletion specified by (s1)[2].
specification 1: Registered
3: Deleted
(s1)[1] Registration/ The instruction completion status is stored.  System
deletion result 0: Normal completion
Other than 0: Error completion (error code)

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 83
Device Item Setting data Setting range Setting side
(s1)[2] Frame No. Specify the user frame number. 1000 to 1199 User
(s1)[3] Number of 1 to 80: Number of bytes of the user frame to be registered. 1 to 80 User
registered bytes * Specify any number in the range from 1 to 80 as a dummy when '3:
Deleted' is selected.

Program example
• The following program registers a user frame as the registration number 3E8H. (For the Q series C24 whose I/O signals are
X/Y80 to X/Y9F)
[Structured ladder/FBD]

Registration request
pulse

Sets registration
request

Sets user frame


number

Sets number of
registered bytes

User frame 0

User frame 1

User frame 2

User frame 3

User frame 4

Sets write enable in


flash ROM side

Registers user frame

Turns normal
completion flag ON

Turns error
completion flag ON

5 MODULE DEDICATED INSTRUCTION


84 5.3 Serial Communication Instruction
[ST]
PLS(X50, Var_Flag_Inst); (* Registration request pulse *)

IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE, 1, Var_ControlData[0]); (* Sets registration request *)
MOV(TRUE, H3E8, Var_ControlData[2]); (* Sets user frame number *)
MOV(TRUE, 10, Var_ControlData[3]); (* Sets number of registered bytes *)
MOV(TRUE, H3946, Var_Frame[0]); (* User frame 0 *)
MOV(TRUE, H3030, Var_Frame[1]); (* User frame 1 *)
MOV(TRUE, H3030, Var_Frame[2]); (* User frame 2 *)
MOV(TRUE, H4646, Var_Frame[3]); (* User frame 3 *)
MOV(TRUE, H3030, Var_Frame[4]); (* User frame 4 *)
TO(TRUE, 1, H08, H2000, 1); (* Sets write enable in flash ROM side *)
G_PUTE(TRUE, H08, Var_ControlData,Var_Frame[0], Var_Result); (* Registers user frame *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *) 5
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 85
G(P)_GETE
Serial Modem

Structured ladder/FBD ST
G_GETE

EN ENO
ENO:= G_GETE (EN, Un*, s1, s2, d);
Un* d
s1
s2

The following instruction can go in the dotted squares.


G_GETE, GP_GETE

■Executing condition
Instruction Executing condition
G_GETE

GP_GETE

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..3]
s2 Start number the device that stores the read ANY16
registration data
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads a user frame.

5 MODULE DEDICATED INSTRUCTION


86 5.3 Serial Communication Instruction
Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Dummy  0 
(s1)[1] Read result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Frame No. Specify the user frame number. 1000 to 1199 User
specification
(s1)[3] Allowable number Specify the maximum number of bytes for storing the registered data 1 to 80 User
of bytes for read of the read user frame to (s2).
data
Number of The number of bytes of the registered data for the read user frame is 1 to 80 System
registered bytes stored.

Program example
• The following program reads out the registration data of the user frame number 3E8H. (For the Q series C24 whose I/O 5
signals are X/Y80 to X/Y9F)
[Structured ladder/FBD]

Read request pulse

Sets user frame number

Sets allowable number


of bytes for read data

Clears user frame


to 0

Reads user frame

Turns normal
completion flag ON

Turns error
completion flag ON

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 87
[ST]
PLS(X51, Var_Flag_Inst); (* Read request pulse *)

IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE, 0, Var_ControlData[0]);
MOV(TRUE, H3E8, Var_ControlData[2]); (* Sets user frame number *)
MOV(TRUE, 80, Var_ControlData[3]); (* Sets allowable number of bytes for read data *)
FMOV(TRUE, 0, 40, Var_Frame[0]); (* Clears user frame to 0 *)
G_GETE(TRUE, H08, Var_ControlData, Var_Frame[0], Var_Result); (* Reads user frame *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


88 5.3 Serial Communication Instruction
Mode switching

ZP_UINI
Serial

Structured ladder/FBD ST
ZP_UINI

EN ENO
ENO:= ZP_UINI (EN, Un*, s, d);
Un* d

The following instruction can go in the dotted squares.


ZP_UINI 5
■Executing condition
Instruction Executing condition
ZP_UINI

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..9]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(S)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction switches the mode, transmission specification, and host station number of the Q series C24.

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 89
Setting data
Device Item Setting data Setting range Setting side
(s)[0] For system Always specify '0'. 0 User
(s)[1] Execution result The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s)[2] Execution type Specify the execution type. 0, 1 User
0: Switches the execution type according to the setting in the area
starting from (s)[3].
1: Returns the execution type according to the switch setting on GX
Works2.
(s)[3] CH1 Transmission Set the transmission specifications for CH1. 0 to 0FFEH
specification Page 91 (s)[3] (CH1 Transmission specification setting) and
setting (s)[5] (CH2 Transmission specification setting)*1
(s)[4] CH1 Set the communication protocol for CH1. 0 to 8
Communication Page 92 (s)[4] (CH1 Communication protocol setting) and (s)[6]
protocol setting (CH2 Communication protocol setting)
(s)[5] CH2 Transmission Set the transmission specifications for CH2. 0 to 0FFFH
specification Page 91 (s)[3] (CH1 Transmission specification setting) and
setting (s)[5] (CH2 Transmission specification setting)*1
(s)[6] CH2 Set the communication protocol for CH2. 0 to 7
Communication Page 92 (s)[4] (CH1 Communication protocol setting) and (s)[6]
protocol setting (CH2 Communication protocol setting)
(s)[7] Station No. setting Set the host station number. 0 to 31
(s)[8] For system Always specify '0'. 0

(s)[12]

5 MODULE DEDICATED INSTRUCTION


90 5.3 Serial Communication Instruction
■(s)[3] (CH1 Transmission specification setting) and (s)[5] (CH2 Transmission specification
setting)*1
b15 … b8 b7 b6 b5 b4 b3 b2 b1 b0

CH1 ((s)[3]) 0

CH2 ((s)[5])

(9) (8) (7) (6) (5) (4) (3) (2) (1)

No. Bit Description Setting value Remarks


(1) b0 Operation setting OFF(0): Independence Always set the CH1 side ((s)[3]) to 0.
ON (1): Link
(2) b1 Data bit OFF(0): 7 Parity bit is not included.
ON(1): 8
(3) b2 Parity bit OFF(0): Without Vertical parity
ON (1): With
(4) b3 Even/Odd parity OFF(0): Odd
ON (1): Even
Valid only when parity bit is set to 'With'.
5
(5) b4 Stop bit OFF(0): 1 
ON(1): 2
(6) b5 Sumcheck code OFF(0): Without 
ON (1): With
(7) b6 Write during RUN OFF(0): Inhibited 
ON (1): Allowed
(8) b7 Setting change OFF(0): Inhibited 
ON (1): Allowed
(9) b15 to b8 Communication speed 0FH: 50bps • 230400bps is selectable only at CH1 side
00H: 300bps ((s)[3]). (Select 300bps at CH2 side ((s)[5]).)
01H: 600bps • The sum of communication speeds selected at
02H: 1200bps CH1 side and CH2 side must be within
03H: 2400bps 230400bps.
04H: 4800bps
05H: 9600bps
06H: 14400bps
07H: 19200bps
08H: 28800bps
09H: 38400bps
0AH: 57600bps
0BH: 115200bps
0CH: 230400bps

*1 Specify '0000H' at the CH side for which "MELSOFT connection" is specified in the communication protocol setting.

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 91
■(s)[4] (CH1 Communication protocol setting) and (s)[6] (CH2 Communication protocol setting)
Setting No. Description Remarks
0H MELSOFT connection Specify '0000H' for the transmission specification setting.
1H MC protocol Format 1 
2H Format 2 
3H Format 3 
4H Format 4 
5H Format 5 
6H Nonprocedural protocol 
7H Bidirectional protocol 
8H For link setting Setting is possible only for CH1 side ((s)[4])
9H Pre-defined protocol Pre-defined protocol communication

Precautions
The UINI instruction is applicable to the QJ71C24N (-R2/R4) of which the function version is B and the first five digits of the
serial number are '06062' or higher.

Program example
• The following program changes settings of the Q series C24 mounted on the I/O numbers X/Y00 to X/Y1F as follows when
X20 turns ON.
Device Bit Description Setting value
Position Specified
value
(s)[3] b0 OFF CH1 Transmission Operation setting Independence 07E6H
specification setting
b1 ON Data bit 8
b2 ON Parity bit With
b3 OFF Even/Odd parity Odd
b4 OFF Stop bit 1
b5 ON Sumcheck code With
b6 ON Write during RUN Allowed
b7 ON Setting change Allowed
b15 to b8  Communication speed 19200bps
(s)[4]  CH1 Communication protocol setting Link setting 0008H
(s)[5] b0 ON CH2 Transmission Operation setting Link 07E7H
specification setting
b1 ON Data bit 8
b2 ON Parity bit With
b3 OFF Even/Odd parity Odd
b4 OFF Stop bit 1
b5 ON Sumcheck code With
b6 ON Write during RUN Allowed
b7 ON Setting change Allowed
b15 to b8  Communication speed 19200bps
(s)[6]  CH2 Communication protocol setting MC protocol Format 5 0005H
(s)[7]  Station No. setting 1 0001H

5 MODULE DEDICATED INSTRUCTION


92 5.3 Serial Communication Instruction
[Structured ladder/FBD]

UINI instruction command

Always sets 0

Clears control data to 0

Sets execution type

Sets CH1 transmission specification

Sets CH1 communication protocol

Sets CH2 transmission specification 5


Sets CH2 communication protocol

Sets host station number

Switches mode

Turns interlock signal for communication stop ON*1

Process on normal completion Normal completion

Process on error completion Error completion

Turns interlock signal for communication stop OFF*1

Data communication process

*1 Create a program so that the data communication process does not run while the interlock signal for communication stop is ON.

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 93
[ST]
IF(LDP(TRUE,X20) (* UINI instruction command *)
&(Y2=FALSE) (* CH1 mode switching request *)
&(Y9=FALSE) (* CH2 mode switching request *)
&(X6=FALSE) (* CH1 mode switching *)
&(X0D=FALSE))THEN (* CH2 mode switching *)
(* Runs if there is no mode switching *)
FMOV(TRUE, H0, 13, Var_ControlData[0]); (* Clears control data to 0 *)
MOV(TRUE, H0, Var_ControlData[0]); (* Always sets 0 *)
MOV(TRUE, H0, Var_ControlData[1]); (* Clears execution result to 0 *)
MOV(TRUE, H0, Var_ControlData[2]); (* Sets execution type *)
MOV(TRUE,H7E6,Var_ControlData[3]); (* Sets CH1 transmission specification *)
MOV(TRUE,H8,Var_ControlData[4]); (* Sets CH1 communication protocol *)
MOV(TRUE, H7E7, Var_ControlData[5]); (* Sets CH2 transmission specification *)
MOV(TRUE, H5, Var_ControlData[6]); (* Sets CH2 communication protocol *)
MOV(TRUE, H1, Var_ControlData[7]); (* Sets host station number *)
ZP_UINI(TRUE, "00", Var_ControlData, Var_Result); (* Switches mode *)
SET(TRUE, Var_Flag ); (* Turns interlock signal for communication stop ON *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
RST(TRUE, Var_Flag); (* Turns interlock signal for communication stop OFF *)*1
END_IF;

(* Do not perform the data communication process during interlock signal for communication stop ON *)
IF(Var_Flag=FALSE)*1 THEN

(* Data communication process *)


END_IF;

*1 Create a program so that the data communication process does not run while the interlock signal for communication stop is ON.

5 MODULE DEDICATED INSTRUCTION


94 5.3 Serial Communication Instruction
Pre-defined protocol communication

G(P)_CPRTCL
Serial

Structured ladder/FBD ST
G_CPRTCL

EN ENO
Un* d ENO:= G_CPRTCL (EN, Un*, n1, n2, s, d);
n1
n2
s

The following instruction can go in the dotted squares.


G_CPRTCL, GP_CPRTCL 5
■Executing condition
Instruction Executing condition
G_CPRTCL

GP_CPRTCL

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition ANY16
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
n1 Channel to communicate with other devices ANY16
1: Channel 1 (CH1 side)
2: Channel 2 (CH2 side)
n2 Number of consecutive protocol executions (1 to 8) ANY16
s Start number of the device in which control data are Array of ANY16 [0..17]
stored
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

n1     
n2     
(s)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction executes the protocols and functional protocols written to the flash ROM by pre-defined protocol support
function.

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 95
Setting data
Device Item Setting data Setting range Setting side
(s)[0] Completion status The instruction completion status is stored.  System
When executing multiple protocols, the execution result of the
protocol executed at last is stored.*1*1
0: Normal completion
Other than 0: Error completion (error code)*2
(s)[1] Number of The number of executions is stored. 1 to 8 System
executions Protocols with errors are included in the count.
When settings of the setting data and control data contain an error,
"0" is stored.
(s)[2] Execution protocol Set the first protocol number or functional protocol number to be 1 to 128, User
 number executed. 201 to 207
(s)[9] designation 
Set the 8th protocol number or functional protocol number to be
executed.
(s)[10] Verification match When the communication type of the first protocol executed is 0, 1 to 16 System
 receive packet "Receive only" or "Send & receive", the matched receive packet
(s)[17] number number is stored.
"0" is stored with the following condition.
• When the communication type is "Send only"
• If the error occurs to the first protocol executed
• When the functional protocol is executed

When the communication type of the 8th protocol executed is
"Receive only" or "Send & receive", the matched receive packet
number is stored.
"0" is stored with the following condition.
• When the communication type is "Send only"
• If the error occurs to the 8th protocol executed
• When the number of the executed protocols is less than 8
• When the functional protocol is executed

*1 When executing multiple protocols, if an error occurs to the nth protocol, the protocols after the nth protocol are not executed.
*2 For details of the error code at the error completion, refer to the following.
 Q Corresponding Serial Communication Module User's Manual (Basic)
 MELSEC-L Serial Communication Module User's Manual (Basic)

5 MODULE DEDICATED INSTRUCTION


96 5.3 Serial Communication Instruction
Program example
• This instruction executes the protocol specified in Var_ControlData[2] when X20 turns ON.
[Structured ladder/FBD]

Store the set value to the send


data storage area

Designate protocol number 1

Execute the protocol


Communicate in CH2

Normal completion flag ON


5
Abnormal completion flag ON

Store the error code

[ST]
IF((X20=TRUE) & (X1D=TRUE))THEN
MOV(TRUE, 0, Var_ControlData[1]; (* Store the set value to the send data storage area *)
MOV(TRUE, 1, Var_ControlData[2]; (* Designate protocol number 1 *)
GP_CPRTCL(TRUE, H00, 2, 1, Var_ControlData, Var_Result); (* Execute the protocol Communicate in CH2 *)
END_IF;

IF(Var_Result[0]=TRUE)THEN
IF(Var_Result[1]=FALSE)THEN
SET(TRUE, Var_Flag_Normal); (* Normal completion flag ON *)
ELSE
SET(TRUE, Var_Flag_Abnormal); (* Abnormal completion flag ON *)
MOV(TRUE, Var_ControlData[0], Var_ErrorCode); (* Store the error code *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.3 Serial Communication Instruction 97
5.4 Network Dedicated Instruction
Reading from the buffer memory of an intelligent device station

J(P)_RIRD, G(P)_RIRD
CC-Link CC IE C CC IE F

Structured ladder/FBD ST

J_RIRD G_RIRD

EN ENO EN ENO ENO:= J_RIRD (EN, Jn*, s, d1, d2);


Jn* d1 Un* d1 ENO:= G_RIRD (EN, Un*, s, d1, d2);
s d2 s d2

The following instruction can go in the dotted squares.


J_RIRD, JP_RIRD, G_RIRD, GP_RIRD

■Executing condition
Instruction Executing condition
J_RIRD
G_RIRD
JP_RIRD
GP_RIRD

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..4]
Output argument ENO Execution result Bit
d1 Start number of the device that stores read data ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads data for the specified number of points from the buffer memory of the CC-Link module or the device of
the programmable controller CPU module on the specified station.

5 MODULE DEDICATED INSTRUCTION


98 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting range Setting side
(s)[0] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
For error codes when target station is anything other than
master/local module, refer to the manual of the target station.
(s)[1] Target station No. Specify the station number of the target station. 0 to 64*1 User
0 to 120
(s)[2] Access code, Specify the access code and attribute code of the device to be Page 99
Attribute code read. Buffer memory of
the CC-Link
b15 b8 b7 b0
module,Page 100
Device memory of
Access code Attribute code the programmable
controller CPU
module
(s)[3] Buffer memory address or Specify the start address of the buffer memory or the start Within the device 5
device No. number of the device. range*2
(s)[4] Number of read points Specify the number of data to be read (in units of words). 1 to 32*3
1 to 480*4

*1 For G(P)_RIRD, the setting range shall be 0 to 64.


*2 For details, refer to the manual for the local station or the intelligent device station from which data are read.
When the random access buffer is specified, specify the start address of the random access buffer as 0.
*3 The value indicates the maximum number of data to be read.
Specify the value within the buffer memory capacity of the local station or the intelligent device station, or the receive buffer area setting
range set by a parameter.
*4 When reading device data from the programmable controller CPU other than the QCPU (Q mode), QCPU (A mode) or QnACPU/
AnUCPU, the setting range shall be 1 to 32 words.

■Buffer memory of the CC-Link module


Buffer memory Access code Attribute code
Buffer in an intelligent device station 00H 04H
Buffer in a master or local station Random access buffer 20H
Remote input 21H
Remote output 22H
Remote register 24H
Link special relay 63H
Link special register 64H

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 99
■Device memory of the programmable controller CPU module
Device*1 Name Device type Unit Access code*2 Attribute code*2
Bit Word
Input relay X   Hexadecimal 01H 05H
Output relay Y   Hexadecimal 02H
Internal relay M   Decimal 03H
Latch relay L   Decimal 83H
Link relay B   Hexadecimal 23H
Timer (contact) T   Decimal 09H
Timer (coil) T   Decimal 0AH
Timer (current value) T   Decimal 0CH
Retentive timer (contact) ST   Decimal 89H
Retentive timer (coil) ST   Decimal 8AH
Retentive timer (current ST   Decimal 8CH
value)
Counter (contact) C   Decimal 11H
Counter (coil) C   Decimal 12H
Counter (current value) C   Decimal 14H
Data register*3 D   Decimal 04H
Link register*3 W   Hexadecimal 24H
File register R   Decimal 84H
Link special relay SB   Hexadecimal 63H
Link special register SW   Hexadecimal 64H
Special relay SM   Decimal 43H
Special register SD   Decimal 44H

*1 Devices other than those listed above cannot be accessed.


When accessing a bit device, specify it with 0 or a multiple of 16.
*2 For access code/attribute code when target station is anything other than master/local module, refer to the manual of the target station.
*3 D65536 and the following devices of extended data registers as well as W10000 and the following devices of extended link registers
cannot be specified.

5 MODULE DEDICATED INSTRUCTION


100 5.4 Network Dedicated Instruction
Program example
• The following program reads out 10-word data, which start from D1000 of the number 1 local station connected to the
master module mounted on the I/O numbers from X/Y40 to X/Y5F, and stores the data in the devices starting from D0 when
X0 turns ON.
(When the refresh device of the link special register (SW) is set to SW0.)
[Structured ladder/FBD]

Sets station number

Sets access code and attribute code

Sets device number

Sets number of read points


5
Performs readout

Turns execution flag ON

Process on completion of readout

Process on normal completion

Process on error completion

Turns execution flag OFF

[ST]
IF((X0=TRUE)
&(Var_Flag_Exe=FALSE) (* Execution flag *)
&(SW80.0=FALSE))THEN (* Data link status of station number 1 *)
MOV(TRUE,1, Var_ControlData[1]); (* Sets station number *)
MOV(TRUE,H0405, Var_ControlData[2]); (* Sets access code and attribute code *)
MOV(TRUE, 1000, Var_ControlData[3]); (* Sets device number *)
MOV(TRUE, 10, Var_ControlData[4]); (* Sets number of read points *)
G_RIRD(TRUE, H04, Var_ControlData, D0, Var_Result); (* Performs readout *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of readout *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;

RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)


END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 101
Writing to the buffer memory of an intelligent device station

J(P)_RIWT, G(P)_RIWT
CC-Link CC IE C CC IE F

Structured ladder/FBD ST

J_RIWT G_RIWT

EN ENO EN ENO ENO:= J_RIWT (EN, Jn*, s1, s2, d);

Jn* d Un* d ENO:= G_RIWT (EN, Un*, s1, s2, d);

s1 s1

s2 s2

The following instruction can go in the dotted squares.


J_RIWT, JP_RIWT, G_RIWT, GP_RIWT

■Executing condition
Instruction Executing condition
J_RIWT
G_RIWT
JP_RIWT
GP_RIWT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..4]
s2 Start number of the device that stores write data ANY16
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction writes the data for the specified number of points to the buffer memory of the CC-Link module or the device of
the programmable controller CPU module on the specified station.

5 MODULE DEDICATED INSTRUCTION


102 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
For error codes when target station is anything other than
master/local module, refer to the manual of the target station.
(s1)[1] Target station No. Specify the station number of the target station 0 to 64*1 User
0 to 120
(s1)[2] Access code Specify the access code and attribute code of the device to be Page 103
Attribute code read. Buffer memory of
the CC-Link
b15 b8 b7 b0
module,Page 104
Device memory of
Access code Attribute code the programmable
controller CPU
module
(s1)[3] Buffer memory address Specify the start address of the buffer memory or the start Within the device 5
or device No. number of the device. range*2
(s1)[4] Number of write points Specify the number of data to be written (in units of words). 1 to 10*3
1 to 480*4

*1 For G(P)_RIWT, the setting range shall be 0 to 64.


*2 For details, refer to the manual for the local station or the intelligent device station to which data are written.
When the random access buffer is specified, specify the start address of the random access buffer as 0.
*3 When writing device data to the programmable controller CPU other than the QCPU (Q mode), QCPU (A mode) or QnACPU/AnUCPU,
the setting range shall be 1 to 10 words.
*4 The value indicates the maximum number of data to be written.
Specify the value within the buffer memory capacity of the local station or the intelligent device station, or the send buffer area setting
range set by a parameter.

■Buffer memory of the CC-Link module


Buffer memory category Access code Attribute code
Buffer memory 00H 04H
Buffer in a master or local station Random access buffer 20H
Remote input 21H
Remote output 22H
Remote register 24H
Link special relay 63H
Link special register 64H

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 103
■Device memory of the programmable controller CPU module
Device*1 Name Device type Unit Access code*2 Attribute code*2
Bit Word
Input relay X   Hexadecimal 01H 05H
Output relay Y   Hexadecimal 02H
Internal relay M   Decimal 03H
Latch relay L   Decimal 83H
Link relay B   Hexadecimal 23H
Timer (contact) T   Decimal 09H
Timer (coil) T   Decimal 0AH
Timer (current value) T   Decimal 0CH
Retentive timer (contact) ST   Decimal 89H
Retentive timer (coil) ST   Decimal 8AH
Retentive timer (current ST   Decimal 8CH
value)
Counter (contact) C   Decimal 11H
Counter (coil) C   Decimal 12H
Counter (current value) C   Decimal 14H
Data register*3 D   Decimal 04H
Link register*3 W   Hexadecimal 24H
File register R   Decimal 84H
Link special relay SB   Hexadecimal 63H
Link special register SW   Hexadecimal 64H
Special relay SM   Decimal 43H
Special register SD   Decimal 44H

*1 Devices other than those listed above cannot be accessed.


When accessing a bit device, specify it with 0 or a multiple of 16.
*2 For access code/attribute code when target station is anything other than master/local module, refer to the manual of the target station.
*3 D65536 and the following devices of extended data registers as well as W10000 and the following devices of extended link registers
cannot be specified.

5 MODULE DEDICATED INSTRUCTION


104 5.4 Network Dedicated Instruction
Program example
• The following program stores 10-word data, which are stored in the devices starting from D0, to the devices starting from
D1000 of the number 1 local station connected to the master module mounted on the I/O numbers from X/Y40 to X/Y5F
when X0 turns ON.
(When the refresh device of the link special register (SW) is set to SW0.)
[Structured ladder/FBD]

Sets station number

Sets access code and attribute code

Sets device number

Sets number of write points


5
Performs writing

Turns execution flag ON

Process on completion of writing

Process on normal completion

Process on error completion

Turns execution flag OFF

[ST]
IF((X0=TRUE)
&(Var_Flag_Exe=FALSE) (* Execution flag *)
&(SW80.0=FALSE))THEN (* Data link status of station number 1 *)
MOV(TRUE, 1, Var_ControlData[1]); (* Sets station number *)
MOV(TRUE, H0405, Var_ControlData[2]); (* Sets access code and attribute code *)
MOV(TRUE, 1000, Var_ControlData[3]); (* Sets device number *)
MOV(TRUE, 10, Var_ControlData[4]); (* Sets number of read points *)
G_RIWT(TRUE, H04, Var_ControlData, D0, Var_Result); (* Performs writing *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of writing *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;

RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)


END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 105
RIRCV instruction

G(P)_RIRCV
CC-Link

Structured ladder/FBD ST
G_RIRCV

EN ENO
ENO:= G_RIRCV (EN, Un*, s1, s2, d1, d2);
Un* d1
s1 d2
s2

The following instruction can go in the dotted squares.


G_RIRCV, GP_RIRCV

■Executing condition
Instruction Executing condition
G_RIRCV

GP_RIRCV

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..4]
s2 Variable that stores interlock signal Array of ANY16 [0..2]
Output argument ENO Execution result Bit
d1 Start number of the device that stores read data ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction automatically performs handshaking with an intelligent device station and reads data from the buffer memory
of the specified intelligent device station.
This instruction is applicable with a module having a handshake signal, such as the AJ65BT-R2(N).

5 MODULE DEDICATED INSTRUCTION


106 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[1] Station No. Specify the station number of the intelligent device station. 0 to 64 User
(s1)[2] Access code, Set '0004H'. 0004H User
Attribute code
*1
(s1)[3] Buffer memory address Specify the start address of the buffer memory. User
(s1)[4] Number of read points Specify the number of data to be read (in units of words). 1 to 480*2 User

*1 For details, refer to the manual for the intelligent device station from which data are read.
*2 The value indicates the maximum number of data to be read.
Specify the value within the buffer memory capacity of the intelligent device station or the receive buffer area setting range set by a
parameter.

■Interlock signal storage device 5


Device Item Setting data Setting range Setting side
(s2)[0] RY: Request device 0 to 127 User
b15 … b8 b7 … b0
Set the high-order 8 bits to 0. 0 User
0 RY

(s2)[1] RX: Completion device 0004H User


b15 … b8 b7 … b0
RWr: Error code storage device 0 to 15, User
RWr*1 RX
Set FFH when no error code storage device exists. FFH
(s2)[2] 0: Completes with the content of one device (RXn). 0/1 User
b15 … b0
1: Completes with the content of two devices (RXn, RXn + 1).
Completion mode (RXn + 1 turns ON upon abnormal completion of the
instruction.)

*1 The same error code as that for the completion status of control data are stored in the error code storage device.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 107
Program example
The following program reads 11-word data, which are stored in buffer memory starting from the buffer memory address 400H
of the number 63 intelligent device station (AJ65BT-R2(N)) connected to the master module mounted on the I/O numbers X/
Y00 to X/Y1F, and stores the data in the devices starting from D40.

The interlock signal storage is set to request device: RY2, completion device: RX2, error code storage device: RWr2, and
completion mode: 1.
(When the refresh device of the link special register (SW) is set to SW0.)
[Structured ladder/FBD]

Sets station number

Sets access code


and attribute code

Sets buffer memory


address

Sets number of
read points

Sets request device

Sets completion device


and error code storage
area

Sets completion mode

Performs readout

Turns execution
flag ON

Process on normal completion


Process on error completion
Turns read request OFF

Turns execution
flag OFF

5 MODULE DEDICATED INSTRUCTION


108 5.4 Network Dedicated Instruction
[ST]
IF((Var_Flag_Inst=TRUE) (* Read request ON *)
&(Var_Flag_Exe=FALSE) (* Execution flag *)
&(SW83.E=FALSE))THEN (* Data link status of station number 63 *)
(* Sets control data *)
MOV(TRUE, 63, Var_ControlData[1]); (* Sets station number *)
MOV(TRUE,H4, Var_ControlData[2]); (* Sets access code and attribute code *)
MOV(TRUE, H400, Var_ControlData[3]); (* Sets buffer memory address *)
MOV(TRUE, 11, Var_ControlData[4]); (* Sets number of read points *)

(* Sets interlock signal storage device *)


MOV(TRUE, H2, Var_InterlockData[0]); (* Sets request device *)
MOV(TRUE, H202, Var_InterlockData[1]); (* Sets completion device and error code storage area *)
MOV(TRUE, H1, Var_InterlockData[2]); (* Sets completion mode *)

G_RIRCV(TRUE, H00, Var_ControlData, Var_InterlockData,D40, Var_Result); (* Performs readout *)


END_IF;

IF(MEP((Var_Flag_Inst=TRUE) & (SW83.E=FALSE)))THEN (* Read request is ON and data link status of station number 63 is OFF (rising pulse) *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
END_IF; 5
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;

RST(TRUE, Var_Flag_Inst); (* Turns read request OFF *)


RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 109
RISEND instruction

G(P)_RISEND
CC-Link

Structured ladder/FBD ST
G_RISEND

EN ENO
ENO:= G_RISEND (EN, Un*, s1, s2, d1, d2);
Un* d1
s1 d2
s2

The following instruction can go in the dotted squares.


G_RISEND, GP_RISEND

■Executing condition
Instruction Executing condition
G_RISEND

GP_RISEND

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..4]
s2 Variable that stores interlock signal Array of ANY16 [0..2]
Output argument ENO Execution result Bit
d1 Start number of the device that stores write data ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction automatically performs handshaking with an intelligent device station and writes data to the buffer memory of
the specified intelligent device station.
This instruction is applicable with a module having a handshake signal, such as the AJ65BT-R2(N).

5 MODULE DEDICATED INSTRUCTION


110 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting range Setting side
(s1)[0] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[1] Station No. Specify the station number of the intelligent device station. 0 to 64 User
(s1)[2] Access code, Set '0004H'. 0004H User
Attribute code
*1
(s1)[3] Buffer memory address Specify the start address of the buffer memory. User
(s1)[4] Number of write points Specify the number of data to be written (in units of words). 1 to 480*2 User

*1 For details, refer to the manual for the intelligent device station to which data are written.
*2 The value indicates the maximum number of data to be written.
Specify the value within the buffer memory capacity of the intelligent device station or the receive buffer area setting range set by a
parameter.

■Interlock signal storage device 5


Device Item Setting data Setting range Setting side
(s2)[0] RY: Request device 0 to 127 User
b15 … b8 b7 … b0
Set the high-order 8 bits to 0. 0 User
0 RY

(s2)[1] RX: Completion device 0 to 127 User


b15 … b8 b7 … b0
RWr: Error code storage device 0 to 15, User
RWr*1 RX
Set FFH when no error code storage device exists. FFH
(s2)[2] 0: Completes with the content of one device (RXn). 0/1 User
b15 … b0
1: Completes with the content of two devices (RXn, RXn + 1).
Completion mode (RXn + 1 turns ON upon abnormal completion of the
instruction.)

*1 The same error code as that for the completion status of control data are stored in the error code storage device.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 111
Program example
The following program writes 1-word data of D10 to the buffer memory address 111H of the number 63 intelligent device
station (AJ65BT-R2(N)) which is connected to the master module mounted on the I/O numbers from X/Y00 to X/Y1F.

The interlock signal storage settings are set to request device: RY4, completion device: RX4, error code storage device:
RWr1, and completion mode: 1.
(When the refresh device of the link special register (SW) is set to SW0.)
[Structured ladder/FBD]

Sets station number

Sets access code and attribute code

Sets buffer memory address

Sets number of write points

Sets request device

Sets completion device and error code storage area


device

Sets completion mode

Sets data to be written to intelligent device station

Performs writing

Turns execution flag ON

Process on normal completion

Process on error completion

Turns write request OFF

Turns execution flag OFF

5 MODULE DEDICATED INSTRUCTION


112 5.4 Network Dedicated Instruction
[ST]
IF((Var_Flag_Inst=TRUE) (* Write request ON *)
&(Var_Flag_Exe=FALSE) (* Execution flag *)
&(SW83.E=FALSE))THEN (* Data link status of station number 63 *)
(* Sets control data *)
MOV(TRUE, 63, Var_ControlData[1]); (* Sets station number *)
MOV(TRUE, H4, Var_ControlData[2]); (* Sets access code and attribute code *)
MOV(TRUE, H111, Var_ControlData[3]); (* Sets buffer memory address *)
MOV(TRUE, 1, Var_ControlData[4]); (* Sets number of write points *)

(* Sets interlock signal storage device *)


MOV(TRUE, H4, Var_InterlockData[0]); (* Sets request device *)
MOV(TRUE, H104, Var_InterlockData[1]); (* Sets completion device and error code storage area device *)
MOV(TRUE, H1, Var_InterlockData[2]); (* Sets completion mode *)
(* Sets data to be written to intelligent device station *)
MOV(TRUE, 11, D10);

GP_RISEND(TRUE, H00, Var_ControlData, Var_InterlockData,D10, Var_Result); (* Performs writing *)


END_IF;
IF(MEP((Var_Flag_Inst=TRUE) & (SW83.E=FALSE)))THEN (* Write request is ON and data link status of station number 63 is OFF (rising pulse) *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *) 5
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;

RST(TRUE, Var_Flag_Inst); (* Turns write request OFF *)


RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 113
Reading from the auto-refresh buffer memory of the master
station

G(P)_RIFR
CC-Link

Structured ladder/FBD ST
G_RIFR

EN ENO
Un* d ENO:= G_RIFR (EN, Un*, n1, n2, n3, d);
n1
n2
n3

The following instruction can go in the dotted squares.


G_RIFR, GP_RIFR

■Executing condition
Instruction Executing condition
G_RIFR

GP_RIFR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
n1 Intelligent device station number (1 to 64) ANY16
Random access buffer specification (FFH)
n2 Offset value of specified intelligent device auto- ANY16
refresh buffer or random access buffer of the
master station
n3 Number of read points (0 to 4096) ANY16
No processing is performed with setting '0'.
Output argument ENO Execution result Bit
d Start number of the device that stores read data ANY16

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

n1     
n2     
n3     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads data from the auto-refresh buffer of the specified station.
The instruction is applicable with a module having an auto-refresh buffer, such as the AJ65BT-R2(N).

5 MODULE DEDICATED INSTRUCTION


114 5.4 Network Dedicated Instruction
Program example
• The following program reads out 10-word data from buffer memory starting from the offset value 100 of the auto-refresh
buffer of the master module (400H in the intelligent device station) and stores the data in the devices starting from D0 when
X0 turns ON.
(When the refresh device of the link special register (SW) is set to SW0.)

Programmable Master module Intelligent device station


controller CPU (start I/O number 40) (station number 1)

Device memory Auto-refresh buffer Buffer memory

300H
Buffer memory
for auto-refresh
5FFH
5

[Structured ladder/FBD]

Performs readout

[ST]
IF((X0=TRUE) & (SW80.0=FALSE))THEN
GP_RIFR(TRUE, H04, 1, H100, 10, D0); (* Performs readout *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 115
Writing to the auto-refresh buffer memory of the master station

G(P)_RITO
CC-Link

Structured ladder/FBD ST
G_RITO

EN ENO
Un* d ENO:= G_RITO (EN, Un*, n1, n2, n3, d);
n1
n2
n3

The following instruction can go in the dotted squares.


G_RITO, GP_RITO

■Executing condition
Instruction Executing condition
G_RITO

GP_RITO

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
n1 Intelligent device station number (1 to 64) ANY16
Random access buffer specification (FFH)
n2 Offset value of specified intelligent device auto- ANY16
refresh buffer or random access buffer of the
master station
n3 Number of write points ANY16
Output argument ENO Execution result Bit
d Start number of the device that stores write data ANY16

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

n1     
n2     
n3     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction writes the data to the auto-refresh buffer of the specified station.
The instruction is applicable with a module having an auto-refresh buffer, such as the AJ65BT-R2(N).

5 MODULE DEDICATED INSTRUCTION


116 5.4 Network Dedicated Instruction
Program example
• The following program write 10-word data which are stored in the devices starting from D0 into buffer memory starting the
offset value 100 of the auto-refresh buffer of the master module (400H in the intelligent device station) when X0 turns ON.
(When the refresh device of the link special register (SW) is set to SW0.)

Programmable controller Master module Intelligent device station


CPU (start I/O number 40) (station number 1)

Device memory Auto-refresh buffer Buffer memory

300H
Buffer memory
for auto-refresh
5FFH

5
[Structured ladder/FBD]

Performs
writing

[ST]
IF((X0=TRUE) & (SW80.0=FALSE))THEN
GP_RITO(TRUE, H04, 1, H100, 10, D0); (* Performs writing *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 117
Network parameter setting

G(P)_RLPASET
CC-Link

Structured ladder/FBD ST
G_RLPASET

EN ENO
Un* d ENO:= G_RLPASET (EN, Un*, s1, s2, s3, s4, s5, d);
s1
s2
s3
s4
s5

The following instruction can go in the dotted squares.


G_RLPASET, GP_RLPASET

■Executing condition
Instruction Executing condition
G_RLPASET

GP_RLPASET

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
00 to FE: Higher two digits when expressing the I/O
number in three digits)
s1 Variable that stores control data Array of ANY16 [0..7]
s2 Variable that stores slave station setting data Array of ANY16 [0..63]
s3 Variable that stores reserved station specification Array of ANY16 [0..3]
data
s4 Variable that stores error invalid station Array of ANY16 [0..3]
specification data
s5 Variable that stores send/receive and auto-refresh Array of ANY16 [0..77]
buffer assignment data
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(s3)   
(s4)   
(s5)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sets the network parameters to the master station and starts up the data link.

5 MODULE DEDICATED INSTRUCTION


118 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting side
range*2
(s1)[0] Completion The instruction completion status is stored.  System
status 0: Normal completion
Other than 0: Error completion (error code)
(s1)[1] Setting flag Specify the validity of each setting data from (s2) to (s5).  User
0: Invalid*1
1: Valid
b15 b14 b13 b4 b3 b2 b1 b0
0 to 0
Slave station setting data s2
Reserved station specification data s3
Error invalid station specification data s4
Send/receive and auto-refresh buffer
assignment data s5
Mode
00: Remote net (Ver. 1 mode)
01: Remote net (Additional mode)
10: Remote net (Ver. 2 mode)
5
11: Cannot be used

(s1)[2] Number of Set the number of connected slave stations. 1 to 64 User


connected
modules
(s1)[3] Number of Set the number of retries to be performed to a communication error station. 1 to 7 User
retries
(s1)[4] Number of Set the number of slave stations that can be returned in one link scan. 1 to 10 User
automatic return
modules
(s1)[5] Operation Specify the data link status when a master station programmable controller CPU error 0, 1 User
specification occurs.
when CPU is 0: Stop
down 1: Continue
(s1)[6] Scan mode Specify the link scan mode for sequence scan. 0, 1 User
specification 0: Asynchronous
1: Synchronous
(s1)[7] Delay time Set '0' for the delay time. 0 User
specification

*1 For the setting data for which invalid is specified, default parameter is applied.
*2 Setting a value outside the setting range results in error completion of the instruction.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 119
■Slave station setting data
Device Item Setting data Setting Setting side
range
(s2)[0] Setting for 1 to Set the slave station type, the number of occupied slave stations, and the station  User
 64 modules*1 number as shown below.
(s2)[63]
b15 to b12 b11 to b8 b7 to b0

Station number
Number of occupied
slave stations
Type of slave station
Default parameter setting is '0101H to 0140H (station number: 1 to 64, number of
occupied slave stations: 1, type of slave station: Ver.1 compatible remote I/O station)'
Setting of station number 1 to 40H
1 to 64 (BIN setting)
Setting of the number of occupied slave stations 1 to 4H
The setting value for the number of occupied slave stations is described below.
1H: 1 station
2H: 2 stations
3H: 3 stations
4H: 4 stations
Setting of slave station type *2 0 to FH
The setting value for the slave station type is described below.
0H: Ver.1 compatible remote I/O station
1H: Ver.1 compatible remote device station
2H: Ver.1 compatible intelligent device station
5H: Ver.2 compatible single remote device station
6H: Ver.2 compatible single intelligent device station
8H: Ver.2 compatible double remote device station
9H: Ver.2 compatible double intelligent device station
BH: Ver.2 compatible quadruple remote device station
CH: Ver.2 compatible quadruple intelligent device station
EH: Ver.2 compatible octuple remote device station
FH: Ver.2 compatible octuple intelligent device station

*1 Set the same number which was set for Number of connected modules in the control data.
*2 Setting a value outside the setting range in the setting of slave station type results in error completion of the instruction.

■Reserved station specification data


Device Item Setting data Setting Setting side
range
(s3)[0] Specification for Specify the reserved station.*2  User
 1 to 64 0: Not specified
(s3)[3] stations*1 1: Specified

b15 b14 b13 b12 to b3 b2 b1 b0


s3 [0] 16 15 14 13 to 4 3 2 1
s3 [1] 32 31 30 29 to 20 19 18 17
s3 [2] 48 47 46 45 to 36 35 34 33
s3 [3] 64 63 62 61 to 52 51 50 49
1 to 64 in the table indicates a station number.

Default parameter setting is '0: Not specified' for all stations.

*1 Set the parameter up to the largest station number set in the slave station setting data.
*2 Set the parameter only to the start station number of the module for the remote station/local station/intelligent device station that
occupies two or more stations.

5 MODULE DEDICATED INSTRUCTION


120 5.4 Network Dedicated Instruction
■Error invalid station specification data
Device Item Setting data Setting Setting side
range
(s4)[0] Specification for Specify the error invalid station.*2  User
 1 to 64 0: Not specified
(s4)[3] stations*1 1: Specified

b15 b14 b13 b12 to b3 b2 b1 b0


s4 [0] 16 15 14 13 to 4 3 2 1
s4 [1] 32 31 30 29 to 20 19 18 17
s4 [2] 48 47 46 45 to 36 35 34 33
s4 [3] 64 63 62 61 to 52 51 50 49
1 to 64 in the table indicates a station number.
Default parameter setting is '0: Not specified' for all stations.

*1 Set the parameter up to the largest station number set in the slave station setting data.
*2 Set the parameter only to the start station number of the module for the remote station/local station/intelligent device station that
occupies two or more stations.
Reserved station specification has a priority when an error invalid station and reserved station are specified for the same station. 5
■Send/receive and auto-refresh buffer assignment data
Device Item Setting data Setting range Setting side
*2
(s5)[0] Specification for Specify the buffer memory size assignment at transient Send/receive buffer User
 1 to 26 transmission for local stations and intelligent device stations. : 0H (no setting) 40H to 1000H
(s5)[77] modules*1 0 (word) (no setting)
s5 [0] Send buffer size
64 to 4096 (words)
s5 [1] Receive buffer size Setting for the 1st module
s5 [2] Auto-refresh buffer size Auto-refresh buffer*3
: 0H (no setting) 80H to 1000H
0 (word) (no setting)
128 to 4096 (words)

s5 [75] Send buffer size

s5 [76] Receive buffer size Setting for the 26th module


s5 [77] Auto-refresh buffer size

Default parameter setting is 'send buffer size: 40H, receive buffer


size: 40H, auto-refresh buffer size: 80H'.

*1 Set the assignment data, in ascending order, for the stations set for a local station or intelligent device station in the slave station setting
data.
*2 Keep the total of the send/receive buffer size within 1000H (4096 (words)).
Specify the size added seven words to the size of send/receive data as the send/receive buffer size.
Setting a value outside the setting range results in error completion of the instruction.
*3 Keep the total of the auto-refresh buffer size within 1000H (4096 (words)).
Specify the necessary auto-refresh buffer size for each intelligent device station.
Setting a value outside the setting range results in error completion of the instruction.

Precautions
The RLPASET instruction is applicable to the QJ61BT11 of which the function version is B and the first five digits of the serial
number are '03042' or higher.
The QJ61BT11N and LJ61BT11 is compatible with the RLPASET instruction.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 121
Program example
The following program sets the network parameter to the master module mounted on the I/O number X/Y00 to X/Y1F, and
starts up the data link.
Station number 1

Station number 2 Station number 3


Master module Local station
(X/Y00 to 1F) Remote I/O station Remote I/O station
(1-station occupy)
(error invalid station) (reserved station)
(1-station occupy) (1-station occupy)

5 MODULE DEDICATED INSTRUCTION


122 5.4 Network Dedicated Instruction
[Structured ladder/FBD]

Reads SB0040 to SB01FF

Reads SW0040 to SW01FF

Parameter setting command

Clears completion status

Sets all of setting flags to Valid

Sets number of connected modules


5
Sets number of retries

Sets number of automatic return modules

Sets operation specification when CPU is down to stop

Sets scan mode specification to asynchronous

Set delay time specification

First module: local station, 1-station occupy, station number 1

Second module: Remote I/O station, 1-station occupy, station


number 2

Third module: Remote I/O station, 1-station occupy, station


number 3

Reserved station specification: station number 3

Error invalid station specification: station number 2

First module: local station, send buffer 100 words

Receive buffer 100 words

Auto-refresh buffer 0 word

Performs parameter setting and data link start

Turns parameter setting command OFF

Refresh command

Control program start command

Process on error completion

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 123
[ST]
FROM(TRUE, H0, H5E4, 28, K4SB40); (* Reads SB0040 to SB01FF *)
FROM(TRUE, H0, H640, 448, SW40); (* Reads SW0040 to SW01FF*)
IF((SM402=TRUE) & (SB6E=TRUE))THEN
SET(TRUE, Var_Flag_Inst); (* Parameter setting command *)
END_IF;
IF(Var_Flag_Inst=TRUE)THEN (* Parameter setting command ON *)
MOV(TRUE, 0, Var_ControlData[0]); (* Clear completion status *)
MOV(TRUE, 15, Var_ControlData[1]); (* Sets all of setting flags to Valid *)
MOV(TRUE, 3, Var_ControlData[2]); (* Sets number of connected modules *)
MOV(TRUE, 3, Var_ControlData[3]); (* Sets number of retries *)
MOV(TRUE, 1, Var_ControlData[4]); (* Sets number of automatic return modules *)
MOV(TRUE, 0, Var_ControlData[5]); (* Sets operation specification when CPU is down to stop *)
MOV(TRUE, 0, Var_ControlData[6]); (* Sets scan mode specification to asynchronous *)
MOV(TRUE, 0, Var_ControlData[7]); (* Set delay time specification *)

MOV(TRUE, H2101, Var_SlaveStation[0]); (* First module: local station, 1-station occupy, station number 1 *)
MOV(TRUE, H0102, Var_SlaveStation[1]); (* Second module: Remote I/O station, 1-station occupy, station number 2*)
MOV(TRUE, H0103, Var_SlaveStation[2]); (* Third module: Remote I/O station, 1-station occupy, station number 3 *)

MOV(TRUE, H4, Var_ReservedStation[0]); (* Reserved station specification: station number 3 *)

MOV(TRUE, H2, Var_ErrorInvalidStation[0]); (* Error invalid station specification: station number 2 *)

MOV(TRUE, 100, Var_BufferSize[0]); (* First module: local module, send buffer 100 words *)
MOV(TRUE, 100, Var_BufferSize[1]); (* Second module: local station, receive buffer 100 words *)
MOV(TRUE, 0, Var_BufferSize[2]); (* Third module: local station, auto-refresh buffer 0 words *)

GP_RLPASET(TRUE, H00, Var_ControlData, Var_SlaveStation,


Var_ReservedStation, Var_ErrorInvalidStation, Var_BufferSize,
Var_Result); (* Performs parameter setting *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, SB3); (* Refresh command *)
SET(TRUE, Var_Flag_Exe); (* Control program start command *)
ELSE (* Error completion *)

(* Process on error completion *)


END_IF;

RST(TRUE, Var_Flag_Inst); (* Turns parameter setting command OFF *)


END_IF;

5 MODULE DEDICATED INSTRUCTION


124 5.4 Network Dedicated Instruction
READ instruction

J(P)_READ, G(P)_READ
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

J_READ G_READ

EN ENO EN ENO ENO:= J_READ (EN, Jn*, s1, s2, d1, d2);
Jn* d1 Un* d1 ENO:= G_READ (EN, Un*, s1, s2, d1, d2);
s1 d2 s1 d2

s2 s2

The following instruction can go in the dotted squares. 5


J_READ, JP_READ, G_READ, GP_READ

■Executing condition
Instruction Executing condition
J_READ
G_READ
JP_READ
GP_READ

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
00 to FE: Higher two digits when expressing the I/O
number in three digits)
s1 Variable that stores control data Array of ANY16 [0..17]
s2 Start number of the target station's device from ANY
which data are read
Output argument ENO Execution result Bit
d1 Start number of the host station's device that stores ANY16
read data
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2) *2  
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.
*2 Only CC-Link IE Field Network
When the target station is LCPU, Universal model QCPU, or Basic model QCPU, the digit specification of the bit device can be used
(example: K4M16).
The digit specification of the bit device can be used when the following conditions are met.
The device number is a multiple of 16 (10H).
The digit specification is 4 points (K4).

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 125
Processing details
This instruction reads data from a word device of another station.

Setting data
Device Item Setting data Setting Setting side
range
(s1)[0] Error completion type 0001H User
b15 … b7 … b0 0081H
0 (1) 0 1

Error completion type (bit 7)


Specify the clock data setup status at the time of error completion.
0: Clock data at the time of error completion is not set in the area starting from
(s1)[11].
1: Clock data at the time of error completion is set in the area starting from
(s1)[11].
(s1)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Channel used by host Specify the channel used by the host station. 1 to 10 User
station Setting values are as follows.
• Ethernet, MELSECNET/H: 1 to 8
• CC-Link IE Controller Network: 1 to 10
• CC-Link IE Field Network: 1 to 2
(s1)[3] Target station's CPU Specify the type of the target station CPU. ■Ethernet User
type Setting values are as follows. 0000H, 03FFH
■Ethernet ■MELSECNET
• 0000H: Target station CPU/host system CPU (Specified data are the same as /H, CC-Link IE
'03FFH'.) 0000H, 03E0H
• 03FFH*1: Target station CPU/host system CPU to 03E3H,
■MELSECNET/H CC-Link IE 03FFH
• 0000H: Target station CPU/host system CPU (Specified data are the same as
'03FFH'.)
• 03E0H*2: Multi-CPU No. 1/target station CPU (single CPU system)
• 03E1H*2: Multi-CPU No. 2
• 03E2H*2: Multi-CPU No. 3
• 03E3H*2: Multi-CPU No. 4
• 03FFH*1: Target station CPU/host system CPU

(s1)[4] Target station network Specify the network number of the target station. 1 to 239, 254 User
No. 1 to 239: Network number
254: Specify this when 254 has been set in Jn.
(s1)[5] Target station No. Specify the station number of the target station. 1 to 125 User
Setting values are as follows.
• MELSECNET/H: 1 to 64
• When the host station is Universal model QCPU in Ethernet or CC-Link IE
Controller Network: 1 to120
• When the host station is anything other than Universal model QCPU in Ethernet
or CC-Link IE Controller Network: 1 to 64
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to
120
(s1)[6]  Reserved 0 User
(s1)[7] Number of resends • For instruction execution 0 to 15 User
Specify the number of instruction resends when the instruction is not completed
within the monitoring time specified in (s1)[8].
• At instruction completion  System
The number of resends (result) is stored.

5 MODULE DEDICATED INSTRUCTION


126 5.4 Network Dedicated Instruction
Device Item Setting data Setting Setting side
range
(s1)[8] Arrival monitoring time Specify the monitoring time required for the instruction completion. If the 0 to 32767 User
instruction is not completed within this time, it is resent by the number of times
specified in (s1)[7].
Setting values are as follows.
■Ethernet
• 0 to 16383
• 0 to TCP retransmission timer value: Monitoring is performed by the TCP
retransmission timer value.
• (TCP retransmission timer value + 1) to 16383: Monitoring time (unit: second)
■MELSECNET/H
• 0 to 32767
• 0: 10 seconds
• 1 to 32767: 1 to 32767 seconds
(s1)[9] Read data length Specify the number of read data. 1 to 8192 User
Setting values are as follows.
• Ethernet, MELSECNET/H, CC-Link IE Field Network: 1 to 960 (word)
• CC-Link IE Controller Network: 1 to 8192 (word)
(s1)[10]  Reserved  User 5
(s1)[11] Clock set flag*3 Valid/invalid status of the data in the area starting from (s1)[12] is stored.  System
0: Invalid
1: Valid
(s1)[12] Clock data at the time Clock data at the time of error completion are stored in BCD format.  System
 of error completion*3
b15 to b8 b7 to b0
(s1)[15]
s1 [12] Month (01H to 12H) Year (00H to 99H) Last two digits
s1 [13] Hour (00H to 23H) Day (01H to 31H)
s1 [14] Second (00H to 59H) Minute (00H to 59H)
s1 [15] Year (00H to 99H) First two digits Day of week (00H to 06H)
00H (Sun.) to 06H (Sat.)

(s1)[16] Error-detected network Network number of the station where an error was detected is stored. (However,  System
No.*3 when an error was detected at the host station, the network number is not stored.)
1 to 239: Network number
(s1)[17] Error-detected station Number of the station where an error was detected is stored. (However, when an  System
No.*3 error was detected at the host station, the network number is not stored.)
Stored values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE Controller Network: 1 to 120
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to
120

*1 Specification is possible when the host station is a network module or Ethernet module of function version D or later.
(Specification is not possible for other modules. An access is always made to the target station CPU.)
*2 Specification is possible when the versions of the QCPU and the network module on the host station and the target station are as
indicated below.
(Specification is not possible for other modules. An access is always made to the target station CPU.)
 Network module: The first five digits of the serial number are '06092' or higher.
 QCPU: The first five digits of the serial number are '06092' or higher.
*3 Data are stored only when 1 is set in bit 7 of Error completion type ((s1)[0]).

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 127
Program example
• The following program reads out data from the devices from D250 to D254 in the station number 4 (target station) and
stores the data to the devices from D700 to D704 of the station number 1 (host station).
[Structured ladder/FBD]

Sets error completion type

Sets channel used by host station

Sets target station's CPU type

Sets target station network number

Sets target station number

Sets monitoring time

Sets data length by the word

Sets number of resends

Performs readout

Process on completion of readout Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

5 MODULE DEDICATED INSTRUCTION


128 5.4 Network Dedicated Instruction
[ST]
IF(LDP(TRUE,Var_Flag_Inst))THEN
MOV(TRUE,H81,Var_ControlData[0]); (* Sets error completion type *)
MOV(TRUE,1,Var_ControlData[2]); (* Sets channel used by host station *)
MOV(TRUE,H0,Var_ControlData[3]); (* Sets target station's CPU type *)
MOV(TRUE,1,Var_ControlData[4]); (* Sets target station network number *)
MOV(TRUE,4,Var_ControlData[5]); (* Sets target station number *)
MOV(TRUE,0,Var_ControlData[6]);
MOV(TRUE,0,Var_ControlData[8]); (* Sets monitoring time *)
MOV(TRUE,5,Var_ControlData[9]); (* Sets data length by the word *)
MOV(TRUE,0,Var_ControlData[10]);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.3=FALSE)) THEN
MOV(TRUE, 5, Var_ControlData[7]); (* Sets number of resends *)
JP_READ(TRUE,1,Var_ControlData,D250,D700,Var_Result); (* Performs readout *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of readout *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *) 5
(* Process on normal completion *)
ELSE (* Error completion *)

(* Process on error completion *)


MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 129
J(P)_SREAD, G(P)_SREAD
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

J_SREAD G_SREAD

EN ENO EN ENO ENO:= J_SREAD (EN, Jn*, s1, s2, d1, d2, d3);
Jn* d1 Un* d1 ENO:= G_SREAD (EN, Un*, s1, s2, d1, d2, d3);

s1 d2 s1 d2

s2 d3 s2 d3

The following instruction can go in the dotted squares.


J_SREAD, JP_SREAD, G_SREAD, GP_SREAD

■Executing condition
Instruction Executing condition
J_SREAD
G_SREAD
JP_SREAD
GP_SREAD

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..17]
s2 Start number of the target station's device from ANY
which data are read
Output argument ENO Execution result Bit
d1 Start number of the host station's device that stores ANY16
read data
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.
d3 Variable that turns ON upon completion of the Bit
instruction
(read notification device)

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d1)   
(d2)   
(d3)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads data from a word device of another station.

5 MODULE DEDICATED INSTRUCTION


130 5.4 Network Dedicated Instruction
Setting data
For the control data of the SREAD instruction that reads the word device memory of another station, refer to READ
instruction.
The control data of the SREAD instruction are the same as those of the READ instruction.
Accordingly, this section omits the explanation.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 131
Program example
• The following program example of the SREAD instruction is different from that of the READ instruction by assigning the
read notification device (d3) at the end of arguments.
[Structured ladder/FBD]

Sets error
completion type

Sets channel used


by host station

Sets target
station's CPU type

Sets target station


network number

Sets target station


number

Sets monitoring
time

Sets data length


by the word

Sets number of
resends

Performs readout

Process on completion of readout Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

5 MODULE DEDICATED INSTRUCTION


132 5.4 Network Dedicated Instruction
[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H81,Var_ControlData[0]); (* Sets error completion type *)
MOV(TRUE,1,Var_ControlData[2]); (* Sets channel used by host station *)
MOV(TRUE,H0,Var_ControlData[3]); (* Sets target station's CPU type *)
MOV(TRUE,1,Var_ControlData[4]); (* Sets target station network number *)
MOV(TRUE,4,Var_ControlData[5]); (* Sets target station number*)
MOV(TRUE,0,Var_ControlData[6]);
MOV(TRUE,0,Var_ControlData[8]); (* Sets monitoring time *)
MOV(TRUE,5,Var_ControlData[9]); (* Sets data length by the word *)
MOV(TRUE,0,Var_ControlData[10]);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.3=FALSE)) THEN
MOV(TRUE, 5, Var_ControlData[7]); (* Sets number of resends *)
J_SREAD(TRUE,1,Var_ControlData,D250,D700,Var_Result,Var_Flag); (* Performs readout *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of readout *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *) 5
(* Process on normal completion *)
ELSE (* Error completion *)

(* Process on error completion *)


MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 133
J(P)_WRITE, G(P)_WRITE
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

J_WRITE G_WRITE

EN ENO EN ENO ENO:= J_WRITE (EN, Jn*, s1, s2, s3, d1);
Jn* d1 Un* d1
ENO:= G_WRITE (EN, Un*, s1, s2, s3, d1);
s1 s1
s2 s2
s3 s3

The following instruction can go in the dotted squares.


J_WRITE, JP_WRITE, G_WRITE, GP_WRITE

■Executing condition
Instruction Executing condition
J_WRITE
G_WRITE
JP_WRITE
GP_WRITE

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..17]
s2 Start number of the host station's device that stores ANY16
write data
s3 Start number of the target station's device to which ANY
data are written
Output argument ENO Execution result Bit
d1 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s1)   
(s2)   
(s3)   
(d1)   

Processing details
This instruction writes data to a word device of another station.

5 MODULE DEDICATED INSTRUCTION


134 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting
range side
(s1)[0] Execution/Error 0000H, User
b15 … b7 … b0
completion type 0001H,
0 (2) 0 (1) 0080H,
Execution type (bit 0) 0081H

■Ethernet
0: Without arrival confirmation
• When the target station is on the same network
Completed when data are sent from the host station.

Completed
Execution source Target station
• When the target station is on another network
Completed when data reach to a relay station on the same network.

Completed
5
Execution source Relay station Target station

1: With arrival confirmation


Completed when data are written to the target station.

Completed
Target station Execution source Relay station Target station
Completed

■MELSECNET/HCC-Link IE
0: Without arrival confirmation
• When the target station is on the same network
Completed when data are sent from the host station.

Request source Target station

Completed

• When the target station is on another network


Completed when data reach to a relay station on the same network.

Request source Relay station Target station


Completed

1: With arrival confirmation


Completed when data are written to the target station.

Completed
Request source Relay station Target station

Completed

Target station
When '0: Without arrival confirmation' is specified, even if writing to the target station is
completed abnormally in the following cases, the processing of the instruction in the
host station is completed normally.
• Communication itself was completed normally, although the sent data were
erroneous.
• Data could not be written to the target station because instructions from multiple
stations were executed to the same station. (An error code (F222H, E006H, E205H,
D202H, or D282H) is detected at the target station.)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 135
Device Item Setting data Setting Setting
range side
(s1)[0] Execution/Error Error completion type (bit 7) 0000H, User
completion type Specify the clock data setup status at the time of error completion. 0001H,
0: Clock data at the time of error completion is not set in the area starting from (s1)[11]. 0080H,
1: Clock data at the time of error completion is set in the area starting from (s1)[11]. 0081H
(s1)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Channel used by host Specify the channel used by the host station. 1 to 10 User
station Setting values are as follows.
• Ethernet, MELSECNET/H: 1 to 8
• CC-Link IE Controller Network: 1 to 10
• CC-Link IE Field Network: 1 to 2
(s1)[3] Target station's CPU Specify the type of the target station CPU. ■Ethernet User
type Setting values are as follows. 0000H,03F
■Ethernet FH
• 0000H: Target station CPU/host system CPU (Specified data are the same as ■MELSEC
'03FFH'.) NET/H, CC-
• 03FFH*1: Target station CPU/host system CPU Link IE
■MELSECNET/H CC-Link IE 0000H,
• 0000H: Target station CPU/host system CPU (Specified data are the same as 03E0H to
'03FFH'.) 03E3H,
• 03E0H*2: Multi-CPU No. 1/target station CPU (single CPU system) 03FFH
• 03E1H*2: Multi-CPU No. 2
• 03E2H*2: Multi-CPU No. 3
• 03E3H*2: Multi-CPU No. 4
• 03FFH*1: Target station CPU/host system CPU

(s1)[4] Target station network Specify the network number of the target station. 1 to 239, User
No. 1 to 239: Network number 254
254: Specify this when 254 has been set in Jn.
(s1)[5] Target station No. Specify the station number of the target station. 1 to 120 User
Setting values are as follows. 125 (7DH)
■Station number specification 81H to A0H
• MELSECNET/H: 1 to 64 FFH
• When the host station is Universal model QCPU in Ethernet or CC-Link IE Controller
Network: 1 to120
• When the host station is anything other than Universal model QCPU in Ethernet or
CC-Link IE Controller Network: 1 to 64
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to 120
To increase the data reliability when the station number is specified, executing the
instruction with setting Execution/Error completion type ((s1)[0]) to '1: With arrival
confirmation' is recommended.
■Group specification (target station is anything other than CC-Link IE Field Network)
81H to A0H: All stations in group numbers 1 to 32
(Setting is available when Execution type is set to '0: Without arrival confirmation' in
(s1)[0].)

Group No.1 81H


Group No.2 82H
to
Group No.32 A0 H
■All stations specification
FFH: All stations of the target network number (Except the host station.)
(Setting is available when Execution type is set to '0: Without arrival confirmation' in
(s1)[0].)
To specify a group or all stations.
• Specify '0000H' or '03FFH' for the target station's CPU type ((s1)[3]).
• Group specification cannot be set for the station of the CC-Link IE Field Network.
• It cannot be confirmed if the data are written to the target station normally. Confirm
the device of the target station of the write destination.
(s1)[6]  (Fixed value) 0 User

5 MODULE DEDICATED INSTRUCTION


136 5.4 Network Dedicated Instruction
Device Item Setting data Setting Setting
range side
(s1)[7] Number of resends • For instruction execution 0 to 15 User
Specify the number of instruction resends when the instruction is not completed within
the monitoring time specified in (s1)[8]. (Setting is available when Execution type is set
to '1: With arrival confirmation' in ((s1)[0].)
• At instruction completion  System
The number of resends (result) is stored. (Setting is available when Execution type is
set to '1: With arrival confirmation' in (s1)[0].)
(s1)[8] Arrival monitoring time Specify the monitoring time required for instruction completion. (Setting is available 0 to 32767 User
when Execution type is set to '1: With arrival confirmation' in ((s1)[0].)
If the instruction is not completed within this time, it is resent by the number of times
specified in (s1)[7].
Setting values are as follows.
■Ethernet
• 0 to 16383
• 0 to TCP retransmission timer value: Monitoring is performed by the TCP
retransmission timer value.
• (TCP retransmission timer value + 1) to 16383: Monitoring time (unit: second)
■MELSECNET/H 5
• 0 to 32767
• 0: 10 seconds
• 1 to 32767: 1 to 32767 seconds
(s1)[9] Write data length Specify the number of write data.  User
Setting values are as follows.
• Ethernet, MELSECNET/H, CC-Link IE Field Network: 1 to 960 (word)
• CC-Link IE Controller Network: 1 to 8192 (word)
(s1)[10] (Reserved)   
(s1)[11] Clock set flag*3 Valid/invalid status of the data in the area starting from (s1)[12] is stored.  System
0: Invalid
1: Valid
(s1)[12] Clock data at the time of Clock data at the time of error completion are stored in BCD format.  System
 error completion*3
b15 to b8 b7 to b0
(s1)[15]
s1 [12 ] Month (01H to 12H) Year (00H to 99H) Last two digits
s1 [13 ] Hour (00H to 23H) Day (01H to 31H)
s1 [14 ] Second (00H to 59H) Minute (00H to 59H)
s1 [15 ] Year (00H to 99H) First two digits Day of week (00H to 06H)
00H (Sun.) to 06H (Sat.)
(s1)[16] Error-detected network Network number of the station where an error was detected is stored. (However, when  System
No.*3 an error was detected at the host station, the network number is not stored.)
1 to 239: Network number
(s1)[17] Error-detected station Number of the station where an error was detected is stored. (However, when an error  System
No.*3 was detected at the host station, the network number is not stored.)
Stored values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE Controller Network: 1 to 120
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to 120

*1 Specification is possible when the host station is a network module or Ethernet module of function version D or later.
(Specification is not possible for other modules. An access is always made to the target station CPU.)
*2 Specification is possible when the versions of the QCPU and the network module on the host station and the target station are as
indicated below.
(Specification is not possible for other modules. An access is always made to the target station CPU.)
 Network module: The first five digits of the serial number are '06092' or higher.
 QCPU: The first five digits of the serial number are '06092' or higher.
*3 Data are stored only when 1 is set in bit 7 of Error completion type ((s1)[0]).

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 137
Program example
• The following program writes data which are stored in the devices from D750 to D753 of the station number 2 (host station)
to the devices from D300 to D303 of the station number 3 (target station).
[Structured ladder/FBD]

Sets execution/error completion type

Sets channel used by host station

Sets target station's CPU type

Sets target station network number

Sets target station number

Sets monitoring time

Sets data length by the word

Sets write data to D750 to D753

Sets number of resends

Performs writing

Process on completion of writing Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

5 MODULE DEDICATED INSTRUCTION


138 5.4 Network Dedicated Instruction
[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H81,Var_ControlData[0]); (* Sets execution/error completion type *)
MOV(TRUE,2,Var_ControlData[2]); (* Sets channel used by host station *)
MOV(TRUE,H0,Var_ControlData[3]); (* Sets target station's CPU type *)
MOV(TRUE,1,Var_ControlData[4]); (* Sets target station network number *)
MOV(TRUE,3,Var_ControlData[5]); (* Sets target station number *)
MOV(TRUE,0,Var_ControlData[6]);
MOV(TRUE,0,Var_ControlData[8]); (* Sets monitoring time *)
MOV(TRUE,4,Var_ControlData[9]); (* Sets data length by the word *)
MOV(TRUE,0,Var_ControlData[10]);
END_IF;
IF(LDP(TRUE,Var_Flag_Inst2)) THEN
MOV(TRUE,10,D750); (* Sets write data to D750 to D753 *)
MOV(TRUE,20,D751);
MOV(TRUE,30,D752);
MOV(TRUE,40,D753);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.2=FALSE)) THEN
MOV(TRUE, 5, Var_ControlData[7]); (* Sets number of resends *)
JP_WRITE(TRUE,1,Var_ControlData,D750,D300,Var_Result); (* Performs writing *) 5
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of writing *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 139
J(P)_SWRITE, G(P)_SWRITE
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

J_SWRITE G_SWRITE

EN ENO EN ENO ENO:= J_SWRITE (EN, Jn*, s1, s2, d1, d2, d3);
Jn* d2 Un* d2
ENO:= G_SWRITE (EN, Un*, s1, s2, d1, d2, d3);
s1 d3 s1 d3
s2 s2
d1 d1

The following instruction can go in the dotted squares.


J_SWRITE, JP_SWRITE, G_SWRITE, GP_SWRITE

■Executing condition
Instruction Executing condition
J_SWRITE
G_SWRITE
JP_SWRITE
GP_SWRITE

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..17]
s2 Start number of the host station's device that stores ANY16
send data
d1 Start number of the target station to which data are ANY
written
Output argument ENO Execution result Bit
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.
d3 Variable that turns ON upon completion of the Bit
instruction
(Write notification device)

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d1)   
(d2)   
(d3)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction writes data to a word device of another station.

5 MODULE DEDICATED INSTRUCTION


140 5.4 Network Dedicated Instruction
Setting data
For the control data of the SWRITE instruction that writes data to the word device memory of another station, refer to WRITE
instruction.
The control data of the SWRITE instruction are the same as those of the WRITE instruction.
Accordingly, this section omits the explanation.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 141
Program example
• The following program example of the SWRITE instruction is different from that of the WRITE instruction by assigning the
write notification device (d3) at the end of arguments.
[Structured ladder/FBD]
(1)Program on the request source (station number 2) of the SWRITE instruction

Sets execution/error completion type

Sets channel used by host station

Sets target station's CPU type

Sets target station network number

Sets target station number

Sets monitoring time

Sets data length by the word

Sets write data to D750 to D753

Sets number of resends

Performs writing

Process on completion of writing Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

(2)Program on the request target (station number 3) of the SWRITE instruction

Stores data of
devices from D300
to D303 to devices
from D500 to D503

5 MODULE DEDICATED INSTRUCTION


142 5.4 Network Dedicated Instruction
[ST]
(1)Program on the request source (station number 2) of the SWRITE instruction
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H81,Var_ControlData[0]); (* Sets execution/error completion type *)
MOV(TRUE,2,Var_ControlData[2]); (* Sets channel used by host station *)
MOV(TRUE,H0,Var_ControlData[3]); (* Sets target station's CPU type *)
MOV(TRUE,1,Var_ControlData[4]); (* Sets target station network number *)
MOV(TRUE,3,Var_ControlData[5]); (* Sets target station number *)
MOV(TRUE,0,Var_ControlData[6]);
MOV(TRUE,0,Var_ControlData[8]); (* Sets monitoring time *)
MOV(TRUE,4,Var_ControlData[9]); (* Sets data length by the word *)
MOV(TRUE,0,Var_ControlData[10]);
END_IF;
IF(LDP(TRUE,Var_Flag_Inst2)) THEN
MOV(TRUE,10,D750); (* Sets write data to D750 to D753 *)
MOV(TRUE,20,D751);
MOV(TRUE,30,D752);
MOV(TRUE,40,D753);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.2=FALSE)) THEN
MOV(TRUE, 5, Var_ControlData[7]); (* Sets number of resends *) 5
JP_SWRITE(TRUE,1,Var_ControlData,D750,D300,Var_Result,Var_Flag); (* Performs writing *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *

(* Process on completion of writing *)


IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
END_IF;
END_IF;

(2)Program on the request target (station number 3) of the SWRITE instruction


IF(Var_Flag=TRUE) THEN
BMOV(TRUE,D300,4,D500); (* Stores data of devices from D300 to D303 to devices from D500 to D503 *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 143
Message (user-specified data) communication

J(P)_SEND, G(P)_SEND
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

J_SEND G_SEND

EN ENO EN ENO ENO:= J_SEND (EN, Jn*, s1, s2, d);

Jn* d Un* d ENO:= G_SEND (EN, Un*, s1, s2, d);

s1 s1

s2 s2

The following instruction can go in the dotted squares.


J_SEND, JP_SEND, G_SEND, GP_SEND

■Executing condition
Instruction Executing condition
J_SEND
G_SEND
JP_SEND
GP_SEND

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..17]
s2 Start number of the host station's device that stores ANY16
write data
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends data to another station.

5 MODULE DEDICATED INSTRUCTION


144 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting side
range
(s1)[0] Execution/Error 0000H, 0001H, User
b15 … b7 … b0
completion type 0080H, 0081H
0 (2) 0 (1)

Execution type (bit 0)


■Ethernet
0: Without arrival confirmation
• When the target station is on the same network
Completed when data are sent from the host station.

Completed
Execution source Target station
• When the target station is on another network
Completed when data reach to a relay station on the same network.

Completed
5
Execution source Relay station Target station

1: With arrival confirmation


Completed when data are stored in the specified channel of the target station.

Completed
Target station Execution source Relay station Target station
Completed

■MELSECNET/H CC-Link IE
0: Without arrival confirmation
• When the target station is on the same network
Completed when data are sent from the host station.

Request source Target station

Completed

• When the target station is on another network


Completed when data reach to a relay station on the same network.

Request source Relay station Target station


Completed

1: With arrival confirmation


Completed when data are written to the target station.

Completed
Request source Relay station Target station

Completed

Target station
When '0: Without arrival confirmation' is specified, even if writing to the target station
is completed abnormally in the following cases, the processing of the instruction in
the host station is completed normally.
• Communication itself was completed normally, although the sent data were
erroneous.
• Data could not be written to the target station because instructions from multiple
stations were executed to the same station. (An error code (F222H, E006H,
E205H, D202H, or D282H) is detected at the target station.)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 145
Device Item Setting data Setting Setting side
range
(s1)[0] Execution/Error Error completion type (bit 7) 0000H, 0001H, User
completion type Specify the clock data setup status at the time of error completion. 0080H, 0081H
0: Clock data at the time of error completion is not set in the area starting from
(s1)[11].
1: Clock data at the time of error completion is set in the area starting from (s1)[11].
(s1)[1] Completion The instruction completion status is stored.  System
status 0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Channel used Specify the channel used by the host station. 1 to 8 User
by host station Setting values are as follows.
• Ethernet, MELSECNET/H, CC-Link IE Controller Network: 1 to 8
• CC-Link IE Field Network: 1 to 2
(s1)[3] Target station Specify the channel of the target station that stores data.*2*2 1 to 64 User
channel Setting values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE: 1 to 8
(s1)[4] Target station Specify the network number of the target station. 1 to 239, 254 User
network No. 1 to 239: Network number
254: Specify this when 254 has been set in Jn. (Network specified in 'Valid module
during other station access')
(s1)[5] Target station Specify the station number of the target station. 1 to 120, 125 User
No. Setting values are as follows. (7DH)
■Station number specification
• MELSECNET/H: 1 to 64
• When the host station is Universal model QCPU in Ethernet or CC-Link IE
Controller Network: 1 to120
• When the host station is anything other than Universal model QCPU in Ethernet or
CC-Link IE Controller Network: 1 to 64
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to 120
To increase the data reliability when the station number is specified, executing the
instruction with setting Execution/Error completion type ((s1)[0]) to '1: With arrival
confirmation' is recommended.
■Group specification (target station is anything other than CC-Link IE Field Network)
81H to A0H: All stations in group numbers 1 to 32
(Setting is available when Execution type is set to '0: Without arrival confirmation' in
(s1)[0].)

Group No.1 81H


Group No.2 82H
to
Group No.32 A0 H
■All stations specification
FFH: All stations of the target network number (Except the host station.)
(Setting is available when Execution type is set to '0: Without arrival confirmation' in
(s1)[0].)

To specify a group or all stations.


• Specify '0000H' or '03FFH' for the target station's CPU type ((s1)[3]).
• Group specification cannot be set for the station of the CC-Link IE Field Network.
• It cannot be confirmed if the data are written to the target station normally. Confirm
the device of the target station of the write destination.
(s1)[6]  (Fixed value) 0 User
(s1)[7] Number of • For instruction execution 0 to 15 User
resends Specify the number of instruction resends when the instruction is not completed within
the monitoring time specified in (s1)[8]. (Setting is available when Execution type is
set to '1: With arrival confirmation' in ((s1)[0].)
• At instruction completion  System
The number of resends (result) is stored. (Setting is available when Execution type is
set to '1: With arrival confirmation' in (s1)[0].)

5 MODULE DEDICATED INSTRUCTION


146 5.4 Network Dedicated Instruction
Device Item Setting data Setting Setting side
range
(s1)[8] Arrival Specify the monitoring time required for instruction completion. (Setting is available 0 to 32767 User
monitoring time when Execution type is set to '1: With arrival confirmation' in ((s1)[0].)
If the instruction is not completed within this time, it is resent by the number of times
specified in (s1)[7].
Setting values are as follows.
■Ethernet
• 0 to 16383
• 0 to TCP retransmission timer value: Monitoring is performed by the TCP
retransmission timer value.
• (TCP retransmission timer value + 1) to 16383: Monitoring time (unit: second)
■MELSECNET/H CC-Link IE
• 0 to 32767
• 0: 10 seconds
• 1 to 32767: 1 to 32767 seconds
(s1)[9] Send data Specify the number of send data. 1 to 960 User
length
(s1)[10] (Reserved)   
(s1)[11] Clock set flag*1 Valid/invalid status of the data in the area starting from (s1)[12] is stored.  System
5
0: Invalid
1: Valid
(s1)[12] Clock data at Clock data at the time of error completion are stored in BCD format.  System
 the time of error
b15 to b8 b7 to b0
(s1)[15] completion*1
s1 [12 ] Month (01H to 12H) Year (00H to 99H) Last two digits
s1 [13 ] Hour (00H to 23H) Day (01H to 31H)
s1 [14 ] Second (00H to 59H) Minute (00H to 59H)
s1 [15 ] Year (00H to 99H) First two digits Day of week (00H to 06H)
00H (Sun.) to 06H (Sat.)
(s1)[16] Error-detected Network number of the station where an error was detected is stored. (However,  System
network No.*1 when an error was detected at the host station, the network number is not stored.)
1 to 239: Network number
(s1)[17] Error-detected Number of the station where an error was detected is stored. (However, when an  System
station No.*1 error was detected at the host station, the network number is not stored.)
Stored values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE Controller Network: 1 to 120
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to 120

*1 Data are stored only when 1 is set in bit 7 of Error completion type ((s1)[0]).
*2 Logical channel setting is not available for the CC-Link IE network module.

Program example
The following program sends data of the devices from D750 to D753 of the station number 1 (host station) to the channel 5 of
the station number 2 (target station).
For the method for reading the data, which are sent by the SEND instruction, from the channel 5 of the station number 2
(target station), refer to the following sections.
• For reading out data in a main program
Page 150 J(P)_RECV, G(P)_RECV
• For reading out data in an interrupt program
Page 154 Z_RECVS

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 147
[Structured ladder/FBD]

Sets execution/error completion type

Sets channel used by host station

Sets target station channel

Sets target station network number

Sets target station number

Sets monitoring time

Sets data length by the word

Sets send data to D750 to D753

Sets number of resends

Sends data

Process on completion of sending Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

5 MODULE DEDICATED INSTRUCTION


148 5.4 Network Dedicated Instruction
[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H81,Var_ControlData[0]); (* Sets execution/error completion type *)
MOV(TRUE,3,Var_ControlData[2]); (* Sets channel used by host station *)
MOV(TRUE,H5,Var_ControlData[3]); (* Sets target station channel *)
MOV(TRUE,1,Var_ControlData[4]); (* Sets target station network number *)
MOV(TRUE,2,Var_ControlData[5]); (* Sets target station number *)
MOV(TRUE,0,Var_ControlData[6]);
MOV(TRUE,0,Var_ControlData[8]); (* Sets monitoring time *)
MOV(TRUE,4,Var_ControlData[9]); (* Sets data length by the word *)
MOV(TRUE,0,Var_ControlData[10]);
END_IF;
IF (Var_Flag_Inst2=TRUE)THEN
MOV(TRUE,10,D750); (*Sets send data to D750 to D753 *)
MOV(TRUE,20,D751);
MOV(TRUE,30,D752);
MOV(TRUE,40,D753);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.1=FALSE)) THEN
MOV(TRUE, 5, Var_ControlData[7]); (* Sets number of resends *)
JP_SEND(TRUE,1,Var_ControlData,D750,Var_Result); (* Sends data *) 5
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of sending *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 149
J(P)_RECV, G(P)_RECV
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

J_RECV G_RECV

EN ENO EN ENO ENO:= J_RECV (EN, Jn*, s, d1, d2);


Jn* d1 Un* d1 ENO:= G_RECV (EN, Un*, s, d1, d2);
s d2 s d2

The following instruction can go in the dotted squares.


J_RECV, JP_RECV, G_RECV, GP_RECV

■Executing condition
Instruction Executing condition
J_RECV
G_RECV
JP_RECV
GP_RECV

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..17]
Output argument ENO Execution result Bit
d1 Start number of the host station's device that stores ANY16
read data
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads received data (for main program).

5 MODULE DEDICATED INSTRUCTION


150 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting side
range
(s)[0] Execution/error 0000H, 0080H User
b15 … b7 … b0
completion type
0 (1) 0

Error completion type (bit 7)


Specify the clock data setup status at the time of error completion.
0: Clock data at the time of error completion is not set in the area starting from (s)[11].
1: Clock data at the time of error completion is set in the area starting from (s)[11].
(s)[1] Completion The instruction completion status is stored.  System
status 0: Normal completion
Other than 0: Error completion (error code)
(s)[2] Host station Specify the channel of host station that stores receive data. 1 to 8 User
channel Setting values are as follows.
• Ethernet, MELSECNET/H, CC-Link IE Controller Network: 1 to 8

(s)[3] Channel used


• CC-Link IE Field Network: 1 to 2
Channel used by the sending station is stored.  System
5
by sending 1 to 8: Channel
station
(s)[4] Network No. of Network number of the sending station is stored.  System
sending station 1 to 239: Network number
(s)[5] Sending station Station number of the sending station is stored.  System
No. Stored values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE Controller Network: 1 to 120
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to 120
(s)[6] (Reserved)   
(s)[7] (Reserved)   
(s)[8] Arrival Specify the monitoring time required for the instruction completion. When the 0 to 32767 User
monitoring time instruction is not completed within the monitoring time, it completes abnormally.
Setting values are as follows.
■Ethernet
• 0 to 16383
• 0 to TCP retransmission timer value: Monitoring is performed by the TCP
retransmission timer value.
• (TCP retransmission timer value + 1) to 16383: Monitoring time (unit: second)
■CC-Link IE MELSECNET/H
• 0 to 32767
• 0: 10 seconds
• 1 to 32767: 1 to 32767 seconds
(s)[9] Receive data The number of received data stored in (d1) to (d1)+n is stored.  System
length 0: No receive data
1 to 960: Number of words of receive data
(s)[10] (Reserved)   
(s)[11] Clock set flag*1 Valid/invalid status of the data in the area starting from (s)[12] is stored.  System
0: Invalid
1: Valid
(s)[12] Clock data at Clock data at the time of error completion are stored in BCD format.  System
 the time of error
b15 to b8 b7 to b0
(s)[15] completion*1
s [12 ] Month (01H to 12H) Year (00H to 99H) Last two digits
s [13 ] Hour (00H to 23H) Day (01H to 31H)
s [14 ] Second (00H to 59H) Minute (00H to 59H)
s [15 ] Year (00H to 99H) First two digits Day of week (00H to 06H)
00H (Sun.) to 06H (Sat.)
(s)[16] Error-detected Network number of the station where an error was detected is stored. (However,  System
network No.*1 when an error was detected at the host station, the network number is not stored.)
1 to 239: Network number

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 151
Device Item Setting data Setting Setting side
range
(s)[17] Error-detected Number of the station where an error was detected is stored. (However, when an  System
station No.*1 error was detected at the host station, the network number is not stored.)
Stored values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE Controller Network: 1 to 120
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to 120

*1 Data are stored only when 1 is set in bit 7 of Error completion type ((s)[0]).

Program example
The following program reads out data, which is sent from the station number 1 by the SEND instruction, from the channel 5 of
the station number 2 (host station) and stores the data to the devices from D770 to D773 of the station number 2 (host station)
when SB0034 turns ON.
For the SEND instruction, refer to the following section.
Message (user-specified data) communication

5 MODULE DEDICATED INSTRUCTION


152 5.4 Network Dedicated Instruction
[Structured ladder/FBD]

Sets error
completion type

Sets host station


channel

Sets arrival
monitoring time

5
Performs readout

Process on completion of readout Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

[ST]
IF(SM400=TRUE)THEN
MOV(TRUE,H80,Var_ControlData[0]); (* Sets error completion type *)
MOV(TRUE,5,Var_ControlData[2]); (* Sets host station channel *)
MOV(TRUE,0,Var_ControlData[6]);
MOV(TRUE,0,Var_ControlData[7]);
MOV(TRUE,0,Var_ControlData[8]); (* Sets arrival monitoring time *)
MOV(TRUE,0,Var_ControlData[10]);
END_IF;
IF((SB34=TRUE) AND (SB47=FALSE)) THEN
JP_RECV(TRUE,1,Var_ControlData,D770,Var_Result); (* Performs readout *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of readout *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 153
Z_RECVS
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

Z_RECVS

EN ENO
ENO:= Z_RECVS (EN, Un*, s1, s2, d);
Jn* d

s1

s2

The following instruction can go in the dotted squares.


Z_RECVS

■Executing condition
Instruction Executing condition
Z_RECVS

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..17]
s2 Start number of the host station's device that stores ANY16
read data
Output argument ENO Execution result Bit
d Dummy Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads received data (for interrupt program).

5 MODULE DEDICATED INSTRUCTION


154 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting side
range
(s1)[0] Completion type 0 (Fixed) 0 User
(s1)[1] Completion The instruction completion status is stored.  System
status 0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Host station Specify the channel of host station that stores receive data. 1 to 8 User
channel Setting values are as follows.
• Ethernet, MELSECNET/H, CC-Link IE Controller Network: 1 to 8
• CC-Link IE Field Network: 1 to 2
(s1)[3] Channel used Channel used by the sending station is stored.  System
by sending 1 to 8: Channel
station
(s1)[4] Network No. of Network number of the sending station is stored.  System
sending station 1 to 239: Network number
(s1)[5] Sending station Station number of the sending station is stored.  System 5
No. Stored values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE Controller Network: 1 to 120
• Master station in CC-Link IE Field Network: 125 (7DH)
• Slave station in CC-Link IE Field Network: 1 to 120
(s1)[6] System area   
(s1)[7]
(s1)[8]
(s1)[9] Receive data The number of received data stored in (s2) to (s2)+n is stored.  System
length 0: No receive data
1 to 960: Number of words of receive data
(s1)[10] System area   

(s1)[17]

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 155
Program example
The following program reads data, which is sent from the station number 1 by the SEND instruction, from the channel 5 of the
station number 2 (host station) and stores the data to the devices from D770 to D773 of the station number 2 (host station)
when an interruption program starts up.
For the SEND instruction, refer to the following section.
Page 144 Message (user-specified data) communication
[Structured ladder/FBD]

Sets execution/error
completion type

Sets host station


channel

Performs readout

Process on completion of readout

[ST]
IF(SM400=TRUE)THEN
MOV(TRUE,H0,Var_ControlData[0]); (* Sets execution/error completion type *)
MOV(TRUE,5,Var_ControlData[2]); (* Sets host station channel *)
Z_RECVS(TRUE,"00",Var_ControlData,D770,Var_Dummy); (* Performs readout *)

(* Process on completion of readout *)


END_IF;

5 MODULE DEDICATED INSTRUCTION


156 5.4 Network Dedicated Instruction
Transient request to another station

J(P)_REQ, G(P)_REQ
CC IE C CC IE F NET/H Ether

Structured ladder/FBD ST

J_REQ G_REQ

EN ENO EN ENO ENO:= J_REQ (EN, Jn*, s1, s2, d1, d2);
Jn* d1 Un* d1 ENO:= G_REQ (EN, Un*, s1, s2, d1, d2);

s1 d2 s1 d2

s2 s2

The following instruction can go in the dotted squares. 5


J_REQ, JP_REQ, G_REQ, GP_REQ

■Executing condition
Instruction Executing condition
J_REQ
G_REQ
JP_REQ
GP_REQ

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239, 254) ANY16
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..17]
s2 Variable that stores request data Array of ANY16 [0..5]
Output argument ENO Execution result Bit
d1 Variable that stores response data Array of ANY16 [0..5]
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
Remotely runs or stops a programmable controller on another station.
Also, reads/writes clock data from/to a programmable controller on another station.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 157
Setting data
Device Item Setting data Setting Setting side
range
(s1)[0] Error completion 0011H, 0091H User
b15 … b7 … b4 … b0
type
0 (1) 0 1 0 1

Error completion type (bit 7)


Specify the clock data setup status at the time of error completion.
0: Clock data at the time of error completion is not set in the area starting from
(s1)[11].
1: Clock data at the time of error completion is set in the area starting from (s1)[11].
(s1)[1] Completion The instruction completion status is stored.  System
status 0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Channel used Specify the channel used by the host station. 1 to 8 User
by host station 1 to 8: Channel
(s1)[3] Target station's Specify the type of the target station CPU. ■Ethernet User
CPU type Setting values are as follows. 0000H,03FFH
■Ethernet ■MELSECNE
• 0000H: Target station CPU/host system CPU (Specified data are the same as T/H, CC-Link
'03FFH'.) IE
• 03FFH*1: Target station CPU/host system CPU 0000H, 03E0H
■MELSECNET/H CC-Link IE to 03E3H,
• 0000H: Target station CPU/host system CPU (Specified data are the same as 03FFH
'03FFH'.)
• 03E0H*2: Multi-CPU No. 1/target station CPU (single CPU system)
• 03E1H*2: Multi-CPU No. 2
• 03E2H*2: Multi-CPU No. 3
• 03E3H*2: Multi-CPU No. 4
• 03FFH*1: Target station CPU/host system CPU

(s1)[4] Target station Specify the network number of the target station. 1 to 239, 254 User
network No. 1 to 239: Network number
254: Specify this when 254 has been set in Jn. (Network specified in 'Valid module
during other station access')
(s1)[5] Target station Specify the station number of the target station. 1 to 120, 125 User
No. Setting values are as follows. (7DH), 81H to
■Station number specification A0H, FFH
• MELSECNET/H: 1 to 64
• When the host station is Universal model QCPU in Ethernet or CC-Link IE
Controller Network: 1 to120
• When the host station is anything other than Universal model QCPU in Ethernet or
CC-Link IE Controller Network: 1 to 64
• Master station in CC-Link IE Field Network: 125 (7DH)
• Local station or the intelligent device station in CC-Link IE Field Network: 1 to 120
■Group specification (target station is anything other than CC-Link IE Field Network)
81H to A0H: All stations in group numbers 1 to 32 (Available only at clock data writing
and remote RUN/STOP)

Group No.1 81H


Group No.2 82H
to
Group No.32 A0 H
■All stations specification
FFH: All stations of the target network number (Except the host station.) (Available
only at clock data writing and remote RUN/STOP)
To specify a group or all stations.
• Specify '0000H' or '03FFH' for the target station's CPU type ((s1)[3]).
• Group specification cannot be set for the station of the CC-Link IE Field Network.
• It cannot be confirmed if the data are written to the target station normally. Confirm
the device of the target station of the write destination.
(s1)[6]  (Fixed value) 0 User
(s1)[7] Number of • For instruction execution 0 to 15 User
resends Specify the number of resends when the instruction is not completed within the
monitoring time specified in (s1)[8].
• At instruction completion 0 to 15 System
The number of resends (result) is stored

5 MODULE DEDICATED INSTRUCTION


158 5.4 Network Dedicated Instruction
Device Item Setting data Setting Setting side
range
(s1)[8] Arrival Specify the monitoring time required for the instruction completion. 0 to 32767 User
monitoring time If the instruction is not completed within this time, it is resent by the number of times
specified in (s1)[7].
Setting values are as follows.
■Ethernet
• 0 to 16383
• 0 to TCP retransmission timer value: Monitoring is performed by the TCP
retransmission timer value.
• (TCP retransmission timer value + 1) to 16383: Monitoring time (unit: second)
■MELSECNET/H CC-Link IE
• 0 to 32767
• 0: 10 seconds
• 1 to 32767: 1 to 32767 seconds
(s1)[9] Request data Specify the number of request data (words). 2 to 4, 6 User
length (Number of words of data stored in the request data storage device (s2))
4: Remote RUN
3: Remote STOP
2: Clock data read
6: Clock data write
5
(s1)[10] Response data Number of response data (words) are stored.  System
length (Number of words of the data stored in response data storage device)
2: Remote RUN/STOP
6: Clock data read
2: Clock data write
(s1)[11] Clock set flag*3 Valid/invalid status of the data in the area starting from (s1)[12] is stored.  System
0: Invalid
1: Valid
(s1)[12] Clock data on Clock data at the time of error completion are stored in BCD format.  System
 error
b15 to b8 b7 to b0
(s1)[15] completion*3
s1 [12 ] Month (01H to 12H) Year (00H to 99H) Last two digits
s1 [13 ] Hour (00H to 23H) Day (01H to 31H)
s1 [14 ] Second (00H to 59H) Minute (00H to 59H)
s1 [15 ] Year (00H to 99H) First two digits Day of week (00H to 06H)
00H (Sun.) to 06H (Sat.)
(s1)[16] Error-detected Network number of the station where an error was detected is stored. (However,  System
network No.*3 when an error was detected at the host station, the network number is not stored.)
1 to 239: Network number
(s1)[17] Error-detected Number of the station where an error was detected is stored. (However, when an  System
station No.*3 error was detected at the host station, the network number is not stored.)
Stored values are as follows.
• MELSECNET/H: 1 to 64
• Ethernet, CC-Link IE Controller Network: 1 to 120
• Master station in CC-Link IE Field Network: 125 (7DH)
• Slave station in CC-Link IE Field Network: 1 to 120

*1 Specification is possible when the host station is a network module or Ethernet module of function version D or later.
(Specification is not possible for other modules. An access is always made to the target station CPU.)
*2 Specification is possible when the versions of the QCPU and the network module on the host station and the target station are as
indicated below.
(Specification is not possible for other modules. An access is always made to the target station CPU.)
 Network module: The first five digits of the serial number are '06092' or higher.
 QCPU: The first five digits of the serial number are '06092' or higher.
*3 This becomes valid only when 1 is set in bit 7 of Error completion type ((s1)[0]).

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 159
■Remote RUN/STOP
• Request data (all set by the user)
Device Item Description Remote Remote
RUN STOP
(s2)[0] Request type 0010H: When station number is specified in (s1)[5]  
0030H: When all stations a group is specified in (s1)[5]
(s2)[1] Sub-request 0001H: Remote RUN  
type 0002H: Remote STOP
(s2)[2] Operation mode Specify whether to forcibly execute remote RUN/STOP. The forced execution is a  
function that forces a station which has stopped by remote STOP to RUN remotely
from another station.
• For remote RUN
0001H: No forced execution
0003H: Forced execution (This setting can be specified for remote RUN.)
• For remote STOP
0003H: (Fixed)
(s2)[3] Clear mode Specify the status of device memory in the CPU module only for remote RUN.  
0000H: Not cleared (Note that the local devices are cleared.)
0001H: Cleared (excluding the latch range and settings in remote RUN)
0002H: Cleared (including the latch range and settings in remote RUN)

Clear mode ((s2)[3]) allows specification to clear (initialize) the devices in the CPU
module at the start of CPU module operation activated by remote RUN.
After performing the specified clear processing, CPU module runs according to the
setting that specified by Device Initial Value in GX Works2.

• Response data*1 (all set by the system)


Device Item Description Remote Remote
RUN STOP
(d1)[0] Request type 0090H: When station number is specified in (s1)[5]  
00B0H: When all stations or a group is specified in (s1)[5]
(d1)[1] Sub-request 0001H: Remote RUN  
type 0002H: Remote STOP

*1 When "all stations or a group (81H to A0H, FFH)" is specified in (s1)[5], no response data will be stored.

5 MODULE DEDICATED INSTRUCTION


160 5.4 Network Dedicated Instruction
■Reading/writing the clock data
• Request data (all set by the user)
Device Item Description Read clock Write clock
data data
(s2)[0] Request type 0001H: Clock data read  
0011H: Clock data write (When station number is specified in (s1)[5])
0031H: Clock data write (When all stations or a group is specified in (s1)[5])
(s2)[1] Sub-request 0002H: Clock data read  
type 0001H: Clock data write
(s2)[2] Change pattern, Change pattern (bit 7 to bit 0)  
Clock data to be Specify the items to be written in high-order byte of (s2)[2] to (s2)[5].
changed 0: Not changed
1: Changed
Year to be changed (bit 15 to bit 8)*1
Store the year (last two digits) in BCD format.

b15 b8 b7 b6 b5 b4 b3 b2 b1 b0
Year (00H to 99H) 0

Year (last two digits) 5


Month
Day
Hour
Minute
Second
Day of week

(s2)[3] Clock data to be High-order 8 bits: Day (01H to 31H), low-order 8 bits: Month (01H to 12H)  
changed
b15 to b8 b7 to b0
(continued)
Day (01H to 31H) Month (01H to 12H)

(s2)[4] High-order 8 bits: Minute (00H to 59H), low-order 8 bits: Hour (00H to 23H)  

b15 to b8 b7 to b0
Minute (00H to 59H) Hour (00H to 23H)

(s2)[5] High-order 8 bits: Day of week (00H (Sunday) to 06H (Saturday)), low-order 8 bits:  
Second (00H to 59H)

b15 to b8 b7 to b0
Day of week (00H to 06H) Second (00H to 59H)

00H (Sun.) to 06H (Sat.)

*1 This function cannot change the first two digits of year data.
To change the year data including the first two digits, set the clock data using another function (such as GX Works2).

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 161
• Response data (all set by the system)
Device Item Description Read clock Write clock
data data
(d1)[0] Request type 0081H: Clock data read  
0091H: Clock data write (When station number is specified in (s1)[5])
00B1H: Clock data write (When all stations or a group is specified in (s1)[5])*2
(d1)[1] Sub-request 0002H: Clock data read  
type 0001H: Clock data write
(d1)[2] Read clock data High-order 8 bits: Month (01H to 12H), low-order 8 bits: Year (00H to 99H)*3  

b15 to b8 b7 to b0
Month (01H to 12H) Year (00 H to 99H)

(d1)[3] High-order 8 bits: Hour (00H to 23H), low-order 8 bits: Day (01H to 31H)  

b15 to b8 b7 to b0
Hour (00H to 23H) Day (01H to 31H)

(d1)[4] High-order 8 bits: Second (00H to 59H), low-order 8 bits (00H to 59H)  

b15 to b8 b7 to b0
Second (00H to 59H) Minute (00H to 59H)

(d1)[5] High-order 8 bits: (00H), low-order 8 bits: Day of week (00H (Sunday) to 06H  
(Saturday))

b15 to b8 b7 to b0
00H Day of week (00H to 06H)

00H (Sun.) to 06H (Sat.)

*2 When "all stations or a group (81H to A0H, FFH)" is specified in (s1)[5], no response data will be stored.
*3 Last two digits of year data

5 MODULE DEDICATED INSTRUCTION


162 5.4 Network Dedicated Instruction
Program example
• The following program performs remote STOP to the QCPU, which is the station number 2 (target station).
[Structured ladder/FBD]

Sets execution/error completion type

Sets channel used by host station

Sets target station's CPU type

Sets target station network number

Sets target station number


5

Sets monitoring time

Sets data length by the word

Sets request data

Sets number of resends

Performs transient request to another station

Process on completion Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 163
[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H91,Var_ControlData[0]); (* Sets execution/error completion type *)
MOV(TRUE,3,Var_ControlData[2]); (* Sets channel used by host station *)
MOV(TRUE,H0,Var_ControlData[3]); (* Sets target station's CPU type *)
MOV(TRUE,1,Var_ControlData[4]); (* Sets target station network number *)
MOV(TRUE,2,Var_ControlData[5]); (* Sets target station number *)
MOV(TRUE,0,Var_ControlData[6]);
MOV(TRUE,0,Var_ControlData[8]); (* Sets monitoring time *)
MOV(TRUE,3,Var_ControlData[9]); (* Sets data length by the word *)
MOV(TRUE,H10,Var_DemandData[0]); (* Sets request data *)
MOV(TRUE,H2,Var_DemandData[1]);
MOV(TRUE,H3,Var_DemandData[2]);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.1=FALSE)) THEN
MOV(TRUE, 5, Var_ControlData[7]); (* Sets number of resends *)
JP_REQ(TRUE,1,Var_ControlData,Var_DemandData,Var_ResponseData,Var_Result); (* Performs transient request to another station *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


164 5.4 Network Dedicated Instruction
Read from other station devices

J(P)_ZNRD
CC IE C NET/H Ether

Structured ladder/FBD ST
J_ZNRD

EN ENO
ENO:= J_ZNRD (EN, Jn*, n1, s, n2, d1, d2);
Jn* d1

n1 d2

n2

The following instruction can go in the dotted squares.


5
J_ZNRD, JP_ZNRD

■Executing condition
Instruction Executing condition
J_ZNRD

JP_ZNRD

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition ANY16
Jn* Network number of the host station (1 to 239) ANY16
n1 Target station number (1 to 64) ANY16
s Target station's start device number where data to ANY16
be read are stored
n2 Read data length ANY16
When the target station is Q/QnA/AnUCPU: 1 to
230 words
When the target station is anything other than Q/
QnA/AnUCPU: 1 to 32 words
Output argument ENO Execution result Bit
d1 The host station's start device number where ANY16
readout data will be stored
A contiguous area for the read data length is
required.)
d2 The host station's device that is turned on for one Array of bit [0..1]
scan upon completion of the instruction
d2[1] also turns ON if the instruction execution has
failed.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1*2 Bit Word Bit Word K, H

n1    
(s)      
n2    
(d1)     
(d2)    

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 165
*1 Local devices and file registers per program cannot be used as setting data.
*2 In addition to the setting data, the ZNRD instruction is executed using the following fixed values.
Channel used by host station: Channel 1
Arrival monitoring time (monitoring time until instruction completion): 10 seconds
Number of resends for arrival monitoring timeout: 5 times

Processing details
This instruction reads data from devices of a programmable controller CPU on another station. (In units of words)

• Specify devices of the target station's CPU within the range allowed for the host station CPU when reading
data from the devices with the ZNRD instruction.
(Target station's start device number (s1) where data to be read are stored) + (Read points - 1)  (End device
No. of host station's CPU*3)
• Specify the host station's start device number (d1) within the range allowed for storing read data.
(Example) When D150 and after the area in the host station's CPU has been already used

Good example (D50 is specified in ( ).) Bad example (D100 is specified in ( ).)

Host station CPU Other station CPU Host station CPU Other station CPU
D0 D0

D50 100 words 100 words


D99 D99
D100
D149
D150 D150
D199

: Data to be read with ZNRD instruction

: Area already used by host station CPU

: Duplicated area

*3 End device No. of the device in the host station CPU, and whose device name is same as in (s1)

5 MODULE DEDICATED INSTRUCTION


166 5.4 Network Dedicated Instruction
Program example
• n this program example, when M101 turns ON, data in D250 to D254 of station No.4 (target station) are read out to D700 to
D704 of station No.1 (host station).
[Structured ladder/FBD]

Performs readout

Process on completion of readout

Process on normal completion

Process on error completion 5


Stores error code

[ST]
IF((M101=TRUE) &(SB47=FALSE) & (SW0A0.3=FALSE)) THEN
JP_ZNRD(TRUE,1,4,D250,5,D700, Var_Result); (* Performs ZNRD instruction*)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of readout *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

IF(SM400=TRUE)THEN
MOV(TRUE,SW30,Var_ErrorCode); (* Stores error code *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 167
Write to other station devices

J(P)_ZNWR
CC IE C NET/H Ether

Structured ladder/FBD ST
J_ZNWR

EN ENO
ENO:= J_ZNWR (EN, Jn*, n1, s, n2, d1, d2);
Jn* d1

n1 d2

n2

The following instruction can go in the dotted squares.


J_ZNWR, JP_ZNWR

■Executing condition
Instruction Executing condition
J_ZNWR

JP_ZNWR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239) ANY16
n1 Target station number ANY16
(1) Station No. specification
1 to 64: Station number
(2) Group specification
81H to A0H: All stations of a group (No.1 to 32)
(3) All stations
FFH: All stations of the target network number
(Except the host station)
s Host station's start device number where data to be ANY16
written are stored
n2 Write data length ANY16
When the target station is Q/QnA/AnUCPU: 1 to
230 words
When the target station is anything other than Q/
QnA/AnUCPU: 1 to 32 words
Output argument ENO Execution result Bit
d1 Target station's start device number where data is ANY16
written
(A contiguous area for the write data length is
required.)
d2 The host station's device that is turned on for one Array of bit [0..1]
scan upon completion of the instruction
d2[1] also turns ON if the instruction execution has
failed.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1*2 Bit Word Bit Word K, H

n1    
(s)      
n2    

5 MODULE DEDICATED INSTRUCTION


168 5.4 Network Dedicated Instruction
Setting Internal device R, ZR J\ U\G Zn Constant Others
data*1*2 Bit Word Bit Word K, H

(d1)     
(d2)    

*1 Local devices and file registers per program cannot be used as a device which is used in setting data.
*2 In addition to the setting data, the ZNWR instruction is executed using the following fixed values.
Channel used by host station: Channel 2
Arrival monitoring time (monitoring time until instruction completion): 10 seconds
Number of resends for arrival monitoring timeout: 5 times

Processing details
This instruction writes data to devices of a programmable controller CPU on another station. (In units of words)

• Specify devices of the target station's CPU within the range allowed for the host station CPU when writing
data to the devices with the ZNWR instruction.
(Target station's start device number (d1) where data are written) + (Write points - 1)  (End device No. of host 5
*3)
station's CPU
• Specify the host station's start device number (d1) within the range allowed for storing write data. (Example)
When D150 and after the area in the host station's CPU has been already used

Good example (D50 is specified in ( ).) Bad example (D100 is specified in ( ).)

Host station CPU Other station CPU Host station CPU Other station CPU
D0 D0
100 words D50 100 words
D99 D99
D100
D149
D150 D150
D199

: Data to be written with ZNWR instruction

: Area already used by target station's CPU

: Duplicated area

*3 End device No. of the device in the host station CPU, and whose device name is same as in (d1)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 169
Program example
• In this program example, when M112 turns ON, data in D750 to D753 of station No.2 (host station) are written to D300 to
D303 of station No.3 (target station).
[Structured ladder/FBD]

Stores data to be
written to D750
to D753

Performs writing

Process on completion of writing

Process on normal completion

Process on error completion

Stores error code

[ST]
IF(M111=TRUE)THEN (* Instruction flag ON *)
MOV( TRUE, 10, D750);
MOV( TRUE, 20, D751);
MOV( TRUE, 30, D752 );
MOV( TRUE, 40, D753 ); (* Stores data to be written to D750 to D753 *)
END_IF;

IF((M112=TRUE) &(SB47=FALSE) & (SW0A0.2=FALSE)) THEN


JP_ZNWR(TRUE,1,3,D300,4, D750, Var_Result); (* Performs writing *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Completion of writing *)

(* Process on completion of writing *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

IF(SM400=TRUE)THEN
MOV(TRUE,SW31,Var_ErrorCode); (* Stores error code *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


170 5.4 Network Dedicated Instruction
RRUN instruction

Z(P)_RRUN_J, Z(P)_RRUN_U
CC IE C NET/H

Structured ladder/FBD ST
Z_RRUN_J Z_RRUN_U

EN ENO EN ENO

Jn* d Un* d ENO:= Z_RRUN_J (EN, Jn*, s1, s2, s3, s4, d);
s1 s1 ENO:= Z_RRUN_U (EN, Un*, s1, s2, s3, s4, d);
s2 s2

s3 s3

s4 s4

5
The following instruction can go in the dotted squares.
Z_RRUN_J, ZP_RRUN_J, Z_RRUN_U, ZP_RRUN_U

■Executing condition
Instruction Executing condition
Z_RRUN_J
Z_RRUN_U
ZP_RRUN_J
ZP_RRUN_U

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 171
■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the target station (1 to 239, 254) String
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the host station network No. String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Channel used by host station ANY16
For the RRUN instruction, specify the channel used
by host station that is the same as the one used for
the RSTOP instruction.
s2 Target station number ANY16
(1) Station number specification
Host station is Universal model QCPU: 1 to 120
Host station is anything other than Universal model
QCPU: 1 to 64
(2) Group specification
81H to A0H: All stations of a group (No.1 to 32)
(3) All stations
FFH: All stations of the target network No. (Except
the host station)
To specify a group or all stations, specify '0000H' or
'03FFH' for the target station's CPU type (s3).
s3 Target station's CPU type ANY16
0000H: Target station CPU/control CPU/host
system CPU (Specified data are the same as
'03FFH'.)
03E0H: Multi-CPU No. 1/target station CPU (single
CPU system)
03E1H: Multi-CPU No. 2
03E2H: Multi-CPU No. 3
03E3H: Multi-CPU No. 4
03FFH: Target station CPU/control CPU/host
system CPU
s4 Mode ANY16
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(s3)     
(s4)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction remotely switches a CPU module on another station to RUN.

Precautions
This instruction is applicable to the QJ71LP21 or QJ71BR11 with the function version B or later.

5 MODULE DEDICATED INSTRUCTION


172 5.4 Network Dedicated Instruction
Program example
• The following program remotely switches the QCPU on the station number 2 (target station) to RUN.
[Structured ladder/FBD]

Performs
remote RUN

Process on completion Execution finished

Process on normal completion Normal completion

Process on error completion Error completion


5
Stores error code

[ST]
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.1=FALSE)) THEN
Z_RRUN_J(TRUE,"J1",3,2,H3FF,H1,Var_Result); (* Performs remote RUN *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

MOV(SM400,SW32,Var_ErrorCode); (* Stores error code *)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 173
RSTOP instruction

Z(P)_RSTOP_J, Z(P)_RSTOP_U
CC IE C NET/H

Structured ladder/FBD ST
Z_RSTOP_J Z_RSTOP_U

EN ENO EN ENO

Jn* d Un* d ENO:= Z_RSTOP_J (EN, Jn*, s1, s2, s3, s4, d);
s1 s1 ENO:= Z_RSTOP_U (EN, Un*, s1, s2, s3, s4, d);
s2 s2

s3 s3

s4 s4

The following instruction can go in the dotted squares.


Z_RSTOP_J, ZP_RSTOP_J, Z_RSTOP_U, ZP_RSTOP_U

■Executing condition
Instruction Executing condition
Z_RSTOP_J
Z_RSTOP_U
ZP_RSTOP_J
ZP_RSTOP_U

5 MODULE DEDICATED INSTRUCTION


174 5.4 Network Dedicated Instruction
■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239) String
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Channel used by host station ANY16
s2 Target station number ANY16
(1) Station number specification
Host station is Universal model QCPU: 1 to 120
Host station is anything other than Universal model
QCPU: 1 to 64
(2) Group specification
81H to A0H: All stations of a group (No.1 to 32)
(3) All stations 5
FFH: All stations of the target network No. (Except
the host station)
s3 Target station's CPU type ANY16
0000H: Target station CPU/control CPU/host
system CPU (Specified data are the same as
'03FFH'.)
03E0H: Multi-CPU No. 1/target station CPU (single
CPU system)
03E1H: Multi-CPU No. 2
03E2H: Multi-CPU No. 3
03E3H: Multi-CPU No. 4
03FFH: Target station CPU/control CPU/host
system CPU
s4 Specify options for the operation mode and clear ANY16
mode.
(1) Operation mode
1H: No forced execution
3H: Forced execution
(2) Clear mode
0H: Do not clear (Note that the local devices are
cleared.)
1H: Clear (excluding the latch range)
2H: Clear (including the latch range)
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(s3)     
(s4)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction remotely switches a CPU module on another station to STOP.

Precautions
This instruction is applicable to the QJ71LP21 or QJ71BR11 with the function version B or later.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 175
Program example
• The following program remotely switches the QCPU on the station number 2 (target station) to STOP.
[Structured ladder/FBD]

Performs remote
STOP

Process on completion Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

[ST]
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.1=FALSE)) THEN
ZP_RSTOP_J(TRUE,"J1",3,2,H3FF,H1,Var_Result); (* Performs remote STOP *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

MOV(SM400, SW32, Var_ErrorCode); (* Stores error code *)

5 MODULE DEDICATED INSTRUCTION


176 5.4 Network Dedicated Instruction
Reading clock data from another station

Z(P)_RTMRD_J, Z(P)_RTMRD_U
CC IE C NET/H

Structured ladder/FBD ST

Z_RTMRD_J Z_RTMRD_U

EN ENO EN ENO
ENO:= Z_RTMRD_J (EN, Jn*, s1, s2, s3, d1, d2);
Jn* d1 Un* d1
ENO:= Z_RTMRD_U (EN, Un*, s1, s2, s3, d1, d2);
s1 d2 s1 d2

s2 s2

s3 s3

5
The following instruction can go in the dotted squares.
Z_RTMRD_J, ZP_RTMRD_J, Z_RTMRD_U, ZP_RTMRD_U

■Executing condition
Instruction Executing condition
Z_RTMRD_J
Z_RTMRD_U
ZP_RTMRD_J
ZP_RTMRD_U

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239) String
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Channel used by host station ANY16
s2 Target station number ANY16
Host station is Universal model QCPU: 1 to 120
Host station is anything other than Universal model
QCPU: 1 to 64
s3 Target station's CPU type ANY16
0000H: Target station CPU/control CPU/host
system CPU (Specified data are the same as
'03FFH'.)
03E0H: Multi-CPU No. 1/target station CPU (single
CPU system)
03E1H: Multi-CPU No. 2
03E2H: Multi-CPU No. 3
03E3H: Multi-CPU No. 4
03FFH: Target station CPU/control CPU/host
system CPU
Output argument ENO Execution result Bit
d1 Variable that stores read clock data Array of ANY16 [0..3]
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 177
Setting Internal device R, ZR J\ U\G Zn Constant Others
data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(s3)     
(d1)     
(d2)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads clock data from a CPU module on another station.

Precautions
This instruction is applicable to the QJ71LP21 or QJ71BR11 with the function version B or later.

Program example
• The following program reads out clock data from the QCPU on the station number 2 (target station) and stores the clock
data in the station number 1 (host station).
[Structured ladder/FBD]

Reads clock data


from another station

Process on completion of readout Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

[ST]
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.1=FALSE)) THEN
ZP_RTMRD_J(TRUE,"J1",4,2,H3FF,D300,Var_Result); (* Reads clock data from another station *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of readout *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;
MOV(SM400, SW33, Var_ErrorCode); (* Stores error code *)

5 MODULE DEDICATED INSTRUCTION


178 5.4 Network Dedicated Instruction
Writing clock data to another station

Z(P)_RTMWR_J, Z(P)_RTMWR_U
CC IE C NET/H

Structured ladder/FBD ST

Z_RTMWR_J Z_RTMWR_U

EN ENO EN ENO
ENO:= Z_RTMWR_J (EN, Jn*, s1, s2, s3, s4, d);
Jn* d Un* d
s1 s1 ENO:= Z_RTMWR_U (EN, Un*, s1, s2, s3, s4, d);
s2 s2
s3 s3
s4 s4

5
The following instruction can go in the dotted squares.
Z_RTMWR_J, ZP_RTMWR_J, Z_RTMWR_U, ZP_RTMWR_U

■Executing condition
Instruction Executing condition
Z_RTMWR_J
Z_RTMWR_U
ZP_RTMWR_J
ZP_RTMWR_U

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the target station (1 to 239, 254) String
254: Network specified in "Valid module during
other station access"
Un* Start I/O number of the host station network No. String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Channel used by host station (1 to 8) ANY16
s2 Target station number ANY16
(1) Station number specification
Host station is Universal model QCPU: 1 to 120
Host station is anything other than Universal model
QCPU: 1 to 64
(2) Group specification
81H to A0H: All stations of a group (No.1 to 32)
(3) All stations
FFH: All stations of the target network No. (Except
the host station)
To specify a group or all stations, specify '0000H' or
'03FFH' for the target station's CPU type (s3).
s3 Target station's CPU type ANY16
0000H: Target station CPU/control CPU/host
system CPU (Specified data are the same as
'03FFH'.)
03E0H: Multi-CPU No. 1/target station CPU (single
CPU system)
03E1H: Multi-CPU No. 2
03E2H: Multi-CPU No. 3
03E3H: Multi-CPU No. 4
03FFH: Target station CPU/control CPU/host
system CPU
s4 Variable that stores write clock data Array of ANY16 [0..4]

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 179
Input/output Name Description Data type
argument
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(s3)     
(s4)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction writes clock data to a CPU module on another station.

Precautions
This instruction is applicable to the QJ71LP21 or QJ71BR11 with the function version B or later.

5 MODULE DEDICATED INSTRUCTION


180 5.4 Network Dedicated Instruction
Program example
• The following program writes the clock data (8:30:00) to all stations on the network number 1.
[Structured ladder/FBD]

Sets clock data

5
Writes clock data
to other stations

Process on completion of writing Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H38,Var_ClockData[0]); (* Sets clock data *)
MOV(TRUE,H0,Var_ClockData[1]);
MOV(TRUE,H8,Var_ClockData[2]);
MOV(TRUE,H3000,Var_ClockData[3]);
MOV(TRUE,H0,Var_ClockData[4]);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SB0A0=FALSE)) THEN
ZP_RTMWR_J(TRUE,"J1",5,H0FF,H3FF,Var_ClockData,Var_Result); (* Writes clock data to other stations*)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion of writing *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;
MOV(SM400, SW34, Var_ErrorCode); (* Stores error code *)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 181
Reading from buffer memory of intelligent function module on
remote I/O station

Z(P)_REMFR
CC IE F NET/H

Structured ladder/FBD ST
Z_REMFR

EN ENO
Jn* d1
d2 ENO:= Z_REMFR (EN, Jn*, n1, n2, n3, n4, n5, d1, d2);
n1
n2
n3
n4
n5

The following instruction can go in the dotted squares.


Z_REMFR, ZP_REMFR

■Executing condition
Instruction Executing condition
Z_REMFR

ZP_REMFR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Target network number (1 to 239) String
n1 Channel number ANY16
CC-Link IE Field Network: 1 to 32
MELSECNET/H: 1 to 8
n2 Target station number ANY16
CC-Link IE Field Network: 1 to 120
MELSECNET/H: 1 to 64
n3 Start I/O number of the target intelligent function ANY16
module
For the CC-Link IE Field Network,
the higher two digits when expressing the I/O
number in three digits.
For the MELSECNET/H,
the higher three digits when expressing the I/O
number in four digits.
n4 Read buffer memory start address ANY16
Specifies the start address of the buffer memory for
the read destination intelligent function module.
n5 Number of read points ANY16
CC-Link IE Field Network: 1 to 240
MELSECNET/H: 1 to 960

5 MODULE DEDICATED INSTRUCTION


182 5.4 Network Dedicated Instruction
Input/output Name Description Data type
argument
Output argument ENO Execution result Bit
d1 Start number of the device that stores read data ANY16
(host station)
Specifies the start number of the host station's
device that stores read data.
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

n1     
n2     
n3     
n4     
n5      5
(d1)     
(d2)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads data from the buffer memory of an intelligent function module to the host station's word device (starting
from (d1)) on the intelligent device station/remote I/O station.

Program example
• The following program reads digital output values.
[Structured ladder/FBD]

Reads data from


buffer memory

Reads CH1 digital


value

Reads CH2 digital


value

Reads CH3 digital


value

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 183
[ST]
IF((X21=TRUE) AND (X1020=TRUE) AND (X102E=TRUE) AND (Y1029=FALSE))THEN
Z_REMFR(TRUE,"J1",2,1,H2,10,4,D10,Var_Result); (* Reads data from buffer memory *)
(*Reads digital values of CH1 to CH3 at once*)
IF((Var_Result[0]=TRUE) AND (Var_Result[1]=FALSE))THEN
IF(D10.0=TRUE)THEN
MOV(TRUE,D11,D21); (* Reads CH1 digital output value *)
END_IF;
IF(D10.1=TRUE)THEN
MOV(TRUE,D12,D22); (* Reads CH2 digital output value *)
END_IF;
IF(D10.2=TRUE)THEN
MOV(TRUE,D13,D23); (* Reads CH3 digital output value *)
END_IF;
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


184 5.4 Network Dedicated Instruction
Writing to buffer memory of intelligent function module on
remote I/O station

Z(P)_REMTO
CC IE F NET/H

Structured ladder/FBD ST
Z_REMTO

EN ENO
Jn* d1
d2 ENO:= Z_REMTO (EN, Jn*, n1, n2, n3, n4, n5, d1, d2);
n1
n2
n3
n4 5
n5

The following instruction can go in the dotted squares.


Z_REMTO, ZP_REMTO

■Executing condition
Instruction Executing condition
Z_REMTO

ZP_REMTO

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Jn* Network number of the host station (1 to 239) String
n1 Channel number ANY16
CC-Link IE Field Network: 1 to 32
MELSECNET/H: 1 to 8
n2 Target station number ANY16
CC-Link IE Field Network: 1 to 120
MELSECNET/H: 1 to 64
n3 Start I/O number of the target intelligent function ANY16
module
For the CC-Link IE Field Network,
the higher two digits when expressing the I/O
number in three digits.
For the MELSECNET/H,
the higher three digits when expressing the I/O
number in four digits.
n4 Write buffer memory start address ANY16
Specifies the start address of the buffer memory for
the write destination intelligent function module.
n5 Number of write points ANY16
CC-Link IE Field Network: 1 to 240
MELSECNET/H: 1 to 960

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 185
Input/output Name Description Data type
argument
Output argument ENO Execution result Bit
d1 Start number of the device that stores write data ANY16
(host station)
Specifies the start number of the host station's
device that stores write data.
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

n1     
n2     
n3     
n4     
n5     
(d1)     
(d2)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction writes data to the buffer memory of an intelligent function module on the intelligent device station/remote I/O
station.

Program example
• The following program makes the A/D conversion enable setting on channels.
[Structured ladder/FBD]

A/D Conversion
enable/disable
setting

CH2 time/count
averaging setting

CH3 time/count
averaging setting

Averaging processing
specification

Writes data to
buffer memory

Turns operating
condition setting
request (Y9) ON

Turns operating
condition setting
request (Y9) OFF

5 MODULE DEDICATED INSTRUCTION


186 5.4 Network Dedicated Instruction
[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H8,D0); (* A/D Conversion enable/disable setting *)
MOV(TRUE,50,D2); (* CH2 time/count averaging setting *)
MOV(TRUE,1000,D3); (* CH3 time/count averaging setting *)
MOV(TRUE,H604,D9); (* Averaging processing specification *)
ZP_REMTO(TRUE,"J1",1,1,H2,H0,10,D0,Var_Result); (* Writes data to buffer memory *)
END_IF;
IF((Var_Result[0]=TRUE) AND (Var_Result[1]=FALSE))THEN
SET(TRUE,Y1029); (* Turns operating condition setting request (Y9) ON *)
END_IF;
IF((Y1029=TRUE) AND (X1029=FALSE))THEN
RST(TRUE,Y1029); (* Turns operating condition setting request (Y9) OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 187
Setting parameter

G(P)_CCPASET
CC IE F

Structured ladder/FBD ST

G_CCPASET

EN ENO

Un* d
ENO:= G_CCPASET (EN, Un*, s1, s2, s3, s4, d);
s1

s2

s3

s4

The following instruction can go in the dotted squares.


G_CCPASET, GP_CCPASET

■Executing condition
Instruction Executing condition
G_CCPASET

GP_CCPASET

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module ANY16
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..3]
s2 Start number of the host station's device that stores Array of ANY16 [0..599]
network configuration setting data.
s3 Start number of the host station's device that stores Array of ANY16 [0..7]
reserved station specification data.
s4 Start number of the host station's device that stores Array of ANY16 [0..7]
error invalid station setting data.
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of Bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(s3)   
(s4)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sets parameters for master/local module (master station).

5 MODULE DEDICATED INSTRUCTION


188 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting
range side
(s1)[0] Completion The instruction completion status is stored.  System
status 0: Normal completion
Other than 0: Error completion (error code)
(s1)[1] Setting flag Specify the validity of setting data from (s2) to (s4) in the range from b0 to b2. Refer to User
'0: Invalid' is specified, default parameter is applied. the left.
The supplementary setting and the network operation setting in the range from b8 to bA.
b15 b11 b10 b9 b8 b7 b3 b2 b1 b0
0 (Fixed) 0 (Fixed)

Network configuration
Data link faulty setting data
station setting 0: Invalid
0: Clear 1: Valid
1: Hold

Output setting
Reserved station
specification data 5
in the CPU STOP status 0: Invalid
0: Hold 1: Valid
1: Clear
Error invalid station
specification data
Link scan mode
0: Invalid
0: Asynchronous
1: Valid
1: Synchronous

(s1)[2] Total number of Specify the number of connected slave stations. 1 to 120 User
slave station
(s1)[3] Constant link Set the constant link scan time. 5 to User
scan time 0: No setting 2000(ms)
5 to 2000: Constant link scan time

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 189
• Network configuration setting data
Set the network configuration settings when network configuration setting data (b0) is enabled in the setting flag ((s1)[1]).
Device Item Setting data Setting Setting
range side
(s2)[0] 1st Slave Specify the station type and station number. Refer to the User
station left.
b15 b12 b11 b8 b7 b0
setting
Station type 1 (Fixed) Station number
information
0 : Remote I/O station 1 to 120 : Station number
1 : Remote device station
2 : Intelligent device station
3 : Local station

(s2)[1] RX/RY Specify the start number of RX/RY in units of 16 points. 0 to 3FF0H
offset
(s2)[2] RX/RY Specify the number of RX/RY in units of 16 points. 0 to 2048
size
(s2)[3] RWr/RWw Specify the start number of RWr/RWw. in units of 4 points. 0 to 1FFCH
offset
(s2)[4] RWr/RWw Specify the number of RWr/RWw. in units of 4 points. 0 to 1024
size
(s2)[5] 
 
(s2)[594] 


(s2)[595] 120th Slave The same as from (s2)[0] to (s2)[4].
station
setting
information
(s2)[596] RX/RY
offset
(s2)[597] RX/RY
size
(s2)[598] RWr/RWw
offset
(s2)[599] RWr/RWw
size

• Reserved station specification data


Set the slave station as the reserved station when reserved station specification data (b1) is enabled in the setting flag
((s1)[1]).
Device Item Setting data Setting
side
(s3)[0] Reserved station Specify the reserved station. User
 specification 0: Not specified (Default)
(s3)[7] 1: Specified

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


s3 [0] 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
s3 [1] 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17
s3 [2] 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
s3 [3] 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
s3 [4] 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65
s3 [5] 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81
s3 [6] 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97
s3 [7] 120 119 118 117 116 115 114 113
Numbers in the table indicate the station numbers.

5 MODULE DEDICATED INSTRUCTION


190 5.4 Network Dedicated Instruction
• Error invalid station setting data
Set the slave station as the error invalid station when error invalid station setting data(b2) is enabled in the setting flag ((s1)[1])
Device Item Setting data Setting
side
(s4)[0] Error invalid station Specify the error invalid station. User
 setting*1 0: Not specified (Default)
(s4)[7] 1: Specified

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


s4 [0] 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
s4 [1] 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17
s4 [2] 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
s4 [3] 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
s4 [4] 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65
s4 [5] 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81
s4 [6] 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97
s4 [7] 120 119 118 117 116 115 114 113
Numbers in the table indicate the station numbers. 5
*1 Reserved station specification has a priority when an error invalid station and reserved station are specified for the same station.

Program example
• The following program sets parameters for master station of network No.1 when Var_Flag_Exe turns ON. (Total number of
slave stations is 3.)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 191
[Structured ladder/FBD]

Set control data

Set network configuration setting data

Set reserved station specification data

Error invalid station specification data

Performs writing

Turns execution flag OFF

Process on normal completion

Process on error completion

5 MODULE DEDICATED INSTRUCTION


192 5.4 Network Dedicated Instruction
[ST]
IF( Var_Flag_Exe = TRUE ) (* Execution flag *)
MOV( TRUE, H107, Var_ControlData[1]); (* Sets control data *)
MOV( TRUE, 3, Var_ControlData[2]);
MOV( TRUE, 0, Var_ControlData[3]);
MOV( TRUE, H2101, Var_NetworkStruct[0] ); (* Sets data of network configuration setting *)
MOV( TRUE, H0, Var_NetworkStruct[1] );
MOV( TRUE, 32, Var_NetworkStruct[2] );
MOV( TRUE, H0, Var_NetworkStruct[3] );
MOV( TRUE, 16, Var_NetworkStruct[4] );
MOV( TRUE, H2102, Var_NetworkStruct[5] );
MOV( TRUE, H20, Var_NetworkStruct[6 ] );
MOV( TRUE, 32, Var_NetworkStruct[7] );
MOV( TRUE, H10, Var_NetworkStruct[8] );
MOV( TRUE, 16, Var_NetworkStruct[9] );
MOV( TRUE, H2103, Var_NetworkStruct[10] );
MOV( TRUE, H40, Var_NetworkStruct[11] );
MOV( TRUE, 32, Var_NetworkStruct[12] );
MOV( TRUE, H20, Var_NetworkStruct[13] );
MOV( TRUE, 16, Var_NetworkStruct[14] );
END_IF; 5
IF( Var_Flag_Exe = TRUE ) (* Execution flag *)
MOV( TRUE, H4, Var_ReservStData[0] ); (* Sets data of reserved station specification *)
END_IF;

IF( Var_Flag_Exe = TRUE ) (* Execution flag *)


MOV( TRUE, H4, Var_ErrorInvalidData[0] ); (* Sets data of error invalid station setting *)
END_IF;

IF( Var_Flag_Exe = TRUE ) (* Execution flag *)


GP_CCPASET(TRUE, H0, Var_ControlData, Var_NetworkStruct, Var_ReservStData, Var_ErrorInvalidData, Var_Result); (* Performs writing *)
RST( TRUE, Var_Flag_Exe ); (* Turns execution flag OFF *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (*Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;

END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 193
Connection opening or closing

ZP_OPEN
Ether

Structured ladder/FBD ST
ZP_OPEN

EN ENO
ENO:= ZP_OPEN (EN, Un*, s1, s2, d);
Un* d

s1

s2

The following instruction can go in the dotted squares.


ZP_OPEN

■Executing condition
Instruction Executing condition
ZP_OPEN

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..9]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction establishes (opens) a connection with external device for data communication.

5 MODULE DEDICATED INSTRUCTION


194 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting
range side
(s2)[0] Execution type/ Specify whether to use the parameter values set by GX Works2 or the setting values of 0000H, User
Completion type the following control data ((s2)[2] to (s2)[9]) at open processing of a connection. 8000H
0000H: Uses the parameter set in [Open settings] of GX Works2.
8000H: Uses the settings of control data (s2)[2] to (s2)[9].
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s2)[2] Application setting Specify the application of connection. (Refer to the User
area left.)
b15 b14 … b9 b8 b7 … b1 b0
(6) 0 (5) (4) (3) 0 (2) (1)

(1) Application of fixed buffer (b0)


0: For sending, or fixed buffer is not used in communication
1: For receiving
(2) Check of existence of the target (b1) 5
0: Not checked
1: Checked
(3) Pairing open setting (b7)
0: No pairing open
1: Pairing open
(4) Communication method (protocol) (b8)
0: TCP/IP
1: UDP/IP
(5) With/without procedure in fixed buffer communication (b9)
0: Procedural communication
Nonprocedural communication
(6) Open system (b15, b14)
00: Active open or UDP/IP
10: Unpassive open
11: Fullpassive open
(s2)[3] Host station port No. Specify the port number of the host station. 401H to User
1387H,
138BH to
FFFEH
(s2)[4] Destination IP Specify the IP address of the external device. 1H to User
(s2)[5] address FFFFFFFFH
(FFFFFFFFH:
broadcast)
(s2)[6] Destination port No. Specify the port number of the external device. 401H to User
FFFFH
(FFFFH:
broadcast)
(s2)[7] Destination MAC Specify the MAC address of the external device. n User
 address 00000000000
(s2)[9] 0H
FFFFFFFFFF
FFH

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 195
Program example
• The following program opens the connection 1 for TCP/IP communication using the Active open process.
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Open request
signal

Connection 1 open
request signal

Turns execution flag


ON when instruction
flag is ON

Execution type when


*1
GX Works2-
[Open settings]
is used

*1 Execution type when


D100-[control data]
is used

Application setting

Host station port


number

Destination
IP address

Destination
port number

Opens connection

Turns normal
completion flag ON

Turns error
completion flag ON

*1 For divisions of (1) and (2) in the program, (1) is necessary when the [Open settings] of GX Works2 is used and (2) is necessary when it
is not used.

5 MODULE DEDICATED INSTRUCTION


196 5.4 Network Dedicated Instruction
[ST]
IF(SM400=TRUE)THEN (* Always ON *)
MOV(TRUE,U0\G20480,K4M0); (* Open completed signal/connection 1 open completion signal *)
MOV(TRUE,U0\G20482,K4M20); (* Open request signal/connection 1 open request signal *)
END_IF;
IF(Var_Flag_Inst=TRUE)THEN (* When instruction flag is ON*)
PLS(TRUE,Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;
IF((Var_Flag_Exe=TRUE) AND (X19=TRUE) (* Execution flag/initialization normal completion signal *)
AND (M0=FALSE) AND (M20=FALSE))THEN (* Connection 1 open completion signal/connection 1 open request signal *)

*1
(*Use GX Works2-[Open settings]*)
MOVP(TRUE,H0,D100);
(*Execution type*)

*1
(*Use D100-[control data]*)
MOVP(TRUE,H8000,D100);
(*Execution type*)
MOVP(TRUE,H0,D102);
5
(*Application setting*)
MOVP(TRUE,H1000,D103);
(*Host station port number*)
DMOVP(TRUE,H0A6155DF,D104);
(*Destination IP address*)
MOVP(TRUE,H2000,D106);
(*Destination port number*)
ZP_OPEN(TRUE,"U0",1,D100,Var_Result); (* Opens connection *)

END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
END_IF;
IF(Var_Result[1]=TRUE)THEN (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

*1 For divisions of (1) and (2) in the program, (1) is necessary when the [Open settings] of GX Works2 is used and (2) is necessary when it
is not used.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 197
ZP_CLOSE
Ether

Structured ladder/FBD ST
ZP_CLOSE

EN ENO
ENO:= ZP_CLOSE (EN, Un*, s1, s2, d);
Un* d

s1

s2

The following instruction can go in the dotted squares.


ZP_CLOSE

■Executing condition
Instruction Executing condition
ZP_CLOSE

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..1]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction shuts off (closes) a connection with external device during data communication.

5 MODULE DEDICATED INSTRUCTION


198 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting
range side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

Program example
• The following program closes the connection 1.
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Connection 1
close timing
5
Closing connection 1
from external device

Close instruction
1PLS

Closes connection

Turns execution
flag ON

Turns normal
completion flag ON

Turns error
completion flag ON

Turns execution
flag OFF

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 199
[ST]
IF(Var_Flag_Open=TRUE)THEN (* Connection 1 open completion signal *)
PLF(TRUE,Var_Flag_CloseTiming); (* Connection 1 close timing *)
END_IF;
IF((Var_Flag_CloseTiming=TRUE) AND (Var_Flag_OpenOK=TRUE))THEN (* Connection 1 close timing/open instruction normal completion *)
PLS(TRUE,Var_Flag_Close); (* Closing connection from external device *)
END_IF;
IF(Var_Flag_Inst=TRUE)THEN (* Close instruction *)
PLS(TRUE,Var_Flag_Inst2); (* Close instruction 1PLS *)
END_IF;
IF(((Var_Flag_Inst2=TRUE) AND (Var_Flag_Open=TRUE)) (* Close instruction 1PLS/connection 1 open completion signal *)
OR ((Var_Flag_Close=TRUE) AND (Var_Flag_Exe=FALSE)))THEN (* Closing connection 1 from external device/CLOSE instruction is in execution *)
ZP_CLOSE(TRUE,"U0",1,Var_ControlData,Var_Result); (* Closes connection *)
SET(TRUE,Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
END_IF;
IF(Var_Result[1]=TRUE)THEN (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
RST(TRUE,Var_Flag_Exe); (* Turns execution flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


200 5.4 Network Dedicated Instruction
Fixed buffer communication

ZP_BUFRCV
Ether

Structured ladder/FBD ST
ZP_BUFRCV

EN ENO
ENO:= ZP_BUFRCV (EN, Un*, s1, s2, d1, d2);
Un* d1

s1 d2

s2

The following instruction can go in the dotted squares. 5


ZP_BUFRCV

■Executing condition
Instruction Executing condition
ZP_BUFRCV

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..1]
Output argument ENO Execution result Bit
d1 Start number of the device that stores read data ANY16
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(d1)     
(d2)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads receive data from external device in fixed buffer communication.
This instruction is used in a main program.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 201
Setting data
Device Item Setting data Setting Setting
range side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

Device Item Setting data Setting Setting


range side
(d1)+0 System area Data length of the data read from the fixed buffer data area is stored. (Refer to the System
(Data length becomes the number of words or the number of bytes depending on the left.)
procedure used in fixed buffer communication.)
• With procedure (communication in binary code): The number of words (1 to 1017)
• With procedure (communication in ASCII code): The number of words (1 to 508)
• Nonprocedural communication (communication in binary code): The number of bytes (1
to 2046)
(d1)+1 Receive data Data read from the fixed buffer data area are stored in ascending address order.  System

(d1)+n

Program example
• The following program reads out receive data from the fixed buffer of the connection 1.
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Connection 1 open
completion signal

Connection 1 open
request signal

Fixed buffer 1
receive status signal

Receive
instruction 1 PLS

Reads data in
fixed buffer
communication

Process on normal completion Normal completion

Process on error completion Error completion

5 MODULE DEDICATED INSTRUCTION


202 5.4 Network Dedicated Instruction
[ST]
IF(SM400=TRUE)THEN (* Always ON *)
MOV(TRUE,U0\G20480,K4M0); (* Open completion signal/connection 1 open completion signal *)
MOV(TRUE,U0\G20482,K4M20); (* Open request signal/connection 1 open request signal *)
MOV(TRUE,U0\G20485,K4M40); (* Fixed buffer receive status signal/fixed buffer 1 receive status signal *)
END_IF;
(* Program to receive fixed buffer number 1 (main program) *)
IF((X19=TRUE) AND (M0=TRUE) AND (M40=TRUE) AND (M500=FALSE))THEN (* Initialization normal completion signal/connection 1 normal open
completion signal *)
(* Fixed buffer 1 receive status signal/receive instruction completion signal *)
PLS(TRUE,Var_Flag_Exe); (* Receive instruction 1PLS *)
END_IF;
IF(Var_Flag_Exe=TRUE)THEN (* Receive instruction 1PLS *)
ZP_BUFRCV(TRUE,"U0",1,Var_ControlData,D500,Var_Result); (* Reads data in fixed buffer communication *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *) 5
(* Process on error completion *)
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 203
Z_BUFRCVS
Ether

Structured ladder/FBD ST

Z_BUFRCVS

EN ENO
ENO:= Z_BUFRCVS (EN, Un*, s, d);
Un* d

The following instruction can go in the dotted squares.


Z_BUFRCVS

■Executing condition
Instruction Executing condition
Z_BUFRCVS

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Connection number (1 to 16) ANY16
Output argument ENO Execution result Bit
d Start number of the device that stores read data ANY16

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads receive data from external device in fixed buffer communication.
This instruction is used in an interrupt program.

5 MODULE DEDICATED INSTRUCTION


204 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting
range side
(d1)+0 Receive data length Data length of the data read from the fixed buffer data area is stored. (Refer to the System
(Data length becomes the number of words or the number of bytes depending on the left.)
procedure used in fixed buffer communication.)
• With procedure (communication in binary code): The number of words (1 to 1017)
• With procedure (communication in ASCII code): The number of words (1 to 508)
• Nonprocedural communication (communication in binary code): The number of bytes (1
to 2046)
(d1)+1 Receive data Data read from the fixed buffer data area are stored in ascending address order.  System

(d1)+n

Program example
• The following program reads receive data from the fixed buffer of the connection 2.
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F) 5
[Structured ladder/FBD]

Performs readout
in fixed buffer
communication

[ST]
Z_BUFRCVS(SM400,"00",2,D700); (* Reads data in fixed buffer communication *)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 205
ZP_BUFSND
Ether

Structured ladder/FBD ST

ZP_BUFSND

EN ENO

Un* d ENO:= ZP_BUFSND (EN, Un*, s1, s2, s3, d);

s1

s2

s3

The following instruction can go in the dotted squares.


ZP_BUFSND

■Executing condition
Instruction Executing condition
ZP_BUFSND

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..1]
s3 Start number of the device that stores write data ANY16
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word K, H

(s1)     
(s2)     
(s3)     
(d)     

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends data to external device in fixed buffer communication.

5 MODULE DEDICATED INSTRUCTION


206 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting
range side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

• Send data
Device Item Setting data Setting Setting
range side
(s3)+0 Send data length Data length of the data read from the fixed buffer data area is stored. (Data length (Refer to the User
becomes the number of words or the number of bytes depending on the procedure used in left.)
fixed buffer communication.)
• With procedure (communication in binary code): The number of words (1 to 1017)
• With procedure (communication in ASCII code): The number of words (1 to 508)
• Nonprocedural communication (communication in binary code): The number of bytes (1
to 2046)
5
(s3)+1 Send data Specify the send data.  User

(s3)+n

Program example
• The following program sends data from the fixed buffer of the connection 1.
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Send instruction
1PLS

Sets data length


(number of words)

Sets send data

Sends data in
fixed buffer
communication

Process on normal completion Normal completion

Process on error completion Error completion

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 207
[ST]
IF((X19=TRUE) AND (Var_Flag_Open=TRUE))THEN (* Initialization normal completion signal/connection 1 open completion signal*)
PLS(TRUE,Var_Flag_Inst); (* Send instruction 1PLS *)
END_IF;
IF(Var_Flag_Inst=TRUE)THEN (* Send instruction 1PLS *)
MOV(TRUE,3,D300); (* Sets data length (number of words) *)
MOV(TRUE,1234,D301); (* Sets send data *)
MOV(TRUE,5678,D302); (* Sets send data *)
MOV(TRUE,8901,D303); (* Sets send data *)
ZP_BUFSND(TRUE,"U0",1,Var_ControlData,D300,Var_Result); (* Sends data in fixed buffer communication *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


208 5.4 Network Dedicated Instruction
Reading or clearing error information

ZP_ERRCLR
Ether

Structured ladder/FBD ST

ZP_ERRCLR

EN ENO ENO:= ZP_ERRCLR (EN, Un*, s, d);


Un* d

The following instruction can go in the dotted squares. 5


ZP_ERRCLR

■Executing condition
Instruction Executing condition
ZP_ERRCLR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..7]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction turns OFF the LED on Ethernet module and clears error information stored in the buffer memory.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 209
Setting data
Device Item Setting data Setting Setting
range side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s)[2] Clear target Specify the error information to be cleared. (Refer to the User
specification 0000H: Initial error code left.)
0001H to 0010H: Open error code of the corresponding connection
0100H: Error log block area
0101H: Communication status - Status by protocol
0102H: Communication status - E-mail reception status
0103H: Communication status - E-mail transmission status
FFFFH: Clears all of the above.
(s)[3] Clear function Specify the function to be cleared. 0000H, User
specification 0000H: [COM.ERR] LED is turned OFF and an error code is cleared. FFFFH
FFFFH: Error log clear
(s)[4] System area   

(s)[7]

Program example
• The following program clears the open error code of the connection 1.
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Sets clear target

Sets clear
function

Turns execution
flag ON

Clears
error information

Normal completion
Clears error code
to 0
Error completion
Stores error code

Turns execution
flag OFF

5 MODULE DEDICATED INSTRUCTION


210 5.4 Network Dedicated Instruction
[ST]
IF((Var_Flag_Inst=TRUE) AND (Var_Flag_Exe=FALSE))THEN
MOVP(TRUE,H1,Var_ControlData[2]); (* Sets clear target *)
MOVP(TRUE,H0,Var_ControlData[3]); (* Sets clear function *)
SET(TRUE,Var_Flag_Exe); (* Turns execution flag ON *)
END_IF;
IF(Var_Flag_Exe=TRUE)THEN
ZP_ERRCLR(TRUE,"U0",Var_ControlData,Var_Result); (* Clears error information *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
MOVP(TRUE,0,Var_ErrorCode); (* Clears error code to 0 *)
END_IF;
IF(Var_Result[1]=TRUE)THEN (* Error completion *)
MOVP(TRUE,Var_ControlData[1],Var_ErrorCode);(* Stores error code *)
END_IF;
RST(TRUE,Var_Flag_Exe); (* Turns execution flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 211
ZP_ERRRD
Ether

Structured ladder/FBD ST

ZP_ERRRD

EN ENO ENO:= ZP_ERRRD (EN, Un*, s, d);


Un* d

The following instruction can go in the dotted squares.


ZP_ERRRD

■Executing condition
Instruction Executing condition
ZP_ERRRD

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..7]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads the error information stored in the buffer memory of the Ethernet module.

Setting data
Device Item Setting data Setting Setting
range side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0 : Error completion (error code)
(s)[2] Read information Specify the error information to be read. 0, User
specification 0: Initial error code 1 to 16
1 to 16: Open error code of the corresponding connection
(s)[3] Read target Specify the target error information to be read. 0000H User
information 0000H: Latest error information
specification

5 MODULE DEDICATED INSTRUCTION


212 5.4 Network Dedicated Instruction
Device Item Setting data Setting Setting
range side
(s)[4] Error information The read error information is stored.  System
0000H: No error
Other than 0000H: Error code
(s)[5] System area   

(s)[7]

Program example
• The following program reads the open error code of the connection 1.
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Sets open
error code

Sets latest error


information 5
Turns execution
flag ON

Reads error
information

Normal completion
Stores error
information
Error completion
Stores error code

Turns execution
flag OFF

[ST]
IF((Var_Flag_Inst=TRUE) AND (Var_Flag_Exe=FALSE))THEN
MOVP(TRUE,H1,Var_ControlData[2]); (* Sets open error code of connection number 1 *)
MOVP(TRUE,H0,Var_ControlData[3]); (* Sets latest error information *)
SET(TRUE,Var_Flag_Exe); (* Turns execution flag ON*)
END_IF;
IF(Var_Flag_Exe=TRUE)THEN
ZP_ERRRD(TRUE,"00",Var_ControlData,Var_Result); (* Reads error information *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
MOVP(TRUE,Var_ControlData[4],Var_ErrorInfo); (* Stores error information*)
END_IF;
IF(Var_Result[1]=TRUE)THEN (* Error completion *)
MOVP(TRUE,Var_ControlData[1],Var_ErrorCode); (* Stores error code *)
END_IF;
RST(TRUE,Var_Flag_Exe); (* Turns execution flag OFF *)
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 213
UINI instruction

Z(P)_UINI

CC IE C Ether
*1 ZP_UINI instruction only

Structured ladder/FBD ST

Z_UINI

EN ENO ENO:= Z_UINI (EN, Un*, s, d);


Un* d

The following instruction can go in the dotted squares.


Z_UINI, ZP_UINI

■Executing condition
Instruction Executing condition
Z_UINI

ZP_UINI

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..9]
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
Ethernet: This instruction reinitializes the Ethernet module.
CC-Link IE Controller Network: For Universal model QCPU, this instruction sets the station number of the CC-Link IE
Controller Network module on normal station (host station).

5 MODULE DEDICATED INSTRUCTION


214 5.4 Network Dedicated Instruction
Setting data
• Ethernet
Device Item Setting data Setting Setting
range side
(s)[0] System area   
(s)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s)[2] Modification [When updating the address information of external devices which are held by the (Refer to the User
specification Ethernet module] left.)
• Specify '0H'.*1
[When modifying the host station IP address, operation settings, transmission speed,
communication mode]
• Specify the parameter to be modified.
However, Modification specification of transmission speed, communication mode cannot
be executed simultaneously with that of host station IP address, operation settings.
If executed, only modification specification of host station IP address and operation
settings will be set.
5
b15 … b12 … b1 b0
(3) 0 (2) (1)

(1) Modification specification of host station IP address (b0)


Specify whether the host station IP address is modified or not.
(To modify the IP address, specify the address in (s)[3] and (s)[4].)
0: Not changed
1: Changed
(2) Modification specification of operation setting (b1)
Specify whether the operation setting is modified or not.
(To modify the operation setting, specify the operation setting in (s)[5].)
0: Not changed
1: Changed
(3) Modification specification of transmission speed, communication mode (b15 to b12)
Specify the transmission speed, communication mode.
0: not changed
1: automatic negotiation
2: 100Mbps/full-duplex communication
3: 100Mbps/half-duplex communication
4: 10Mbps/full-duplex communication
5: 10Mbps/half-duplex communication
(s)[3] Host station IP Specify the IP address of the host station. 00000001H User
(s)[4] address to
FFFFFFFEH
(s)[5] Operation setting …
(Refer to the User
b15 b8 … b6 b5 b4 … b1 b0
0 (5) 0 (4) (3) (2) 0 (1) 0 left.)

(1) Communication data code setting (b1)


0: Binary code
1: ASCII code
(2) TCP existence confirmation setting (b4)
0: Use Ping
1: Use KeepAlive
(3) Transmission frame setting (b5)
0: Ethernet frame
1: IEEE802.3 frame
(4) Setting for enabling/disabling write during RUN (b6)
0: Disable
1: Enable
(5) Initial timing setting (b8)
0: Do not wait for OPEN (communication impossible during STOP status)
1: Always wait for OPEN (communication possible during STOP status)
(s)[6]  Specify 0. 0 User

(s)[9]

*1 The Ethernet module enables data exchange to restart by clearing the address information retained in the module and by performing re-
initial processing. (The Initial normal completion signal (X19) is on.)

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 215
• CC-link IE Controller Network
Device Item Setting data Setting Setting
range side
(s)[0]  Specify 0. 0 User
(s)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s)[2] Modification Specify the change target 0001H User
specification 0001H: With station number setting
(s)[3] Host station No. Specify the station number of the host station. 1 to 120 User
(s)[4]  Specify 0. 0 User

(s)[9]

The UINI instruction can be executed only once. The UINI instruction cannot be executed again after
determination of station number. (It caused an error completion.)
However, in the case of the UINI instruction with the error completion, execute the UINI instruction again after
taking corrective action.

Program example
• The following program sets the station number 2. The following is an example for Ethernet.
[Structured ladder/FBD]

Sets change
target

Sets host
station number

Performs
reinitialization

Process on completion Execution finished

Process on normal completion Normal completion

Process on error completion Error completion

Stores error code

5 MODULE DEDICATED INSTRUCTION


216 5.4 Network Dedicated Instruction
[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE,H1,Var_ControlData[2]); (* Sets change target *)
MOV(TRUE,ZR0,Var_ControlData[3]); (* Sets host station number *)
END_IF;
IF((Var_Flag_Exe=TRUE) AND (SB70=TRUE))THEN
ZP_UINI(TRUE,"00",Var_ControlData,Var_Result); (* Performs reinitialization *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)

(* Process on completion *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *) 5
END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 217
E-mail communication

ZP_MRECV
Ether

Structured ladder/FBD ST

ZP_MRECV

EN ENO
ENO:= ZP_MRECV (EN, Un*, s, d1, d2);
Un* d1

s d2

The following instruction can go in the dotted squares.


ZP_MRECV

■Executing condition
Instruction Executing condition
ZP_MRECV

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s Variable that stores control data Array of ANY16 [0..15]
Output argument ENO Execution result Bit
d1 Start number of the host station's device that stores ANY16
the content of the received e-mail (header +
attached file)
d2 Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s)   
(d1)   
(d2)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads received e-mail.

5 MODULE DEDICATED INSTRUCTION


218 5.4 Network Dedicated Instruction
Setting data
Device Item Setting data Setting Setting
range side
(s)[0] Execution/Error 0000H, User
b15 … b9 b8 b7 … b0
completion type 0080H,
0 (2) 0 (1) 0
0200H,
(1) Error completion type (bit 7) 0280H
Specify the clock data setup status at the time of error completion.
0: Clock data at the time of error completion is not set in the area starting from (s)[11].
1: Clock data at the time of error completion is set in the area starting from (s)[11].
(2) Execution type (bit 9)*1
Specify whether to inquire about existence of mails in the server after reading received
mails.
0: Not requested (not read)
1: Requested (read)
(s)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code) 5
(s)[2] E-mail No. to be read Specify the number of a mail to be read when multiple mails are received. 0 or more User
0: First mail
1 or more: Specified mail
(s)[3] System area   

(s)[8]
(s)[9] Receive For Specify the data length (header + attached file) of the mail that can be stored in (d1) to 0 to 6517 User
data length instruction (d1)+n. (Header: 1 to 373, attached file: 1 to 6144) (word)
execution 0: Adjust data length to that of the received mail. * Includes
1 to 6517: The number of data that can be stored in ((d1) to (d1)+n) the header
At Data length (header + attached file) of the mail stored in (d1) to (d1)+n is stored. length System
instruction 1 to 6517: The number of receive data stored in ((d1) to (d1)+n) explained
completion below.

(s)[10] Header For Specify the header data length of the mail that can be stored in (d1) to (d1)+n. 0 to 373 User
length instruction 0: Adjust header data length to that of the received mail. (word)
execution 1 to 373: The number of data that can be stored in ((d1) to (d1)+n)
At Header data length of the mail stored in (d1) to (d1)+n is stored. System
instruction 1 to 373: Number of receive data stored in ((d1) to (d1)+n)
completion
(s)[11] Clock set flag Valid/invalid status of the data in the area starting from (s)[12] is stored. 0, 1 System
0: Invalid
1: Valid
(s)[12] Clock data Clock data at the time of error completion are stored in BCD format.  System
 (set only when errors
b15 to b8 b7 to b0
(s)[15] occur)
s [12 ] Month (01H to 12H) Year (00H to 99H) Last two digits
s [13 ] Hour (00H to 23H) Day (01H to 31H)
s [14 ] Second (00H to 59H) Minute (00H to 59H)
s [15 ] Year (00H to 99H) First two digits Day of week (00H to 06H)
00H (Sun.) to 06H (Sat.)
(d1)+0 Receive data Content (header + attached file) of the received mail are stored.  System

(d1)+n

*1 The following table shows the processing that depends on the selection of the execution type after executing the MRECV instruction.

Setting option Processing Advantage Disadvantage


No request • Only e-mail read processing from the mail server is performed. Unnecessary read Even if mails remain in
(not read) • Inquiry (reading) for the information of received mails remaining in the mail server is processing is not the mail server, they
performed after the time set in the GX Works2 parameter has elapsed. performed when cannot be read
the mail server has immediately.
no mail. Mails tend to be
accumulated in the mail
server.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 219
Setting option Processing Advantage Disadvantage
Request • E-mail read processing from the mail server is performed. Received mails Inquiries to the mail
(read) • After the execution of the MRECV instruction, inquiry (read) processing for information stored in the mail server are made more
on the received mails remaining in the mail server is performed. (Inquiry for receiving server can be read often.
of a mail is made immediately.) in series. Internal processing of
the module increases,
which affects other
internal processing to a
certain degree.

Program example
• The following program performs the e-mail receiving process by the receive instruction (X21).
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
[Structured ladder/FBD]

Sets to inquire
to server

Sets to read
the first mail

Sets to adjust data


length to that of
the received mail
Sets to adjust header
data length to that
of the received mail
Reads received
e-mail

Process on normal completion Normal completion

Process on error completion Error completion

[ST]
IF (X21=TRUE) THEN
SET(TRUE,Var_Flag_Exe);
END_IF;
IF((Var_Flag_Exe=TRUE) AND (U0\G9858.F=TRUE))THEN
MOVP(TRUE,H200,Var_ControlData[0]); (* Sets to inquire to server *)
MOVP(TRUE,0,Var_ControlData[2]); (* Sets to read the first mail *)
MOVP(TRUE,0,Var_ControlData[9]); (* Sets to adjust data length to that of the received mail *)
MOVP(TRUE,0,Var_ControlData[10]); (* Sets to adjust header data length to that of the received mail *)
ZP_MRECV(TRUE,"00",Var_ControlData,D100,Var_Result); (* Reads received e-mail *)
RST(TRUE,Var_Flag_Exe);
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


220 5.4 Network Dedicated Instruction
ZP_MSEND
Ether

Structured ladder/FBD ST
ZP_MSEND

EN ENO
ENO:= ZP_MSEND (EN, Un*, s1, s2, d);
Un* d

s1

s2

The following instruction can go in the dotted squares.


ZP_MSEND

■Executing condition 5
Instruction Executing condition
ZP_MSEND

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un* Start I/O number of the module String
(00 to FE: Higher two digits when expressing the I/
O number in three digits)
s1 Variable that stores control data Array of ANY16 [0..15]
s2 Start number of the host station's device that stores ANY16
the content of the sent e-mail (subject + attached
file) or (subject + text)
Output argument ENO Execution result Bit
d Variable that turns ON upon completion of the Array of bit [0..1]
instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data*1 Bit Word Bit Word
(s1)   
(s2)   
(d)   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends an e-mail.

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 221
Setting data
Device Item Setting data Setting Setting
range side
(s1)[0] Execution/Error (Refer to the User
b15 … b12 … b8 b7 … b0
completion type Send left.)
0 (2) (1) 0
data format
(1) Error completion type (bit 7)
Specify the clock data setup status at the time of error completion.
0: Clock data at the time of error completion is not set in the area starting from (s1)[11].
1: Clock data at the time of error completion is set in the area starting from (s1)[11].
(2) Send data format (bit 12 to bit 8)
Specify the data format of the send data.
(Sending the data as an attached file)
• Binary data
• ASCII data (converted from binary into ASCII)
• CSV data (converted from binary into CSV)
(Sending the data as a text)
• Binary data
[Precautions for specifying a text]
• When a text is specified, setting at bit 11 to bit 8 is invalid.
• Specify the text in ASCII characters in a sequence program. (Ethernet module does
not convert text into ASCII characters.)
• The following binary code data are treated as control codes.
0D0AH: Line feed code, CR+LF
00H: End of the text
• The number of characters per line in a text to 78 characters or less (Enter the line
feed code, CR+LF (0D0AH), at the last line of a text.)
(s1)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s1)[2] Transmission destination Specify the external device to which e-mails are to be sent by the setting number on 1 to 16 User
No. [Send mail address setting] of GX Works2.
1 to 16: Setting number of the external device
(s1)[3] System area   

(s1)[8]
(s1)[9] Send data length Specify the data length ((subject + attached file) or (subject + text)) of the mail stored in 0 to 6517 User
(s2) to (s2)+n. or
• Sending the data as an attached file (subject: 0 to 373, attached file: 1 to 6144) 1 to 1333
1 to 6517: Data length (word) of a mail
• Sending the data as a text (subject: 0 to 373, text: 1 to 960)
1 to 1333: Data length (word) of a mail
(s1)[10] Subject length Specify the subject data length of the mail stored in (s2) to (s2)+n. 0 to 373 User
0 to 373: Data length (word) of subject
(s1)[11] Clock set Valid/invalid status of the data in the area starting from (s1)[12] is stored.  System
flag 0: Invalid
1: Valid
(s1)[12] Clock data Clock data at the time of error completion are stored in BCD format.  System
 (set only when errors
b15 to b8 b7 to b0
(s1)[15] occur)
s1 [12 ] Month (01H to 12H) Year (00H to 99H) Last two digits
s1 [13 ] Hour (00H to 23H) Day (01H to 31H)
s1 [14 ] Second (00H to 59H) Minute (00H to 59H)
s1 [15 ] Year (00H to 99H) First two digits Day of week (00H to 06H)
00v (Sun.) to 06H (Sat.)

• Send data
Device Item Setting data Setting Setting
range side
(s2)+0 Send data Specify the content of ((subject + attached file) or (Subject + text)) of a mail to be sent.  User

(s2)+n

5 MODULE DEDICATED INSTRUCTION


222 5.4 Network Dedicated Instruction
Program example
• The following program performs e-mail sending process by the send instruction (X20).
(The I/O signals of the Ethernet module are X/Y00 to X/Y1F)
• Sending the data as an attached file
[Structured ladder/FBD]

Sets ASCII as send


data format

Sets transmission
destination number

Sets send data


length

Sets subject length

Sets subject
5

Sets file
to be attached

Sends e-mail

Process on normal completion Normal completion

Process on error completion Error completion

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 223
[ST]
IF(X20=TRUE)THEN
MOVP(TRUE,H800,Var_ControlData[0]); (* Sets ASCII as send data format *)
MOVP(TRUE,1,Var_ControlData[2]); (* Sets transmission destination number *)
MOVP(TRUE,10,Var_ControlData[9]); (* Sets send data length *)
MOVP(TRUE,7,Var_ControlData[10]); (* Sets subject length *)

Int_Msg[0] := H6574; (* te *)
Int_Msg[1] := H7473; (* st *)
Int_Msg[2] := H616d; (* ma *)
Int_Msg[3] := H6c69; (* il *)
Int_Msg[4] := H6d20; (* m *)
Int_Msg[5] := H6573; (* se *)
Int_Msg[6] := H646e; (* nd *) (* Sets subject *)

MOVP(TRUE,H1234,Int_Msg[7]); (* Sets file to be attached *)


MOVP(TRUE,H5678,Int_Msg[8]);
MOVP(TRUE,H9ABC,Int_Msg[9]);
ZP_MSEND(TRUE,"U0",Var_ControlData,Int_Msg[0],Var_Result); (* Sends e-mail *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


224 5.4 Network Dedicated Instruction
• Sending the data as a text
[Structured ladder/FBD]

Sets text as send


data format

Sets transmission
destination number

Sets send data


length

Sets subject length

Sets subject

5
Sets text

Sends e-mail

Process on normal completion Normal completion

Process on error completion Error completion

5 MODULE DEDICATED INSTRUCTION


5.4 Network Dedicated Instruction 225
[ST]
IF(X20=TRUE)THEN
MOVP(TRUE,H1000,Var_ControlData[0]); (* Sets text as send data format *)
MOVP(TRUE,1,Var_ControlData[2]); (* Sets transmission destination number *)
MOVP(TRUE,16,Var_ControlData[9]); (* Sets send data length *)
MOVP(TRUE,7,Var_ControlData[10]); (* Sets subject length *)

Int_Msg[0] := H6574; (* te *)
Int_Msg[1] := H7473; (* st *)
Int_Msg[2] := H616d; (* ma *)
Int_Msg[3] := H6c69; (* il *)
Int_Msg[4] := H6d20; (* m *)
Int_Msg[5] := H6573; (* se *)
Int_Msg[6] := H646e; (* nd *) (* Sets subject *)

Int_Msg[7] := H7274; (* Er *)
Int_Msg[8] := H6f72; (* ro *)
Int_Msg[9] := H2072; (* r *)
Int_Msg[10] := H614d; (* Ma *)
Int_Msg[11] := H6863; (* ch *)
Int_Msg[12] := H6e69; (* in *)
Int_Msg[13] := H3165; (* e1 *)
Int_Msg[14] := H3020; (* 0 *)
Int_Msg[15] := H3130; (* 01 *) (* Sets text *)

ZP_MSEND(TRUE,"U0",Var_ControlData,Int_Msg[0],Var_Result); (* Sends e-mail *)


END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)

(* Process on normal completion *)


ELSE (* Error completion *)

(* Process on error completion *)


END_IF;
END_IF;

5 MODULE DEDICATED INSTRUCTION


226 5.4 Network Dedicated Instruction
6 PID CONTROL INSTRUCTION

6.1 PID Control Instruction (Inexact Differential)


Data setting

S(P)_PIDINIT

Structured ladder/FBD ST

S_PIDINIT
ENO:= S_PIDINIT (EN, s);
EN ENO

The following instruction can go in the dotted squares. 6


S_PIDINIT, SP_PIDINIT

■Executing condition
Instruction Executing condition
S_PIDINIT

SP_PIDINIT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Start number of the device that stores PID control ANY16
data
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   

Processing details
This instruction enables PID control by registering the PID control data for the number of loops to be used to the CPU module
in batch.

6 PID CONTROL INSTRUCTION


6.1 PID Control Instruction (Inexact Differential) 227
Setting data
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

Common setting data (device: (s)+0 to (s)+1)


(s)+0 Number of loops Set the number of loops for 1 to 32 User An error occurs and the PID
PID operation. operation for all loops is not
(s)+1 Number of loops in Set the number of loops for 1 to 32 User performed.
one scan PID operation in one scan if
multiple loops have reached
the sampling cycle time.
Setting data for No. 1 loop (device: (s)+2 to (s)+15)
(s)+2 Operational Select the PID operational 0: Forward 0: Forward User An error occurs and the PID
expression expression.*1 operation operation operation for the
selection 1: Reverse 1: Reverse corresponding loop is not
operation operation performed.
(s)+3 Sampling cycle Set the PID operation cycle. 1 to 6000 1 to 6000 User
(TS) (unit: 10ms) (unit: 10ms)
(s)+4 Proportional Proportional gain of PID 1 to 10000 1 to 10000 User
constant (KP) operation (unit: 0.01) (unit: 0.01)
(s)+5 Integral constant Constant that expresses the 1 to 32767 1 to 32767 User
(TI) magnitude of the integral (unit: 100ms) (unit: 100ms)
action (I action) effect.
Increasing the integral If setting value If setting value
constant slows down the > 30000 > 30000
manipulated value change. TI = Infinite () TI = Infinite ()
(s)+6 Derivative constant Constant that expresses the 0 to 30000 0 to 30000 User
(TD) magnitude of the derivative (unit: 10ms) (unit: 10ms)
action (D action) effect.
Increasing the derivative
constant causes a significant
change in the manipulated
value even with a slight
change of the control target.
(s)+7 Filter coefficient () Set the degree of filtering to 0 to 100 0 to 100 User
be applied to the process
value.
The filtering effect decreases
as the value gets closer to 0.
(s)+8 MV lower limit Set the lower limit for the -50 to 2050 -32768 to 32767 User In the case of "With PID
(MVLL) manipulated value (MV) limits", the PID operation is
calculated in PID operation in performed after values are
automatic mode. replaced as follows:
If the MV is less than the set • If the MVLL or MVHL is
lower limit value (MVLL), the less than -50, the value is
value is clipped to the MVLL. clipped to -50.
• If the MVLL or MVHL is
(s)+9 MV upper limit Set the upper limit for the -50 to 2050 -32768 to 32767 User
greater than 2050, the
(MVHL) manipulated value calculated
value is clipped to 2050.
in PID operation in automatic
mode.
If the MV is greater than the
set upper limit value (MVHL),
the value is clipped to the
MVHL.

6 PID CONTROL INSTRUCTION


228 6.1 PID Control Instruction (Inexact Differential)
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+10 MV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (MVL) between the previous MV limits", the PID operation is
and the present MV. performed after values are
When the MV variation is replaced as follows:
greater than the limit value, • If the MVL value is less
bit 1 (b1) of the alarm device than 0, the value is clipped
is set to '1'. to 0.
MV variation is not limited. • If the MVL value is
(Even if the MV variation greater than 2000, the
exceeds the limit value, the value is clipped to 2000.
actual MV variation is used
as it is for calculating the
MV.)
(s)+11 PV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (PVL) between the previous PV and limits", the PID operation is
the present PV. performed after values are
When the PV variation is replaced as follows:
greater than the limit value, • If the PVL value is less
bit 0 (b0) of the alarm device than 0, the value is clipped
is set to '1'. to 0.
PV variation is not limited. • If the PVL value is greater 6
(Even if the PV variation than 2000, the value is
exceeds the limit value, the clipped to 2000.
actual PV variation is used as
it is for performing the PID
operation.)
(s)+12 (Fixed value)  0 0 User 
(s)+13 Derivative gain Set a duration (delay in 0 to 32767 0 to 32767 User An error occurs and the PID
(KD) action) for derivative action. (unit: 0.01) (unit: 0.01) operation for the
As the setting value corresponding loop is not
increases, the duration If setting value If setting value performed.
becomes smaller and action > 30000 > 30000
becomes closer to exact KD = Infinite () KD = Infinite ()
differential.
Ideal value KD = 8.00
(s)+14 (Fixed value)  0 0 User 
(s)+15 (Fixed value)  0 0 User 
Setting data for No. 2 loop (device: (s)+16 to (s)+29)

6 PID CONTROL INSTRUCTION


6.1 PID Control Instruction (Inexact Differential) 229
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+16 Operational The same as Setting data for No. 1 loop


expression
selection
(s)+17 Sampling cycle
(TS)
(s)+18 Proportional
constant (KP)
(s)+19 Integral constant
(TI)
(s)+20 Derivative constant
(TD)
(s)+21 Filter coefficient ()
(s)+22 MV lower limit
(MVLL)
(s)+23 MV upper limit
(MVHL)
(s)+24 MV change rate
limit (MVL)
(s)+25 PV change rate
limit (PVL)
(s)+26 (Fixed value)
(s)+27 Derivative gain
(KD)
(s)+28 (Fixed value)
(s)+29 (Fixed value)
Setting data for No. n loop
(s)+(m+0) Operational The same as Setting data for No. 1 loop
expression m=(n-1)14+2
selection n: number of loops
(s)+(m+1) Sampling cycle
(TS)
(s)+(m+2) Proportional
constant (KP)
(s)+(m+3) Integral constant
(TI)
(s)+(m+4) Derivative constant
(TD)
(s)+(m+5) Filter coefficient ()
(s)+(m+6) MV lower limit
(MVLL)
(s)+(m+7) MV upper limit
(MVHL)
(s)+(m+8) MV change rate
limit (MVL)
(s)+(m+9) PV change rate
limit (PVL)
(s)+(m+10) (Fixed value)
(s)+(m+11) Derivative gain
(KD)
(s)+(m+12) (Fixed value)
(s)+(m+13) (Fixed value)

*1 For the PID operational expression set in the operational expression selection, refer to the following.
 MELSEC-Q/L/QnA Programming Manual (PID Control Instructions)

6 PID CONTROL INSTRUCTION


230 6.1 PID Control Instruction (Inexact Differential)
Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential).
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU
The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


6.1 PID Control Instruction (Inexact Differential) 231
PID operation

S(P)_PIDCONT

Structured ladder/FBD ST

S_PIDCONT
ENO:= S_PIDCONT (EN, s);
EN ENO

The following instruction can go in the dotted squares.


S_PIDCONT, SP_PIDCONT

■Executing condition
Instruction Executing condition
S_PIDCONT

SP_PIDCONT

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Start number of the device that is assigned in I/O ANY16
data area
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   

Processing details
• This instruction measures sampling cycle and performs PID operation at instruction execution.
• This instruction performs PID operation based on the set value (SV) and process value (PV) in the I/O data area set to the
device number specified by (s) or later, and stores the operation result to the automatic manipulated value (MV) area in the
I/O data area.
• PID operation is performed in response to the first execution of the PIDCONT instruction after the set sampling cycle time
has elapsed.

6 PID CONTROL INSTRUCTION


232 6.1 PID Control Instruction (Inexact Differential)
Setting data
Device Data name Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+0 Initial processing flag Processing method at the 0: PID operation for the number of loops User 
start of PID operation to be used is batch-processed in one
scan.
Other than 0: PID operation for the
number of loops to be used is processed
in several scans.
(s)+1 PID control work area    
 (reserved by the system)
(s)+9
I/O data area for No. 1 loop (device: (s)+10 to (s)+27)
(s)+10 Setting SV • PID control target value 0 to 2000 -32768 to 32767 User In the case of "With PID
value limits", the PID operation is
performed after values are
replaced as follows:
• If SV is less than 0, the
value is clipped to 0.
• If SV is greater than 2000,
the value is clipped to
6
2000.
(s)+11 Process PV • Feedback data from the -50 to 2050 -32768 to 32767 User In the case of "With PID
value control target to the A/D limits", the PID operation is
conversion module performed after values are
replaced as follows:
• If PV is less than -50, the
value is clipped to -50.
• If PV is greater than 2050,
the value is clipped to
2050.
(s)+12 Automatic MV • Manipulated value -50 to 2050 -32768 to 32767 System 
manipulated obtained by PID operation
value • The value is output from
the D/A conversion
module to the control
target.
(s)+13 Process PVf • Process value obtained by -50 to 2050 -32768 to 32767 System 
value after calculation using
filtering operational expression.*1
(s)+14 Manual MVMAN • Store the data output from -50 to 2050 -32768 to 32767 User In the case of "With PID
manipulated the D/A conversion limits", the PID operation is
value module in manual performed after values are
operation. replaced as follows:
• If MVMAN is less than -50,
the value is clipped to -50.
• If MVMAN is greater than
2050, the value is clipped
to 2050.
(s)+15 Manual/ MAN/ • Select whether the output 0: Automatic manipulated value User When other than 0 or 1 is
automatic AUTO to the D/A conversion 1: Manual manipulated value selected, an error occurs and
selection module is a manual the operation for the
manipulated value or an corresponding loop is not
automatic manipulated performed.
value.
• In manual operation, the
automatic manipulated
value remains
unchanged.

6 PID CONTROL INSTRUCTION


6.1 PID Control Instruction (Inexact Differential) 233
Device Data name Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+16 Alarm ALARM • Used to determine if the User 


b15 … b1 b0
change rate of the MV
0 (2) (1)
(manipulated value) and System
the PV (process value) is When the MV variation is outside the limit
within or outside the limit range, bit 1 (b1) is set to '1'.
value range. When the PV variation is outside the limit
• Once set, the alarm data range, bit 0 (b0) is set to '1'.
are maintained until the
user resets it.
(s)+17 PID control work area   
 (reserved by the system)
(s)+32
I/O data area for No. 2 loop (device: (s)+28 to (s)+45)
(s)+33 Setting SV The same as I/O data area for No. 1 loop
value
(s)+34 Process PV
value
(s)+35 Automatic MV
manipulated
value
(s)+36 Process PVf
value after
filtering
(s)+37 Manual MVMAN
manipulated
value
(s)+38 Manual/ MAN/
automatic AUTO
selection
(s)+39 Alarm ALARM
(s)+40 PID control work area   
 (reserved by the system)
(s)+55
I/O data area for No. n loop
(s)+(m+0) Setting SV The same as I/O data area for No. 1 loop
value m=(n-1)  23+10
n: number of loops
(s)+(m+1) Process PV
value
(s)+(m+2) Automatic MV
manipulated
value
(s)+(m+3) Process PVf
value after
filtering
(s)+(m+4) Manual MVMAN
manipulated
value
(s)+(m+5) Manual/ MAN/
automatic AUTO
selection
(s)+(m+6) Alarm ALARM
(s)+(m+7) PID control work area   
 (reserved by the system)
(s)+(m+22)

*1 For process value after filtering (PVf), the value calculated based on the process value of input data are stored.
For the operational expression, refer to the following.
 MELSEC-Q/L/QnA Programming Manual (PID Control Instructions)

6 PID CONTROL INSTRUCTION


234 6.1 PID Control Instruction (Inexact Differential)
Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential).
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU
The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


6.1 PID Control Instruction (Inexact Differential) 235
PIDSTOP instruction and PIDRUN instruction

S_PIDSTOP, S_PIDRUN

Structured ladder/FBD ST

S_PIDSTOP
ENO:= S_PIDSTOP (EN, n);
EN ENO

The following instruction can go in the dotted squares.


S_PIDSTOP, SP_PIDSTOP, S_PIDRUN, SP_PIDRUN

■Executing condition
Instruction Executing condition
S_PIDSTOP, S_PIDRUN

SP_PIDSTOP, SP_PIDRUN

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n Loop number for stop/start ANY16
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(n)    

Processing details
• S(P)_PIDSTOP
This instruction stops the PID operation for the loop number specified by 'n'.
• S(P)_PIDRUN
This instruction starts the PID operation for the loop number specified by 'n'.

Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential).
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU
The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


236 6.1 PID Control Instruction (Inexact Differential)
Operation parameter change

S(P)_PIDPRMW

Structured ladder/FBD ST
S_PIDPRMW

EN ENO
ENO:= S_PIDPRMW (EN, n, s);
n

The following instruction can go in the dotted squares.


S_PIDPRMW, SP_PIDPRMW

■Executing condition
Instruction Executing condition
S_PIDPRMW

SP_PIDPRMW
6

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n Loop number to be changed ANY16
s Start number of the device that stores PID control ANY16
data to be changed
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(n)     
(s)     

Processing details
This instruction changes the operation parameter of the loop number specified by 'n' to the PID control data stored in the
devices starting from the device number specified by (s).

6 PID CONTROL INSTRUCTION


6.1 PID Control Instruction (Inexact Differential) 237
Setting data
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+0 Operational Select the PID operational 0: Forward 0: Forward User An error occurs and the PID
expression expression.*1 operation operation operation for the
selection 1: Reverse 1: Reverse corresponding loop is not
operation operation performed.
(s)+1 Sampling cycle Set the PID operation cycle. 1 to 6000 1 to 6000 User
(TS) (unit: 10ms) (unit: 10ms)
(s)+2 Proportional Proportional gain of PID 1 to 10000 1 to 10000 User An error occurs and the PID
constant (KP) operation (unit: 0.01) (unit: 0.01) operation for the
corresponding loop is not
(s)+3 Integral constant Constant that expresses the 1 to 32767 1 to 32767 User
performed.
(TI) magnitude of the integral (unit: 100ms) (unit: 100ms)
action (I action) effect.
Increasing the integral If setting value If setting value
constant slows down the > 30000 > 30000
manipulated value change. TI = Infinite () TI = Infinite ()
(s)+4 Derivative constant Constant that expresses the 0 to 30000 0 to 30000 User
(TD) magnitude of the derivative (unit: 10ms) (unit: 10ms)
action (D action) effect.
Increasing the derivative
constant causes significant
changes in the manipulated
value even with a slight
change of the control target.
(s)+5 Filter coefficient () Set the degree of filtering to 0 to 100 0 to 100 User
be applied to the process
value.
The filtering effect decreases
as the value gets closer to 0.
(s)+6 MV lower limit Set the lower limit for the -50 to 2050 -32768 to 32767 User In the case of "With PID
(MVLL) manipulated value (MV) limits", the PID operation is
calculated in PID operation in performed after values are
automatic mode. replaced as follows:
If the MV is less than the set • If MVLL or MVHL value is
lower limit value (MVLL), the less than -50, the value is
value is clipped to the MVLL. clipped to -50.
• If MVLL or MVHL value is
(s)+7 MV upper limit Set the upper limit for the -50 to 2050 -32768 to 32767 User
greater than 2050, the
(MVHL) manipulated value calculated
in PID operation in automatic value is clipped to 2050.
mode.
If the MV is greater than the
set upper limit value (MVHL),
the value is clipped to the
MVHL.
(s)+8 MV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (MVL) between the previous MV limits", the PID operation is
and the present MV. performed after values are
When the MV variation is replaced as follows:
greater than the limit value, • If the MVL value is less
bit 1 (b1) of the alarm device than 0, the value is clipped
is set to '1'. to 0.
MV variation is not limited. • If the MVL value is
(Even if the MV variation greater than 2000, the
exceeds the limit value, the value is clipped to 2000.
actual MV variation is used
as it is for calculating the
MV.)

6 PID CONTROL INSTRUCTION


238 6.1 PID Control Instruction (Inexact Differential)
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+9 PV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (PVL) between the previous PV and limits", the PID operation is
the present PV. performed after values are
When the PV variation is replaced as follows:
greater than the limit value, • If the PVL value is less
bit 0 (b0) of the alarm device than 0, the value is clipped
is set to '1'. to 0.
PV variation is not limited. • If the PVL value is greater
(Even if the PV variation than 2000, the value is
exceeds the limit value, the clipped to 2000.
actual PV variation is used as
it is for performing the PID
operation.)
(s)+10 (Fixed value)  0 0 User 
(s)+11 Derivative gain Set a duration (delay in 0 to 32767 0 to 32767 User An error occurs and the PID
(KD) action) for derivative action. (unit: 0.01) (unit: 0.01) operation for the
As the setting value corresponding loop is not
increases, the duration If setting value > If setting value > performed.
becomes smaller and action 30000 30000
becomes closer to exact
differential.
KD = Infinite () KD = Infinite ()
6
Ideal value KD = 8.00
(s)+12 (Fixed value)  0 0 User 
(s)+13 (Fixed value)  0 0 User 

*1 For the PID operational expression set in the operational expression selection, refer to the following.
 MELSEC-Q/L/QnA Programming Manual (PID Control Instructions)

Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential).
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU
The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


6.1 PID Control Instruction (Inexact Differential) 239
6.2 PID Control Instruction (Exact Differential)
Data setting

PIDINIT(P)

Structured ladder/FBD ST

PIDINIT
ENO:= PIDINIT (EN, s);
EN ENO

The following instruction can go in the dotted squares.


PIDINIT, PIDINITP

■Executing condition
Instruction Executing condition
PIDINIT

PIDINITP

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Start number of the device that stores PID control ANY16
data
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   

Processing details
This instruction enables PID control by registering the PID control data for the number of loops to be used to the CPU module
in batch.

6 PID CONTROL INSTRUCTION


240 6.2 PID Control Instruction (Exact Differential)
Setting data
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

Common setting data (device: (s)+0 to (s)+1)


(s)+0 Number of loops Set the number of loops for 1 to 32 User An error occurs and the PID
PID operation. operation for all loops is not
(s)+1 Number of loops in Set the number of loops for 1 to 32 User performed.
one scan PID operation in one scan if
multiple loops have reached
the sampling cycle time.
Setting data for No. 1 loop (device: (s)+2 to (s)+11)
(s)+2 Operational Select the PID operational 0: Forward 0: Forward User An error occurs and the PID
expression expression.*1 operation operation operation for the
selection 1: Reverse 1: Reverse corresponding loop is not
operation operation performed.
(s)+3 Sampling cycle Set the PID operation cycle. 1 to 6000 1 to 6000 User
(TS) (unit: 10ms) (unit: 10ms)
(s)+4 Proportional Proportional gain of PID 1 to 10000 1 to 10000 User
constant (KP) operation (unit: 0.01) (unit: 0.01) 6
(s)+5 Integral constant Constant that expresses the 1 to 32767 1 to 32767 User
(TI) magnitude of the integral (unit: 100ms) (unit: 100ms)
action (I action) effect.
Increasing the integral If setting value If setting value
constant slows down the > 30000 > 30000
manipulated value change. TI = Infinite () TI = Infinite ()
(s)+6 Derivative constant Constant that expresses the 0 to 30000 0 to 30000 User
(TD) magnitude of the derivative (unit: 10ms) (unit: 10ms)
action (D action) effect.
Increasing the derivative
constant causes a significant
changes in the manipulated
value even with a slight
change of the control target.
(s)+7 Filter coefficient () Set the degree of filtering to 0 to 100 0 to 100 User
be applied to the process
value.
The filtering effect decreases
as the value gets closer to 0.
(s)+8 MV lower limit Set the lower limit for the -50 to 2050 -32768 to 32767 User In the case of "With PID
(MVLL) manipulated value (MV) limits", the PID operation is
calculated in PID operation in performed after values are
automatic mode. replaced as follows:
If the MV is less than the set • If MVLL or MVHL value is
lower limit value (MVLL), the less than -50, the value is
value is clipped to the MVLL. clipped to -50.
• If MVLL or MVHL value is
(s)+9 MV upper limit Set the upper limit for the -50 to 2050 -32768 to 32767 User
greater than 2050, the
(MVHL) manipulated value calculated
value is clipped to 2050.
in PID operation in automatic
mode.
If the MV is greater than the
set upper limit value (MVHL),
the value is clipped to the
MVHL.

6 PID CONTROL INSTRUCTION


6.2 PID Control Instruction (Exact Differential) 241
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+10 MV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (MVL) between the previous MV limits", the PID operation is
and the present MV. performed after values are
When the MV variation is replaced as follows:
greater than the limit value, • If the MVL value is less
bit 1 (b1) of the alarm device than 0, the value is clipped
is set to '1'. to 0.
MV variation is not limited. • If the MVL value is
(Even if the MV variation greater than 2000, the
exceeds the limit value, the value is clipped to 2000.
actual MV variation is used
as it is for calculating the
MV.)
(s)+11 PV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (PVL) between the previous PV and limits", the PID operation is
the present PV. performed after values are
When the PV variation is replaced as follows:
greater than the limit value, • If the PVL value is less
bit 0 (b0) of the alarm device than 0, the value is clipped
is set to '1'. to 0.
PV variation is not limited. • If the PVL value is greater
(Even if the PV variation than 2000, the value is
exceeds the limit value, the clipped to 2000.
actual PV variation is used as
it is for performing the PID
operation.)
Setting data for No. 2 loop (device: (s)+12 to (s)+21)
(s)+12 Operational The same as Setting data for No. 1 loop
expression
selection
(s)+13 Sampling cycle
(TS)
(s)+14 Proportional
constant (KP)
(s)+15 Integral constant
(TI)
(s)+16 Derivative constant
(TD)
(s)+17 Filter coefficient ()
(s)+18 MV lower limit
(MVLL)
(s)+19 MV upper limit
(MVHL)
(s)+20 MV change rate
limit (MVL)
(s)+21 PV change rate
limit (PVL)
Setting data for No. n loop

6 PID CONTROL INSTRUCTION


242 6.2 PID Control Instruction (Exact Differential)
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+(m+0) Operational The same as Setting data for No. 1 loop


expression m=(n-1)10+2
selection n: number of loops
(s)+(m+1) Sampling cycle
(TS)
(s)+(m+2) Proportional
constant (KP)
(s)+(m+3) Integral constant
(TI)
(s)+(m+4) Derivative constant
(TD)
(s)+(m+5) Filter coefficient ()
(s)+(m+6) MV lower limit
(MVLL)
(s)+(m+7) MV upper limit
(MVHL)
(s)+(m+8) MV change rate

(s)+(m+9)
limit (MVL)
PV change rate
6
limit (PVL)

*1 For the PID operational expression set in the operational expression selection, refer to the following.
 MELSEC-Q/L/QnA Programming Manual (PID Control Instructions)

Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential).
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


6.2 PID Control Instruction (Exact Differential) 243
PID operation

PIDCONT(P)

Structured ladder/FBD ST

PIDCONT
ENO:= PIDCONT (EN, s);
EN ENO

The following instruction can go in the dotted squares.


PIDCONT, PIDCONTP

■Executing condition
Instruction Executing condition
PIDCONT

PIDCONTP

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Start number of the device that is assigned in I/O ANY16
data area
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   

Processing details
• This instruction measures sampling cycle and performs PID operation at instruction execution.
• This instruction performs PID operation based on the set value (SV) and process value (PV) in the I/O data area set to the
device number specified by (s) or later, and stores the operation result to the automatic manipulated value (MV) area in the
I/O data area.
• PID operation is performed in response to the first execution of the PIDCONT instruction after the set sampling cycle time
has elapsed.

6 PID CONTROL INSTRUCTION


244 6.2 PID Control Instruction (Exact Differential)
Setting data
Device Data name Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+0 Initial processing flag Processing method at the 0: PID operation for the number of loops User 
start of PID operation to be used is batch-processed in one
scan.
Other than 0: PID operation for the
number of loops to be used is processed
in several scans.
(s)+1 PID control work area    
 (reserved by the system)
(s)+9
I/O data area for No. 1 loop (device: (s)+10 to (s)+27)
(s)+10 Setting SV • PID control target value 0 to 2000 -32768 to 32767 User In the case of "With PID
value limits", the PID operation is
performed after values are
replaced as follows:
• If SV is less than 0, the
value is clipped to 0.
• If SV is greater than 2000,
the value is clipped to
6
2000.
(s)+11 Process PV • Feedback data from the -50 to 2050 -32768 to 32767 User In the case of "With PID
value control target to the A/D limits", the PID operation is
conversion module performed after values are
replaced as follows:
• If PV is less than -50, the
value is clipped to -50.
• If PV is greater than 2050,
the value is clipped to
2050.
(s)+12 Automatic MV • Manipulated value -50 to 2050 -32768 to 32767 System 
manipulated obtained by PID operation
value • The value is output from
the D/A conversion
module to the control
target.
(s)+13 Process PVf • Process value obtained by -50 to 2050 -32768 to 32767 System 
value after calculation using
filtering operational expression.*1
(s)+14 Manual MVMAN • Store the data output from -50 to 2050 -32768 to 32767 User In the case of "With PID
manipulated the D/A conversion limits", the PID operation is
value module in manual performed after values are
operation. replaced as follows:
• If MVMAN is less than -50,
the value is clipped to -50.
• If MVMAN is greater than
2050, the value is clipped
to 2050.
(s)+15 Manual/ MAN/ • Select whether the output 0: Automatic manipulated value User When other than 0 or 1 is
automatic AUTO to the D/A conversion 1: Manual manipulated value selected, an error occurs and
selection module is a manual the operation for the
manipulated value or an corresponding loop is not
automatic manipulated performed.
value.
• In manual operation, the
automatic manipulated
value remains
unchanged.

6 PID CONTROL INSTRUCTION


6.2 PID Control Instruction (Exact Differential) 245
Device Data name Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+16 Alarm ALARM • Used to determine if the User 


b15 … b1 b0
change rate of the MV
0 (2) (1)
(manipulated value) and System
the PV (process value) is When the MV variation is outside the limit
within or outside the limit range, bit 1 (b1) is set to '1'.
value range. When the PV variation is outside the limit
• Once set, the alarm data range, bit 0 (b0) is set to '1'.
are maintained until the
user resets it.
(s)+17 PID control work area   
 (reserved by the system)
(s)+27
I/O data area for No. 2 loop (device: (s)+28 to (s)+45)
(s)+28 Setting SV The same as I/O data area for No. 1 loop
value
(s)+29 Process PV
value
(s)+30 Automatic MV
manipulated
value
(s)+31 Process PVf
value after
filtering
(s)+32 Manual MVMAN
manipulated
value
(s)+33 Manual/ MAN/
automatic AUTO
selection
(s)+34 Alarm ALARM
(s)+35 PID control work area   
 (reserved by the system)
(s)+45
I/O data area for No. n loop
(s)+(m+0) Setting SV The same as I/O data area for No. 1 loop
value m=(n-1)  18+10
n: number of loops
(s)+(m+1) Process PV
value
(s)+(m+2) Automatic MV
manipulated
value
(s)+(m+3) Process PVf
value after
filtering
(s)+(m+4) Manual MVMAN
manipulated
value
(s)+(m+5) Manual/ MAN/
automatic AUTO
selection
(s)+(m+6) Alarm ALARM
(s)+(m+7) PID control work area   
 (reserved by the system)
(s)+(m+17)

*1 For process value after filtering (PVf), the value calculated based on the process value of input data are stored.
For the operational expression, refer to the following.
 MELSEC-Q/L/QnA Programming Manual (PID Control Instructions)

6 PID CONTROL INSTRUCTION


246 6.2 PID Control Instruction (Exact Differential)
Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential).
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU
The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


6.2 PID Control Instruction (Exact Differential) 247
PIDSTOP instruction and PIDRUN instruction

PIDSTOP, PIDRUN

Structured ladder/FBD ST

PIDSTOP
ENO:= PIDSTOP (EN, n);
EN ENO

The following instruction can go in the dotted squares.


PIDSTOP, PIDSTOPP, PIDRUN, PIDRUNP

■Executing condition
Instruction Executing condition
PIDSTOP, PIDRUN

PIDSTOPP, PIDRUNP

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n Loop number for stop/start ANY16
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(n)  

Processing details
• PIDSTOP(P)
This instruction stops the PID operation for the loop number specified by 'n'.
• PIDRUN(P)
This instruction starts the PID operation for the loop number specified by 'n'.

Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential).
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU
The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


248 6.2 PID Control Instruction (Exact Differential)
Operation parameter change

PIDPRMW(P)

Structured ladder/FBD ST
PIDPRMW

EN ENO
ENO:= PIDPRMW (EN, n, s);
n

The following instruction can go in the dotted squares.


PIDPRMW, PIDPRMWP

■Executing condition
Instruction Executing condition
PIDPRMW

PIDPRMWP
6

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n Loop number to be changed ANY16
s Start number of the device that stores PID control ANY16
data to be changed
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(n)     
(s)     

Processing details
This instruction changes the operation parameter of the loop number specified by 'n' to the PID control data stored in the
devices starting from the device number specified by (s).

6 PID CONTROL INSTRUCTION


6.2 PID Control Instruction (Exact Differential) 249
Setting data
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+0 Operational Select the PID operational 0: Forward 0: Forward User An error occurs and the PID
expression expression.*1 operation operation operation for the
selection 1: Reverse 1: Reverse corresponding loop is not
operation operation performed.
(s)+1 Sampling cycle Set the PID operation cycle. 1 to 6000 1 to 6000 User
(TS) (unit: 10ms) (unit: 10ms)
(s)+2 Proportional Proportional gain of PID 1 to 10000 1 to 10000 User An error occurs and the PID
constant (KP) operation (unit: 0.01) (unit: 0.01) operation for the
corresponding loop is not
(s)+3 Integral constant Constant that expresses the 1 to 32767 1 to 32767 User
performed.
(TI) magnitude of the integral (unit: 100ms) (unit: 100ms)
action (I action) effect.
Increasing the integral If setting value If setting value
constant slows down the > 30000 > 30000
manipulated value change. TI = Infinite () TI = Infinite ()
(s)+4 Derivative constant Constant that expresses the 0 to 30000 0 to 30000 User
(TD) magnitude of the derivative (unit: 10ms) (unit: 10ms)
action (D action) effect.
Increasing the derivative
constant causes significant
changes in the manipulated
value even with a slight
change of the control target.
(s)+5 Filter coefficient () Set the degree of filtering to 0 to 100 0 to 100 User
be applied to the process
value.
The filtering effect decreases
as the value gets closer to 0.
(s)+6 MV lower limit Set the lower limit for the -50 to 2050 -32768 to 32767 User In the case of "With PID
(MVLL) manipulated value (MV) limits", the PID operation is
calculated in PID operation in not performed after values
automatic mode. are replaced as follows:
If the MV is less than the set • If MVLL or MVHL value is
lower limit value (MVLL), the less than -50, the value is
value is clipped to the MVLL. clipped to -50.
• If MVLL or MVHL value is
(s)+7 MV upper limit Set the upper limit for the -50 to 2050 -32768 to 32767 User
greater than 2050, the
(MVHL) manipulated value calculated
in PID operation in automatic value is clipped to 2050.
mode.
If the MV is greater than the
set upper limit value (MVHL),
the value is clipped to the
MVHL.
(s)+8 MV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (MVL) between the previous MV limits", the PID operation is
and the present MV. performed after values are
When the MV variation is replaced as follows:
greater than the limit value, • MVL value is less than 0,
bit 1 (b1) of the alarm device the value is clipped to 0.
is set to '1'. • MVL value is greater than
MV variation is not limited. 2000, the value is clipped
(Even if the MV variation to 2000.
exceeds the limit value, the
actual MV variation is used
as it is for calculating the
MV.)

6 PID CONTROL INSTRUCTION


250 6.2 PID Control Instruction (Exact Differential)
Device Data item Description Setting range Setting Processing when the
With PID limits Without PID side setting data are outside
limits the setting range

(s)+9 PV change rate Set the variation limit 0 to 2000 -32768 to 32767 User In the case of "With PID
limit (PVL) between the previous PV and limits", the PID operation is
the present PV. performed values are
When the PV variation is replaced as follows:
greater than the limit value, • If the PVL value is less
bit 0 (b0) of the alarm device than 0, the value is clipped
is set to '1'. to 0.
PV variation is not limited. • If the PVL value is greater
(Even if the PV variation than 2000, the value is
exceeds the limit value, the clipped to 2000.
actual PV variation is used as
it is for performing the PID
operation.)

*1 For the PID operational expression set in the operational expression selection, refer to the following.
 MELSEC-Q/L/QnA Programming Manual (PID Control Instructions)

Precautions
The following table shows the CPU modules applicable to the PID control instructions (inexact differential) and the PID control
instructions (exact differential). 6
CPU module model Inexact differential Exact differential
Basic model QCPU The first five digits of the serial number are '04121' or lower.  
The first five digits of the serial number are '04122' or higher  
High Performance model The first five digits of the serial number are '05031' or lower.  
QCPU The first five digits of the serial number are '05032' or higher.  
Redundant CPU  
Universal model QCPU  
LCPU  

: Applicable, : Not applicable

6 PID CONTROL INSTRUCTION


6.2 PID Control Instruction (Exact Differential) 251
7 SOCKET COMMUNICATION FUNCTION
INSTRUCTION
7.1 Opening/Closing Connection

SP_SOCOPEN
QnUDE(H) LCPU

Structured ladder/FBD ST
SP_SOCOPEN

EN ENO
ENO:= SP_SOCOPEN (EN, Un, s1, s2, d);
Un d

s1

s2

The following instruction can go in the dotted squares.


SP_SOCOPEN

■Executing condition
Instruction Executing condition
SP_SOCOPEN

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..9]
Output argument ENO Execution result Bit
d Variable that turns ON during one scan upon Array of bit [0..1]
completion of the instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)  *1  *1
  
(d) *1  *1   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction establishes a connection.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


252 7.1 Opening/Closing Connection
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] Execution type/Completion type Specify which to use the parameter values set by GX Works2 0000H User
or the setting values of the following control data ((s2)[2] to 8000H
(s2)[9]) at open processing of a connection.
0000H: Uses the parameter set in [Open settings] of GX
Works2.
8000H: Uses the settings of control data (s2)[2] to (s2)[9].
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s2)[2] Application setting area (Refer to the User
b15 b14 … b9 b8 … b0 left.)
(3) 0 (2) (1) 0

(1) Communication method (protocol) (b8)


0: TCP/IP
1: UDP/IP
(2) With/without procedure in socket communication function
(b9)
1: Nonprocedural communication
(3) Open system (b15, b14)
00: Active open or UDP/IP
10: Unpassive open
11: Fullpassive open
(s2)[3] Host station port No. Specify the port number of the host station. 1H to 1387H User
1392H to FFFEH 7
(400H or later is
recommended)
(s2)[4] Destination IP address*2 Specify the IP address of the external device. 1H to User
(s2)[5] FFFFFFFFH
(FFFFFFFFH :
broadcast)
(s2)[6] Destination port No.*2 Specify the port number of the external device. 1H to FFFFH User
(FFFFH:
broadcast)
(s2)[7] to  Unavailable  System
(s2)[9]

*2 "Destination IP address" and "Destination port No" are neglected at Unpassive open.

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.1 Opening/Closing Connection 253
Program example
• The following program opens the connection 1.
[Structured ladder/FBD]

Sets execution
type/completion
type to 0H
Establishes
the connection
number 1

Turns normal
completion flag ON

Turns error
completion flag ON

[ST]
IF((LDP( TRUE, Var_Flag_Inst ))
&(SD1282.0=FALSE) &(SD1284.0=FALSE) &(SD1288.A=TRUE))THEN
MOVP(TRUE, H0, Var_ControlData[0]); (* Sets execution type/completion type to 0H *)
SP_SOCOPEN( TRUE, "00", 1, Var_ControlData, Var_Result ); (* Establishes the connection number 1 *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET( FALSE, Var_Flag_Normal ); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


254 7.1 Opening/Closing Connection
SP_SOCCLOSE
QnUDE(H) LCPU

Structured ladder/FBD ST
SP_SOCCLOSE

EN ENO
ENO:= SP_SOCCLOSE (EN, Un, s1, s2, d);
Un d

s1

s2

The following instruction can go in the dotted squares.


SP_SOCCLOSE

■Executing condition
Instruction Executing condition
SP_SOCCLOSE

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit 7
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 (0..1)
Output argument ENO Execution result Bit
d Variable that turns ON during one scan upon Array of bit [0..1]
completion of the instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)  *1 *1   
(d) *1  *1   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction shuts off a specified connection.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.1 Opening/Closing Connection 255
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

Program example
• The following program shuts off the connection 1 when the disconnect request flag turns ON or the external device closes
the connection 1.
[Structured ladder/FBD]

Turns flag ON when


open completion
signal turns OFF
Shuts off the
connection number 1

Turns execution
flag ON

Turns normal
completion flag ON

Turns error
completion flag ON

Turns execution
flag OFF

[ST]
IF((LDF( TRUE, SD1282.0 ))
&(SD1284.0=TRUE))THEN (* When open completion signal turns OFF *)
PLS(TRUE, Var_Flag); (* Turns flag ON *)
END_IF;

IF(((LDP(TRUE, Var_Flag_Inst) & SD1282.0) OR Var_Flag) & (NOT Var_Flag_Exe)) THEN


SP_SOCCLOSE(TRUE, "00", 1, Var_ControlData, Var_Result); (* Shuts off the connection number 1 *)
SET(TRUE, Var_Flag_Exe); (* Turns execution flag ON *)
ELSE
SP_SOCCLOSE(FALSE, "00", 1, Var_ControlData, Var_Result);
SET(FALSE, Var_Flag_Exe);
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN
SET(FALSE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
RST(TRUE, Var_Flag_Exe); (* Turns execution flag OFF *)
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


256 7.1 Opening/Closing Connection
7.2 SOCRCV Instruction

SP_SOCRCV
QnUDE(H) LCPU

Structured ladder/FBD ST
SP_SOCRCV

EN ENO
ENO:= SP_SOCRCV (EN, Un, s1, s2, d1, d2);
Un d1

s1 d2

s2

The following instruction can go in the dotted squares.


SP_SOCRCV

■Executing condition
Instruction Executing condition
SP_SOCRCV

■Argument 7
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..1]
Output argument ENO Execution result Bit
d1 Start number of the device that stores receive data ANY16
d2 Variable that turns ON during one scan upon Array of bit [0..1]
completion of the instruction
d2[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)  *1 *1   
(d1)  *1 *1   
(d2) *1  *1   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction reads receive data of a specified connection from the socket communication receive data area at the end
process performed after the instruction execution.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.2 SOCRCV Instruction 257
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

Device Item Setting data Setting range Setting side


(d1)+0 Receive data length Data length of the data read from the socket communication 0 to 2046 System
receive data area is stored.
(number of bytes)
(d1)+1 to Receive data Data read from the socket communication receive data area  System
(d1)+n are stored in ascending address order.

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

Program example
• The following program reads data received from the external device.
[Structured ladder/FBD]

Reads data from


the connection
number 1

Turns normal
completion flag ON

Turns error
completion flag OFF

[ST]
IF((Var_Flag_Inst=TRUE) &(SD1282.0=TRUE) &(SD1286.0=TRUE) &(Var_Result[0]=FALSE))THEN
SP_SOCRCV ( TRUE, "U0", 1, Var_ControlData, D500, Var_Result ); (* Reads data from the connection number 1 *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


258 7.2 SOCRCV Instruction
S_SOCRCVS
QnUDE(H) LCPU

Structured ladder/FBD ST
S_SOCRCVS

EN ENO
ENO:= S_SOCRCVS (EN, Un, s, d);
Un d

The following instruction can go in the dotted squares.


S_SOCRCVS

■Executing condition
Instruction Executing condition
S_SOCRCVS

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit 7
Un Dummy ("U0") String
s Connection number (1 to 16) ANY16
Output argument ENO Execution result Bit
d Start number of the device that stores receive data ANY16

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s)      
(d)      

Processing details
This instruction reads receive data of a specified connection from the socket communication receive data area.

Setting data
Device Item Setting data Setting range Setting side
(d)+0 Receive data length Data length of the data read from the socket communication 0 to 2046 System
receive data area is stored.
(number of bytes)
(d)+1 to (d)+(n) Receive data Data read from the socket communication receive data area  System
are stored in ascending address order.

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.2 SOCRCV Instruction 259
Program example
• The following program reads data received from the external device.
[Structured ladder/FBD]

Reads data from


the connection
number 1

[ST]
IF((Var_Flag_Inst=TRUE) &(SD1282.0=TRUE) &(SD1286.0=TRUE) )THEN
S_SOCRCVS( TRUE, "U0", 1, D5000 ); (* Reads data from the connection number 1 *)
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


260 7.2 SOCRCV Instruction
7.3 Sending Data

SP_SOCSND
QnUDE(H) LCPU

Structured ladder/FBD ST
SP_SOCSND

EN ENO
ENO:= SP_SOCSND (EN, Un, s1, s2, s3, d);
Un d
s1
s2
s3

The following instruction can go in the dotted squares.


SP_SOCSND

■Executing condition
Instruction Executing condition
SP_SOCSND

■Argument 7
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..1]
s3 Start number of the device that stores send data ANY16
Output argument ENO Execution result Bit
d Variable that turns ON during one scan upon Array of bit [0..1]
completion of the instruction
d[1] also turns ON at the time of error completion.

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)  *1 *1   
(s3)      
(d) *1  *1   

*1 Local devices and file registers per program cannot be used as setting data.

Processing details
This instruction sends data to the external device of a specified connection.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.3 Sending Data 261
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

Device Item Setting data Setting range Setting side


(s3)+0 Send data length Data length of the data read from the fixed buffer data area is 0 to 2046 User
stored.
(number of bytes)
(s3)+1 to Send data Specify the send data.  User
(s3)+n

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


262 7.3 Sending Data
Program example
• The following program sends data (1234, 5678, and 8901) to the external device using the socket communication function.
[Structured ladder/FBD]

Sets data length


by the byte

Sets send data

Sends data to
the connection
number 1

Turns normal
completion flag ON

Turns error
7
completion flag ON

[ST]
IF((Var_Flag_Inst=TRUE)&(SD1282.0=TRUE))THEN
MOVP(TRUE, 6, Var_SendData[0]); (* Sets data length by the byte *)
MOVP(TRUE, 1234, Var_SendData[1]); (* Sets send data *)
MOVP(TRUE, 5678, Var_SendData[2]);
MOVP(TRUE, 8901, Var_SendData[3]);
SP_SOCSND( TRUE, "00", 1, Var_ControlData, Var_SendData[0], Var_Result ); (* Sends data to the connection number 1 *)
END_IF;

IF(Var_Result[0]=TRUE)THEN (* Execution finished *)


IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(FALSE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag OFF *)
END_IF;
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.3 Sending Data 263
7.4 SOCCINF Instruction

SP_SOCCINF
QnUDE(H) LCPU

Structured ladder/FBD ST
SP_SOCCINF

EN ENO
ENO:= SP_SOCCINF (EN, Un, s1, s2, d);
Un d

s1

s2

The following instruction can go in the dotted squares.


SP_SOCCINF

■Executing condition
Instruction Executing condition
SP_SOCCINF

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..1]
Output argument ENO Execution result Bit
d Variable that stores connection information Array of ANY16 [0..4]

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)      
(d)      

Processing details
This instruction reads connection information of a specified connection.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


264 7.4 SOCCINF Instruction
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

Device Item Setting data Setting range Setting side


(d)[0] Destination IP address The IP address of the external device is stored. 1H to System
(d)[1] FFFFFFFFH
0H : No
destination
(FFFFFFFFH :
broadcast)
(d)[2] Destination port No. The port number of the external device is stored. 1H to FFFFH System
(FFFFH:
broadcast)
(d)[3] Host station port No. The port number of the host station is stored. 1H to 1387H System
1392H to FFFEH
(d)[4] Application setting area  System
b15 b14 … b9 b8 … b0
(3) 0 (2) (1) 0

(1) Communication method (protocol) (b8)


0: TCP/IP
1: UDP/IP
(2) With/without procedure in socket communication function
7
(b9)
1: Nonprocedural communication
(3) Open system (b15, b14)
00: Active open or UDP/IP
10: Unpassive open
11: Fullpassive open

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

Program example
• The following program reads connection information of the connection number 1.
[Structured ladder/FBD]

Reads data from


the connection
number 1

[ST]
IF(Var_Flag_Inst=TRUE)THEN
SP_SOCCINF( TRUE, "U0", 1, Var_ControlData, Var_Connection ); (* Reads data from the connection number 1 *)
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.4 SOCCINF Instruction 265
7.5 Changing Destination

SP_SOCCSET
QnUDE(H) LCPU

Structured ladder/FBD ST
SP_SOCCSET

EN ENO
ENO:= SP_SOCCSET (EN, Un, s1, s2);
Un
s1
s2

The following instruction can go in the dotted squares.


SP_SOCCSET

■Executing condition
Instruction Executing condition
SP_SOCCSET

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..4]
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)      

Processing details
This instruction changes the IP address and port number of the external device of a specified connection.
(Available only with a UDP/IP connection)

Setting data
Device Item Setting data Setting range Setting side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s2)[2] Destination IP address Specify the IP address of the external device. 1H to User
(s2)[3] FFFFFFFFH
0H : No
destination
(FFFFFFFFH :
broadcast)
(s2)[4] Destination port No. Specify the port number of the external device. 1H to FFFFH User
(FFFFH:
broadcast)

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


266 7.5 Changing Destination
Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

Program example
• The following program changes the destination (destination IP address and port number) of the connection number 1 which
is being open.
[Structured ladder/FBD]

Sets destination
IP address
to 10.97.85.222

Sets destination
port number to 8193

Changes the setting


of the connection
number 1

[ST]
7
IF((LDP( TRUE, Var_Flag_Inst )) &(SD1282.0=TRUE))THEN
MOVP( TRUE, H55DE, Var_ControlData[2] );
MOVP( TRUE, H0A61, Var_ControlData[3] ); (* Sets destination IP address to 10.97.85.222 *)
MOVP(TRUE, H2001, Var_ControlData[4]); (* Sets destination port number to 8193 *)
SP_SOCCSET( TRUE, "U0", 1, Var_ControlData ); (* Changes the setting of the connection number 1 *)
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.5 Changing Destination 267
7.6 Changing Receive Mode

SP_SOCRMODE
QnUDE(H) LCPU

Structured ladder/FBD ST
SP_SOCRMODE

EN ENO
ENO:= SP_SOCRMODE (EN, Un, s1, s2);
Un

s1
s2

The following instruction can go in the dotted squares.


SP_SOCRMODE

■Executing condition
Instruction Executing condition
SP_SOCRMODE

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..3]
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)      

Processing details
This instruction changes the TCP receive mode (unavailable for a UDP connection) and receive data size.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


268 7.6 Changing Receive Mode
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] System area   
(s2)[1] Completion status The instruction completion status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)
(s2)[2] TCP Receive Mode*1 Specify the TCP receive mode. 0, 1 User
0: TCP normal receive mode
1: TCP fixed length receive mode
(s2)[3] Receive Data Size Specify the receive data size of the socket communication. 1 to 2046 User
(number of bytes)

*1 Unavailable for a UDP connection.

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

Program example
• The following program changes the receive mode of the connection number 1 to TCP fixed length receive mode and
changes its receive data length to 256 bytes.
• After instruction execution, the connection number 1 turns the receive status signal ON when the length of receive data
7
reaches 256 bytes.
[Structured ladder/FBD]

Sets TCP receive


mode to 1

Sets receive
data size to 256

Changes the receive


mode of the
connection number 1

[ST]
IF(Var_Flag_Inst=TRUE)THEN
MOVP(TRUE, 1, Var_ControlData[2]); (* Sets TCP receive mode to 1 *)
MOVP(TRUE, 256, Var_ControlData[3]); (* Sets receive data size to 256 *)
SP_SOCRMODE( TRUE, "00", 1, Var_ControlData); (*Changes the receive mode of the connection number 1 *)
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.6 Changing Receive Mode 269
7.7 SOCRDATA Instruction

S(P)_SOCRDATA
QnUDE(H) LCPU

Structured ladder/FBD ST
S_SOCRDATA
EN ENO ENO:= S_SOCRDATA (EN, Un, s1, s2, n, d);
Un d
s1
s2
n

The following instruction can go in the dotted squares.


S_SOCRDATA, SP_SOCRDATA

■Executing condition
Instruction Executing condition
S_SOCRDATA

SP_SOCRDATA

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Un Dummy ("U0") String
s1 Connection number (1 to 16) ANY16
s2 Variable that stores control data Array of ANY16 [0..1]
n Number of read data (1 to 1024 words) ANY16
Output argument ENO Execution result Bit
d Variable that stores read data ANY16

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H

(s1)      
(s2)      
n      
(d)      

Processing details
This instruction reads data for the specified number of words from the socket communication receive data area of a specified
connection, and stores it.

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


270 7.7 SOCRDATA Instruction
Setting data
Device Item Setting data Setting range Setting side
(s2)[0] System area   
(s2)[1] Completion status The instruction application status is stored.  System
0: Normal completion
Other than 0: Error completion (error code)

Precautions
• Use the Built-in Ethernet port QCPU of which the function version is B or later and the first five digits of the serial number
are '11012' or higher.
• Use the LCPU other than L02SCPU and L02SCPU-P.

Program example
• The following program reads the receive data length of the connection number 1.
[Structured ladder/FBD]

Reads receive data


length of the
connection number 1

[ST]
7
IF((Var_Flag_Inst=TRUE) &(SD1282.0=TRUE) &(SD1286.0=TRUE))THEN
SP_SOCRDATA( TRUE, "00", 1, Var_ControlData, 1, Var_Data); (* Reads receive data length of connection number 1 *)
END_IF;

7 SOCKET COMMUNICATION FUNCTION INSTRUCTION


7.7 SOCRDATA Instruction 271
8 BUILT-IN I/O FUNCTION INSTRUCTION

8.1 Positioning Function Dedicated Instruction


Positioning start

IPPSTRT1, IPPSTRT2
LCPU

ST
Structured ladder/FBD
IPPSTRT1

EN ENO
ENO:= IPPSTRT1 (EN, n);

The following instruction can go in the dotted squares.


IPPSTRT1, IPPSTRT1P, IPPSTRT2, IPPSTRT2P

■Executing condition
Instruction Executing condition
IPPSTRT1
IPPSTRT2
IPPSTRT1P
IPPSTRT2P

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n Positioning data number (Setting range: 1 to 10) ANY16
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
n     

Processing details
This instruction specifies a data number to be executed for 'n' from the positioning data No. 1 to No. 10 which are previously
set in GX Works2, and starts the specified axis (refer to the following).
• IPPSTRT1(P): Axis 1
• IPPSTRT2(P): Axis 2

Program example
• The following program starts the "Positioning Data" No. 1 of the Axis 1 when M0 turns ON.
[Structured ladder/FBD]

[ST]
IPPSTRT1(M0, 1);

8 BUILT-IN I/O FUNCTION INSTRUCTION


272 8.1 Positioning Function Dedicated Instruction
IPDSTRT1, IPDSTRT2
LCPU

ST
Structured ladder/FBD
IPDSTRT1

EN ENO
ENO:= IPDSTRT1 (EN, s);

The following instruction can go in the dotted squares.


IPDSTRT1, IPDSTRT1P, IPDSTRT2, IPDSTRT2P

■Executing condition
Instruction Executing condition
IPDSTRT1
IPDSTRT2
IPPSTRT1P
IPDSTRT2P

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Start number of the device in which the control data
are stored
Array of ANY16 [0..7]
8
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   

Processing details
Regardless of "Positioning Data" No. 1 to No. 10 which are previously set in GX Works2, this instruction starts the positioning
of the specified axis (refer to the following) using the data stored in the devices starting from (s).
• IPDSTRT1(P): Axis 1
• IPDSTRT2(P): Axis 2

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.1 Positioning Function Dedicated Instruction 273
Setting data
Device Item Setting data Setting range Setting side
(s)[0] Control system 1: Positioning control (ABS) 1 to 7 User
2: Positioning control (INC)
3: Speed/position switching control (forward RUN)
4: Speed/position switching control (reverse RUN)
5: Current value change
6: Speed control (forward RUN)
7: Speed control (reverse RUN)
(s)[1] Acceleration/deceleration time  0 to 32767(ms)
(s)[2] Deceleration stop time  0 to 32767(ms)
(s)[3] Dwell time  0 to 65535(ms)*1
(s)[4] Command speed  0 to 200000
(pulse/s)*2
(s)[5]
(s)[6] Positioning address/movement  -2147483648 to
amount 2147483647(pul
(s)[7]
se)

*1 Enter the setting value to the program as described below.


1 to 32767: Enter in decimal
32768 to 65535: Enter after converting it to hexadecimal
*2 The restricted speed value may be applied when the set value of the command speed is not within 0 to 200000.

Program example
• The following program sets the following positioning data and starts the axis 1 when M0 turns ON.
Device Item Setting data
D0 Control system Positioning control (ABS)
D1 Acceleration/deceleration time 1000(ms)
D2 Deceleration stop time 1000(ms)
D3 Dwell time 0(ms)
D4, D5 Command speed 20000(pulse/s)
D6, D7 Positioning address/movement amount 100000(pulse)

[Structured ladder/FBD]

[ST]
MOV( M0, 1, D0);
MOV( M0, 1000, D1);
MOV( M0, 1000, D2);
MOV( M0, 0, D3);
DMOV( M0, 20000, D4);
DMOV( M0, 100000, D6);
IPDSTRT1P(M0, D0);

8 BUILT-IN I/O FUNCTION INSTRUCTION


274 8.1 Positioning Function Dedicated Instruction
IPSIMUL(P)
LCPU

Structured ladder/FBD ST
IPSIMUL

EN ENO
ENO:= IPSIMUL (EN, n1, n2);
n1

n2

The following instruction can go in the dotted squares.


IPSIMUL, IPSIMULP

■Executing condition
Instruction Executing condition
IPSIMUL

IPSIMULP

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n1
n2
Axis 1 positioning data number
Axis 2 positioning data number
ANY16
ANY16
8
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
n1     
n2     

Processing details
This instruction simultaneously starts the positioning of the axis 1 positioning data number specified by n1 and the axis 2
positioning data number specified by n2.

Program example
• The following program simultaneously starts the axis 1 positioning data No. 1 and the axis 2 positioning data No. 10 when
M0 turns ON.
[Structured ladder/FBD]

[ST]
IPSIMULP(M0, 1, 10);

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.1 Positioning Function Dedicated Instruction 275
OPR start

IPOPR1, IPOPR2
LCPU

ST
Structured ladder/FBD
IPOPR1

EN ENO
ENO:= IPOPR1 (EN, s);

The following instruction can go in the dotted squares.


IPOPR1, IPOPR1P, IPOPR2, IPOPR2P

■Executing condition
Instruction Executing condition
IPOPR1
IPOPR2
IPOPR1P
IPOPR2P

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Start number of the device in which the control data Array of ANY16 [0..2]
are stored
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   

Processing details
This instruction starts the OPR of which type is specified by (s) on the specified axis (refer to the following).
• IPOPR1(P): Axis 1
• IPOPR2(P): Axis 2

Setting data
Device Item Setting data Setting range Setting side
(s)[0] OPR type 1: Machine OPR 1 to 3 User
2: Fast OPR (OP address)
3: Fast OPR (standby address)
(s)[1] Standby address  -2147483648 to
(s)[2] (Set only when Fast OPR 2147483647(pulse)
(standby address (3)) is set for (Ignored when
the OPR type) other than standby
address (3))

8 BUILT-IN I/O FUNCTION INSTRUCTION


276 8.1 Positioning Function Dedicated Instruction
Program example
• The following program starts the machine OPR of the axis 1 when M0 turns ON.
Device Item Setting data
D0 OPR type Machine OPR
D1, D2 Standby address 0 (Ignored)

[Structured ladder/FBD]

[ST]
MOV(M0, 1, D0);
DMOV(M0, 0, D1);
IPOPR1P(M0, D0);

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.1 Positioning Function Dedicated Instruction 277
JOG start

IPJOG1, IPJOG2
LCPU

Structured ladder/FBD ST
IPJOG1

EN ENO
ENO:= IPJOG1 (EN, s1, s2);
s1

s2

The following instruction can go in the dotted squares.


IPJOG1, IPJOG2

■Executing condition
Instruction Executing condition
IPJOG1
IPJOG2

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s1 Start number of the device in which the control data Array of ANY16 [0..3]
are stored
s2 Direction specification of the JOG operation Bit
0: Forward RUN
1: Reverse RUN
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s1)   
(s2)    

Processing details
This instruction starts the JOG operation of the specified axis (refer to the following).
• IPJOG1: Axis 1
• IPJOG2: Axis 2
The JOG operation is executed in the direction specified by (s2), using the JOG speed, JOG acceleration/deceleration time
stored in the devices starting from (s1).

Setting data
Device Item Setting data Setting range Setting side
(s1)[0] JOG speed  0 to User
200000(pulse/
(s1)[1]
s)*1
(s1)[2] JOG acceleration time  0 to 32767(ms)
(s1)[3] JOG deceleration time 

*1 The restricted speed value may be applied when the set value of the JOG speed is not within 0 to 200000.

8 BUILT-IN I/O FUNCTION INSTRUCTION


278 8.1 Positioning Function Dedicated Instruction
Program example
• The following program starts the forward JOG operation when M0 turns ON, and starts the reverse JOG operation when M1
turns ON.
Device Item Setting data
D0, D1 JOG speed 10000(pulse/s)
D2 JOG acceleration time 1000(ms)
D3 JOG deceleration time

[Structured ladder/FBD]

[ST]
DMOV(SM402, 10000, D0);
MOV(SM402, 1000, D2);
MOV(SM402, 1000, D3);
OUT( M0, M2 );
OUT(M1,M3);
IPJOG1((M2 AND (NOT M3)) OR( (NOT M2) AND M3), D0 , M3);

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.1 Positioning Function Dedicated Instruction 279
Absolute position restoration

IPABRST1, IPABRST2
LCPU

ST
Structured ladder/FBD
IPABRST1

EN ENO
ENO:= IPABRST1 (EN, s, d);

s d

The following instruction can go in the dotted squares.


IPABRST1, IPABRST2

■Executing condition
Instruction Executing condition
IPABRST1
IPABRST2

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Start number of the device for input Array of bit [0..2]
Output argument ENO Execution result Bit
d Start number of the device for output Array of bit [0..2]

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)  
(d)  

Processing details
This instruction executes the absolute position restoration of the specified axis (refer to the following) by communicating with
the servo amplifier using the input device specified by (s) and output device specified by (d).
• IPABRST1: Axis 1
• IPABRST2: Axis 2

Setting data
• Signals imported from servo amplifier
Device Item Setting data Setting range Setting side
(s)[0] Signals imported from servo ABS send data bit0 0, 1 User
amplifier
(s)[1] ABS send data bit1
(s)[2] ABS send data ready

• Signals exported to servo amplifier


Device Item Setting data Setting range Setting side
(d)[0] Signals exported to servo Servo ON  System
amplifier
(d)[1] ABS transfer mode
(d)[2] ABS request flag

8 BUILT-IN I/O FUNCTION INSTRUCTION


280 8.1 Positioning Function Dedicated Instruction
Program example
This instruction executes the absolute position restoration of the axis 1 when M0 turns ON.
• X20 to X22: Signals imported from the servo amplifier
• Y30 to Y32: Signals exported to the servo amplifier
[Structured ladder/FBD]

[ST]
IPABRST1( M0 , X20, Y30 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.1 Positioning Function Dedicated Instruction 281
IPSTOP instruction

IPSTOP1, IPSTOP2
LCPU

ST
Structured ladder/FBD

IPSTOP ENO:= IPSTOP (EN);


EN ENO

The following instruction can go in the dotted squares.


IPSTOP1, IPSTOP2

■Executing condition
Instruction Executing condition
IPSTOP1
IPSTOP2

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
 

Processing details
This instruction stops the positioning of the specified axis (refer to the following).
• IPSTOP1: Axis 1
• IPSTOP2: Axis 2

Program example
• The following program stops the axis 1 when M0 turns ON.
[Structured ladder/FBD]

[ST]
IPSTOP1( M0 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


282 8.1 Positioning Function Dedicated Instruction
Speed change

IPSPCHG1, IPSPCHG2
LCPU

ST
Structured ladder/FBD
IPSPCHG1

EN ENO
ENO:= IPSPCHG1 (EN, s);

The following instruction can go in the dotted squares.


IPSPCHG1, IPSPCHG1P, IPSPCHG2, IPSPCHG2P

■Executing condition
Instruction Executing condition
IPSPCHG1
IPSPCHG2
IPSPCHG1P
IPSPCHG2P

■Argument
Input/output Name Description Data type
argument 8
Input argument EN Executing condition Bit
s Start number of the device in which the control data Array of ANY16 [0..3]
are stored
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)   

Processing details
This instruction changes the speed of the specified axis (refer to the following) using the acceleration/deceleration time at
speed change, deceleration stop time at speed change, and new speed value stored in the devices starting from (s).
• IPSPCHG1(P): Axis 1
• IPSPCHG2(P): Axis 2

Setting data
Device Item Setting data Setting range Setting side
(s)[0] Acceleration/deceleration time  0 to 32767(ms) User
at speed change
(s)[1] Deceleration stop time at speed 
change
(s)[2] New speed value  0 to 200000
(pulse/s)*1
(s)[3]

*1 The restricted speed value may be applied when the set value of the new speed is not within 0 to 200000.

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.1 Positioning Function Dedicated Instruction 283
Program example
• The following program changes the speed of the axis 1 when M0 turns ON.
Device Item Setting data
D0 Acceleration/deceleration time at speed 2000(ms)
change
D1 Deceleration stop time at speed change 1000(ms)
D2, D3 New speed value 200000(pulse/s)

[Structured ladder/FBD]

[ST]
MOV(M0, 2000, D0);
MOV(M0, 1000, D1);
DMOV(M0, 20000, D2);
IPSPCHG1P( M0 , D0 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


284 8.1 Positioning Function Dedicated Instruction
Target position change

IPTPCHG1, IPTPCHG2
LCPU

ST
Structured ladder/FBD
IPTPCHG1

EN ENO
ENO:= IPTPCHG1 (EN, s);

The following instruction can go in the dotted squares.


IPTPCHG1, IPTPCHG1P, IPTPCHG2, IPTPCHG2P

■Executing condition
Instruction Executing condition
IPTPCHG1
IPTPCHG2
IPTPCHG1P
IPTPCHG2P

■Argument
Input/output Name Description Data type
argument 8
Input argument EN Executing condition Bit
s Target position change value (constant), or start ANY32
number of the device in which the control data are
stored.
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)     

Processing details
This instruction changes the position of the specified axis (refer to the following) to the new target position specified by (s).
• IPTPCHG1(P): Axis 1
• IPTPCHG2(P): Axis 2

Setting data
Device Item Setting data Setting range Setting side
(s)+0 Target position change value  -2147483648 to User
2147483647(pulse/
(s)+1
s)

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.1 Positioning Function Dedicated Instruction 285
Program example
• The following program changes the target position of the axis 1 to 2000 when M0 turns ON.
[Structured ladder/FBD]

[ST]
IPTPCHG1P( M0 , 2000 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


286 8.1 Positioning Function Dedicated Instruction
8.2 Counter Function Dedicated Instruction
Current value read

ICCNTRD1, ICCNTRD2
LCPU

ST
Structured ladder/FBD

ICCNTRD1 ENO:= ICCNTRD1 (EN);


EN ENO

The following instruction can go in the dotted squares.


ICCNTRD1, ICCNTRD1P, ICCNTRD2, ICCNTRD2P

■Executing condition
Instruction Executing condition
ICCNTRD1
ICCNTRD2
ICCNTRD1P
ICCNTRD2P
8
■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
 

Processing details
This instruction stores a value at the time of instruction execution to the current value of the specified CH (refer to the
following).
Instruction CH Device in which the current value is stored
ICCNTRD1(P) CH1 SD1880, SD1881
ICCNTRD2(P) CH2 SD1900, SD1901

Program example
• The following program stores the most recent value to the CH 1 current value (SD1880, SD1881) when M0 turns ON.
[Structured ladder/FBD]

[ST]
ICCNTRD1( M0 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.2 Counter Function Dedicated Instruction 287
Ring counter upper/lower limit value write

ICRNGWR1, ICRNGWR2
LCPU

Structured ladder/FBD ST
ICRNGWR1

EN ENO
ENO:= ICRNGWR1 (EN, s1, s2);
s1

s2

The following instruction can go in the dotted squares.


ICRNGWR1, ICRNGWR1P, ICRNGWR2, ICRNGWR2P

■Executing condition
Instruction Executing condition
ICRNGWR1
ICRNGWR2
ICRNGWR1P
ICRNGWR2P

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s1 Ring counter lower limit value (constant), or start ANY32
number of the device that stores the ring counter
lower limit value
• Constant: Settings which is within the range of -
2147483648 to 2147483647 and ((s1), (s1)+1) 
((s2), (s2)+1)
• Device: Within the range of specified device
s2 Ring counter upper limit value (constant), or start ANY32
number of the device that stores the ring counter
upper limit value
• Constant: Settings which is within the range of -
2147483648 to 2147483647 and ((s1), (s1)+1) 
((s2), (s2)+1)
• Device: Within the range of specified device
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s1)     
(s2)     

Processing details
This instruction sets the ring counter lower limit value and the ring counter upper limit value of the specified CH (refer to the
following).
• ICRNGWR1(P): CH1
• ICRNGWR2(P): CH2

8 BUILT-IN I/O FUNCTION INSTRUCTION


288 8.2 Counter Function Dedicated Instruction
Program example
• The following program sets -100000 for the ring counter lower limit value and 100000 for the ring counter upper limit value
of CH 1 when M0 turns ON.
[Structured ladder/FBD]

[ST]
ICRNGWR1P( M0 , -100000 , 100000 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.2 Counter Function Dedicated Instruction 289
Preset value write

ICPREWR1, ICPREWR2
LCPU

ST
Structured ladder/FBD
ICRNGWR1

EN ENO
ENO:= ICRNGWR1 (EN, s);

The following instruction can go in the dotted squares.


ICPREWR1, ICPREWR1P, ICPREWR2, ICPREWR2P

■Executing condition
Instruction Executing condition
ICPREWR1
ICPREWR2
ICPREWR1P
ICPREWR2P

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
s Preset value (constant), or start number of the ANY32
device that stores the preset value
• Constant: Settings which is within the range of -
2147483648 to 2147483647
• Device: Within the range of specified device
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s)     

Processing details
This instruction sets a preset value of the specified CH (refer to the following).
• ICPREWR1(P): CH1
• ICPREWR2(P): CH2

Program example
• The following program sets 10000 for the preset value of CH 1 when M0 turns ON.
[Structured ladder/FBD]

[ST]
ICPREWR1( M0 , 10000 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


290 8.2 Counter Function Dedicated Instruction
Latch counter value read

ICLTHRD1, ICLTHRD2
LCPU

ST
Structured ladder/FBD
ICLTHRD1

EN ENO
ENO:= ICLTHRD1 (EN, n, d);

n d

The following instruction can go in the dotted squares.


ICLTHRD1, ICLTHRD1P, ICLTHRD2, ICLTHRD2P

■Executing condition
Instruction Executing condition
ICLTHRD1
ICLTHRD2
ICLTHRD1P
ICLTHRD2P

■Argument
Input/output Name Description Data type
argument 8
Input argument EN Executing condition Bit
n Latch count value (1,2) ANY16
Output argument ENO Execution result Bit
d Start number of the device in which the latch count ANY32
value is stored

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
n     
(d)     

Processing details
This instruction stores a latch count value n of the specified CH (refer to the following) to (d).
• ICLTHRD1(P): CH1
• ICLTHRD2(P): CH2

Program example
• The following program stores the latch count value 1 of CH 1 to D100 and D101 when M0 turns ON.
[Structured ladder/FBD]

[ST]
ICLTHRD1( M0 , 1 , D100 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.2 Counter Function Dedicated Instruction 291
Sampling counter value read

ICSMPRD1, ICSMPRD2
LCPU

ST
Structured ladder/FBD
ICSMPRD1

EN ENO
ENO:= ICSMPRD1 (EN, d);

The following instruction can go in the dotted squares.


ICSMPRD1, ICSMPRD1P, ICSMPRD2, ICSMPRD2P

■Executing condition
Instruction Executing condition
ICSMPRD1
ICSMPRD2
ICSMPRD1P
ICSMPRD2P

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Output argument ENO Execution result Bit
d Start number of the device in which the sampling ANY32
count value is stored

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(d)     

Processing details
This instruction stores a sampling count value of the specified CH (refer to the following) to (d).
• ICSMPRD1(P): CH1
• ICSMPRD2(P): CH2

Program example
• The following program stores the sampling count value of CH 1 to D100 and D101 when M0 turns ON.
[Structured ladder/FBD]

[ST]
ICSMPRD1( M0, D100 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


292 8.2 Counter Function Dedicated Instruction
Coincidence output point write

ICCOVWR1, ICCOVWR2
LCPU

Structured ladder/FBD ST
ICCOVWR1

EN ENO
ENO:= ICCOVWR1 (EN, n, s);
n

The following instruction can go in the dotted squares.


ICCOVWR1, ICCOVWR1P, ICCOVWR2, ICCOVWR2P

■Executing condition
Instruction Executing condition
ICCOVWR1
ICCOVWR2
ICCOVWR1P
ICCOVWR2P

■Argument
Input/output Name Description Data type
argument 8
Input argument EN Executing condition Bit
n Coincidence output No. n point (1,2) ANY16
s Coincidence output No. n point (constant), or start ANY32
number of the device in which coincidence output
No. n point is stored
• Constant: Settings which is within the range of -
2147483648 to 2147483647
• Device: Within the range of specified device
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
n     
(s)     

Processing details
This instruction stores a coincidence output No. n point of the specified CH (refer to the following).
• ICCOVWR1(P): CH1
• ICCOVWR2(P): CH2

Program example
• The following program sets the value of D100 and D101 to the coincidence output No. 2 point of CH 1 when M0 turns ON.
[Structured ladder/FBD]

[ST]
ICCOVWR1( M0 , 2 , D100 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.2 Counter Function Dedicated Instruction 293
Frequency measurement

ICFCNT1, ICFCNT2
LCPU

ST
Structured ladder/FBD
ICFCNT1

EN ENO
ENO:= ICFCNT1 (EN, d);

The following instruction can go in the dotted squares.


ICFCNT1, ICFCNT2

■Executing condition
Instruction Executing condition
ICFCNT1
ICFCNT2

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Output argument ENO Execution result Bit
d Start number of the device that stores the ANY32
measured frequency value

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(d)     

Processing details
This instruction measures a frequency of the specified CH (refer to the following) according to the settings such as the
frequency measurement unit time setting.
• ICFCNT1: CH1
• ICFCNT2: CH2
The measured value is stored to (d) at the ICFCNT instruction execution. The measurement starts at the rising pulse of the
ICFCNT instruction execution command, and ends at the falling pulse.

Program example
• The following program executes the frequency measurement of CH 1 while M0 is ON.
[Structured ladder/FBD]

[ST]
ICFCNT1( M0 , D100 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


294 8.2 Counter Function Dedicated Instruction
Rotation speed measurement

ICRCNT1, ICRCNT2
LCPU

ST
Structured ladder/FBD
ICRCNT1

EN ENO
ENO:= ICRCNT1 (EN, d);

The following instruction can go in the dotted squares.


ICRCNT1, ICRCNT2

■Executing condition
Instruction Executing condition
ICRCNT1
ICRCNT2

■Argument
Input/output Name Description Data type
argument
Input argument
Output argument
EN
ENO
Executing condition
Execution result
Bit
Bit
8
d Start number of the device that stores the ANY32
measured rotation speed

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(d)     

Processing details
This instruction measures a rotation speed of the specified CH (refer to the following) according to the settings such as the
rotation speed measurement unit time setting.
• ICRCNT1: CH1
• ICRCNT2: CH2
The measured value is stored to (d) at the ICRCNT instruction execution. The measurement starts at the rising pulse of the
ICRCNT instruction execution command, and ends at the falling pulse.

Program example
• The following program stores the rotation speed measurement value of CH 1 to D100 and D101 while M0 is ON.
[Structured ladder/FBD]

[ST]
ICRCNT1( M0 , D100 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.2 Counter Function Dedicated Instruction 295
Pulse measurement read

ICPLSRD1, ICPLSRD2
LCPU

ST
Structured ladder/FBD
ICPLSRD1

EN ENO
ENO:= ICPLSRD1 (EN, d);

The following instruction can go in the dotted squares.


ICPLSRD1, ICPLSRD1P, ICPLSRD2, ICPLSRD2P

■Executing condition
Instruction Executing condition
ICPLSRD1
ICPLSRD2
ICPLSRD1P
ICPLSRD2P

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
Output argument ENO Execution result Bit
d Start number of the device that stores the ANY32
measured pulse value

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(d)     

Processing details
This instruction stores a measured pulse value of the specified CH (refer to the following) to (d).
• ICPLSRD1(P): CH1
• ICPLSRD2(P): CH2

Program example
• The following program stores the measured pulse value of CH 1 to D100 and D101 when M0 turns ON.
[Structured ladder/FBD]

[ST]
ICPLSRD1( M0 , D100 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


296 8.2 Counter Function Dedicated Instruction
PWM output

ICPWM1, ICPWM2
LCPU

Structured ladder/FBD ST
ICPWM1

EN ENO
ENO:= ICPWM1 (EN, s1, s2);
s1

s2

The following instruction can go in the dotted squares.


ICPWM1, ICPWM2

■Executing condition
Instruction Executing condition
ICPWM1
ICPWM2

■Argument
Input/output Name Description Data type
argument
Input argument EN
s1
Executing condition
PWM output ON time setting value (constant), or
Bit
ANY32
8
start number of the device that stores the PWM
output ON time setting value
• Constant: Settings which is 0 or within the range
of 10 to 107 (0.1s) and ((s1), (s1)+1)  ((s2),
(s2)+1)
• Device: Within the range of specified device
s2 PWM output cycle time setting value (constant), or ANY32
start number of the device that stores the PWM
output cycle time setting value
• Constant: Settings which is 0 or within the range
of 50 to 107 (0.1s) and ((s1), (s1)+1)  ((s2),
(s2)+1)
• Device: Within the range of specified device
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word
(s1)     
(s2)     

Processing details
This instruction outputs a PWM waveform of the specified CH (refer to the following).
• ICPWM1: CH1
• ICPWM2: CH2
The PWM waveform with the ON time ((s1)) and the cycle time ((s2)) is output from the coincidence output No.1 signal during
the ICPWM instruction execution. The output of the PWM waveform starts from OFF.

8 BUILT-IN I/O FUNCTION INSTRUCTION


8.2 Counter Function Dedicated Instruction 297
Program example
• The following program outputs the PWM waveform with 1s ON time and 5s cycle time from CH 1 while M0 is ON.
[Structured ladder/FBD]

[ST]
ICPWM1( M0 , 10 , 50 );

8 BUILT-IN I/O FUNCTION INSTRUCTION


298 8.2 Counter Function Dedicated Instruction
9 DATA LOGGING FUNCTION INSTRUCTION
9
9.1 Trigger Logging Set/Reset

LOGTRG Instruction, LOGTRGR Instruction


QnUDV LCPU

ST
Structured ladder/FBD
LOGTRG

EN ENO
ENO:= LOGTRG (EN, n);

The following instruction can go in the dotted squares.


LOGTRG, LOGTRGR

■Executing condition
Instruction Executing condition
LOGTRG

LOGTRGR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n Data logging configuration number ANY16
Output argument ENO Execution result Bit

Setting Internal device R, ZR J\ U\G Zn Constant Others


data Bit Word Bit Word K, H
n     

9 DATA LOGGING FUNCTION INSTRUCTION


9.1 Trigger Logging Set/Reset 299
Processing details
■LOGTRG
• The LOGTRG instruction generates a trigger in the trigger logging of the data logging configuration number specified by 'n'.
• A value from 1 to 10 is set for 'n'.
• When the LOGTRG instruction is executed, the special relay (data logging trigger) of the data logging configuration number
specified by 'n' turns ON. After executing the trigger logging for the number of times set for "Number of records", the
instruction latches the data and stops the trigger logging.
• Validated when "When trigger instruction executed" is selected as the trigger condition.
• No processing is performed with the following condition.
• Specifying a data logging configuration number for which other than "When trigger instruction executed" is specified as the trigger condition.
• Specifying a data logging configuration number which is not configured.
• Specifying a data logging configuration number which is currently used for continuous logging.
• Executing the LOGTRG instruction again without executing the LOGTRGR instruction after the LOGTRG instruction.

■LOGTRGR
• The LOGTRGR instruction resets the LOGTRG instruction of the specified data logging configuration number.
• When the LOGTRGR instruction is executed, the special relay (data logging trigger, trigger logging complete) of the data
logging configuration number specified by 'n' turns OFF.
• When the instruction is executed while transferring data in the buffer memory to the SD memory card, the instruction
process is held until data transfer is complete.

Operation error
• In the following case, an operation error occurs, the error flag (SM0) is turned ON, and the corresponding error code is
stored to SD0.
Error code Description
4100 The value for n is outside the range of 1 to 10

Precautions
• Use the LCPU other than L02SCPU and L02SCPU-P.

Program example
• The following program executes the LOGTRG instruction on the data logging configuration No. 1 when X0 turns ON, and
resets the trigger condition with the LOGTRGR instruction when X1 turns ON.
[Structured ladder/FBD]

[ST]
LOGTRG(X0,1);
LOGTRGR(X1,1);

9 DATA LOGGING FUNCTION INSTRUCTION


300 9.1 Trigger Logging Set/Reset
10 SFC CONTROL INSTRUCTION
10.1 SFC Step Comment Read
10
S(P)_SFCSCOMR
High
performance Process Redundant Universal

Structured ladder/FBD ST
SP_SFCSCOMR

EN ENO
ENO:= SP_SFCSCOMR (EN, n1, n2, n3, d1, d2);
n1 d1
n2 d2
n3

The following instruction can go in the dotted squares.


S_SFCSCOMR, SP_SFCSCOMR

■Executing condition
Instruction Executing condition
S_SFCSCOMR

SP_SFCSCOMR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n1 Block No. of an SFC program that read comments ANY16
or device number where block No. is stored.
n2 The device number where the number of comments ANY16
to read or the number of comments is stored.
n3 The number of comments to read in a single scan ANY16
or device number where the number of comments
is stored.
Output argument ENO Execution result Bit
d1 The first number of device that stores comment ANY16
read.
d2 A device that turns ON for 1 scan at completion of Bit
the instruction.

Setting Internal R J\ Constant Expansion Others Sequence SFC Program Execution Site
data device U\G K, H SFC Program
Bit Word Zn BLm\Sn Step Transition Block Step Transition
Condition Condition
n1          
n2         
n3         
(d1)  *1       
(d2) *1        

*1 Local device cannot be used.

10 SFC CONTROL INSTRUCTION


10.1 SFC Step Comment Read 301
Processing details
This function reads step comments being activated in the SFC block specified at (n1), by the number of comment specified at
(n2), and stores those to the device number of after specified at (d1).

Precautions
• For High Performance model QCPU, use the function version is B or later and the first five digits of the serial number are
'07012' or higher.
• For Process CPU and Redundant CPU, use the first five digits of the serial number are '07032' or higher.
• For Universal CPU, use the first five digits of the serial number are '12052' or higher. Q00UJCPU, Q00UCPU, Q01UCPU,
and Q02UCPU can not be used.

Program example
• This program reads 2 comments being activated at the SFC block No.1 when X1 is turned ON, and stores those to the
storage device after D0. (The number of comment to be read (n3) in a single scan is also set in 2.)
[Structured ladder/FBD]

Online program
change enable flag

Execution command
of SP_SFCSCOMR
instruction

[ST]
IF((Var_Flag_Exe=TRUE) & (SM735=FALSE))THEN (*Online program change execution command*)
SET(TRUE, Var_Flag); (*Online program change enable flag*)
END_IF;
IF((Var_Flag_Inst=TRUE) & (Var_Flag=FALSE))THEN (*Execution command of SP_SFCSCOMR instruction*)
SP_SFCSCOMR(TRUE, 1, D0, 2, D1, M1);
END_IF;

10 SFC CONTROL INSTRUCTION


302 10.1 SFC Step Comment Read
10.2 SFC Transition Condition Comment Read

S(P)_SFCTCOMR
High
performance Process Redundant Universal 10

Structured ladder/FBD ST
SP_SFCTCOMR

EN ENO
ENO:= SP_SFCTCOMR (EN, n1, n2, n3, d1, d2);
n1 d1
n2 d2
n3

The following instruction can go in the dotted squares.


S_SFCTCOMR, SP_SFCTCOMR

■Executing condition
Instruction Executing condition
S_SFCTCOMR

SP_SFCTCOMR

■Argument
Input/output Name Description Data type
argument
Input argument EN Executing condition Bit
n1 Block No. of an SFC program that read comments ANY16
or device number where block No. is stored.
n2 The device number where the number of comments ANY16
to read or the number of comments is stored.
n3 The number of comments to read in a single scan ANY16
or device number where the number of comments
is stored.
Output argument ENO Execution result Bit
d1 The first number of device that stores comment ANY16
read.
d2 A device that turns ON for 1 scan at completion of Bit
the instruction.

Setting Internal R J\ Constant Expansion Others Sequence SFC Program Execution Site
data device U\G K, H SFC Program
Bit Word Zn BLm\Sn Step Transition Block Step Transition
Condition Condition
n1          
n2         
n3         
*1
(d1)         
(d2) *1        

*1 Local device cannot be used.

Processing details
This function reads comments of the transition condition 1 associated with steps activated in the SFC block specified at (n1)
with the number of comments specified at (n2), and stores those to the device number of after specified at (d1).

10 SFC CONTROL INSTRUCTION


10.2 SFC Transition Condition Comment Read 303
Precautions
• For High Performance model QCPU, use the function version is B or later and the first five digits of the serial number are
'07012' or higher.
• For Process CPU and Redundant CPU, use the first five digits of the serial number are '07032' or higher.
• For Universal CPU, use the first five digits of the serial number are '12052' or higher. Q00UJCPU, Q00UCPU, Q01UCPU,
and Q02UCPU can not be used.

Program example
• This program reads 2 comments being activated at the SFC block No.1 when X1 is turned ON, and stores those to the
storage device after D0. (The number of comment to be read (n3) in a single scan is also set in 2.)
[Structured ladder/FBD]

Online program
change enable flag

Execution command
of SP_SFCTCOMR
instruction

[ST]
IF((Var_Flag_Exe=TRUE) & (SM735=FALSE))THEN (*Online program change execution command*)
SET(TRUE, Var_Flag); (*Online program change enable flag*)
END_IF;
IF((Var_Flag_Inst=TRUE) & (Var_Flag=FALSE))THEN (*Execution command of SP_SFCTCOMR instruction*)
SP_SFCTCOMR(TRUE, 1, D0, 2, D1, M1);
END_IF;

10 SFC CONTROL INSTRUCTION


304 10.2 SFC Transition Condition Comment Read
MEMO

10

10 SFC CONTROL INSTRUCTION


10.2 SFC Transition Condition Comment Read 305
INDEX

A Positioning instruction . . . . . . . . . . . . . . . . . . . . .17


Process CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Analog instruction . . . . . . . . . . . . . . . . . . . . . . . 16
Application function . . . . . . . . . . . . . . . . . . . . . . . 9
Q
B QCPU (Q mode) . . . . . . . . . . . . . . . . . . . . . . . . . .9

Basic model QCPU . . . . . . . . ............... 9


Built-in Ethernet port LCPU . . ............... 9 R
Built-in Ethernet port QCPU . . ............... 9 Redundant CPU . . . . . . . . . . . . . . . . . . . . . . . . . .9
Built-in I/O function instruction . . . . . . . . . . . . . . 25

S
C
Serial communication instruction . . . . . . . . . . . . .18
CC-Link IE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 SFC control instruction . . . . . . . . . . . . . . . . . . . .28
Common instruction . . . . . . . . . . . . . . . . . . . . . . 9 Socket communication function instruction . . . . . .24
Configuration of instructions . . . . . . . . . . . . . . . . 29 Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
Counter function dedicated instruction . . . . . . . . . 26 Special instruction . . . . . . . . . . . . . . . . . . . . . . . .9
CPU module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

U
D
Universal model Process CPU . . . . . . . . . . . . . . . . 9
Data logging function instruction . . . . . . . . . . . . . 28 Universal model QCPU . . . . . . . . . . . . . . . . . . . . .9
Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

G
GX Works2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

H
High Performance model QCPU . . . . . . . . . . . . . . 9
High-speed Universal model QCPU . . . . . . . . . . . 9
How to read instructions . . . . . . . . . . . . . . . . . . 31

I
I/O number of module . . . . . . . . . . . . . . . . . . . . 29
IEC61131-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Instruction tables . . . . . . . . . . . . . . . . . . . . . . . . 15

L
LCPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

M
MELSECNET/H . . . . . . . . . . . . . . . . . . . . . . . . . 9
Modules and versions applicable to instructions . . 13

N
Network dedicated instruction. . . . . . . . . . . . . . . 19
Network number . . . . . . . . . . . . . . . . . . . . . . . . 29

P
Personal computer . . . . . . . . . . . . . . . . . ...... 9
PID control instruction . . . . . . . . . . . . . . . . . . . . 23
PID control instruction (exact differential) . . . . . . . 23
Positioning function dedicated instruction . . . . . . 25

306
MEMO

307
INSTRUCTION INDEX

G IPPSTRT2(P) . . . . . . . . . . . . . . . . . . . . . . . . . .272
IPSIMUL(P) . . . . . . . . . . . . . . . . . . . . . . . . . . .275
G(P)_BIDIN . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 IPSPCHG1(P) . . . . . . . . . . . . . . . . . . . . . . . . .283
G(P)_BIDOUT . . . . . . . . . . . . . . . . . . . . . . . . . 59 IPSPCHG2(P) . . . . . . . . . . . . . . . . . . . . . . . . .283
G(P)_CCPASET . . . . . . . . . . . . . . . . . . . . . . . 188 IPSTOP1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
G(P)_CPRTCL . . . . . . . . . . . . . . . . . . . . . . . . . 95 IPSTOP2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
G(P)_GETE . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 IPTPCHG1(P) . . . . . . . . . . . . . . . . . . . . . . . . .285
G(P)_OFFGAN . . . . . . . . . . . . . . . . . . . . . . . . . 33 IPTPCHG2(P) . . . . . . . . . . . . . . . . . . . . . . . . .285
G(P)_OGLOAD. . . . . . . . . . . . . . . . . . . . . . . . . 35
G(P)_OGSTOR . . . . . . . . . . . . . . . . . . . . . . . . 37
G(P)_ONDEMAND . . . . . . . . . . . . . . . . . . . . . . 51 J
G(P)_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . 54 J(P)_READ . . . . . . . . . . . . . . . . . . . . . . . . . . .125
G(P)_PRR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 J(P)_RECV . . . . . . . . . . . . . . . . . . . . . . . . . . .150
G(P)_PUTE . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 J(P)_REQ . . . . . . . . . . . . . . . . . . . . . . . . . . . .157
G(P)_READ . . . . . . . . . . . . . . . . . . . . . . . . . . 125 J(P)_RIRD . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98
G(P)_RECV . . . . . . . . . . . . . . . . . . . . . . . . . . 150 J(P)_RIWT . . . . . . . . . . . . . . . . . . . . . . . . . . . .102
G(P)_REQ . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 J(P)_SEND . . . . . . . . . . . . . . . . . . . . . . . . . . .144
G(P)_RIFR . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 J(P)_SREAD . . . . . . . . . . . . . . . . . . . . . . . . . .130
G(P)_RIRCV . . . . . . . . . . . . . . . . . . . . . . . . . 106 J(P)_SWRITE . . . . . . . . . . . . . . . . . . . . . . . . .140
G(P)_RIRD. . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 J(P)_WRITE. . . . . . . . . . . . . . . . . . . . . . . . . . .134
G(P)_RISEND . . . . . . . . . . . . . . . . . . . . . . . . 110 J(P)_ZNRD . . . . . . . . . . . . . . . . . . . . . . . . . . .165
G(P)_RITO . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 J(P)_ZNWR . . . . . . . . . . . . . . . . . . . . . . . . . . .168
G(P)_RIWT . . . . . . . . . . . . . . . . . . . . . . . . . . 102
G(P)_RLPASET . . . . . . . . . . . . . . . . . . . . . . . 118
G(P)_SEND . . . . . . . . . . . . . . . . . . . . . . . . . . 144 L
G(P)_SPBUSY . . . . . . . . . . . . . . . . . . . . . . . . . 63 LOGTRG . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299
G(P)_SREAD . . . . . . . . . . . . . . . . . . . . . . . . . 130 LOGTRGR . . . . . . . . . . . . . . . . . . . . . . . . . . . .299
G(P)_SWRITE . . . . . . . . . . . . . . . . . . . . . . . . 140
G(P)_WRITE . . . . . . . . . . . . . . . . . . . . . . . . . 134
G_INPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 P
PIDCONT(P) . . . . . . . . . . . . . . . . . . . . . . . . . .244
I PIDINIT(P) . . . . . . . . . . . . . . . . . . . . . . . . . . . .240
PIDPRMW(P) . . . . . . . . . . . . . . . . . . . . . . . . . .249
ICCNTRD1(P) . . . . .................... 287 PIDRUN(P) . . . . . . . . . . . . . . . . . . . . . . . . . . .248
ICCNTRD2(P) . . . . .................... 287 PIDSTOP(P) . . . . . . . . . . . . . . . . . . . . . . . . . .248
ICCOVWR1(P) . . . . .................... 293
ICCOVWR2(P) . . . . .................... 293
ICFCNT1 . . . . . . . . .................... 294 S
ICFCNT2 . . . . . . . . .................... 294
S(P)_PIDCONT . . . . . . . . . . . . . . . . . . . . . . . .232
ICLTHRD1(P) . . . . . .................... 291
S(P)_PIDINIT . . . . . . . . . . . . . . . . . . . . . . . . . .227
ICLTHRD2(P) . . . . . .................... 291
S(P)_PIDPRMW . . . . . . . . . . . . . . . . . . . . . . . .237
ICPLSRD1(P) . . . . . .................... 296
S(P)_PIDRUN . . . . . . . . . . . . . . . . . . . . . . . . .236
ICPLSRD2(P) . . . . . .................... 296
S(P)_PIDSTOP . . . . . . . . . . . . . . . . . . . . . . . .236
ICPREWR1(P) . . . . .................... 290
S(P)_SFCSCOMR . . . . . . . . . . . . . . . . . . . . . .301
ICPREWR2(P) . . . . .................... 290
S(P)_SFCTCOMR . . . . . . . . . . . . . . . . . . . . . .303
ICPWM1 . . . . . . . . .................... 297
S(P)_SOCRDATA . . . . . . . . . . . . . . . . . . . . . .270
ICPWM2 . . . . . . . . .................... 297
SP_SOCCINF . . . . . . . . . . . . . . . . . . . . . . . . .264
ICRCNT1 . . . . . . . . .................... 295
SP_SOCCLOSE. . . . . . . . . . . . . . . . . . . . . . . .255
ICRCNT2 . . . . . . . . .................... 295
SP_SOCCSET . . . . . . . . . . . . . . . . . . . . . . . . .266
ICRNGWR1(P) . . . . .................... 288
SP_SOCOPEN . . . . . . . . . . . . . . . . . . . . . . . .252
ICRNGWR2(P) . . . . .................... 288
SP_SOCRCV . . . . . . . . . . . . . . . . . . . . . . . . . .257
ICSMPRD1(P) . . . . .................... 292
SP_SOCRMODE . . . . . . . . . . . . . . . . . . . . . . .268
ICSMPRD2(P) . . . . .................... 292
SP_SOCSND . . . . . . . . . . . . . . . . . . . . . . . . . .261
IPABRST1 . . . . . . . .................... 280
S_SOCRCVS . . . . . . . . . . . . . . . . . . . . . . . . . .259
IPABRST2 . . . . . . . .................... 280
IPDSTRT1(P) . . . . . .................... 273
IPDSTRT2(P) . . . . . .................... 273 Z
IPJOG1 . . . . . . . . . .................... 278
Z(P)_REMFR . . . . . . . . . . . . . . . . . . . . . . . . . .182
IPJOG2 . . . . . . . . . .................... 278
IPOPR1(P) . . . . . . . .................... 276 Z(P)_REMTO . . . . . . . . . . . . . . . . . . . . . . . . . .185
Z(P)_RRUN_J . . . . . . . . . . . . . . . . . . . . . . . . .171
IPOPR2(P) . . . . . . . .................... 276
Z(P)_RRUN_U . . . . . . . . . . . . . . . . . . . . . . . . .171
IPPSTRT1(P) . . . . . .................... 272
Z(P)_RSTOP_J . . . . . . . . . . . . . . . . . . . . . . . .174

308
Z(P)_RSTOP_U . . . . . . . . . . . . . . . . . . . . . . . 174
Z(P)_RTMRD_J . . . . . . . . . . . . . . . . . . . . . . . 177
Z(P)_RTMRD_U . . . . . . . . . . . . . . . . . . . . . . . 177
Z(P)_RTMWR_J . . . . . . . . . . . . . . . . . . . . . . . 179
Z(P)_RTMWR_U . . . . . . . . . . . . . . . . . . . . . . 179
Z(P)_UINI. . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Z_ABRST1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Z_ABRST2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Z_ABRST3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Z_ABRST4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Z_BUFRCVS . . . . . . . . . . . . . . . . . . . . . . . 66,204
ZP_BUFRCV . . . . . . . . . . . . . . . . . . . . . . . . . 201
ZP_BUFSND . . . . . . . . . . . . . . . . . . . . . . . . . 206
ZP_CLOSE . . . . . . . . . . . . . . . . . . . . . . . . . . 198
ZP_CSET. . . . . . . . . . . . . . . . . . . . . . . . 64,72,75
ZP_ERRCLR . . . . . . . . . . . . . . . . . . . . . . . . . 209
ZP_ERRRD . . . . . . . . . . . . . . . . . . . . . . . . . . 212
ZP_MRECV . . . . . . . . . . . . . . . . . . . . . . . . . . 218
ZP_MSEND . . . . . . . . . . . . . . . . . . . . . . . . . . 221
ZP_OPEN . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
ZP_PFWRT . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
ZP_PINIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
ZP_PSTRT1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
ZP_PSTRT2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
ZP_PSTRT3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
ZP_PSTRT4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
ZP_TEACH1 . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ZP_TEACH2 . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ZP_TEACH3 . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ZP_TEACH4 . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ZP_UINI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Z_RECVS . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

309
REVISIONS
*The manual number is given on the bottom left of the back cover.
Revision date *Manual number Description
July, 2008 SH(NA)-080785ENG-A Due to the transition to the e-Manual, the details of revision have been deleted.
 
June, 2013 SH(NA)-080785ENG-K
February, 2017 SH(NA)-080785ENG-L Complete revision (layout change)
September, 2018 SH(NA)-080785ENG-M Descriptions regarding the QnUDPVCPU is added.

Japanese manual version SH-080738-Q


This manual confers no industrial property rights of any other kind, nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot be held
responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual.

 2008 MITSUBISHI ELECTRIC CORPORATION

310
WARRANTY
Please confirm the following product warranty details before using this product.
1. Gratis Warranty Term and Gratis Warranty Range
If any faults or defects (hereinafter "Failure") found to be the responsibility of Mitsubishi occurs during use of the product
within the gratis warranty term, the product shall be repaired at no cost via the sales representative or Mitsubishi Service
Company.
However, if repairs are required onsite at domestic or overseas location, expenses to send an engineer will be solely at
the customer's discretion. Mitsubishi shall not be held responsible for any re-commissioning, maintenance, or testing
on-site that involves replacement of the failed module.
[Gratis Warranty Term]
The gratis warranty term of the product shall be for one year after the date of purchase or delivery to a designated place.
Note that after manufacture and shipment from Mitsubishi, the maximum distribution period shall be six (6) months, and
the longest gratis warranty term after manufacturing shall be eighteen (18) months. The gratis warranty term of repair
parts shall not exceed the gratis warranty term before repairs.
[Gratis Warranty Range]
(1) The range shall be limited to normal use within the usage state, usage methods and usage environment, etc., which
follow the conditions and precautions, etc., given in the instruction manual, user's manual and caution labels on the
product.
(2) Even within the gratis warranty term, repairs shall be charged for in the following cases.
1. Failure occurring from inappropriate storage or handling, carelessness or negligence by the user. Failure caused
by the user's hardware or software design.
2. Failure caused by unapproved modifications, etc., to the product by the user.
3. When the Mitsubishi product is assembled into a user's device, Failure that could have been avoided if functions
or structures, judged as necessary in the legal safety measures the user's device is subject to or as necessary by
industry standards, had been provided.
4. Failure that could have been avoided if consumable parts (battery, backlight, fuse, etc.) designated in the
instruction manual had been correctly serviced or replaced.
5. Failure caused by external irresistible forces such as fires or abnormal voltages, and Failure caused by force
majeure such as earthquakes, lightning, wind and water damage.
6. Failure caused by reasons unpredictable by scientific technology standards at time of shipment from Mitsubishi.
7. Any other failure found not to be the responsibility of Mitsubishi or that admitted not to be so by the user.
2. Onerous repair term after discontinuation of production
(1) Mitsubishi shall accept onerous product repairs for seven (7) years after production of the product is discontinued.
Discontinuation of production shall be notified with Mitsubishi Technical Bulletins, etc.
(2) Product supply (including repair parts) is not available after production is discontinued.
3. Overseas service
Overseas, repairs shall be accepted by Mitsubishi's local overseas FA Center. Note that the repair conditions at each FA
Center may differ.
4. Exclusion of loss in opportunity and secondary loss from warranty liability
Regardless of the gratis warranty term, Mitsubishi shall not be liable for compensation to:
(1) Damages caused by any cause found not to be the responsibility of Mitsubishi.
(2) Loss in opportunity, lost profits incurred to the user by Failures of Mitsubishi products.
(3) Special damages and secondary damages whether foreseeable or not, compensation for accidents, and
compensation for damages to products other than Mitsubishi products.
(4) Replacement by the user, maintenance of on-site equipment, start-up test run and other tasks.
5. Changes in product specifications
The specifications given in the catalogs, manuals or technical documents are subject to change without prior notice.

311
TRADEMARKS
Ethernet is a registered trademark of Fuji Xerox Co., Ltd. in Japan.
Microsoft, Microsoft Access, Excel, SQL Server, Visual Basic, Visual C++, Visual Studio, Windows, Windows NT, Windows
Server, Windows Vista, and Windows XP are either registered trademarks or trademarks of Microsoft Corporation in the
United States and/or other countries.
The company names, system names and product names mentioned in this manual are either registered trademarks or
trademarks of their respective companies.
In some cases, trademark symbols such as '' or '' are not specified in this manual.

312 SH(NA)-080785ENG-M
SH(NA)-080785ENG-M(1809)KWIX
MODEL: Q-KP-TM-E
MODEL CODE: 13JW09

HEAD OFFICE : TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN
NAGOYA WORKS : 1-14 , YADA-MINAMI 5-CHOME , HIGASHI-KU, NAGOYA , JAPAN

When exported from Japan, this manual does not require application to the
Ministry of Economy, Trade and Industry for service transaction permission.

Specifications subject to change without notice.

You might also like