Mitsubishi Electric MELSEC-L Special Instructions Manual

Melsec-q/l structured programming manual
Hide thumbs Also See for MELSEC-L:
Table of Contents

Advertisement

Quick Links

MELSEC-Q/L Structured Programming Manual
(Special Instructions)

Advertisement

Table of Contents
loading

Summary of Contents for Mitsubishi Electric MELSEC-L

  • Page 1 MELSEC-Q/L Structured Programming Manual (Special Instructions)
  • Page 3: Safety Precautions

    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.
  • Page 4: Introduction

    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.
  • Page 5: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 CONDITIONS OF USE FOR THE PRODUCT .
  • Page 6 Receive data clear............... . 64 BUFRCVS instruction .
  • Page 7 Changing Destination ..............266 Changing Receive Mode .
  • Page 8: Manuals

    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>...
  • Page 9 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>...
  • Page 10 Description 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...
  • Page 11: Terms

    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...
  • Page 12: Chapter 1 Overview

    OVERVIEW 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.
  • Page 13 Details of instructions in each programming language Purpose Overview Details 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  ...
  • Page 14: Explanation Content In This Manual

    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 •...
  • Page 15: Modules And Versions Applicable To Instructions

    Modules and Versions Applicable to Instructions This section describes the modules and versions applicable to the instructions explained in this manual. For details of 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,...
  • Page 16 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, Q04UDEHCPU, instruction are limited. Page 301 SFC Step Q06HCPU, Q06PHCPU, Q06UDHCPU, Q06UDVCPU, Q06UDEHCPU, Q10UDHCPU, Q10UDEHCPU, Q12HCPU, Q12PHCPU, Q12PRHCPU, Comment Read Q13UDHCPU, Q13UDVCPU, Q13UDEHCPU, Q20UDHCPU,...
  • Page 17: Chapter 2 Instruction Tables

    INSTRUCTION TABLES How to Read Instruction Tables The instruction tables found from Page 16 Module Dedicated Instruction to Page 28 SFC Control Instruction have been made according to the following format: Ò Ó Ô Õ Ö × Ø Description Classifies instructions by application. Indicates the instructions used in a program.
  • Page 18: Module Dedicated Instruction

    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) •...
  • Page 19: Positioning 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 axis. Z_ABRST1, Z_ABRST2, Z_ABRST2 (Un*), (s), (d) Z_ABRST3, Z_ABRST4 Z_ABRST3 (Un*), (s), (d) Z_ABRST4 (Un*), (s), (d) Positioning start...
  • Page 20: Serial Communication Instruction

    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 Serial transmission function of MC protocol. G(P)_ONDE MAND GP_ONDEMAN (Un*), (s1), (s2), Modem Nonprocedural protocol G_OUTPUT (Un*), (s1), (s2),...
  • Page 21: Network 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 (d2) points from the buffer memory or J(P)_RIRD, device station device of the specified station.
  • Page 22 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 CC IE C (d1), (d2) another station. J(P)_READ, G(P)_READ JP_READ (Jn*), (s1), (s2), CC IE F (d1), (d2) NET/H...
  • Page 23 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 CC IE C another station (d1), (d2) another station. J(P)_REQ, Reads/writes clock data from another G(P)_REQ JP_REQ (Jn*), (s1), (s2), station.
  • Page 24 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 NET/H memory of intelligent n4, n5, (d1), (d2) an intelligent function module on the Z(P)_REMF function module on remote I/O station.
  • Page 25: Pid Control Instruction

    PID Control Instruction PID control instruction (inexact differential) Classification Instruction Argument Processing details Executing Reference name condition Data setting S_PIDINIT Sets data to be used for PID operation. Page 227 S(P)_PIDINIT SP_PIDINIT PID operation S_PIDCONT Performs PID operation based on the set value Page 232 (SV) and process value (PV).
  • Page 26: Socket Communication Function Instruction

    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 SP_SOCOPEN SP_SOCCLOS (Un*), (s1), (s2), Shuts a connection off. Page 255 SP_SOCCLOS Reading receive data SP_SOCRCV (Un*), (s1), (s2), Reads receive data.
  • Page 27: Built-In I/O Function Instruction

    Built-in I/O Function Instruction Positioning function dedicated instruction Classification Instruction Argument Processing details Executing Reference name condition Positioning start IPPSTRT1 Specifies a data number to be executed from Page 272 "Positioning Data" No. 1 to No. 10 which are IPPSTRT1, previously set in GX Works2, and starts the IPPSTRT2 IPPSTRT1P...
  • Page 28: Counter Function Dedicated Instruction

    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, ICCNTRD2  ICCNTRD1P  ICCNTRD2  ICCNTRD2P Ring counter upper/lower limit ICRNGWR1...
  • Page 29 Classification Instruction Argument Processing details Executing Reference name condition Pulse measurement read ICPLSRD1 Stores the measured pulse value of the Page 296 specified CH. ICPLSRD1, ICPLSRD2 ICPLSRD1P ICPLSRD2 ICPLSRD2P PWM output ICPWM1 (s1), (s2) Outputs the PWM waveform of the specified Page 297 ICPWM1, ICPWM2...
  • Page 30: Data Logging Function Instruction

    Data Logging Function Instruction Classification Instruction Argument Processing details Executing Reference name condition Trigger logging set/reset LOGTRG 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...
  • Page 31: Chapter 3 Configuration Of Instructions

    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. •...
  • Page 32 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.
  • Page 33: Chapter 4 How To Read Instructions

    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...
  • Page 34 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 Modem QnUDV CC-Link...
  • Page 35: Chapter 5 Module Dedicated Instruction

    MODULE DEDICATED INSTRUCTION Analog Instruction OFFGAN instruction G(P)_OFFGAN Structured ladder/FBD G_OFFGAN ENO:= (EN, Un*, s); G_OFFGAN 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 Executing condition...
  • Page 36 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...
  • Page 37: Setting Value Reading

    Setting value reading G(P)_OGLOAD Structured ladder/FBD G_OGLOAD ENO:= (EN, Un*, s, d); G_OGLOAD The following instruction can go in the dotted squares. G_OGLOAD, GP_OGLOAD ■Executing condition Instruction Executing condition G_OGLOAD GP_OGLOAD ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module ANY16...
  • Page 38 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...
  • Page 39: Setting Value Restoration

    Setting value restoration G(P)_OGSTOR Structured ladder/FBD G_OGSTOR ENO:= (EN, Un*, s, d); G_OGSTOR The following instruction can go in the dotted squares. G_OGSTOR, GP_OGSTOR ■Executing condition Instruction Executing condition G_OGSTOR GP_OGSTOR ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module ANY16...
  • Page 40 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...
  • Page 41: Positioning Instruction

    Positioning Instruction Absolute position restoration Z_ABRST1, Z_ABRST2, Z_ABRST3, Z_ABRST4 Structured ladder/FBD Z_ABRST1 ENO:= (EN, Un*, s,d); Z_ABRST1 The following instruction can go in the dotted squares. 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...
  • Page 42 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...
  • Page 43 [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 Sets ABS data Sets ABS data in data b0 received from the servo...
  • Page 44 [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);...
  • Page 45: Positioning Start

    Positioning start ZP_PSTRT1, ZP_PSTRT2, ZP_PSTRT3, ZP_PSTRT4 Structured ladder/FBD ZP_PSTRT1 ENO:= (EN, Un*, s,d); ZP_PSTRT1 The following instruction can go in the dotted squares. ZP_PSTRT1, ZP_PSTRT2, ZP_PSTRT3, ZP_PSTRT4 ■Executing condition Instruction Executing condition ZP_PSTRT1, ZP_PSTRT2, ZP_PSTRT3, ZP_PSTRT4 ■Argument Input/output Name Description Data type argument Input argument...
  • Page 46 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.
  • Page 47: Teaching

    Teaching ZP_TEACH1, ZP_TEACH2, ZP_TEACH3, ZP_TEACH4 Structured ladder/FBD ZP_TEACH1 ENO:= (EN, Un*, s,d); ZP_TEACH1 The following instruction can go in the dotted squares. ZP_TEACH1, ZP_TEACH2, ZP_TEACH3, ZP_TEACH4 ■Executing condition Instruction Executing condition ZP_TEACH1, ZP_TEACH2, ZP_TEACH3, ZP_TEACH4 ■Argument Input/output Name Description Data type argument Input argument Executing condition...
  • Page 48 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 Sets teaching data Sets positioning data number Performs teaching Turns teaching instruction memory [ST]...
  • Page 49: Pfwrt Instruction

    PFWRT instruction ZP_PFWRT Structured ladder/FBD ZP_PFWRT ENO:= (EN, Un*, s,d); ZP_PFWRT The following instruction can go in the dotted squares. ZP_PFWRT ■Executing condition Instruction Executing condition ZP_PFWRT ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/ O number in three digits)
  • Page 50 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...
  • Page 51: Setting Data Initialization

    Setting data initialization ZP_PINIT Structured ladder/FBD ZP_PINIT ENO:= (EN, Un*, s,d); ZP_PINIT The following instruction can go in the dotted squares. ZP_PINIT ■Executing condition Instruction Executing condition ZP_PINIT ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/ O number in three digits)
  • Page 52 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...
  • Page 53: Serial Communication Instruction

    Serial Communication Instruction On-demand function transmission G(P)_ONDEMAND Serial Modem Structured ladder/FBD G_ONDEMAND ENO:= (EN, Un*, s1, s2, d); G_ONDEMAND 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...
  • Page 54 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)
  • Page 55 [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);...
  • Page 56: Nonprocedural Protocol Communication

    Nonprocedural protocol communication G(P)_OUTPUT Serial Modem Structured ladder/FBD G_OUTPUT ENO:= (EN, Un*, s1, s2, d); G_OUTPUT 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 Executing condition...
  • Page 57 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 Sets transmission channel to 1 Sets number of send...
  • Page 58 [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]);...
  • Page 59 G_INPUT Serial Modem Structured ladder/FBD G_INPUT ENO:= (EN, Un*, s, d1, d2); G_INPUT The following instruction can go in the dotted squares. G_INPUT ■Executing condition Instruction Executing condition G_INPUT ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module ANY16 (00 to FE: Higher two digits when expressing the I/...
  • Page 60 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...
  • Page 61: Bidirectional Protocol Communication

    Bidirectional protocol communication G(P)_BIDOUT Serial Modem Structured ladder/FBD G_BIDOUT ENO:= (EN ,Un* ,s1 ,s2 ,d); G_BIDOUT The following instruction can go in the dotted squares. G_BIDOUT, GP_BIDOUT ■Executing condition Instruction Executing condition G_BIDOUT GP_BIDOUT ■Argument Input/output Name Description Data type argument Input argument Executing condition...
  • Page 62 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...
  • Page 63 G(P)_BIDIN Serial Modem Structured ladder/FBD G_BIDIN ENO:= (EN, Un*, s, d1, d2); G_BIDIN The following instruction can go in the dotted squares. G_BIDIN, GP_BIDIN ■Executing condition Instruction Executing condition G_BIDIN GP_BIDIN ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module ANY16...
  • Page 64 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...
  • Page 65: Communication Status Check

    Communication status check G(P)_SPBUSY Serial Modem Structured ladder/FBD G_SPBUSY ENO:= (EN, Un*, d); G_SPBUSY The following instruction can go in the dotted squares. G_SPBUSY, GP_SPBUSY ■Executing condition Instruction Executing condition G_SPBUSY GP_SPBUSY ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module ANY16...
  • Page 66: Receive Data Clear

    Receive data clear ZP_CSET Serial Modem Structured ladder/FBD ZP_CSET ENO:= (EN, Un*, s1, s2, d1, d2); ZP_CSET 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 Executing condition Start I/O number of the module...
  • Page 67 Setting data Device Item Setting data Setting range Setting side (s2)[0] Execution type Specify '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.
  • Page 68: Bufrcvs Instruction

    BUFRCVS instruction Z_BUFRCVS Serial Modem Structured ladder/FBD Z_BUFRCVS ENO:= (EN, Un*, s, d); Z_BUFRCVS 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 Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/...
  • Page 69 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 [ST] (* Set the normal/error confirmation flag for the main program *) (* The main program resets flags *) SET(DX3, Var_Flag_Normal);...
  • Page 70 G(P)_PRR Serial Modem Structured ladder/FBD G_PRR ENO:= (EN, Un*, s, d); G_PRR 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 Executing condition Start I/O number of the module ANY16 (00 to FE: Higher two digits when expressing the I/...
  • Page 71 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)
  • Page 72 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...
  • Page 73 [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]);...
  • Page 74: Initial Setting

    Initial setting ZP_CSET Serial Modem Structured ladder/FBD ZP_CSET ENO:= (EN, Un*, s1, s2, d1, d2); ZP_CSET 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 Executing condition Start I/O number of the module String...
  • Page 75 Setting data Device Item Setting data Setting range Setting side (s2)[0] Execution type Specify '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.
  • Page 76 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...
  • Page 77: Cset Instruction (Programmable Controller Cpu Monitor)

    CSET instruction (programmable controller CPU monitor) ZP_CSET Serial Modem Structured ladder/FBD ZP_CSET ENO:= (EN, Un*, s1, s2, d1, d2); ZP_CSET 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...
  • Page 78 Setting data ■Registering the programmable controller CPU monitoring Device Item Setting data Setting Setting side range (s2)[0] Execution type Specify '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.
  • Page 79 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...
  • Page 80 Device Item Setting data Setting Setting side range (s2)[103] CPU status Condition Fixed value Specify a fixed value to monitor the CPU status. User monitoring agreement (s2)[104] setting transmission (s2)[105] * Error (s2)[106] monitoring (s2)[107] 11th (s2)[108] * 11th block (s2)[109] User frame Specify the start pointer of the to which the user...
  • Page 81 ■Canceling the programmable controller CPU monitoring Device Item Setting data Setting range Setting side (s2)[0] Execution type Specify '0H'. 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.
  • Page 82 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...
  • Page 83 [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]);...
  • Page 84 • 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...
  • Page 85: Pute Instruction

    PUTE instruction G(P)_PUTE Serial Modem Structured ladder/FBD G_PUTE ENO:= (EN, Un*, s1, s2, d); G_PUTE The following instruction can go in the dotted squares. G_PUTE, GP_PUTE ■Executing condition Instruction Executing condition G_PUTE GP_PUTE ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module...
  • Page 86 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.
  • Page 87 [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]);...
  • Page 88 G(P)_GETE Serial Modem Structured ladder/FBD G_GETE ENO:= (EN, Un*, s1, s2, d); G_GETE 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 Executing condition Start I/O number of the module ANY16...
  • Page 89 Setting data Device Item Setting data Setting range Setting side   (s1)[0] Dummy  (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...
  • Page 90 [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);...
  • Page 91: Mode Switching

    Mode switching ZP_UINI Serial Structured ladder/FBD ZP_UINI ENO:= (EN, Un*, s, d); ZP_UINI The following instruction can go in the dotted squares. ZP_UINI ■Executing condition Instruction Executing condition ZP_UINI ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/...
  • Page 92 Setting data Device Item Setting data Setting range Setting side (s)[0] For system Always specify '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.
  • Page 93 ■(s)[3] (CH1 Transmission specification setting) and (s)[5] (CH2 Transmission specification setting) … CH1 ((s)[3]) CH2 ((s)[5]) Description Setting value Remarks Operation setting OFF(0): Independence Always set the CH1 side ((s)[3]) to 0. ON (1): Link Data bit OFF(0): 7 Parity bit is not included. ON(1): 8 Parity bit OFF(0): Without...
  • Page 94 ■(s)[4] (CH1 Communication protocol setting) and (s)[6] (CH2 Communication protocol setting) Setting No. Description Remarks MELSOFT connection Specify '0000H' for the transmission specification setting. MC protocol Format 1  Format 2  Format 3   Format 4 Format 5 ...
  • Page 95 [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 Sets CH2 communication protocol Sets host station number Switches mode Turns interlock signal for communication stop ON Process on normal completion Normal completion Process on error completion...
  • Page 96 [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]);...
  • Page 97: Pre-Defined Protocol Communication

    Pre-defined protocol communication G(P)_CPRTCL Serial Structured ladder/FBD G_CPRTCL ENO:= (EN, Un*, n1, n2, s, d); G_CPRTCL The following instruction can go in the dotted squares. G_CPRTCL, GP_CPRTCL ■Executing condition Instruction Executing condition G_CPRTCL GP_CPRTCL ■Argument Input/output Name Description Data type argument Input argument Executing condition...
  • Page 98 *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 5.3 Serial Communication Instruction...
  • Page 99 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 Abnormal completion flag ON Store the error code [ST]...
  • Page 100: Network Dedicated Instruction

    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 J_RIRD G_RIRD ENO:= (EN, Jn*, s, d1, d2); J_RIRD ENO:= (EN, Un*, s, d1, d2); G_RIRD The following instruction can go in the dotted squares.
  • Page 101 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.
  • Page 102 ■Device memory of the programmable controller CPU module Device Name Device type Unit Access code Attribute code Word   Input relay Hexadecimal   Output relay Hexadecimal   Internal relay Decimal   Latch relay Decimal   Link relay Hexadecimal ...
  • Page 103 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.
  • Page 104: Writing To The Buffer Memory Of An Intelligent Device Station

    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 J_RIWT G_RIWT ENO:= (EN, Jn*, s1, s2, d); J_RIWT ENO:= (EN, Un*, s1, s2, d); G_RIWT The following instruction can go in the dotted squares. J_RIWT, JP_RIWT, G_RIWT, GP_RIWT ■Executing condition Instruction...
  • Page 105 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.
  • Page 106 ■Device memory of the programmable controller CPU module Device Name Device type Unit Access code Attribute code Word   Input relay Hexadecimal   Output relay Hexadecimal   Internal relay Decimal   Latch relay Decimal   Link relay Hexadecimal ...
  • Page 107 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.
  • Page 108: Rircv Instruction

    RIRCV instruction G(P)_RIRCV CC-Link Structured ladder/FBD G_RIRCV ENO:= (EN, Un*, s1, s2, d1, d2); G_RIRCV 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 Executing condition Start I/O number of the module...
  • Page 109 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]...
  • Page 110 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.
  • Page 111 [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]);...
  • Page 112: Risend Instruction

    RISEND instruction G(P)_RISEND CC-Link Structured ladder/FBD G_RISEND ENO:= (EN, Un*, s1, s2, d1, d2); G_RISEND 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 Executing condition Start I/O number of the module...
  • Page 113 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]...
  • Page 114 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.
  • Page 115 [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]);...
  • Page 116: Reading From The Auto-Refresh Buffer Memory Of The Master Station

    Reading from the auto-refresh buffer memory of the master station G(P)_RIFR CC-Link Structured ladder/FBD G_RIFR ENO:= (EN, Un*, n1, n2, n3, d); G_RIFR 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...
  • Page 117 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.
  • Page 118: Writing To The Auto-Refresh Buffer Memory Of The Master Station

    Writing to the auto-refresh buffer memory of the master station G(P)_RITO CC-Link Structured ladder/FBD G_RITO ENO:= (EN, Un*, n1, n2, n3, d); G_RITO 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...
  • Page 119 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.) Master module Intelligent device station...
  • Page 120: Network Parameter Setting

    Network parameter setting G(P)_RLPASET CC-Link Structured ladder/FBD G_RLPASET ENO:= (EN, Un*, s1, s2, s3, s4, s5, d); G_RLPASET 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...
  • Page 121 Setting data Device Item Setting data Setting Setting side range  (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). ...
  • Page 122 ■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 number as shown below. (s2)[63] b12 b11 b8 b7...
  • Page 123 ■Error invalid station specification data Device Item Setting data Setting Setting side range (s4)[0] Specification for Specify the error invalid station.  User  1 to 64 0: Not specified (s4)[3] stations 1: Specified s4 [0] s4 [1] s4 [2] s4 [3] 1 to 64 in the table indicates a station number.
  • Page 124 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...
  • Page 125 [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 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...
  • Page 126 [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]);...
  • Page 127: Read Instruction

    READ instruction J(P)_READ, G(P)_READ CC IE C CC IE F NET/H Ether Structured ladder/FBD J_READ G_READ ENO:= (EN, Jn*, s1, s2, d1, d2); J_READ ENO:= (EN, Un*, s1, s2, d1, d2); G_READ The following instruction can go in the dotted squares. J_READ, JP_READ, G_READ, GP_READ ■Executing condition Instruction...
  • Page 128 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 … … 0081H 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].
  • Page 129 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].
  • Page 130 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...
  • Page 131 [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]);...
  • Page 132 J(P)_SREAD, G(P)_SREAD CC IE C CC IE F NET/H Ether Structured ladder/FBD J_SREAD G_SREAD ENO:= (EN, Jn*, s1, s2, d1, d2, d3); J_SREAD ENO:= (EN, Un*, s1, s2, d1, d2, d3); G_SREAD The following instruction can go in the dotted squares. J_SREAD, JP_SREAD, G_SREAD, GP_SREAD ■Executing condition Instruction...
  • Page 133 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...
  • Page 134 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...
  • Page 135 [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]);...
  • Page 136 J(P)_WRITE, G(P)_WRITE CC IE C CC IE F NET/H Ether Structured ladder/FBD J_WRITE G_WRITE ENO:= (EN, Jn*, s1, s2, s3, d1); J_WRITE ENO:= (EN, Un*, s1, s2, s3, d1); G_WRITE The following instruction can go in the dotted squares. J_WRITE, JP_WRITE, G_WRITE, GP_WRITE ■Executing condition Instruction Executing condition...
  • Page 137 Setting data Device Item Setting data Setting Setting range side (s1)[0] Execution/Error 0000H, User … … completion type 0001H, 0080H, 0081H 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.
  • Page 138 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].
  • Page 139 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].) ...
  • Page 140 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...
  • Page 141 [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]);...
  • Page 142 J(P)_SWRITE, G(P)_SWRITE CC IE C CC IE F NET/H Ether Structured ladder/FBD J_SWRITE J_SWRITE G_SWRITE G_SWRITE ENO:= (EN, Jn*, s1, s2, d1, d2, d3); J_SWRITE ENO:= (EN, Un*, s1, s2, d1, d2, d3); G_SWRITE The following instruction can go in the dotted squares. J_SWRITE, JP_SWRITE, G_SWRITE, GP_SWRITE ■Executing condition Instruction...
  • Page 143 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.
  • Page 144 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...
  • Page 145 [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]);...
  • Page 146: Message (User-Specified Data) Communication

    Message (user-specified data) communication J(P)_SEND, G(P)_SEND CC IE C CC IE F NET/H Ether Structured ladder/FBD J_SEND G_SEND ENO:= (EN, Jn*, s1, s2, d); J_SEND ENO:= (EN, Un*, s1, s2, d); G_SEND The following instruction can go in the dotted squares. J_SEND, JP_SEND, G_SEND, GP_SEND ■Executing condition Instruction...
  • Page 147 Setting data Device Item Setting data Setting Setting side range (s1)[0] Execution/Error 0000H, 0001H, User … … completion type 0080H, 0081H 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.
  • Page 148 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].
  • Page 149 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].
  • Page 150 [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...
  • Page 151 [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]);...
  • Page 152 J(P)_RECV, G(P)_RECV CC IE C CC IE F NET/H Ether Structured ladder/FBD J_RECV G_RECV ENO:= (EN, Jn*, s, d1, d2); J_RECV ENO:= (EN, Un*, s, d1, d2); G_RECV The following instruction can go in the dotted squares. J_RECV, JP_RECV, G_RECV, GP_RECV ■Executing condition Instruction Executing condition...
  • Page 153 Setting data Device Item Setting data Setting Setting side range (s)[0] Execution/error 0000H, 0080H User … … completion type 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].
  • Page 154 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. error was detected at the host station, the network number is not stored.) Stored values are as follows.
  • Page 155 [Structured ladder/FBD] Sets error completion type Sets host station channel Sets arrival monitoring time Performs readout Process on completion of readout Execution finished Normal completion Process on normal completion Error completion Process on error completion Stores error code [ST] IF(SM400=TRUE)THEN MOV(TRUE,H80,Var_ControlData[0]);...
  • Page 156 Z_RECVS CC IE C CC IE F NET/H Ether Structured ladder/FBD Z_RECVS ENO:= (EN, Un*, s1, s2, d); Z_RECVS 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 Executing condition...
  • Page 157 Setting data Device Item Setting data Setting Setting side range (s1)[0] Completion type 0 (Fixed) 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.
  • Page 158 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.
  • Page 159: Transient Request To Another Station

    Transient request to another station J(P)_REQ, G(P)_REQ CC IE C CC IE F NET/H Ether Structured ladder/FBD J_REQ G_REQ ENO:= (EN, Jn*, s1, s2, d1, d2); J_REQ ENO:= (EN, Un*, s1, s2, d1, d2); G_REQ The following instruction can go in the dotted squares. J_REQ, JP_REQ, G_REQ, GP_REQ ■Executing condition Instruction...
  • Page 160 Setting data Device Item Setting data Setting Setting side range (s1)[0] Error completion 0011H, 0091H User … … … type 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].
  • Page 161 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].
  • Page 162 ■Remote RUN/STOP • Request data (all set by the user) Device Item Description Remote Remote 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]  ...
  • Page 163 ■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]) ...
  • Page 164 • 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]) ...
  • Page 165 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 Sets monitoring time Sets data length by the word...
  • Page 166 [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]);...
  • Page 167: Read From Other Station Devices

    Read from other station devices J(P)_ZNRD CC IE C NET/H Ether Structured ladder/FBD J_ZNRD ENO:= (EN, Jn*, n1, s, n2, d1, d2); J_ZNRD The following instruction can go in the dotted squares. J_ZNRD, JP_ZNRD ■Executing condition Instruction Executing condition J_ZNRD JP_ZNRD ■Argument Input/output...
  • Page 168 *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.
  • Page 169 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 Stores error code...
  • Page 170: Write To Other Station Devices

    Write to other station devices J(P)_ZNWR CC IE C NET/H Ether Structured ladder/FBD J_ZNWR ENO:= (EN, Jn*, n1, s, n2, d1, d2); J_ZNWR 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...
  • Page 171 Setting Internal device R, ZR J\ U\G Constant Others *1*2 data K, H Word Word (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.
  • Page 172 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...
  • Page 173: Rrun Instruction

    RRUN instruction Z(P)_RRUN_J, Z(P)_RRUN_U CC IE C NET/H Structured ladder/FBD Z_RRUN_J Z_RRUN_U ENO:= (EN, Jn*, s1, s2, s3, s4, d); Z_RRUN_J ENO:= (EN, Un*, s1, s2, s3, s4, d); Z_RRUN_U 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...
  • Page 174 ■Argument Input/output Name Description Data type argument Input argument Executing condition Network number of the target station (1 to 239, 254) String 254: Network specified in "Valid module during other station access" 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)
  • Page 175 Program example • The following program remotely switches the QCPU on the station number 2 (target station) to RUN. [Structured ladder/FBD] Performs remote RUN Execution finished Process on completion Process on normal completion Normal completion Error completion Process on error completion Stores error code [ST] IF((Var_Flag_Exe=TRUE) AND (SB47=FALSE) AND (SW0A0.1=FALSE)) THEN...
  • Page 176: Rstop Instruction

    RSTOP instruction Z(P)_RSTOP_J, Z(P)_RSTOP_U CC IE C NET/H Structured ladder/FBD Z_RSTOP_J Z_RSTOP_U ENO:= (EN, Jn*, s1, s2, s3, s4, d); Z_RSTOP_J ENO:= (EN, Un*, s1, s2, s3, s4, d); Z_RSTOP_U 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...
  • Page 177 ■Argument Input/output Name Description Data type argument Input argument Executing condition Network number of the host station (1 to 239) String 254: Network specified in "Valid module during other station access" Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/ O number in three digits) Channel used by host station ANY16...
  • Page 178 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...
  • Page 179: Reading Clock Data From Another Station

    Reading clock data from another station Z(P)_RTMRD_J, Z(P)_RTMRD_U CC IE C NET/H Structured ladder/FBD Z_RTMRD_J Z_RTMRD_U ENO:= (EN, Jn*, s1, s2, s3, d1, d2); Z_RTMRD_J ENO:= (EN, Un*, s1, s2, s3, d1, d2); Z_RTMRD_U The following instruction can go in the dotted squares. Z_RTMRD_J, ZP_RTMRD_J, Z_RTMRD_U, ZP_RTMRD_U ■Executing condition Instruction...
  • Page 180 Setting Internal device R, ZR J\ U\G Constant Others data K, H Word Word      (s1)      (s2)      (s3)      (d1)   ...
  • Page 181: Writing Clock Data To Another Station

    Writing clock data to another station Z(P)_RTMWR_J, Z(P)_RTMWR_U CC IE C NET/H Structured ladder/FBD Z_RTMWR_J Z_RTMWR_U ENO:= (EN, Jn*, s1, s2, s3, s4, d); Z_RTMWR_J ENO:= (EN, Un*, s1, s2, s3, s4, d); Z_RTMWR_U The following instruction can go in the dotted squares. Z_RTMWR_J, ZP_RTMWR_J, Z_RTMWR_U, ZP_RTMWR_U ■Executing condition Instruction...
  • Page 182 Input/output Name Description Data type argument Output argument Execution result 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 Constant Others data...
  • Page 183 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 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...
  • Page 184: Reading From Buffer Memory Of Intelligent Function Module On Remote I/O Station

    Reading from buffer memory of intelligent function module on remote I/O station Z(P)_REMFR CC IE F NET/H Structured ladder/FBD Z_REMFR ENO:= (EN, Jn*, n1, n2, n3, n4, n5, d1, d2); Z_REMFR The following instruction can go in the dotted squares. Z_REMFR, ZP_REMFR ■Executing condition Instruction...
  • Page 185 Input/output Name Description Data type argument Output argument Execution result 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. 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.
  • Page 186 [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;...
  • Page 187: Writing To Buffer Memory Of Intelligent Function Module On Remote I/O Station

    Writing to buffer memory of intelligent function module on remote I/O station Z(P)_REMTO CC IE F NET/H Structured ladder/FBD Z_REMTO ENO:= (EN, Jn*, n1, n2, n3, n4, n5, d1, d2); Z_REMTO The following instruction can go in the dotted squares. Z_REMTO, ZP_REMTO ■Executing condition Instruction...
  • Page 188 Input/output Name Description Data type argument Output argument Execution result 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. 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.
  • Page 189 [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);...
  • Page 190: Setting Parameter

    Setting parameter G(P)_CCPASET CC IE F Structured ladder/FBD G_CCPASET ENO:= G_CCPASET (EN, Un*, s1, s2, s3, s4, d); 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...
  • Page 191 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.
  • Page 192 • 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] Slave Specify the station type and station number. Refer to the User station...
  • Page 193 • 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 ...
  • Page 194 [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 5.4 Network Dedicated Instruction...
  • Page 195 [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] );...
  • Page 196: Connection Opening Or Closing

    Connection opening or closing ZP_OPEN Ether Structured ladder/FBD ZP_OPEN ENO:= (EN, Un*, s1, s2, d); ZP_OPEN 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 Executing condition Start I/O number of the module String...
  • Page 197 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.
  • Page 198 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...
  • Page 199 [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;...
  • Page 200 ZP_CLOSE Ether Structured ladder/FBD ZP_CLOSE ENO:= (EN, Un*, s1, s2, d); ZP_CLOSE 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 Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/ O number in three digits)
  • Page 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) 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...
  • Page 202 [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);...
  • Page 203: Fixed Buffer Communication

    Fixed buffer communication ZP_BUFRCV Ether Structured ladder/FBD ZP_BUFRCV ENO:= (EN, Un*, s1, s2, d1, d2); ZP_BUFRCV The following instruction can go in the dotted squares. ZP_BUFRCV ■Executing condition Instruction Executing condition ZP_BUFRCV ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module String...
  • Page 204 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...
  • Page 205 [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 *)
  • Page 206 Z_BUFRCVS Ether Structured ladder/FBD Z_BUFRCVS ENO:= (EN, Un*, s, d); Z_BUFRCVS 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 Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/ O number in three digits)
  • Page 207 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.) •...
  • Page 208 ZP_BUFSND Ether Structured ladder/FBD ZP_BUFSND ENO:= (EN, Un*, s1, s2, s3, d); ZP_BUFSND 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 Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/...
  • Page 209 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...
  • Page 210 [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);...
  • Page 211: Reading Or Clearing Error Information

    Reading or clearing error information ZP_ERRCLR Ether Structured ladder/FBD ZP_ERRCLR ENO:= (EN, Un*, s, d); ZP_ERRCLR The following instruction can go in the dotted squares. ZP_ERRCLR ■Executing condition Instruction Executing condition ZP_ERRCLR ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module String...
  • Page 212 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.
  • Page 213 [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);...
  • Page 214 ZP_ERRRD Ether Structured ladder/FBD ZP_ERRRD ENO:= (EN, Un*, s, d); ZP_ERRRD 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 Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/ O number in three digits)
  • Page 215 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...
  • Page 216: Uini Instruction

    UINI instruction Z(P)_UINI CC IE C Ether *1 ZP_UINI instruction only Structured ladder/FBD Z_UINI ENO:= (EN, Un*, s, d); Z_UINI 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...
  • Page 217 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...
  • Page 218 • CC-link IE Controller Network Device Item Setting data Setting Setting range side  (s)[0] Specify 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...
  • Page 219 [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 *)
  • Page 220: E-Mail Communication

    E-mail communication ZP_MRECV Ether Structured ladder/FBD ZP_MRECV ENO:= (EN, Un*, s, d1, d2); ZP_MRECV 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 Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/...
  • Page 221 Setting data Device Item Setting data Setting Setting range side (s)[0] Execution/Error 0000H, User … … completion type 0080H, 0200H, 0280H (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 (s)[11]. 1: Clock data at the time of error completion is set in the area starting from (s)[11].
  • Page 222 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.
  • Page 223 ZP_MSEND Ether Structured ladder/FBD ZP_MSEND ENO:= (EN, Un*, s1, s2, d); ZP_MSEND The following instruction can go in the dotted squares. ZP_MSEND ■Executing condition Instruction Executing condition ZP_MSEND ■Argument Input/output Name Description Data type argument Input argument Executing condition Start I/O number of the module String (00 to FE: Higher two digits when expressing the I/ O number in three digits)
  • Page 224 Setting data Device Item Setting data Setting Setting range side (s1)[0] Execution/Error (Refer to the User … … … completion type Send left.) 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].
  • Page 225 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...
  • Page 226 [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;...
  • Page 227 • 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 Sets text Sends e-mail Normal completion Process on normal completion Error completion Process on error completion 5 MODULE DEDICATED INSTRUCTION 5.4 Network Dedicated Instruction...
  • Page 228 [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;...
  • Page 229: Chapter 6 Pid Control Instruction

    PID CONTROL INSTRUCTION PID Control Instruction (Inexact Differential) Data setting S(P)_PIDINIT Structured ladder/FBD S_PIDINIT ENO:= (EN, s); S_PIDINIT The following instruction can go in the dotted squares. S_PIDINIT, SP_PIDINIT ■Executing condition Instruction Executing condition S_PIDINIT SP_PIDINIT ■Argument Input/output Name Description Data type argument Input argument...
  • Page 230 Setting data Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits 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...
  • Page 231 Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (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...
  • Page 232 Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (s)+16 Operational The same as Setting data for No. 1 loop expression selection (s)+17 Sampling cycle (s)+18 Proportional constant (K...
  • Page 233 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. ...
  • Page 234: Pid Operation

    PID operation S(P)_PIDCONT Structured ladder/FBD S_PIDCONT ENO:= (EN, s); S_PIDCONT 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 Executing condition Start number of the device that is assigned in I/O ANY16 data area Output argument...
  • Page 235 Setting data Device Data name Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits  (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...
  • Page 236 Device Data name Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits  (s)+16 Alarm ALARM • Used to determine if the User … b1 b0 change rate of the MV (manipulated value) and System the PV (process value) is...
  • Page 237 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. ...
  • Page 238: Pidstop Instruction And Pidrun Instruction

    PIDSTOP instruction and PIDRUN instruction S_PIDSTOP, S_PIDRUN Structured ladder/FBD S_PIDSTOP ENO:= (EN, n); S_PIDSTOP 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...
  • Page 239: Operation Parameter Change

    Operation parameter change S(P)_PIDPRMW Structured ladder/FBD S_PIDPRMW ENO:= (EN, n, s); S_PIDPRMW The following instruction can go in the dotted squares. S_PIDPRMW, SP_PIDPRMW ■Executing condition Instruction Executing condition S_PIDPRMW SP_PIDPRMW ■Argument Input/output Name Description Data type argument Input argument Executing condition Loop number to be changed ANY16 Start number of the device that stores PID control...
  • Page 240 Setting data Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (s)+0 Operational Select the PID operational 0: Forward 0: Forward User An error occurs and the PID expression expression.
  • Page 241 Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (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...
  • Page 242: Pid Control Instruction (Exact Differential)

    PID Control Instruction (Exact Differential) Data setting PIDINIT(P) Structured ladder/FBD PIDINIT ENO:= (EN, s); PIDINIT 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 Executing condition Start number of the device that stores PID control...
  • Page 243 Setting data Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits 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...
  • Page 244 Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (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...
  • Page 245 Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (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 (s)+(m+2)
  • Page 246: Pid Operation

    PID operation PIDCONT(P) Structured ladder/FBD PIDCONT ENO:= (EN, s); PIDCONT 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 Executing condition Start number of the device that is assigned in I/O ANY16 data area Output argument...
  • Page 247 Setting data Device Data name Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits  (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...
  • Page 248 Device Data name Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits  (s)+16 Alarm ALARM • Used to determine if the User … b1 b0 change rate of the MV (manipulated value) and System the PV (process value) is...
  • Page 249 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. ...
  • Page 250: Pidstop Instruction And Pidrun Instruction

    PIDSTOP instruction and PIDRUN instruction PIDSTOP, PIDRUN Structured ladder/FBD PIDSTOP ENO:= (EN, n); PIDSTOP 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...
  • Page 251: Operation Parameter Change

    Operation parameter change PIDPRMW(P) Structured ladder/FBD PIDPRMW ENO:= (EN, n, s); PIDPRMW The following instruction can go in the dotted squares. PIDPRMW, PIDPRMWP ■Executing condition Instruction Executing condition PIDPRMW PIDPRMWP ■Argument Input/output Name Description Data type argument Input argument Executing condition Loop number to be changed ANY16 Start number of the device that stores PID control...
  • Page 252 Setting data Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (s)+0 Operational Select the PID operational 0: Forward 0: Forward User An error occurs and the PID expression expression.
  • Page 253 Device Data item Description Setting range Setting Processing when the side setting data are outside With PID limits Without PID the setting range limits (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...
  • Page 254: Chapter 7 Socket Communication Function Instruction

    SOCKET COMMUNICATION FUNCTION INSTRUCTION Opening/Closing Connection SP_SOCOPEN QnUDE(H) LCPU Structured ladder/FBD SP_SOCOPEN ENO:= (EN, Un, s1, s2, d); SP_SOCOPEN 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 Executing condition...
  • Page 255 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.
  • Page 256 Program example • The following program opens the connection 1. [Structured ladder/FBD] Sets execution type/completion type to 0 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]);...
  • Page 257 SP_SOCCLOSE QnUDE(H) LCPU Structured ladder/FBD SP_SOCCLOSE ENO:= (EN, Un, s1, s2, d); SP_SOCCLOSE 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 Executing condition Dummy ("U0") String Connection number (1 to 16)
  • Page 258 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.
  • Page 259: Socrcv Instruction

    SOCRCV Instruction SP_SOCRCV QnUDE(H) LCPU Structured ladder/FBD SP_SOCRCV ENO:= SP_SOCRCV (EN, Un, s1, s2, d1, d2); The following instruction can go in the dotted squares. SP_SOCRCV ■Executing condition Instruction Executing condition SP_SOCRCV ■Argument Input/output Name Description Data type argument Input argument Executing condition Dummy ("U0") String...
  • Page 260 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...
  • Page 261 S_SOCRCVS QnUDE(H) LCPU Structured ladder/FBD S_SOCRCVS (EN, Un, s, d); ENO:= S_SOCRCVS 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 Executing condition Dummy ("U0") String Connection number (1 to 16) ANY16...
  • Page 262 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;...
  • Page 263: Sending Data

    Sending Data SP_SOCSND QnUDE(H) LCPU Structured ladder/FBD SP_SOCSND ENO:= (EN, Un, s1, s2, s3, d); SP_SOCSND The following instruction can go in the dotted squares. SP_SOCSND ■Executing condition Instruction Executing condition SP_SOCSND ■Argument Input/output Name Description Data type argument Input argument Executing condition Dummy ("U0") String...
  • Page 264 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...
  • Page 265 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 completion flag ON...
  • Page 266: Soccinf Instruction

    SOCCINF Instruction SP_SOCCINF QnUDE(H) LCPU Structured ladder/FBD SP_SOCCINF ENO:= SP_SOCCINF (EN, Un, s1, s2, d); 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 Executing condition Dummy ("U0") String...
  • Page 267 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]...
  • Page 268: Changing Destination

    Changing Destination SP_SOCCSET QnUDE(H) LCPU Structured ladder/FBD SP_SOCCSET ENO:= (EN, Un, s1, s2); SP_SOCCSET 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 Executing condition Dummy ("U0") String Connection number (1 to 16)
  • Page 269 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 •...
  • Page 270: Changing Receive Mode

    Changing Receive Mode SP_SOCRMODE QnUDE(H) LCPU Structured ladder/FBD SP_SOCRMODE (EN, Un, s1, s2); SP_SOCRMODE ENO:= 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 Executing condition Dummy ("U0") String...
  • Page 271 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 Specify the TCP receive mode.
  • Page 272: Socrdata Instruction

    SOCRDATA Instruction S(P)_SOCRDATA QnUDE(H) LCPU Structured ladder/FBD S_SOCRDATA ENO:= (EN, Un, s1, s2, n, d); S_SOCRDATA 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 Executing condition...
  • Page 273 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.
  • Page 274: Chapter 8 Built-In I/O Function Instruction

    BUILT-IN I/O FUNCTION INSTRUCTION Positioning Function Dedicated Instruction Positioning start IPPSTRT1, IPPSTRT2 LCPU Structured ladder/FBD IPPSTRT1 ENO:= (EN, n); IPPSTRT1 The following instruction can go in the dotted squares. IPPSTRT1, IPPSTRT1P, IPPSTRT2, IPPSTRT2P ■Executing condition Instruction Executing condition IPPSTRT1 IPPSTRT2 IPPSTRT1P IPPSTRT2P ■Argument...
  • Page 275 IPDSTRT1, IPDSTRT2 LCPU Structured ladder/FBD IPDSTRT1 ENO:= (EN, s); IPDSTRT1 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 Executing condition Start number of the device in which the control data Array of ANY16 [0..7]...
  • Page 276 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) ...
  • Page 277 IPSIMUL(P) LCPU Structured ladder/FBD IPSIMUL ENO:= (EN, n1, n2); IPSIMUL 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 Executing condition Axis 1 positioning data number ANY16 Axis 2 positioning data number ANY16...
  • Page 278: Opr Start

    OPR start IPOPR1, IPOPR2 LCPU Structured ladder/FBD IPOPR1 ENO:= (EN, s); IPOPR1 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 Executing condition...
  • Page 279 Program example • The following program starts the machine OPR of the axis 1 when M0 turns ON. Device Item Setting data 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);...
  • Page 280: Jog Start

    JOG start IPJOG1, IPJOG2 LCPU Structured ladder/FBD IPJOG1 ENO:= (EN, s1, s2); IPJOG1 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 Executing condition Start number of the device in which the control data Array of ANY16 [0..3]...
  • Page 281 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) JOG acceleration time 1000(ms) JOG deceleration time [Structured ladder/FBD] [ST] DMOV(SM402, 10000, D0);...
  • Page 282: Absolute Position Restoration

    Absolute position restoration IPABRST1, IPABRST2 LCPU Structured ladder/FBD IPABRST1 ENO:= (EN, s, d); IPABRST1 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 Executing condition Start number of the device for input Array of bit [0..2]...
  • Page 283 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 );...
  • Page 284: Ipstop Instruction

    IPSTOP instruction IPSTOP1, IPSTOP2 LCPU Structured ladder/FBD IPSTOP ENO:= (EN); IPSTOP 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 Executing condition Output argument Execution result Setting...
  • Page 285: Speed Change

    Speed change IPSPCHG1, IPSPCHG2 LCPU Structured ladder/FBD IPSPCHG1 ENO:= (EN, s); IPSPCHG1 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 Input argument Executing condition...
  • Page 286 Program example • The following program changes the speed of the axis 1 when M0 turns ON. Device Item Setting data Acceleration/deceleration time at speed 2000(ms) change Deceleration stop time at speed change 1000(ms) D2, D3 New speed value 200000(pulse/s) [Structured ladder/FBD] [ST] MOV(M0, 2000, D0);...
  • Page 287: Target Position Change

    Target position change IPTPCHG1, IPTPCHG2 LCPU Structured ladder/FBD IPTPCHG1 ENO:= (EN, s); IPTPCHG1 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 Input argument Executing condition...
  • Page 288 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 8.1 Positioning Function Dedicated Instruction...
  • Page 289: Counter Function Dedicated Instruction

    Counter Function Dedicated Instruction Current value read ICCNTRD1, ICCNTRD2 LCPU Structured ladder/FBD ENO:= (EN); ICCNTRD1 ICCNTRD1 The following instruction can go in the dotted squares. ICCNTRD1, ICCNTRD1P, ICCNTRD2, ICCNTRD2P ■Executing condition Instruction Executing condition ICCNTRD1 ICCNTRD2 ICCNTRD1P ICCNTRD2P ■Argument Input/output Name Description Data type...
  • Page 290: Ring Counter Upper/Lower Limit Value Write

    Ring counter upper/lower limit value write ICRNGWR1, ICRNGWR2 LCPU Structured ladder/FBD ICRNGWR1 ENO:= (EN, s1, s2); ICRNGWR1 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...
  • Page 291 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...
  • Page 292: Preset Value Write

    Preset value write ICPREWR1, ICPREWR2 LCPU Structured ladder/FBD ICRNGWR1 ENO:= (EN, s); ICRNGWR1 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 Executing condition...
  • Page 293: Latch Counter Value Read

    Latch counter value read ICLTHRD1, ICLTHRD2 LCPU Structured ladder/FBD ICLTHRD1 ENO:= (EN, n, d); ICLTHRD1 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...
  • Page 294: Sampling Counter Value Read

    Sampling counter value read ICSMPRD1, ICSMPRD2 LCPU Structured ladder/FBD ICSMPRD1 ENO:= (EN, d); ICSMPRD1 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...
  • Page 295: Coincidence Output Point Write

    Coincidence output point write ICCOVWR1, ICCOVWR2 LCPU Structured ladder/FBD ICCOVWR1 ENO:= (EN, n, s); ICCOVWR1 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...
  • Page 296: Frequency Measurement

    Frequency measurement ICFCNT1, ICFCNT2 LCPU Structured ladder/FBD ICFCNT1 ENO:= (EN, d); ICFCNT1 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 Executing condition Output argument Execution result Start number of the device that stores the...
  • Page 297: Rotation Speed Measurement

    Rotation speed measurement ICRCNT1, ICRCNT2 LCPU Structured ladder/FBD ICRCNT1 ENO:= (EN, d); ICRCNT1 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 Executing condition Output argument Execution result...
  • Page 298: Pulse Measurement Read

    Pulse measurement read ICPLSRD1, ICPLSRD2 LCPU Structured ladder/FBD ICPLSRD1 ENO:= (EN, d); ICPLSRD1 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 Executing condition...
  • Page 299: Pwm Output

    PWM output ICPWM1, ICPWM2 LCPU Structured ladder/FBD ICPWM1 ENO:= (EN, s1, s2); ICPWM1 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 Executing condition PWM output ON time setting value (constant), or ANY32...
  • Page 300 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 8.2 Counter Function Dedicated Instruction...
  • Page 301: Chapter 9 Data Logging Function Instruction

    DATA LOGGING FUNCTION INSTRUCTION Trigger Logging Set/Reset LOGTRG Instruction, LOGTRGR Instruction QnUDV LCPU Structured ladder/FBD LOGTRG ENO:= (EN, n); LOGTRG 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...
  • Page 302 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.
  • Page 303: Chapter 10 Sfc Control Instruction

    SFC CONTROL INSTRUCTION 10.1 SFC Step Comment Read S(P)_SFCSCOMR High Universal Process Redundant performance Structured ladder/FBD SP_SFCSCOMR ENO:= (EN, n1, n2, n3, d1, d2); SP_SFCSCOMR The following instruction can go in the dotted squares. S_SFCSCOMR, SP_SFCSCOMR ■Executing condition Instruction Executing condition S_SFCSCOMR SP_SFCSCOMR ■Argument...
  • Page 304 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.
  • Page 305: Sfc Transition Condition Comment Read

    10.2 SFC Transition Condition Comment Read S(P)_SFCTCOMR High Universal Process Redundant performance Structured ladder/FBD SP_SFCTCOMR ENO:= (EN, n1, n2, n3, d1, d2); SP_SFCTCOMR 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...
  • Page 306 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. •...
  • Page 307 MEMO 10 SFC CONTROL INSTRUCTION 10.2 SFC Transition Condition Comment Read...
  • Page 308: Index

    INDEX .....17 Positioning instruction ......9 Process CPU .
  • Page 309 MEMO...
  • Page 310: Instruction Index

    INSTRUCTION INDEX ......272 IPPSTRT2(P) ......275 IPSIMUL(P) .
  • Page 311 ..... . . 174 Z(P)_RSTOP_U ..... . . 177 Z(P)_RTMRD_J .
  • Page 312: Revisions

    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.
  • Page 313: Warranty

    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.
  • Page 314: Trademarks

    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.
  • Page 316 SH(NA)-080785ENG-L(1702)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.

This manual is also suitable for:

Melsec-q

Table of Contents