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

Predefined Protocol Support For Positioning Function Block Library Reference (IAI Corporation)

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

Predefined Protocol Support For Positioning

Function Block Library Reference


(IAI Corporation)
SAFETY PRECAUTIONS
(Read these precautions before using this product.)
Before using this product, please read this reference carefully and pay full attention to safety to handle the product correctly.
The precautions given in this reference are concerned with this product only. For the safety precautions for the programmable
controller system, refer to the user's manual for the CPU module used and MELSEC iQ-R Module Configuration Manual.
In this reference, the safety precautions are classified into two levels: " WARNING" and " CAUTION".

Indicates that incorrect handling may cause hazardous conditions, resulting in


WARNING death or severe injury.

Indicates that incorrect handling may cause hazardous conditions, resulting in


CAUTION minor or moderate injury or property damage.

Under some circumstances, failure to observe the precautions given under " CAUTION" may lead to serious
consequences.
Observe the precautions of both levels because they are important for personal and system safety.
Make sure that the end users read this reference and then keep the reference in a safe place for future reference.

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

2
INTRODUCTION
Thank you for purchasing the Mitsubishi Electric MELSEC iQ-R series, MELSEC-Q series, and MELSEC-L series
programmable controllers.
This reference describes function blocks which execute positioning control by connecting the MELSEC iQ-R series, MELSEC-
Q series, or MELSEC-L series programmable controller to IAI controllers.
Before using this product, please read this reference carefully and develop familiarity with the functions and performance of
the MELSEC iQ-R series, MELSEC-Q series, and MELSEC-L series programmable controllers to handle the product
correctly.
When applying the program examples provided in this reference to an actual system, ensure the applicability and confirm that
they will not cause system control problems.
Please make sure that the end users read this reference.

3
CONTENTS
SAFETY PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
CONDITIONS OF USE FOR THE PRODUCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
RELEVANT MANUALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
TERMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
GENERIC TERM AND ABBREVIATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7

CHAPTER 1 OVERVIEW 8
1.1 FB List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2 Acquisition Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3 System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
CPU module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Serial communication module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Supported models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

CHAPTER 2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES) 11


2.1 M+IAIStartHomePositioning_R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 M+IAIJogInching_R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3 M+IAIReadPositionTable_R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.4 M+IAITeachingPosition_R. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.5 M+IAIStartPositioning_R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.6 M+IAIMonitoring_R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

4
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.7 M+IAIServoControl_R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

CONTENTS
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

CHAPTER 3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES) 55


3.1 Preparation for Using FB Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Importing M+CPU-IAIPosiSp_CPRTCL-ST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Checking the start I/O number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.2 M+CPU-IAIPosiSp_StartHomePosi-ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.3 M+CPU-IAIPosiSp_JogInching-ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.5 M+CPU-IAIPosiSp_TeachingPosi-ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
3.6 M+CPU-IAIPosiSp_StartPosi-ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.7 M+CPU-IAIPosiSp_Monitoring-ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

5
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
3.8 M+CPU-IAIPosiSp_ServoControl-ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Performance value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
3.9 M+CPU-IAIPosiSp_CPRTCL-ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
FB details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

APPENDIX 102
Appendix 1 Table Information (MELSEC iQ-R Series) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Position table structure (stPositionTable) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Monitoring table structure (stMonitoringTable) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Appendix 2 Table Information (MELSEC-Q/L Series) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Position table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Monitoring table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

INSTRUCTION INDEX 107

REVISIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
TRADEMARKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

6
RELEVANT MANUALS
Manual name [manual number] Description Available form
Predefined Protocol Support For Positioning Specifications, functions, and input/output labels of IAI controller function e-Manual
Function Block Library Reference (IAI Corporation) blocks PDF
[BCN-P5999-1179] (this reference)

e-Manual refers to the Mitsubishi Electric FA electronic book manuals that can be browsed using a dedicated
tool.
e-Manual has the following features:
• Required information can be cross-searched in multiple manuals.
• Other manuals can be accessed from the links in the manual.
• Hardware specifications of each part can be found from the product figures.
• Pages that users often browse can be bookmarked.
• Sample programs can be copied to an engineering tool.

TERMS
Unless otherwise specified, this reference uses the following terms.
Term Description
Buffer memory Memory in an intelligent function module to store data such as setting values and monitor values.
For CPU modules, it refers to memory to store data such as setting values and monitor values of the Ethernet function,
or data used for data communication of the multiple CPU system function.
Device A memory of a CPU module to store data. Devices such as X, Y, M, D, and others are provided depending on the
intended use.
Engineering tool A tool used for setting up programmable controllers, programming, debugging, and maintenance.
Intelligent function module A module that has functions other than an input or output, such as an A/D converter module and D/A converter module.
Process CPU A CPU module that performs process control and sequence control. Process control function blocks and the online
module change function can be executed.
This module is also used with a redundant function module as a pair and configures a redundant system.

GENERIC TERM AND ABBREVIATION


Unless otherwise specified, this reference uses the following generic terms and abbreviations.
Generic term and Description
abbreviation
IAI An abbreviation for IAI Corporation.

7
1 OVERVIEW
A function block (FB) in this reference is for connecting the MELSEC iQ-R, MELSEC-Q, or MELSEC-L series programmable
controller to IAI controllers via serial communication (Modbus RTU) and executing electric actuator positioning control.

1.1 FB List
This section shows the FB list of this reference.
Note that this reference does not describe the FB version information which is indicated such as "_00A" at the end of an FB
name.

MELSEC iQ-R series


FB name Description
M+IAIStartHomePositioning_R To move an electric actuator to the initial position (home position return).
M+IAIJogInching_R To perform JOG or inching operation.
M+IAIReadPositionTable_R To read the data of the specified position table.
M+IAITeachingPosition_R To set a designated position to the specified position table (target position).
M+IAIStartPositioning_R To execute positioning operation based on the specified position table data.
M+IAIMonitoring_R To monitor a current position and alarms, and reset alarms.
M+IAIServoControl_R To request a servo to turn ON or OFF.

MELSEC-Q/L series
FB name Description
M+CPU-IAIPosiSp_StartHomePosi-ST To move an electric actuator to the initial position (home position return).
M+CPU-IAIPosiSp_JogInching-ST To perform JOG or inching operation.
M+CPU-IAIPosiSp_ReadPosiTable-ST To read the data of the specified position table.
M+CPU-IAIPosiSp_TeachingPosi-ST To set a designated position to the specified position table (target position).
M+CPU-IAIPosiSp_StartPosi-ST To execute positioning operation based on the specified position table data.
M+CPU-IAIPosiSp_Monitoring-ST To monitor a current position and alarms, and reset alarms.
M+CPU-IAIPosiSp_ServoControl-ST To request a servo to turn ON or OFF.
M+CPU-IAIPosiSp_CPRTCL-ST To execute an instruction for predefined protocol communication (G_CPRTCL) by being called from other
FBs.
Do not use this FB in a user-created program as this is used only internally in other FBs.

Considerations
• To use FBs in this reference, it is necessary to write protocol setting data for a predefined protocol in advance by using the
predefined protocol information write function of Predefined Protocol Support Tool For Positioning. (Predefined Protocol
Support Tool For Positioning Operating Manual)
• When an execution command of an FB is turned ON, do not use the same channel of a serial communication module to
communicate with a controller.
• All FBs use serial communication module buffer memories (user setting area); therefore, do not access to the following
buffer memories:
MELSEC iQ-R series: Un\G3072 to 5600
MELSEC-Q/L series: Un\G3072 to 5520

1.2 Acquisition Method


Please contact your local Mitsubishi Electric sales office or representative.

1 OVERVIEW
8 1.1 FB List
1.3 System Configuration
The following shows the system configuration for using the FBs in this reference.
1
(1) (2)

(2)

(3)

(4)

No. Device name Description


(1) MELSEC iQ-R series programmable controller To use a base unit, a power supply module, and a CPU module.
MELSEC-Q series programmable controller
MELSEC-L series programmable controller
(2) Serial communication module To use a serial communication module which has an RS-422/485
interface(s).
(3) Serial communication (RS-485 connection) To connect controllers.
Maximum number of connectable controllers: 16
(4) IAI Controller Page 10 Supported models

For the specifications of modules to be used, refer to the user's manual of each module.

CPU module
Series Generic term Model
MELSEC iQ- RCPU R00CPU, R01CPU, R02CPU, R04CPU, R04ENCPU, R08CPU, R08ENCPU, R08PCPU, R16CPU,
R R16ENCPU, R16PCPU, R32CPU, R32ENCPU, R32PCPU, R120CPU, R120ENCPU, R120PCPU
MELSEC-Q QCPU Universal model QCPU Q00UJCPU, Q00UCPU, Q01UCPU, Q02UCPU, Q03UDCPU, Q03UDECPU, Q03UDVCPU,
Q04UDHCPU, Q04UDEHCPU, Q04UDVCPU, Q04UDPVCPU, Q06UDHCPU, Q06UDEHCPU,
Q06UDVCPU, Q06UDPVCPU, Q10UDHCPU, Q10UDEHCPU, Q13UDHCPU, Q13UDEHCPU,
Q13UDVCPU, Q13UDPVCPU, Q20UDHCPU, Q20UDEHCPU, Q26UDHCPU, Q26UDEHCPU,
Q26UDVCPU, Q26UDPVCPU, Q50UDEHCPU, Q100UDEHCPU
Process CPU Q02PHCPU, Q06PHCPU, Q12PHCPU, Q25PHCPU
MELSEC-L LCPU L02SCPU, L02SCPU-P, L02CPU, L02CPU-P, L06CPU, L06CPU-P, L26CPU, L26CPU-P, L26CPU-
BT, L26CPU-PBT

Serial communication module


Series Model Available channel
MELSEC iQ-R RJ71C24 CH2
RJ71C24-R4 CH1, CH2
MELSEC-Q QJ71C24N*1 CH2
QJ71C24N-R4*1 CH2
MELSEC-L LJ71C24 CH2

*1 The first five digits of the serial number are '11062' or higher.

1 OVERVIEW
1.3 System Configuration 9
Supported models
Manufacturer Type Series Type and model
IAI Corporation Built-in Controller Type Actuator RCP6S RCP6S*1
ERC3 ERC3
ERC2 ERC2 (SE)
Controller PCON PCON-CA
PCON-CB
PCON-CFA
PCON-CFB
PCON-C
PCON-SE
PCON-CF
PCON-CY
PCON-CYB
DCON DCON-CA
DCON-CB
DCON-CYB
ACON ACON-CA
ACON-CB
ACON-C
ACON-SE
ACON-CY
ACON-CYB
SCON SCON-CA
SCON-CAL
SCON-CB
SCON-CB-F*2
SCON-C

*1 Reading from or writing to the positioning data using the following FBs is not supported. Use Teaching Pendant or PC Software
developed by IAI Corporation to read from or write to the positioning data.
M+IAIReadPositionTable_R, M+IAITeachingPosition_R
M+CPU-IAIPosiSp_ReadPosiTable-ST, and M+CPU-IAIPosiSp_TeachingPosi-ST
*2 Reading from or writing to the positioning data using the following FBs is not supported. Use Teaching Pendant or PC Software
developed by IAI Corporation to read from or write to the positioning data.
M+IAIStartHomePositioning_R, M+IAIReadPositionTable_R, M+IAITeachingPosition_R
M+CPU-IAIPosiSp_StartHomePosi-ST, M+CPU-IAIPosiSp_ReadPosiTable-ST, and M+CPU-IAIPosiSp_TeachingPosi-ST

1 OVERVIEW
10 1.3 System Configuration
2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R
SERIES)
2.1 M+IAIStartHomePositioning_R 2

Overview
Moves an electric actuator to the initial position (home position return).

M+IAIStartHomePositioning_R
(1) B : i_bEN o_bENO : B (5)

(2) UW : i_uStartIONo o_bOK : B (6)

(3) UW : i_uCh o_bErr : B (7)

(4) UW : i_uAxis o_uErrId : UW (8)

o_bUnitErr : B (9)

o_uUnitErrId : UW (10)

Labels

Input label
No. Label Name Data type Range Description
(1) i_bEN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) i_uStartIONo Start I/O No. Word [unsigned] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) i_uCh Target channel Word [unsigned] 1, 2 Specify the channel of a serial communication
module.
(4) i_uAxis Target axis Word [unsigned] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.

Output label
No. Label Name Data type Default value Description
(5) o_bENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(6) o_bOK Normal completion Bit OFF The ON state indicates that a home position
return is completed.
(7) o_bErr Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(8) o_uErrId Error code Word [unsigned] 0 The error code of an error occurred in the FB is
stored.
(9) o_bUnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(10) o_uUnitErrId Unit error code Word [unsigned] 0 The error code of an error occurred in the module
is stored.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.1 M+IAIStartHomePositioning_R 11
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
RJ71C24  GX Works3 Version 1.055H or later
RJ71C24-R4  GX Works3 Version 1.055H or later

■ CPU module
RCPU

Basic specifications
Item Description
Language ST
Number of basic steps 3585 Steps
The number of steps of the FB embedded in a program varies depending on a CPU module used, the input and output definitions, and
the option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
Number of points of a • Label: 72 points (Word)
label used • Latch label: 0 point (Word)
The number of points of a label used that is embedded in a program varies depending on a device specified for an argument and the
option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
FB dependence M+IAIStartHomePositioning_R
M+IAIServoControl_R
FB compilation Subroutine type
method
FB operation Pulse execution (multiple scan execution type)

Processing
• Specify the axis number of the operation target in i_uAxis (target axis).
• This FB switches from PIO to Modbus communication at the rise of i_bEN (execution command), and executes a home
position return.
• o_bOK (normal completion) is turned ON when a home position return is completed.
• When a value out of the range is set for the start I/O number, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '100H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target channel, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '101H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target axis, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '102H' is stored in o_uErrId (error code).
• When the connected device is not the operation target, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '200H' is stored in o_uErrId (error code).
• When turning OFF i_bEN (execution command) before o_bOK (normal completion), o_bErr (error completion), or
o_bUnitErr (unit error completion) is turned ON, o_bErr (error completion) is turned ON for one scan only. In addition, the
error code '201H' is stored in o_uErrId (error code) for one scan.
• When turning ON i_bEN (execution command) of this FB while executing any of the following FBs, o_bErr (error
completion) is turned ON. In addition, the error code '202H' is stored in o_uErrId (error code).
M+IAIStartHomePositioning_R, M+IAIJogInching_R, M+IAIStartPositioning_R, and M+IAIServoControl_R
• When an error occurs while sending/receiving a message to/from the predefined protocol, o_bErr (error completion) is
turned ON and the processing of the FB is interrupted. An error code is stored in o_uErrId (error code). For details on the
error code, refer to MELSEC iQ-R Serial Communication Module User's Manual(Application).
• When this FB receives an error code due to an error occurred in an electric actuator, o_bUnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in o_uUnitErrId (unit
error code).

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


12 2.1 M+IAIStartHomePositioning_R
Timing chart of I/O signals
■ In normal completion

i_bEN

2
o_bENO

Instruction command Not Instruction command communication Home position Not


Controller status signal read
communication performed from M+IAIServoControl_R return performed

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr
OFF

o_uUnitErrId 0

■ In error completion

i_bEN

o_bENO

Instruction command Not performed


communication

o_bOK OFF

o_bErr

o_uErrId 0 Error code 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.1 M+IAIStartHomePositioning_R 13
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
i_bEN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF i_bEN (execution command).
• This FB requires the configuration of the ladder for every input label.
• Change the memory/device setting in the CPU parameter so that the capacity required to use this FB is secured.
Otherwise, a compiling error may occur in GX Works3.
• After a home position return is started by using this FB, when turning OFF i_bEN (execution command) before o_bOK
(normal completion), o_bErr (error completion), or o_bUnitErr (unit error completion) is turned ON, an electric actuator
continues to operate until a home position return is completed.
• This FB uses the CPRTCL instruction. For details, refer to MELSEC iQ-R Programming Manual (Module Dedicated
Instructions).
• Specify the start I/O number assigned to a serial communication module in i_uStartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, the stop error of the CPU (2820H) occurs.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following parameters (module parameters of a serial communication
module) to a module by using GX Works3.
Item Setting value
Communication protocol setting Predefined protocol
Communication speed setting Set the value according to the setting of an electric actuator controller to be used.
Transmission Data bit 8
setting
Parity bit None
Stop bit 1
Communication Echo back enable/prohibit specification Echo back prohibit
control
specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Subroutine type
• CPU module: R120CPU
• Serial communication module: RJ71C24-R4
• Controller: PCON-CB
• Electric actuator: RCP3-TA4C-I-28P-4-20-P3-P
• Electric actuator initial position: Home position (0.00 mm)
Time required for the Maximum scan time Number of scans required for
processing*1 the processing
1380.000 ms 0.428 ms 6877 scans

*1 The time required from start to end of the processing.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


14 2.1 M+IAIStartHomePositioning_R
Error code
Error code Description Corrective action
100H The value set for the start I/O number is out of the range. Set a value within the range from 00H to FEH for the start I/O
number and execute the FB again.
101H The value set for the target channel is out of the range. Set 1 or 2 for the target channel and execute the FB again.
2
102H The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
200H An unsupported device is connected. Review and correct the connected device and execute the FB
again.
201H The execution command turned OFF during the processing. Do not turn OFF i_bEN (execution command) until o_bOK (normal
completion), o_bErr (error completion), or o_bUnitErr (unit error
completion) is turned ON.
(This error code is output for one scan only.)
202H Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+IAIStartHomePositioning_R
• M+IAIJogInching_R
• M+IAIStartPositioning_R
• M+IAIServoControl_R
For M+IAIJogInching_R, check that o_bParamOK (parameter
setting completion flag) is turned ON and o_bBusy (busy signal) is
turned OFF.
203H Emergency stop or major failure is occurring. Check the status of a controller in M+IAIMonitoring_R.
After checking the status, remove the cause of the error and
execute the FB again.
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error MELSEC iQ-R Serial Communication Module User's
code Manual(Application)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.1 M+IAIStartHomePositioning_R 15
2.2 M+IAIJogInching_R
Overview
Executes JOG or inching operation.

M+IAIJogInching_R
(1) B : i_bEN o_bENO : B (10)

(2) UW : i_uStartIONo o_bOK : B (11)

(3) UW : i_uCh o_bErr : B (12)

(4) UW : i_uAxis o_uErrId : UW (13)

(5) B : i_bJogOrInching o_bUnitErr : B (14)

(6) UD : i_udJogSpeed o_uUnitErrId : UW (15)

(7) UD : i_udInchingMovingDistance o_bParamOK : B (16)

(8) B : i_bFJog o_bBusy : B (17)

(9) B : i_bRJog

Labels

Input label
No. Label Name Data type Range Description
(1) i_bEN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) i_uStartIONo Start I/O No. Word [unsigned] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) i_uCh Target channel Word [unsigned] 1, 2 Specify the channel of a serial communication
module.
(4) i_uAxis Target axis Word [unsigned] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) i_bJogOrInching JOG/Inching Bit ON, OFF ON: Inching operation
replacement OFF: JOG operation
(6) i_udJogSpeed JOG speed Double Word 1 to 999999 Specify the JOG speed.
[unsigned] For the inching operation, the specified speed is
ignored. (Unit: 0.01 mm/s)
(7) i_udInchingMovingDista Inching amount of Double Word 1 to 999999 Specify the inching amount of movement
nce movement [unsigned] For the JOG operation, the specified movement
amount is ignored. (Unit: 0.01 mm/s)
(8) i_bFJog JOG + command Bit ON, OFF Turn ON this label to perform the forward JOG or
inching operation.
(9) i_bRJog JOG - command Bit ON, OFF Turn ON this label to perform the reverse JOG or
inching operation.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


16 2.2 M+IAIJogInching_R
Output label
No. Label Name Data type Default value Description
(10) o_bENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(11) o_bOK Normal completion Bit OFF The ON state indicates that the JOG operation is
started, and the inching operation is completed 2
normally.
(12) o_bErr Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(13) o_uErrId Error code Word [unsigned] 0 The error code of an error occurred in the FB is
stored.
(14) o_bUnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(15) o_uUnitErrId Unit error code Word [unsigned] 0 The error code of an error occurred in the module
is stored.
(16) o_bParamOK Parameter setting Bit OFF The ON state indicates that the initial settings until
completion flag an electric actuator is ready to operate is
completed.
(17) o_bBusy Busy signal Bit OFF The ON state indicates that an electric actuator is
operating.

FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
RJ71C24  GX Works3 Version 1.055H or later
RJ71C24-R4  GX Works3 Version 1.055H or later

■ CPU module
RCPU

Basic specifications
Item Description
Language ST
Number of basic steps 5576 Steps
The number of steps of the FB embedded in a program varies depending on a CPU module used, the input and output definitions, and
the option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
Number of points of a • Label: 88 points (Word)
label used • Latch label: 0 point (Word)
The number of points of a label used that is embedded in a program varies depending on a device specified for an argument and the
option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
FB dependence M+IAIJogInching_R
M+IAIServoControl_R
FB compilation Subroutine type
method
FB operation Real-time execution

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.2 M+IAIJogInching_R 17
Processing
• Specify the axis number of the operation target in i_uAxis (target axis).
• The movement amount of inching operation is set to i_udInchingMovingDistance (inching amount of movement).
• The JOG operation speed is set to i_udJogSpeed (JOG speed).
• This FB switches from PIO to Modbus communication at the rise of i_bEN (execution command), and writes i_udJogSpeed
(JOG speed) and i_udInchingMovingDistance (inching amount of movement) to the parameter data of a controller.
• When the JOG or inching operation becomes ready to operate after writing parameter data and resetting software,
o_bParamOK (parameter setting completion flag) is turned ON.
• o_bBusy (busy signal) is turned ON while an electric actuator is operating.
• The inching operation command is executed until the operation is completed by turning ON i_bJogOrInching (JOG/Inching
replacement) and at the rise of i_bFJog (JOG + command) or i_bRJog (JOG - command). When the operation is
completed, o_bOK (normal completion) is turned ON.
• For the inching operation, the operation decelerates to stop when turning ON the command which moves an electric
actuator in the reverse direction while the actuator is operating.
• The JOG operation command is executed while i_bJogOrInching (JOG/Inching replacement) is turned OFF and i_bFJog
(JOG + command) or i_bRJog (JOG - command) is turned ON. o_bOK (normal completion) is turned ON at the start of the
operation. When i_bFJog (JOG + command) or i_bRJog (JOG - command) is turned OFF, the operation decelerates to stop
and o_bOK (normal completion) is turned OFF.
• For the JOG operation, the operation decelerates to stop when turning ON both i_bFJog (JOG + command) and i_bRJog
(JOG - command). The ON operation is started by turning OFF either one of the commands.
• The operation decelerates to stop when i_bJogOrInching (JOG/Inching replacement) is changed during the operation of
i_bFJog (JOG + command) or i_bRJog (JOG - command).
• When a value out of the range is set for the start I/O number, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '100H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target channel, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '101H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target axis, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '102H' is stored in o_uErrId (error code).
• When a value out of the range is set for the JOG speed, o_bErr (error completion) is turned ON and the processing of the
FB is interrupted. In addition, the error code '103H' is stored in o_uErrId (error code).
• When a value out of the range is set for the inching amount of movement, o_bErr (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '104H' is stored in o_uErrId (error code).
• When the connected device is not the operation target, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '200H' is stored in o_uErrId (error code).
• When turning OFF i_bEN (execution command) before o_bParamOK (parameter setting completion flag) is turned ON,
o_bErr (error completion) is turned ON for one scan only. In addition, the error code '201H' is stored in o_uErrId (error code)
for one scan.
• When turning ON i_bEN (execution command) of this FB while executing any of the following FBs, o_bErr (error
completion) is turned ON. In addition, the error code '202H' is stored in o_uErrId (error code).
M+IAIStartHomePositioning_R, M+IAIJogInching_R, M+IAIStartPositioning_R, and M+IAIServoControl_R
• When an error occurs while sending/receiving a message to/from the predefined protocol, o_bErr (error completion) is
turned ON and the processing of the FB is interrupted. An error code is stored in o_uErrId (error code). For details on the
error code, refer to MELSEC iQ-R Serial Communication Module User's Manual(Application).
• When this FB receives an error code due to an error occurred in an electric actuator, o_bUnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in o_uUnitErrId (unit
error code).

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


18 2.2 M+IAIJogInching_R
Timing chart of I/O signals
■ In normal completion
• From the rise of i_bEN (execution command) to parameter data static area write command
The program is executed once at the rise of i_bEN (execution command).

2
i_bEN

o_bENO

Instruction command Not Instruction command communication Inching amount of Parameter data static
communication performed from M+IAIServoControl_R JOG speed write
movement write area write command

o_bParamOK OFF

o_bBusy OFF

o_bOK OFF

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

• From extended device status read command to servo ON command


The program is executed once at the rise of i_bEN (execution command).

i_bEN

o_bENO

Instruction command Instruction command communication


Extended device status read command Software reset from M+IAIServoControl_R
communication

o_bParamOK

o_bBusy OFF

o_bOK OFF

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.2 M+IAIJogInching_R 19
• From JOG/Inching replacement command to when i_bEN (execution command) is turned OFF (Example: JOG operation)
The following processing is executed repeatedly while i_bEN (execution command) is turned ON.

i_bEN

o_bENO

Instruction command JOG/inching JOG+(-) Operation Controller status JOG+(-) Stop Controller status Not
communication replacement command (FF00H) signal read (0000H) signal read performed

o_bParamOK

o_bBusy

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

• For JOG operation (JOG + command)

i_bEN

o_bENO

i_bJogOrInching

i_udJogSpeed K10000

i_bFJog

i_bRJog OFF

Instruction command JOG/inching JOG+ Controller status JOG+ Controller status


communication replacement command (FF00H) signal read (0000H) signal read

o_bParamOK

o_bBusy

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


20 2.2 M+IAIJogInching_R
• For JOG operation (JOG - command)

i_bEN

o_bENO

i_bJogOrInching
2
i_udJogSpeed K10000

OFF
i_bFJog

i_bRJog

Instruction command JOG/inching JOG- Controller status signal JOG- Controller status signal
communication replacement command (FF00H) read (0000H) read

o_bParamOK

o_bBusy

o_bOK

OFF
o_bErr

o_uErrId 0

OFF
o_bUnitErr

o_uUnitErrId 0

• For JOG operation (when both JOG + command and JOG - command are turned ON simultaneously)

i_bEN

o_bENO

i_bJogOrInching OFF

i_udJogSpeed K10000

i_bFJog

i_bRJog

Instruction command JOG+ Controller status signal Stop command Controller status signal JOG+ Controller status signal
(FF00H) read (0000H) read (FF00H) read
communication

o_bParamOK

o_bBusy

o_bOK

OFF
o_bErr

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.2 M+IAIJogInching_R 21
• For inching operation (JOG + command)
When i_bFJog (JOG + command) is turned OFF before o_bOK (normal completion) is turned ON, o_bOK (normal completion)
is turned ON for one scan only.

i_bEN

o_bENO

i_bJogOrInching

i_udInchingMovingDistance K10000

i_bFJog

i_bRJog OFF

Instruction command JOG/inching JOG+ JOG+ Controller status signal Controller status signal
communication replacement command (FF00H) (0000H) read read

o_bParamOK

o_bBusy

o_bOK

o_bErr OFF

o_uErrId 0

OFF
o_bUnitErr

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


22 2.2 M+IAIJogInching_R
• For inching operation (JOG - command)
When i_bRJog (JOG - command) is turned OFF before o_bOK (normal completion) is turned ON, o_bOK (normal completion)
is turned ON for one scan only.

i_bEN

o_bENO 2
i_bJogOrInching

i_udInchingMovingDistance K10000

OFF
i_bFJog

i_bRJog

Instruction command JOG/inching JOG- JOG- Controller status signal Controller status signal
communication replacement command (FF00H) (0000H) read read

o_bParamOK

o_bBusy

o_bOK

o_bErr OFF

o_uErrId 0

OFF
o_bUnitErr

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.2 M+IAIJogInching_R 23
• For inching operation (when both JOG + command and JOG - command are turned ON simultaneously)

i_bEN

o_bENO

i_bJogOrInching

i_udInchingMovingDistance K10000

i_bFJog

i_bRJog

Instruction command JOG+ JOG+ Controller status Controller status Stop command Controller status
communication (FF00H) (0000H) signal read signal read (0000H) signal read

o_bParamOK

o_bBusy

o_bOK OFF

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

■ In error completion

i_bEN

o_bENO

Instruction command
Not performed
communication

o_bBusy

o_bOK OFF

o_bErr

o_uErrId 0 Error code 0

OFF
o_bUnitErr

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


24 2.2 M+IAIJogInching_R
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
2
i_bEN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF i_bEN (execution command).
• This FB requires the configuration of the ladder for every input label.
• Change the memory/device setting in the CPU parameter so that the capacity required to use this FB is secured.
Otherwise, a compiling error may occur in GX Works3.
• This FB writes to the non-volatile memory. For details, refer to the IAI Corporation manuals related to serial communication
(Modbus version).
• By turning ON i_bEN (execution command), this FB restarts the controller after turning OFF the servo. It takes 2000 ms to
restart.
• If the time from when a controller is restarted to when the controller is ready for communication takes more than 2100 ms,
this FB is completed with an error. In this case, set the time to the buffer memory (Un\G5520). The waiting time for this FB
is Un\G5520  100 ms. When the waiting time is set for less than 2100 ms, the time is automatically changed to 2100 ms.
• JOG speed and inching amount of movement cannot be changed while i_bEN (execution command) is turned ON. For
changing the JOG speed or inching amount of movement, execute the FB again.
• Execute a home position return after o_bParamOK (parameter setting completion flag) is turned ON. Otherwise a critical
error may occur when an electric actuator exceeds the operation limit value.
• When the electric actuator stops at the operation limit value, an error will not occur in this FB.
• When i_bFJog (JOG + command) or i_bRJog (JOG - command) is turned ON before o_bParamOK (parameter setting
completion flag) is turned ON, JOG + (-) command is ignored. Turn ON the JOG + (-) command again.
• When turning OFF i_bEN (execution command) while an electric actuator is operating, the actuator continues to operate.
Prepare a program for the operation of the actuator separately in accordance with the required system operation.
• This FB uses the CPRTCL instruction. For details, refer to MELSEC iQ-R Programming Manual (Module Dedicated
Instructions).
• Specify the start I/O number assigned to a serial communication module in i_uStartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, the stop error of the CPU (2820H) occurs.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following parameters (module parameters of a serial communication
module) to a module by using GX Works3.
Item Setting value
Communication protocol setting Predefined protocol
Communication speed setting Set the value according to the setting of an electric actuator controller to be used.
Transmission Data bit 8
setting
Parity bit None
Stop bit 1
Communication Echo back enable/prohibit specification Echo back prohibit
control
specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.2 M+IAIJogInching_R 25
Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Subroutine type
• CPU module: R120CPU
• Serial communication module: RJ71C24-R4
• Controller: PCON-CB
• Electric actuator: RCP3-TA4C-I-28P-4-20-P3-P
• JOG speed: 10.00 mm/sec
• Inching amount of movement: 0.10 mm
Measuring range Time required for the Maximum scan time Number of scans required
processing*1 for the processing
From when i_bEN (execution command) is 3110.000 ms 0.437 ms 19719 scans
turned ON to when o_bParamOK (parameter
setting completion flag) is turned ON
From when i_bFJog (JOG + command) or 17.200 ms 0.448 ms 78 scans
i_bRJog (JOG - command) is turned ON to
when JOG operation starts
From when i_bFJog (JOG + command) or 49.200 ms 0.469 ms 238 scans
i_bRJog (JOG - command) is turned ON to
when inching movement completes

*1 The time required from start to end of the processing.

Error code
Error code Description Corrective action
100H The value set for the start I/O number is out of the range. Set a value within the range from 00H to FEH for the start I/O
number and execute the FB again.
101H The value set for the target channel is out of the range. Set 1 or 2 for the target channel and execute the FB again.
102H The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
103H The value set for the JOG speed is out of the range. Set a value within the range from 1 to 999999 for the JOG speed
and execute the FB again.
104H The value set for the inching amount of movement is out of the Set a value within the range from 1 to 999999 for the inching
range. amount of movement and execute the FB again.
200H An unsupported device is connected. Review and correct the connected device and execute the FB
again.
201H The execution command turned OFF during the processing. Do not turn OFF i_bEN (execution command) until o_bParamOK
(parameter setting completion flag) is turned ON.
(This error code is output for one scan only.)
202H Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+IAIStartHomePositioning_R
• M+IAIJogInching_R
• M+IAIStartPositioning_R
• M+IAIServoControl_R
203H Emergency stop or major failure is occurring. Check the status of a controller in M+IAIMonitoring_R.
After checking the status, remove the cause of the error and
execute the FB again.
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error MELSEC iQ-R Serial Communication Module User's
code Manual(Application)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


26 2.2 M+IAIJogInching_R
2.3 M+IAIReadPositionTable_R
Overview
Reads the data of the specified position table.
2
M+IAIReadPositionTable_R
(1) B : i_bEN o_bENO : B (6)
(2) UW : i_uStartIONo o_bOK : B (7)

(3) UW : i_uCh o_bErr : B (8)

(4) UW : i_uAxis o_uErrId : UW (9)

(5) UW : i_uTableNo o_bUnitErr : B (10)

o_uUnitErrId : UW (11)

o_stPositionTable : DUT (12)

Labels

Input label
No. Label Name Data type Range Description
(1) i_bEN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) i_uStartIONo Start I/O No. Word [unsigned] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) i_uCh Target channel Word [unsigned] 1, 2 Specify the channel of a serial communication
module.
(4) i_uAxis Target axis Word [unsigned] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) i_uTableNo Position table No. Word [unsigned] 0 to 767 Specify the position table number from which the
setting value is read.

Output label
No. Label Name Data type Default value Description
(6) o_bENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(7) o_bOK Normal completion Bit OFF The ON state indicates that reading position data
is completed.
(8) o_bErr Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(9) o_uErrId Error code Word [unsigned] 0 The error code of an error occurred in the FB is
stored.
(10) o_bUnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(11) o_uUnitErrId Unit error code Word [unsigned] 0 The error code of an error occurred in the module
is stored.
(12) o_stPositionTable Position table Structure  For details, refer to the following:
(stPositionTable) Page 102 Position table structure
(stPositionTable)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.3 M+IAIReadPositionTable_R 27
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
RJ71C24  GX Works3 Version 1.055H or later
RJ71C24-R4  GX Works3 Version 1.055H or later

■ CPU module
RCPU

Basic specifications
Item Description
Language ST
Number of basic steps 2250 Steps
The number of steps of the FB embedded in a program varies depending on a CPU module used, the input and output definitions, and
the option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
Number of points of a • Label: 52 points (Word)
label used • Latch label: 0 point (Word)
The number of points of a label used that is embedded in a program varies depending on a device specified for an argument and the
option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
FB dependence No dependence
FB compilation Subroutine type
method
FB operation Pulse execution (multiple scan execution type)

Processing
• Specify the axis number of the operation target in i_uAxis (target axis).
• Specify the position table number to be read in i_uTableNo (position table No.).
• This FB switches from PIO to Modbus communication at the rise of i_bEN (execution command), and reads the setting data
of the specified position table number of a controller.
• o_bOK (normal completion) is turned ON when reading the position table is completed.
• When a value out of the range is set for the start I/O number, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '100H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target channel, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '101H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target axis, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '102H' is stored in o_uErrId (error code).
• When a value out of the range is set for the position table number, o_bErr (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '105H' is stored in o_uErrId (error code).
• When the connected device is not the operation target, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '200H' is stored in o_uErrId (error code).
• When turning OFF i_bEN (execution command) before o_bOK (normal completion), o_bErr (error completion), or
o_bUnitErr (unit error completion) is turned ON, o_bErr (error completion) is turned ON for one scan only. In addition, the
error code '201H' is stored in o_uErrId (error code) for one scan.
• When an error occurs while sending/receiving a message to/from the predefined protocol, o_bErr (error completion) is
turned ON and the processing of the FB is interrupted. An error code is stored in o_uErrId (error code). For details on the
error code, refer to MELSEC iQ-R Serial Communication Module User's Manual(Application).
• When this FB receives an error code due to an error occurred in an electric actuator, o_bUnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in o_uUnitErrId (unit
error code).

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


28 2.3 M+IAIReadPositionTable_R
Timing chart of I/O signals
■ In normal completion

i_bEN

2
o_bENO

Instruction command Not Not


performed PIO/Modbus switching Connected device read Position table data read performed
communication

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

o_stPositionTable 0 Position table data

■ In error completion

i_bEN

o_bENO

Instruction command
Not performed
communication

o_bOK OFF

o_bErr

o_uErrId 0 Error code 0

o_bUnitErr OFF

o_uUnitErrId 0

o_stPositionTable 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.3 M+IAIReadPositionTable_R 29
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
i_bEN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF i_bEN (execution command).
• This FB requires the configuration of the ladder for every input label.
• Change the memory/device setting in the CPU parameter so that the capacity required to use this FB is secured.
Otherwise, a compiling error may occur in GX Works3.
• This FB uses the CPRTCL instruction. For details, refer to MELSEC iQ-R Programming Manual (Module Dedicated
Instructions).
• Specify the start I/O number assigned to a serial communication module in i_uStartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, the stop error of the CPU (2820H) occurs.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following parameters (module parameters of a serial communication
module) to a module by using GX Works3.
Item Setting value
Communication protocol setting Predefined protocol
Communication speed setting Set the value according to the setting of an electric actuator controller to be used.
Transmission Data bit 8
setting
Parity bit None
Stop bit 1
Communication Echo back enable/prohibit specification Echo back prohibit
control
specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Subroutine type
• CPU module: R120CPU
• Serial communication module: RJ71C24-R4
• Controller: PCON-CB
• Electric actuator: RCP3-TA4C-I-28P-4-20-P3-P
Time required for the Maximum scan time Number of scans required for
processing*1 the processing
56.300 ms 0.379 ms 280 scans

*1 The time required from start to end of the processing.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


30 2.3 M+IAIReadPositionTable_R
Error code
Error code Description Corrective action
100H The value set for the start I/O number is out of the range. Set a value within the range from 00H to FEH for the start I/O
number and execute the FB again.
101H The value set for the target channel is out of the range. Set 1 or 2 for the target channel and execute the FB again.
2
102H The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
105H The position table number is out of the range. Set a value within the range from 0 to 767 for the position table
number and execute the FB again.
200H An unsupported device is connected. Review and correct the connected device and execute the FB
again.
201H The execution command turned OFF during the processing. Do not turn OFF i_bEN (execution command) until o_bOK (normal
completion), o_bErr (error completion), or o_bUnitErr (unit error
completion) is turned ON.
(This error code is output for one scan only.)
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error MELSEC iQ-R Serial Communication Module User's
code Manual(Application)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.3 M+IAIReadPositionTable_R 31
2.4 M+IAITeachingPosition_R
Overview
Sets the designated position to the specified position table (target position).

M+IAITeachingPosition_R
(1) B : i_bEN o_bENO : B (7)

(2) UW : i_uStartIONo o_bOK : B (8)

(3) UW : i_uCh o_bErr : B (9)

(4) UW : i_uAxis o_uErrId : UW (10)

(5) UW : i_uTableNo o_bUnitErr : B (11)

(6) D : i_dPodsitionData o_uUnitErrId : UW (12)

Labels

Input label
No. Label Name Data type Range Description
(1) i_bEN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) i_uStartIONo Start I/O No. Word [unsigned] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) i_uCh Target channel Word [unsigned] 1, 2 Specify the channel of a serial communication
module.
(4) i_uAxis Target axis Word [unsigned] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) i_uTableNo Position table No. Word [unsigned] 0 to 767 Specify the position table number to which the
setting value is written.
(6) i_dPositionData Position data Double Word -999999 to 999999 Specify the target position data to be set.
[signed]

Output label
No. Label Name Data type Default value Description
(7) o_bENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(8) o_bOK Normal completion Bit OFF The ON state indicates that the position data
setting is completed.
(9) o_bErr Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(10) o_uErrId Error code Word [unsigned] 0 The error code of an error occurred in the FB is
stored.
(11) o_bUnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(12) o_uUnitErrId Unit error code Word [unsigned] 0 The error code of an error occurred in the module
is stored.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


32 2.4 M+IAITeachingPosition_R
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
2
RJ71C24  GX Works3 Version 1.055H or later
RJ71C24-R4  GX Works3 Version 1.055H or later

■ CPU module
RCPU

Basic specifications
Item Description
Language ST
Number of basic steps 2069 Steps
The number of steps of the FB embedded in a program varies depending on a CPU module used, the input and output definitions, and
the option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
Number of points of a • Label: 44 points (Word)
label used • Latch label: 0 point (Word)
The number of points of a label used that is embedded in a program varies depending on a device specified for an argument and the
option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
FB dependence No dependence
FB compilation Subroutine type
method
FB operation Pulse execution (multiple scan execution type)

Processing
• Specify the axis number of the operation target in i_uAxis (target axis).
• Specify the position table number to be set in i_uTableNo (position table No.).
• This FB switches from PIO to Modbus communication at the rise of i_bEN (execution command), and sets i_dPositionData
(position data) to the target position of the specified position table number of a controller. For details on the position table,
refer to the IAI Corporation manuals related to serial communication (Modbus version).
• o_bOK (normal completion) is turned ON when the position table setting is completed.
• When a value out of the range is set for the start I/O number, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '100H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target channel, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '101H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target axis, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '102H' is stored in o_uErrId (error code).
• When a value out of the range is set for the position table number, o_bErr (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '105H' is stored in o_uErrId (error code).
• When a value out of the range is set for the position data, o_bErr (error completion) is turned ON and the processing of the
FB is interrupted. In addition, the error code '106H' is stored in o_uErrId (error code).
• When the connected device is not the operation target, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '200H' is stored in o_uErrId (error code).
• When turning OFF i_bEN (execution command) before o_bOK (normal completion), o_bErr (error completion), or
o_bUnitErr (unit error completion) is turned ON, o_bErr (error completion) is turned ON for one scan only. In addition, the
error code '201H' is stored in o_uErrId (error code) for one scan.
• When turning ON i_bEN (execution command) of this FB while executing the following FB, o_bErr (error completion) is
turned ON. In addition, the error code '202H' is stored in o_uErrId (error code).
M+IAIStartPositioning_R
• When an error occurs while sending/receiving a message to/from the predefined protocol, o_bErr (error completion) is
turned ON and the processing of the FB is interrupted. An error code is stored in o_uErrId (error code). For details on the

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.4 M+IAITeachingPosition_R 33
error code, refer to MELSEC iQ-R Serial Communication Module User's Manual(Application).
• When this FB receives an error code due to an error occurred in an electric actuator, o_bUnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in o_uUnitErrId (unit
error code).

Timing chart of I/O signals


■ In normal completion

i_bEN

o_bENO

Instruction command Not Not


PIO/Modbus switching Connected device read Position table data write
communication performed performed

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

■ In error completion

i_bEN

o_bENO

Instruction command
Not performed
communication

o_bOK OFF

o_bErr

o_uErrId
0 Error code 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


34 2.4 M+IAITeachingPosition_R
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
2
i_bEN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF i_bEN (execution command).
• This FB requires the configuration of the ladder for every input label.
• Change the memory/device setting in the CPU parameter so that the capacity required to use this FB is secured.
Otherwise, a compiling error may occur in GX Works3.
• This FB writes to the non-volatile memory. For details, refer to the IAI Corporation manuals related to serial communication
(Modbus version).
• This FB uses the CPRTCL instruction. For details, refer to MELSEC iQ-R Programming Manual (Module Dedicated
Instructions).
• Specify the start I/O number assigned to a serial communication module in i_uStartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, the stop error of the CPU (2820H) occurs.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following parameters (module parameters of a serial communication
module) to a module by using GX Works3.
Item Setting value
Communication protocol setting Predefined protocol
Communication speed setting Set the value according to the setting of an electric actuator controller to be used.
Transmission Data bit 8
setting Parity bit None
Stop bit 1
Communication Echo back enable/prohibit specification Echo back prohibit
control
specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Subroutine type
• CPU module: R120CPU
• Serial communication module: RJ71C24-R4
• Controller: PCON-CB
• Electric actuator: RCP3-TA4C-I-28P-4-20-P3-P
Time required for the Maximum scan time Number of scans required for
processing*1 the processing
53.000 ms 0.373 ms 272 scans

*1 The time required from start to end of the processing.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.4 M+IAITeachingPosition_R 35
Error code
Error code Description Corrective action
100H The value set for the start I/O number is out of the range. Set a value within the range from 00H to FEH for the start I/O
number and execute the FB again.
101H The value set for the target channel is out of the range. Set 1 or 2 for the target channel and execute the FB again.
102H The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
105H The position table number is out of the range. Set a value within the range from 0 to 767 for the position table
number and execute the FB again.
106H The position data is out of the range. Set a value within the range from -999999 to 999999 for the position
data and execute the FB again.
200H An unsupported device is connected. Review and correct the connected device and execute the FB
again.
201H The execution command turned OFF during the processing. Do not turn OFF i_bEN (execution command) until o_bOK (normal
completion), o_bErr (error completion), or o_bUnitErr (unit error
completion) is turned ON.
(This error code is output for one scan only.)
202H Other FB which may affect the operation of an electric actuator is After stopping M+IAIStartPositioning_R, execute the FB again.
executing.
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error MELSEC iQ-R Serial Communication Module User's
code Manual(Application)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


36 2.4 M+IAITeachingPosition_R
2.5 M+IAIStartPositioning_R
Overview
Executes positioning operation based on the specified position table data.
2
M+IAIStartPositioning_R
(1) B : i_bEN o_bENO : B (6)

(2) UW : i_uStartIONo o_bOK : B (7)

(3) UW : i_uCh o_bErr : B (8)

(4) UW : i_uAxis o_uErrId : UW (9)

(5) UW : i_uTableNo o_bUnitErr : B (10)

o_uUnitErrId : UW (11)

Labels

Input label
No. Label Name Data type Range Description
(1) i_bEN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) i_uStartIONo Start I/O No. Word [unsigned] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) i_uCh Target channel Word [unsigned] 1, 2 Specify the channel of a serial communication
module.
(4) i_uAxis Target axis Word [unsigned] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) i_uTableNo Position table No. Word [unsigned] 0 to 767 Specify the position table number whose
positioning operation is executed.

Output label
No. Label Name Data type Default value Description
(6) o_bENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(7) o_bOK Normal completion Bit OFF The ON state indicates that positioning operation
is completed.
(8) o_bErr Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(9) o_uErrId Error code Word [unsigned] 0 The error code of an error occurred in the FB is
stored.
(10) o_bUnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(11) o_uUnitErrId Unit error code Word [unsigned] 0 The error code of an error occurred in the module
is stored.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.5 M+IAIStartPositioning_R 37
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
RJ71C24  GX Works3 Version 1.055H or later
RJ71C24-R4  GX Works3 Version 1.055H or later

■ CPU module
RCPU

Basic specifications
Item Description
Language ST
Number of basic steps 4110 Steps
The number of steps of the FB embedded in a program varies depending on a CPU module used, the input and output definitions, and
the option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
Number of points of a • Label: 76 points (Word)
label used • Latch label: 0 point (Word)
The number of points of a label used that is embedded in a program varies depending on a device specified for an argument and the
option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
FB dependence M+IAIStartPositioning_R
M+IAIServoControl_R
FB compilation Subroutine type
method
FB operation Pulse execution (multiple scan execution type)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


38 2.5 M+IAIStartPositioning_R
Processing
• Specify the axis number of the operation target in i_uAxis (target axis).
• Set the position table number to be executed in i_uTableNo (position table No.).
• This FB switches from PIO to Modbus communication at the rise of i_bEN (execution command), and starts positioning
operation.
2
• o_bOK (normal completion) is turned ON when positioning operation is completed.
• When a value out of the range is set for the start I/O number, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '100H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target channel, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '101H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target axis, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '102H' is stored in o_uErrId (error code).
• When a value out of the range is set for the position table number, o_bErr (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '105H' is stored in o_uErrId (error code).
• When the connected device is not the operation target, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '200H' is stored in o_uErrId (error code).
• When turning OFF i_bEN (execution command) before o_bOK (normal completion), o_bErr (error completion), or
o_bUnitErr (unit error completion) is turned ON, o_bErr (error completion) is turned ON for one scan only. In addition, the
error code '201H' is stored in o_uErrId (error code) for one scan.
• When turning ON i_bEN (execution command) of this FB while executing any of the following FBs, o_bErr (error
completion) is turned ON. In addition, the error code '202H' is stored in o_uErrId (error code).
M+IAIStartHomePositioning_R, M+IAIJogInching_R, M+IAITeachingPosition_R, M+IAIStartPositioning_R, and
M+IAIServoControl_R
• When an error occurs while sending/receiving a message to/from the predefined protocol, o_bErr (error completion) is
turned ON and the processing of the FB is interrupted. An error code is stored in o_uErrId (error code). For details on the
error code, refer to MELSEC iQ-R Serial Communication Module User's Manual(Application).
• When this FB receives an error code due to an error occurred in an electric actuator, o_bUnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in o_uUnitErrId (unit
error code).

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.5 M+IAIStartPositioning_R 39
Timing chart of I/O signals
■ In normal completion

i_bEN

o_bENO

i_uTableNo
K1

Instruction command Not Instruction command communication K1 operation Not


Controller status signal read
communication performed from M+IAIServoControl_R command performed

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

■ In error completion

i_bEN

o_bENO

Instruction command
Not performed
communication

o_bOK OFF

o_bErr

o_uErrId 0 Error code 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


40 2.5 M+IAIStartPositioning_R
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
2
i_bEN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF i_bEN (execution command).
• This FB requires the configuration of the ladder for every input label.
• Change the memory/device setting in the CPU parameter so that the capacity required to use this FB is secured.
Otherwise, a compiling error may occur in GX Works3.
• After positioning operation is started by using this FB, when turning OFF i_bEN (execution command) before o_bOK
(normal completion), o_bErr (error completion), or o_bUnitErr (unit error completion) is turned ON, an electric actuator
continues to operate until a home position return is completed.
• After turning ON the power, when this FB is operated without executing a home position return, positioning operation is
performed automatically after executing the home position return.
• This FB uses the CPRTCL instruction. For details, refer to MELSEC iQ-R Programming Manual (Module Dedicated
Instructions).
• Specify the start I/O number assigned to a serial communication module in i_uStartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, the stop error of the CPU (2820H) occurs.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following parameters (module parameters of a serial communication
module) to a module by using GX Works3.
Item Setting value
Communication protocol setting Predefined protocol
Communication speed setting Set the value according to the setting of an electric actuator controller to be used.
Transmission Data bit 8
setting Parity bit None
Stop bit 1
Communication Echo back enable/prohibit specification Echo back prohibit
control
specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.5 M+IAIStartPositioning_R 41
Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Subroutine type
• CPU module: R120CPU
• Serial communication module: RJ71C24-R4
• Controller: PCON-CB
• Electric actuator: RCP3-TA4C-I-28P-4-20-P3-P
• Electric actuator initial position: Home position (0.00 mm)
• Position table execution setting:
Target position: 10.00 mm
Positioning width: 0.1 mm
Speed: 10.00 mm/sec
Acceleration: 0.1 G
Deceleration: 0.1 G
Other setting value: 0
Timing for turning execution Time required for Maximum scan time Number of scans
command ON the processing*1 required for the
processing
Immediately after power supply ON 3080.000 ms 0.426 ms 15291 scans
After executing home position return 1170.000 ms 0.428 ms 5812 scans

*1 The time required from start to end of the processing.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


42 2.5 M+IAIStartPositioning_R
Error code
Error code Description Corrective action
100H The value set for the start I/O number is out of the range. Set a value within the range from 00H to FEH for the start I/O
number and execute the FB again.
101H The value set for the target channel is out of the range. Set 1 or 2 for the target channel and execute the FB again.
2
102H The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
105H The position table number is out of the range. Set a value within the range from 0 to 767 for the position table
number and execute the FB again.
200H An unsupported device is connected. Review and correct the connected device and execute the FB
again.
201H The execution command turned OFF during the processing. Do not turn OFF i_bEN (execution command) until o_bOK (normal
completion), o_bErr (error completion), or o_bUnitErr (unit error
completion) is turned ON.
(This error code is output for one scan only.)
202H Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+IAIStartHomePositioning_R
• M+IAIJogInching_R
• M+IAITeachingPosition_R
• M+IAIStartPositioning_R
• M+IAIServoControl_R
For M+IAIJogInching_R, check that o_bParamOK (parameter
setting completion flag) is turned ON and o_bBusy (busy signal) is
turned OFF.
203H Emergency stop or major failure is occurring. Check the status of a controller in M+IAIMonitoring_R.
After checking the status, remove the cause of the error and
execute the FB again.
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error MELSEC iQ-R Serial Communication Module User's
code Manual(Application)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.5 M+IAIStartPositioning_R 43
2.6 M+IAIMonitoring_R
Overview
Monitors a current position and alarms, and reset the alarms.

M+IAIMonitoring_R
(1) B : i_bEN o_bENO : B (6)
(2) UW : i_uStartIONo o_bOK : B (7)
(3) UW : i_uCh o_bErr : B (8)

(4) UW : i_uAxis o_uErrId : UW (9)


(5) B : i_bAlmReset o_bUnitErr : B (10)

o_uUnitErrId : UW (11)
o_bMonitorOK : B (12)
o_stMonitoringTable : DUT (13)

Labels

Input label
No. Label Name Data type Range Description
(1) i_bEN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) i_uStartIONo Start I/O No. Word [unsigned] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) i_uCh Target channel Word [unsigned] 1, 2 Specify the channel of a serial communication
module.
(4) i_uAxis Target axis Word [unsigned] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) i_bAlmReset Reset alarm Bit ON, OFF ON: An alarm is reset
OFF: An alarm does not operate

Output label
No. Label Name Data type Default value Description
(6) o_bENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(7) o_bOK Normal completion Bit OFF The ON state indicates that an alarm is cleared
normally.
(8) o_bErr Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(9) o_uErrId Error code Word [unsigned] 0 The error code of an error occurred in the FB is
stored.
(10) o_bUnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(11) o_uUnitErrId Unit error code Word [unsigned] 0 The error code of an error occurred in the module
is stored.
(12) o_bMonitorOK Monitoring status Bit OFF The ON state indicates that a current position and
alarms are monitored normally.
(13) o_stMonitoringTable Monitoring table Structure  For details, refer to the following:
(stMonitoringTable) Page 102 Monitoring table structure
(stMonitoringTable)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


44 2.6 M+IAIMonitoring_R
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
2
RJ71C24  GX Works3 Version 1.055H or later
RJ71C24-R4  GX Works3 Version 1.055H or later

■ CPU module
RCPU

Basic specifications
Item Description
Language ST
Number of basic steps 2645 Steps
The number of steps of the FB embedded in a program varies depending on a CPU module used, the input and output definitions, and
the option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
Number of points of a • Label: 64 points (Word)
label used • Latch label: 0 point (Word)
The number of points of a label used that is embedded in a program varies depending on a device specified for an argument and the
option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
FB dependence No dependence
FB compilation Subroutine type
method
FB operation Real-time execution

Processing
• Specify the axis number of the operation target in i_uAxis (target axis).
• This FB switches from PIO to Modbus communication at the rise of i_bEN (execution command), and starts monitoring for
a controller target axis. The monitoring data (such as a current position and alarm codes) is stored in o_stMonitoringTable
(monitoring table).
• o_bMonitorOK (monitoring status) is turned ON while monitoring the target axis.
• The alarm is reset by turning ON i_bEN (execution command), and then turning ON i_bAlmReset (reset alarm) while the
alarm is occurring.
• o_bOK (normal completion) is turned ON when the alarm reset is completed.
• When a value out of the range is set for the start I/O number, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '100H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target channel, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '101H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target axis, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '102H' is stored in o_uErrId (error code).
• When the connected device is not the operation target, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '200H' is stored in o_uErrId (error code).
• When turning OFF i_bEN (execution command) before monitoring is started, o_bErr (error completion) is turned ON for one
scan only. In addition, the error code '201H' is stored in o_uErrId (error code) for one scan.
• When an error occurs while sending/receiving a message to/from the predefined protocol, o_bErr (error completion) is
turned ON and the processing of the FB is interrupted. An error code is stored in o_uErrId (error code). For details on the
error code, refer to MELSEC iQ-R Serial Communication Module User's Manual(Application).
• When this FB receives an error code due to an error occurred in an electric actuator, o_bUnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in o_uUnitErrId (unit
error code).

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.6 M+IAIMonitoring_R 45
Timing chart of I/O signals
■ In normal completion

i_bEN

o_bENO

i_bAlmReset

Instruction command Not PIO/Modbus Connected Various monitor Various monitor


Alarm reset Various monitor Various monitor Not
communication performed switching device read information read information read information read information read performed

o_bMonitorOK

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

o_stMonitoringTable Various monitor Various monitor information Various monitor information


0 information (alarm occurring)

■ In error completion

i_bEN

o_bENO

Instruction command
Not performed
communication

o_bOK OFF

o_bErr

o_uErrId
0 Error code 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


46 2.6 M+IAIMonitoring_R
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
2
i_bEN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF i_bEN (execution command).
• This FB requires the configuration of the ladder for every input label.
• Change the memory/device setting in the CPU parameter so that the capacity required to use this FB is secured.
Otherwise, a compiling error may occur in GX Works3.
• This FB uses the CPRTCL instruction. For details, refer to MELSEC iQ-R Programming Manual (Module Dedicated
Instructions).
• Specify the start I/O number assigned to a serial communication module in i_uStartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, the stop error of the CPU (2820H) occurs.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following parameters (module parameters of a serial communication
module) to a module by using GX Works3.
Item Setting value
Communication protocol setting Predefined protocol
Communication speed setting Set the value according to the setting of an electric actuator controller to be used.
Transmission Data bit 8
setting
Parity bit None
Stop bit 1
Communication Echo back enable/prohibit specification Echo back prohibit
control
specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Subroutine type
• CPU module: R120CPU
• Serial communication module: RJ71C24-R4
• Controller: PCON-CB
• Electric actuator: RCP3-TA4C-I-28P-4-20-P3-P
Measuring range Time required for Maximum scan time Number of scans
the processing*1 required for the
processing
From when i_bEN (execution command) turns ON to when 78.400 ms 0.377 ms 392 scans
o_bMonitorOK (monitoring status) turns ON
From when i_bAlmReset (reset alarm) turns ON to when an alarm 60.700 ms 0.499 ms 229 scans
reset is completed

*1 The time required from start to end of the processing.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.6 M+IAIMonitoring_R 47
Error code
Error code Description Corrective action
100H The value set for the start I/O number is out of the range. Set a value within the range from 00H to FEH for the start I/O
number and execute the FB again.
101H The value set for the target channel is out of the range. Set 1 or 2 for the target channel and execute the FB again.
102H The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
200H An unsupported device is connected. Review and correct the connected device and execute the FB
again.
201H The execution command turned OFF during the processing. Do not turn OFF i_bEN (execution command) until monitoring
starts.
(This error code is output for one scan only.)
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error MELSEC iQ-R Serial Communication Module User's
code Manual(Application)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


48 2.6 M+IAIMonitoring_R
2.7 M+IAIServoControl_R
Overview
Requests a servo to turn ON or OFF.
2
M+IAIServoControl_R
(1) B : i_bEN o_bENO : B (7)

(2) UW : i_uStartIONo o_bOK : B (8)

(3) UW : i_uCh o_bErr : B (9)

(4) UW : i_uAxis o_uErrId : UW (10)

(5) B : i_bServo o_bUnitErr : B (11)

(6) B : i_bPress o_uUnitErrId : UW (12)

Labels

Input label
No. Label Name Data type Range Description
(1) i_bEN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) i_uStartIONo Start I/O No. Word [unsigned] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) i_uCh Target channel Word [unsigned] 1, 2 Specify the channel of a serial communication
module.
(4) i_uAxis Target axis Word [unsigned] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) i_bServo Servo ON/OFF Bit ON, OFF ON: Servo ON
replacement OFF: Servo OFF
(6) i_bPress Servo press ON/ Bit ON, OFF ON: Servo press ON
OFF replacement OFF: Servo press OFF

Output label
No. Label Name Data type Default value Description
(7) o_bENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(8) o_bOK Normal completion Bit OFF The ON state indicates that the execution of servo
ON or OFF command (servo press ON or OFF
command) is completed.
(9) o_bErr Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(10) o_uErrId Error code Word [unsigned] 0 The error code of an error occurred in the FB is
stored.
(11) o_bUnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(12) o_uUnitErrId Unit error code Word [unsigned] 0 The error code of an error occurred in the module
is stored.

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.7 M+IAIServoControl_R 49
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
RJ71C24  GX Works3 Version 1.055H or later
RJ71C24-R4  GX Works3 Version 1.055H or later

■ CPU module
RCPU

Basic specifications
Item Description
Language ST
Number of basic steps 2300 Steps
The number of steps of the FB embedded in a program varies depending on a CPU module used, the input and output definitions, and
the option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
Number of points of a • Label: 36 points (Word)
label used • Latch label: 0 point (Word)
The number of points of a label used that is embedded in a program varies depending on a device specified for an argument and the
option settings of GX Works3. For the option settings of GX Works3, refer to GX Works3 Operating Manual.
FB dependence No dependence
FB compilation Subroutine type
method
FB operation Pulse execution (multiple scan execution type)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


50 2.7 M+IAIServoControl_R
Processing
• Specify the axis number of the operation target in i_uAxis (target axis).
• This FB switches from PIO to Modbus communication at the rise of i_bEN (execution command). The FB requests a servo
to turn ON when i_bServo (servo ON/OFF replacement) is turned ON, and requests to turn OFF when i_bServo is turned
OFF. In addition, the FB requests a servo press to turn ON when i_bPress (servo press ON/OFF replacement) is turned
2
ON, and requests to turn OFF when i_bPress is turned OFF. Note whether the servo turns ON or OFF is not checked with
this FB. Check the servo status using M+IAIMonitoring_R. (Page 44 M+IAIMonitoring_R)
• At the completion of the servo ON/OFF command execution, o_bOK (normal completion) is turned ON.
• When a value out of the range is set for the start I/O number, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '100H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target channel, o_bErr (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '101H' is stored in o_uErrId (error code).
• When a value out of the range is set for the target axis, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '102H' is stored in o_uErrId (error code).
• When the connected device is not the operation target, o_bErr (error completion) is turned ON and the processing of the FB
is interrupted. In addition, the error code '200H' is stored in o_uErrId (error code).
• When turning OFF i_bEN (execution command) before o_bOK (normal completion), o_bErr (error completion), or
o_bUnitErr (unit error completion) is turned ON, o_bErr (error completion) is turned ON for one scan only. In addition, the
error code '201H' is stored in o_uErrId (error code) for one scan.
• When turning ON i_bEN (execution command) of this FB while executing any of the following FBs, o_bErr (error
completion) is turned ON. In addition, the error code '202H' is stored in o_uErrId (error code).
M+IAIStartHomePositioning_R, M+IAIJogInching_R, M+IAIStartPositioning_R, and M+IAIServoControl_R
• When an error occurs while sending/receiving a message to/from the predefined protocol, o_bErr (error completion) is
turned ON and the processing of the FB is interrupted. An error code is stored in o_uErrId (error code). For details on the
error code, refer to MELSEC iQ-R Serial Communication Module User's Manual(Application).
• When this FB receives an error code due to an error occurred in an electric actuator, o_bUnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in o_uUnitErrId (unit
error code).

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.7 M+IAIServoControl_R 51
Timing chart of I/O signals
■ In normal completion

i_bEN

o_bENO

Instruction command Not Not


performed PIO/Modbus switching Connected device read Servo ON/OFF command performed
communication

o_bOK

o_bErr OFF

o_uErrId 0

o_bUnitErr OFF

o_uUnitErrId 0

■ In error completion

i_bEN

o_bENO

Instruction command
Not performed
communication

o_bOK OFF

o_bErr

o_uErrId
0 Error code 0

o_bUnitErr OFF

o_uUnitErrId 0

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


52 2.7 M+IAIServoControl_R
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
2
i_bEN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF i_bEN (execution command).
• This FB requires the configuration of the ladder for every input label.
• Change the memory/device setting in the CPU parameter so that the capacity required to use this FB is secured.
Otherwise, a compiling error may occur in GX Works3.
• This FB uses the CPRTCL instruction. For details, refer to MELSEC iQ-R Programming Manual (Module Dedicated
Instructions).
• Specify the start I/O number assigned to a serial communication module in i_uStartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, the stop error of the CPU (2820H) occurs.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• This FB must satisfy the following conditions in the monitoring table. (Page 102 Monitoring table structure
(stMonitoringTable))
Bit 10 in device status 1 (Major failure status): 0
Bit 15 in device status 1 (EMG status): 0
Bit 15 in device status 2 (Enable): 1
Bit 17 in system status (Auto servo OFF): 0
If the conditions are not satisfied, o_bOK (normal completion) turns ON but a servo is not turned ON or OFF. For details,
refer to the IAI Corporation manuals related to serial communication (Modbus version).
• Before operating an electric actuator, write the following parameters (module parameters of a serial communication
module) to a module by using GX Works3.
Item Setting value
Communication protocol setting Predefined protocol
Communication speed setting Set the value according to the setting of an electric actuator controller to be used.
Transmission Data bit 8
setting Parity bit None
Stop bit 1
Communication Echo back enable/prohibit specification Echo back prohibit
control
specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


2.7 M+IAIServoControl_R 53
Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Subroutine type
• CPU module: R120CPU
• Serial communication module: RJ71C24-R4
• Controller: PCON-CB
• Electric actuator: RCP3-TA4C-I-28P-4-20-P3-P
Input label Time required for Maximum scan time Number of scans
i_bServo i_bPress the processing*1 required for the
(Servo ON/OFF (Servo press ON/OFF processing
replacement) replacement)
OFF OFF 48.800 ms 0.384 ms 250 scans
ON OFF 49.000 ms 0.384 ms 251 scans
ON ON 48.900 ms 0.386 ms 249 scans
OFF ON 49.100 ms 0.392 ms 250 scans

*1 The time required from start to end of the processing.

Error code
Error code Description Corrective action
100H The value set for the start I/O number is out of the range. Set a value within the range from 00H to FEH for the start I/O
number and execute the FB again.
101H The value set for the target channel is out of the range. Set 1 or 2 for the target channel and execute the FB again.
102H The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
200H An unsupported device is connected. Review and correct the connected device and execute the FB
again.
201H The execution command turned OFF during the processing. Do not turn OFF i_bEN (execution command) until o_bOK (normal
completion), o_bErr (error completion), or o_bUnitErr (unit error
completion) is turned ON.
(This error code is output for one scan only.)
202H Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+IAIStartHomePositioning_R
• M+IAIJogInching_R
• M+IAIStartPositioning_R
• M+IAIServoControl_R
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error MELSEC iQ-R Serial Communication Module User's
code Manual(Application)

2 DETAILS OF THE FB LIBRARY (MELSEC iQ-R SERIES)


54 2.7 M+IAIServoControl_R
3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L
SERIES)
3.1 Preparation for Using FB Library
This section explains advance preparation required for using MELSEC-Q/L series FB libraries.
3
Importing M+CPU-IAIPosiSp_CPRTCL-ST
M+CPU-IAIPosiSp_CPRTCL-ST is used internally in each FB of the MELSEC-Q/L series FB library.
M+CPU-IAIPosiSp_CPRTCL-ST must be imported in a project.
Do not use M+CPU-IAIPosiSp_CPRTCL-ST in a user-created program as this FB is used only internally in other FBs. For
details on M+CPU-IAIPosiSp_CPRTCL-ST, refer to the following:
Page 101 M+CPU-IAIPosiSp_CPRTCL-ST

Checking the start I/O number


When the start I/O number of a serial communication module is other than 0000H to 00F0H, add the G_CPRTCL instruction
to a program of M+CPU-IAIPosiSp_CPRTCL-ST.
For details on M+CPU-IAIPosiSp_CPRTCL-ST, refer to the following:
Page 101 M+CPU-IAIPosiSp_CPRTCL-ST

Ex.
When the start I/O number to which a serial communication module is mounted is 0FE0H

CASE iw_StartIONo OF
0:
G_CPRTCL(TRUE = FB_EN,H0,iw_Ch,K1,iow_18ControlData,ob_2CompDevice);
1:
G_CPRTCL(TRUE = FB_EN,H1,iw_Ch,K1,iow_18ControlData,ob_2CompDevice);

15:
G_CPRTCL(TRUE = FB_EN,H0F,iw_Ch,K1,iow_18ControlData,ob_2CompDevice);
Describe a value, in which the start I/O number is divided by 16,
254: in decimal (FEH = K254)
G_CPRTCL(TRUE = FB_EN, H0FE, iw_Ch, K1, iow_18ControlData, ob_2CompDevice);

Add the G_CPRTCL instruction whose FEH is


specified for the start I/O No.
END_CASE;

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.1 Preparation for Using FB Library 55
3.2 M+CPU-IAIPosiSp_StartHomePosi-ST

Advanced preparation is required for using this FB. For details, refer to the following:
Page 55 Importing M+CPU-IAIPosiSp_CPRTCL-ST
Page 55 Checking the start I/O number

Overview
Moves an electric actuator to the initial position (home position return).

M+CPU-IAIPosiSp_StartHomePosi-ST
(1) B : FB_EN FB_ENO : B (5)

(2) W : iw_StartIONo FB_OK : B (6)

(3) W : iw_Ch FB_ERROR : B (7)

(4) W : iw_Axis ERROR_ID : W (8)

ob_UnitErr : B (9)

ow_UnitErrId : W (10)

Labels

Input label
No. Label Name Data type Range Description
(1) FB_EN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) iw_StartIONo Start I/O No. Word [signed] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) iw_Ch Target channel Word [signed] 2 Specify the channel of a serial communication
module.
(4) iw_Axis Target axis Word [signed] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.

Output label
No. Label Name Data type Default value Description
(5) FB_ENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(6) FB_OK Normal completion Bit OFF The ON state indicates that a home position
return is completed.
(7) FB_ERROR Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(8) ERROR_ID Error code Word [signed] 0 The error code of an error occurred in the FB is
stored.
(9) ob_UnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(10) ow_UnitErrId Unit error code Word [signed] 0 The error code of an error occurred in the module
is stored.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


56 3.2 M+CPU-IAIPosiSp_StartHomePosi-ST
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
*1
QJ71C24N The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
QJ71C24N-R4*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later 3
higher.
LJ71C24*1  GX Works2 Version 1.570U or later

*1 Available only in CH2.

■ CPU module
• QCPU*1
• LCPU
*1 Universal model QCPUs and process CPUs only

Basic specifications
Item Description
Language ST
Number of basic steps 3744 steps
The number of steps of the FB which is embedded in a program varies depending on the CPU module being used, input/output
definitions, and option settings of GX Works2. For the option settings of GX Works2, refer to the GX Works2 Version 1 Operating
Manual (Common).
Number of points of a • Label: 0.08K points (Word), 0.04K points (Bit)
label used • Latch label: 0 point (Word), 0 point (Bit)
The number of points of a label used which is embedded in a program varies depending on the device specified for an argument and
option settings of GX Works2. For the option settings of GX Works2, refer to GX Works2 Version 1 Operating Manual (Common).
FB dependence M+CPU-IAIPosiSp_StartHomePosi-ST
M+CPU-IAIPosiSp_ServoControl-ST
M+CPU-IAIPosiSp_CPRTCL-ST
FB compilation Macro type
method
FB operation Pulse execution (multiple scan execution type)

Processing
• Before executing this FB, check that the G_CPRTCL instruction which is executed for the specified start I/O number exists
in the M+CPU-IAIPosiSp_CPRTCL-ST program. (Page 55 Checking the start I/O number, Page 101 M+CPU-
IAIPosiSp_CPRTCL-ST)
• Specify the axis number of the operation target in iw_Axis (target axis).
• This FB switches from PIO to Modbus communication at the rise of FB_EN (execution command) and executes a home
position return.
• FB_OK (normal completion) is turned ON when a home position return is completed.
• When a value out of the range is set for the start I/O number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '10' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target channel, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '11' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target axis, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '12' is stored in ERROR_ID (error code).
• When the connected device is not the operation target, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '20' is stored in ERROR_ID (error code).
• When turning OFF FB_EN (execution command) before FB_OK (normal completion), FB_ERROR (error completion), or
ob_UnitErr (unit error completion) is turned ON, FB_ERROR (error completion) is turned ON for one scan only. In addition,
the error code '21' is stored in ERROR_ID (error code) for one scan.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.2 M+CPU-IAIPosiSp_StartHomePosi-ST 57
• When turning ON FB_EN (execution command) of this FB while executing any of the following FBs, FB_ERROR (error
completion) is turned ON. In addition, the error code '22' is stored in ERROR_ID (error code).
M+CPU-IAIPosiSp_StartHomePosi-ST, M+CPU-IAIPosiSp_JogInching-ST, M+CPU-IAIPosiSp_StartPosi-ST,
and M+CPU-IAIPosiSp_ServoControl-ST
• When an error occurs while sending/receiving a message to/from the predefined protocol, FB_ERROR (error completion) is
turned ON and the processing of the FB is interrupted. In addition, an error code is stored in ERROR_ID (error code). For
details on the error code, refer to Q Corresponding Serial Communication Module User's Manual (Basic) or
MELSEC-L Serial Communication Module User's Manual (Basic).
• When this FB receives an error code due to an error occurred in an electric actuator, ob_UnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in ow_UnitErrId (unit
error code).

Timing chart of I/O signals


■ In normal completion

FB_EN

FB_ENO

Instruction command Not Instruction command communication Home position Not


Controller status signal read
communication performed from M+CPU-IAIPosiSp_ServoControl-ST return performed

FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr
OFF

ow_UnitErrId 0

■ In error completion

FB_EN

FB_ENO

Instruction command Not performed


communication

FB_OK OFF

FB_ERROR

ERROR_ID 0 Error code 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


58 3.2 M+CPU-IAIPosiSp_StartHomePosi-ST
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
FB_EN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF FB_EN (execution command).
• This FB requires the configuration of the ladder for every input label.
3
• After a home position return is started by using this FB, when turning OFF FB_EN (execution command) before FB_OK
(normal completion), FB_ERROR (error completion), or ob_UnitErr (unit error completion) is turned ON, an electric actuator
continues to operate until a home position return is completed.
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• Specify the start I/O number assigned to a serial communication module in iw_StartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, a stop error (2110H) occurs in the CPU module.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following intelligent function module data (parameters of a serial
communication module) to a module in GX Works2.
Item Setting value
Switch Setting Transmission Data Bit 8
Setting Parity Bit None
Stop bit 1
Communication rate setting Set the value according to the setting of an electric actuator controller to be used.
Communication protocol setting Predefined protocol
Various Control Echo back permit/prohibit specification 1: Prohibited
Specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning (Q/L) to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Macro type
• CPU module: Q04UDVCPU
• Serial communication module: QJ71C24N
• Controller: 
• Electric actuator: ERC3-SA5C-I-42P-12-50-SE-P-CN
• Electric actuator initial position: Home position (0.00 mm)
Time required for the Maximum scan time Number of scans required for
processing*1 the processing
1620.000 ms 0.847 ms 5610 scans

*1 The time required from start to end of the processing.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.2 M+CPU-IAIPosiSp_StartHomePosi-ST 59
Error code
Error code Description Corrective action
(Decimal)
10 The value set for the start I/O number is out of the range. Set the start I/O number to which a serial communication module is
mounted and execute FB again.
11 The value set for the target channel is out of the range. Set 2 for the target channel and execute the FB again.
12 The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
20 An unsupported device is connected. Review and correct the connected device and execute the FB
again.
21 The execution command turned OFF during the processing. Do not turn OFF FB_EN (execution command) until FB_OK (normal
completion), FB_ERROR (error completion), or ob_UnitErr (unit
error completion) is turned ON.
(This error code is output for one scan only.)
22 Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+CPU-IAIPosiSp_StartHomePosi-ST
• M+CPU-IAIPosiSp_JogInching-ST
• M+CPU-IAIPosiSp_StartPosi-ST
• M+CPU-IAIPosiSp_ServoControl-ST
For M+CPU-IAIPosiSp_JogInching-ST, check that ob_ParamOK
(parameter setting completion flag) is turned ON and ob_Busy
(busy signal) is turned OFF.
23 Emergency stop or major failure is occurring. Check the status of a controller in M+CPU-IAIPosiSp_Monitoring-
ST.
After checking the status, remove the cause of the error and
execute the FB again.
24 The G_CPRTCL instruction which is executed for the specified start Add the G_CPRTCL instruction, which is executed for the specified
I/O number is not defined. start I/O number, to the M+CPU-IAIPosiSp_CPRTCL-ST program.
For details, refer to the following:
Page 55 Checking the start I/O number
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error Q Corresponding Serial Communication Module User's Manual
code (Basic)
MELSEC-L Serial Communication Module User's Manual
(Basic)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


60 3.2 M+CPU-IAIPosiSp_StartHomePosi-ST
3.3 M+CPU-IAIPosiSp_JogInching-ST

Advanced preparation is required for using this FB. For details, refer to the following:
Page 55 Importing M+CPU-IAIPosiSp_CPRTCL-ST
Page 55 Checking the start I/O number

Overview 3
Executes JOG or inching operation.

M+CPU-IAIPosiSp_JogInching-ST
(1) B : FB_EN FB_ENO : B (10)

(2) W : iw_StartIONo FB_OK : B (11)

(3) W : iw_Ch FB_ERROR : B (12)

(4) W : iw_Axis ERROR_ID : W (13)

(5) B : ib_JogOrInching ob_UnitErr : B (14)

(6) D : id_JogSpeed ow_UnitErrId : W (15)

(7) D : id_IncMovDist ob_ParamOK : B (16)

(8) B : ib_FJog ob_Busy : B (17)

(9) B : ib_RJog

Labels

Input label
No. Label Name Data type Range Description
(1) FB_EN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) iw_StartIONo Start I/O No. Word [signed] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) iw_Ch Target channel Word [signed] 2 Specify the channel of a serial communication
module.
(4) iw_Axis Target axis Word [signed] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) ib_JogOrInching JOG/Inching Bit ON, OFF ON: Inching operation
replacement OFF: JOG operation
(6) id_JogSpeed JOG speed Double Word 1 to 999999 Specify the JOG speed.
[signed] For the inching operation, the specified speed is
ignored. (Unit: 0.01 mm/s)
(7) id_IncMovDist Inching amount of Double Word 1 to 999999 Specify the inching amount of movement
movement [signed] For the JOG operation, the specified movement
amount is ignored. (Unit: 0.01 mm/s)
(8) ib_FJog JOG + command Bit ON, OFF Turn ON this label to perform the forward JOG or
inching operation.
(9) ib_RJog JOG - command Bit ON, OFF Turn ON this label to perform the reverse JOG or
inching operation.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.3 M+CPU-IAIPosiSp_JogInching-ST 61
Output label
No. Label Name Data type Default value Description
(10) FB_ENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(11) FB_OK Normal completion Bit OFF The ON state indicates that the JOG operation is
started, and the inching operation is completed
normally.
(12) FB_ERROR Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(13) ERROR_ID Error code Word [signed] 0 The error code of an error occurred in the FB is
stored.
(14) ob_UnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(15) ow_UnitErrId Unit error code Word [signed] 0 The error code of an error occurred in the module
is stored.
(16) ob_ParamOK Parameter setting Bit OFF The ON state indicates that the initial settings until
completion flag an electric actuator is ready to operate is
completed.
(17) ob_Busy Busy signal Bit OFF The ON state indicates that an electric actuator is
operating.

FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
*1
QJ71C24N The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
QJ71C24N-R4*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
LJ71C24*1  GX Works2 Version 1.570U or later

*1 Available only in CH2.

■ CPU module
• QCPU*1
• LCPU
*1 Universal model QCPUs and process CPUs only

Basic specifications
Item Description
Language ST
Number of basic steps 6289 steps
The number of steps of the FB which is embedded in a program varies depending on the CPU module being used, input/output
definitions, and option settings of GX Works2. For the option settings of GX Works2, refer to the GX Works2 Version 1 Operating
Manual (Common).
Number of points of a • Label: 0.07K points (Word), 0.04K point (Bit)
label used • Latch label: 0 point (Word), 0 point (Bit)
The number of points of a label used which is embedded in a program varies depending on the device specified for an argument and
option settings of GX Works2. For the option settings of GX Works2, refer to GX Works2 Version 1 Operating Manual (Common).
FB dependence M+CPU-IAIPosiSp_JogInching-ST
M+CPU-IAIPosiSp_ServoControl-ST
M+CPU-IAIPosiSp_CPRTCL-ST
FB compilation Macro type
method
FB operation Real-time execution

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


62 3.3 M+CPU-IAIPosiSp_JogInching-ST
Processing
• Before executing this FB, check that the G_CPRTCL instruction which is executed for the specified start I/O number exists
in the M+CPU-IAIPosiSp_CPRTCL-ST program. (Page 55 Checking the start I/O number, Page 101 M+CPU-
IAIPosiSp_CPRTCL-ST)
• Specify the axis number of the operation target in iw_Axis (target axis).
• The movement amount of inching operation is set to id_IncMovDist (inching amount of movement).
• The JOG operation speed is set to id_JogSpeed (JOG speed).
• This FB switches from PIO to Modbus communication at the rise of FB_EN (execution command) and writes id_JogSpeed
3
(JOG speed) and id_IncMovDist (inching amount of movement) to the parameter data of a controller.
• When the JOG or inching operation becomes ready to operate after writing parameter data and resetting software,
ob_ParamOK (parameter setting completion flag) is turned ON.
• ob_Busy (busy signal) is turned ON while an electric actuator is operating.
• The inching operation command is executed until the operation is completed by turning ON ib_JogOrInching (JOG/Inching
replacement) and at the rise of ib_FJog (JOG + command) or ib_RJog (JOG - command). When the operation is
completed, FB_OK (normal completion) is turned ON.
• For the inching operation, the operation decelerates to stop when turning ON the command which moves an electric
actuator in the reverse direction while the actuator is operating.
• The JOG operation command is executed while ib_JogOrInching (JOG/Inching replacement) is turned OFF and ib_FJog
(JOG + command) or ib_RJog (JOG - command) is turned ON. FB_OK (normal completion) is turned ON at the start of the
operation. When ib_FJog (JOG + command) or ib_RJog (JOG - command) is turned OFF, the operation decelerates to stop
and FB_OK (normal completion) is turned OFF.
• For the JOG operation, the operation decelerates to stop when turning ON both ib_FJog (JOG + command) and ib_RJog
(JOG - command). The ON operation is started by turning OFF either one of the commands.
• The operation decelerates to stop when ib_JogOrInching (JOG/Inching replacement) is changed during the operation of
ib_FJog (JOG + command) or ib_RJog (JOG - command).
• When a value out of the range is set for the start I/O number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '10' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target channel, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '11' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target axis, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '12' is stored in ERROR_ID (error code).
• When a value out of the range is set for the JOG speed, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '13' is stored in ERROR_ID (error code).
• When a value out of the range is set for the inching amount of movement, FB_ERROR (error completion) is turned ON and
the processing of the FB is interrupted. In addition, the error code '14' is stored in ERROR_ID (error code).
• When the connected device is not the operation target, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '20' is stored in ERROR_ID (error code).
• When turning OFF FB_EN (execution command) before ob_ParamOK (parameter setting completion flag) is turned ON,
FB_ERROR (error completion) is turned ON for one scan only. In addition, the error code '21' is stored in ERROR_ID (error
code) for one scan.
• When turning ON FB_EN (execution command) of this FB while executing any of the following FBs, FB_ERROR (error
completion) is turned ON. In addition, the error code '22' is stored in ERROR_ID (error code).
M+CPU-IAIPosiSp_StartHomePosi-ST, M+CPU-IAIPosiSp_JogInching-ST, M+CPU-IAIPosiSp_StartPosi-ST,
and M+CPU-IAIPosiSp_ServoControl-ST
• When an error occurs while sending/receiving a message to/from the predefined protocol, FB_ERROR (error completion) is
turned ON and the processing of the FB is interrupted. In addition, an error code is stored in ERROR_ID (error code). For
details on the error code, refer to Q Corresponding Serial Communication Module User's Manual (Basic) or
MELSEC-L Serial Communication Module User's Manual (Basic).
• When this FB receives an error code due to an error occurred in an electric actuator, ob_UnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in ow_UnitErrId (unit
error code).

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.3 M+CPU-IAIPosiSp_JogInching-ST 63
Timing chart of I/O signals
■ In normal completion
• From the rise of FB_EN (execution command) to parameter data static area write command
The program is executed once at the rise of FB_EN (execution command).

FB_EN

FB_ENO

Instruction command Not Instruction command communication from Inching amount of Parameter data static
communication performed M+CPU-IAIPosiSp_ServoControl-ST JOG speed write
movement write area write command

ob_ParamOK OFF

ob_Busy OFF

FB_OK OFF

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

• From extended device status read command to servo ON command


The program is executed once at the rise of FB_EN (execution command).

FB_EN

FB_ENO

Instruction command Extended device status read command Software reset


Instruction command communication from
communication M+CPU-IAIPosiSp_ServoControl-ST

ob_ParamOK

ob_Busy OFF

FB_OK OFF

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


64 3.3 M+CPU-IAIPosiSp_JogInching-ST
• From JOG/Inching replacement command to when FB_EN (execution command) is turned OFF (Example: JOG operation)
The following processing is executed repeatedly while FB_EN (execution command) is turned ON.

FB_EN

FB_ENO

Instruction command JOG/inching JOG+(-) Operation Controller status JOG+(-) Stop Controller status Not
communication replacement command (FF00H) signal read (0000H) signal read performed

ob_ParamOK 3
ob_Busy

FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

• For JOG operation (JOG + command)

FB_EN

FB_ENO

ib_JogOrInching

id_JogSpeed K10000

ib_FJog

ib_RJog OFF

Instruction command JOG/inching JOG+ Controller status JOG+ Controller status


communication replacement command (FF00H) signal read (0000H) signal read

ob_ParamOK

ob_Busy

FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.3 M+CPU-IAIPosiSp_JogInching-ST 65
• For JOG operation (JOG - command)

FB_EN

FB_ENO

ib_JogOrInching

ib_JogSpeed K10000

OFF
ib_FJog

ib_RJog

Instruction command JOG/inching JOG- Controller status signal JOG- Controller status signal
communication replacement command (FF00H) read (0000H) read

ob_ParamOK

ob_Busy

FB_OK

OFF
FB_ERROR

ERROR_ID 0

OFF
ob_UnitErr

ow_UnitErrId 0

• For JOG operation (when both JOG + command and JOG - command are turned ON simultaneously)

FB_EN

FB_ENO

ib_JogOrInching OFF

id_JogSpeed K10000

ib_FJog

ib_RJog

Instruction command JOG+ Controller status signal Stop command Controller status signal JOG+ Controller status signal
(FF00H) read (0000H) read (FF00H) read
communication

ob_ParamOK

ob_Busy

FB_OK

OFF
FB_ERROR

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


66 3.3 M+CPU-IAIPosiSp_JogInching-ST
• For inching operation (JOG + command)
When ib_FJog (JOG + command) is turned OFF before FB_OK (normal completion) is turned ON, FB_OK (normal
completion) is turned ON for one scan only.

FB_EN

FB_ENO

ib_JogOrInching

id_IncMovDist K10000
3
ib_FJog

ib_RJog OFF

Instruction command JOG/inching JOG+ JOG+ Controller status signal Controller status signal
communication replacement command (FF00H) (0000H) read read

ob_ParamOK

ob_Busy

FB_OK

FB_ERROR OFF

ERROR_ID 0

OFF
ob_UnitErr

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.3 M+CPU-IAIPosiSp_JogInching-ST 67
• For inching operation (JOG - command)
When ib_RJog (JOG - command) is turned OFF before FB_OK (normal completion) is turned ON, FB_OK (normal
completion) is turned ON for one scan only.

FB_EN

FB_ENO

ib_JogOrInching

id_IncMovDist K10000

OFF
ib_FJog

ib_RJog

Instruction command JOG/inching JOG- JOG- Controller status signal Controller status signal
communication replacement command (FF00H) (0000H) read read

ob_ParamOK

ob_Busy

FB_OK

FB_ERROR OFF

ERROR_ID 0

OFF
ob_UnitErr

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


68 3.3 M+CPU-IAIPosiSp_JogInching-ST
• For inching operation (when both JOG + command and JOG - command are turned ON simultaneously)

FB_EN

FB_ENO

ib_JogOrInching

id_IncMovDist K10000

ib_FJog
3
ib_RJog

Instruction command JOG+ JOG+ Controller status Controller status Stop command Controller status
communication (FF00H) (0000H) signal read signal read (0000H) signal read

ob_ParamOK

ob_Busy

FB_OK OFF

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

■ In error completion

FB_EN

FB_ENO

Instruction command
Not performed
communication

ob_Busy

FB_OK OFF

FB_ERROR

ERROR_ID 0 Error code 0

OFF
ob_UnitErr

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.3 M+CPU-IAIPosiSp_JogInching-ST 69
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
FB_EN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF FB_EN (execution command).
• This FB requires the configuration of the ladder for every input label.
• This FB writes to the non-volatile memory. For details, refer to the IAI Corporation manuals related to serial communication
(Modbus version).
• By turning ON FB_EN (execution command), this FB restarts the controller after turning OFF the servo. It takes 2000 ms to
restart.
• If the time from when a controller is restarted to when the controller is ready for communication takes more than 2100 ms,
this FB is completed with an error. In this case, set the time to the buffer memory (Un\G5520). The waiting time for this FB
is Un\G5520  100 ms. When the waiting time is set for less than 2100 ms, the time is automatically changed to 2100 ms.
• JOG speed and inching amount of movement cannot be changed while FB_EN (execution command) is turned ON. For
changing the JOG speed or inching amount of movement, execute the FB again.
• Execute a home position return after ob_ParamOK (parameter setting completion flag) is turned ON. Otherwise a critical
error may occur when an electric actuator exceeds the operation limit value.
• When the electric actuator stops at the operation limit value, an error will not occur in this FB.
• When turning ON ib_FJog (JOG + command) or ib_RJog (JOG - command) before ob_ParamOK (parameter setting
completion flag) is turned ON, JOG + (-) command is ignored. Turn ON the JOG + (-) command again.
• When turning OFF FB_EN (execution command) while an electric actuator is operating, the actuator continues to operate.
Prepare a program for the operation of the actuator separately in accordance with the required system operation.
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• Specify the start I/O number assigned to a serial communication module in iw_StartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, a stop error (2110H) occurs in the CPU module.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following intelligent function module data (parameters of a serial
communication module) to a module in GX Works2.
Item Setting value
Switch Setting Transmission Data Bit 8
Setting Parity Bit None
Stop bit 1
Communication rate setting Set the value according to the setting of an electric actuator controller to be used.
Communication protocol setting Predefined protocol
Various Control Echo back permit/prohibit specification 1: Prohibited
Specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning (Q/L) to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


70 3.3 M+CPU-IAIPosiSp_JogInching-ST
Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Macro type
• CPU module: Q04UDVCPU
• Serial communication module: QJ71C24N
• Controller: 
• Electric actuator: ERC3-SA5C-I-42P-12-50-SE-P-CN
• JOG speed: 10.00 mm/sec 3
• Inching amount of movement: 0.10 mm
Measuring range Time required for the Maximum scan time Number of scans required
processing*1 for the processing
From when FB_EN (execution command) is 2680.000 ms 0.915 ms 12475 scans
turned ON to when ob_ParamOK (parameter
setting completion flag) is turned ON
From when ib_FJog (JOG + command) or 21.000 ms 0.895 ms 65 scans
ib_RJog (JOG - command) is turned ON to
when JOG operation is started
From when ib_FJog (JOG + command) or 59.900 ms 0.847 ms 195 scans
ib_RJog (JOG - command) is turned ON to
when inching movement is completed

*1 The time required from start to end of the processing.

Error code
Error code Description Corrective action
(Decimal)
10 The value set for the start I/O number is out of the range. Set the start I/O number to which a serial communication module is
mounted and execute FB again.
11 The value set for the target channel is out of the range. Set 2 for the target channel and execute the FB again.
12 The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
13 The value set for the JOG speed is out of the range. Set a value within the range from 1 to 999999 for the JOG speed
and execute the FB again.
14 The value set for the inching amount of movement is out of the Set a value within the range from 1 to 999999 for the inching
range. amount of movement and execute the FB again.
20 An unsupported device is connected. Review and correct the connected device and execute the FB
again.
21 The execution command turned OFF during the processing. Do not turn OFF FB_EN (execution command) until ob_ParamOK
(parameter setting completion flag) is turned ON.
(This error code is output for one scan only.)
22 Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+CPU-IAIPosiSp_StartHomePosi-ST
• M+CPU-IAIPosiSp_JogInching-ST
• M+CPU-IAIPosiSp_StartPosi-ST
• M+CPU-IAIPosiSp_ServoControl-ST
23 Emergency stop or major failure is occurring. Check the status of a controller in M+CPU-IAIPosiSp_Monitoring-
ST.
After checking the status, remove the cause of the error and
execute the FB again.
24 The G_CPRTCL instruction which is executed for the specified start Add the G_CPRTCL instruction, which is executed for the specified
I/O number is not defined. start I/O number, to the M+CPU-IAIPosiSp_CPRTCL-ST program.
For details, refer to the following:
Page 55 Checking the start I/O number
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error Q Corresponding Serial Communication Module User's Manual
code (Basic)
MELSEC-L Serial Communication Module User's Manual
(Basic)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.3 M+CPU-IAIPosiSp_JogInching-ST 71
3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST

Advanced preparation is required for using this FB. For details, refer to the following:
Page 55 Importing M+CPU-IAIPosiSp_CPRTCL-ST
Page 55 Checking the start I/O number

Overview
Reads the data of the specified position table.

M+CPU-IAIPosiSp_ReadPosiTable-ST
(1) B : FB_EN FB_ENO : B (7)
(2) W : iw_StartIONo FB_OK : B (8)

(3) W : iw_Ch FB_ERROR : B (9)

(4) W : iw_Axis ERROR_ID : W (10)

(5) W : iw_TableNo ob_UnitErr : B (11)

(6) W : iw_TableStartPos ow_UnitErrId : W (12)

Labels

Input label
No. Label Name Data type Range Description
(1) FB_EN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) iw_StartIONo Start I/O No. Word [signed] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) iw_Ch Target channel Word [signed] 2 Specify the channel of a serial communication
module.
(4) iw_Axis Target axis Word [signed] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) iw_TableNo Position table No. Word [signed] 0 to 767 Specify the position table number from which the
setting value is read.
(6) iw_TableStartPos Position table Word [signed] 0 to FFFFH Specify the start number of D device, which stores
starting position position table values, in hexadecimal.
For details on the position table, refer to the
following:
Page 104 Position table

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


72 3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST
Output label
No. Label Name Data type Default value Description
(7) FB_ENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(8) FB_OK Normal completion Bit OFF The ON state indicates that reading position data
is completed.
(9) FB_ERROR Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(10) ERROR_ID Error code Word [signed] 0 The error code of an error occurred in the FB is
stored.
3
(11) ob_UnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(12) ow_UnitErrId Unit error code Word [signed] 0 The error code of an error occurred in the module
is stored.

FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
QJ71C24N*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
QJ71C24N-R4*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
LJ71C24*1  GX Works2 Version 1.570U or later

*1 Available only in CH2.

■ CPU module
• QCPU*1
• LCPU
*1 Universal model QCPUs and process CPUs only

Basic specifications
Item Description
Language ST
Number of basic steps 2075 steps
The number of steps of the FB which is embedded in a program varies depending on the CPU module being used, input/output
definitions, and option settings of GX Works2. For the option settings of GX Works2, refer to the GX Works2 Version 1 Operating
Manual (Common).
Number of points of a • Label: 0.04K points (Word), 0.01K points (Bit)
label used • Latch label: 0 point (Word), 0 point (Bit)
The number of points of a label used which is embedded in a program varies depending on the device specified for an argument and
option settings of GX Works2. For the option settings of GX Works2, refer to GX Works2 Version 1 Operating Manual (Common).
FB dependence M+CPU-IAIPosiSp_ReadPosiTable-ST
M+CPU-IAIPosiSp_CPRTCL-ST
FB compilation Macro type
method
FB operation Pulse execution (multiple scan execution type)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST 73
Processing
• Before executing this FB, check that the G_CPRTCL instruction which is executed for the specified start I/O number exists
in the M+CPU-IAIPosiSp_CPRTCL-ST program. (Page 55 Checking the start I/O number, Page 101 M+CPU-
IAIPosiSp_CPRTCL-ST)
• Specify the axis number of the operation target in iw_Axis (target axis).
• Specify the position table number to be read to iw_TableNo (position table No.).
• This FB switches from PIO to Modbus communication at the rise of FB_EN (execution command) and reads the setting
data of the specified position table number of a controller.
• FB_OK (normal completion) is turned ON when reading the position table is completed.
• When a value out of the range is set for the start I/O number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '10' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target channel, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '11' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target axis, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '12' is stored in ERROR_ID (error code).
• When a value out of the range is set for the position table number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '15' is stored in ERROR_ID (error code).
• When the connected device is not the operation target, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '20' is stored in ERROR_ID (error code).
• When turning OFF FB_EN (execution command) before FB_OK (normal completion), FB_ERROR (error completion), or
ob_UnitErr (unit error completion) is turned ON, FB_ERROR (error completion) is turned ON for one scan only. In addition,
the error code '21' is stored in ERROR_ID (error code) for one scan.
• When an error occurs while sending/receiving a message to/from the predefined protocol, FB_ERROR (error completion) is
turned ON and the processing of the FB is interrupted. In addition, an error code is stored in ERROR_ID (error code). For
details on the error code, refer to Q Corresponding Serial Communication Module User's Manual (Basic) or
MELSEC-L Serial Communication Module User's Manual (Basic).
• When this FB receives an error code due to an error occurred in an electric actuator, ob_UnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in ow_UnitErrId (unit
error code).

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


74 3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST
Timing chart of I/O signals
■ In normal completion

FB_EN

FB_ENO

Instruction command Not Not


communication performed PIO/Modbus switching Connected device read Position table data read performed
3
FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

Position table 0 Position table data

■ In error completion

FB_EN

FB_ENO

Instruction command
Not performed
communication

FB_OK OFF

FB_ERROR

ERROR_ID 0 Error code 0

ob_UnitErr OFF

ow_UnitErrId 0

Position table 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST 75
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
FB_EN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF FB_EN (execution command).
• This FB requires the configuration of the ladder for every input label.
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• Specify the start I/O number assigned to a serial communication module in iw_StartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, a stop error (2110H) occurs in the CPU module.
• This FB uses the index register (Z9 and Z8). Do not use the Z9 and Z8 in an interrupt program.
• Before operating an electric actuator, write the following intelligent function module data (parameters of a serial
communication module) to a module in GX Works2.
Item Setting value
Switch Setting Transmission Data Bit 8
Setting
Parity Bit None
Stop bit 1
Communication rate setting Set the value according to the setting of an electric actuator controller to be used.
Communication protocol setting Predefined protocol
Various Control Echo back permit/prohibit specification 1: Prohibited
Specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning (Q/L) to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Macro type
• CPU module: Q04UDVCPU
• Serial communication module: QJ71C24N
• Controller: 
• Electric actuator: ERC3-SA5C-I-42P-12-50-SE-P-CN
Time required for the Maximum scan time Number of scans required for
processing*1 the processing
65.000 ms 0.815 ms 247 scans

*1 The time required from start to end of the processing.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


76 3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST
Error code
Error code Description Corrective action
(Decimal)
10 The value set for the start I/O number is out of the range. Set the start I/O number to which a serial communication module is
mounted and execute FB again.
11 The value set for the target channel is out of the range. Set 2 for the target channel and execute the FB again.
12 The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
15 The position table number is out of the range. Set a value within the range from 0 to 767 for the position table 3
number and execute the FB again.
20 An unsupported device is connected. Review and correct the connected device and execute the FB
again.
21 The execution command turned OFF during the processing. Do not turn OFF FB_EN (execution command) until FB_OK (normal
completion), FB_ERROR (error completion), or ob_UnitErr (unit
error completion) is turned ON.
(This error code is output for one scan only.)
24 The G_CPRTCL instruction which is executed for the specified start Add the G_CPRTCL instruction, which is executed for the specified
I/O number is not defined. start I/O number, to the M+CPU-IAIPosiSp_CPRTCL-ST program.
For details, refer to the following:
Page 55 Checking the start I/O number
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error Q Corresponding Serial Communication Module User's Manual
code (Basic)
MELSEC-L Serial Communication Module User's Manual
(Basic)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.4 M+CPU-IAIPosiSp_ReadPosiTable-ST 77
3.5 M+CPU-IAIPosiSp_TeachingPosi-ST

Advanced preparation is required for using this FB. For details, refer to the following:
Page 55 Importing M+CPU-IAIPosiSp_CPRTCL-ST
Page 55 Checking the start I/O number

Overview
Sets the designated position to the specified position table (target position).

M+CPU-IAIPosiSp_TeachingPosi-ST
(1) B : FB_EN FB_ENO : B (7)

(2) W : iw_StartIONo FB_OK : B (8)

(3) W : iw_Ch FB_ERROR : B (9)

(4) W : iw_Axis ERROR_ID : W (10)

(5) W : iw_TableNo ob_UnitErr : B (11)

(6) D : id_PositionData ow_UnitErrId : W (12)

Labels

Input label
No. Label Name Data type Range Description
(1) FB_EN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) iw_StartIONo Start I/O No. Word [signed] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) iw_Ch Target channel Word [signed] 2 Specify the channel of a serial communication
module.
(4) iw_Axis Target axis Word [signed] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) iw_TableNo Position table No. Word [signed] 0 to 767 Specify the position table number to which the
setting value is written.
(6) id_PositionData Position data Double Word -999999 to 999999 Specify the target position data to be set.
[signed]

Output label
No. Label Name Data type Default value Description
(7) FB_ENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(8) FB_OK Normal completion Bit OFF The ON state indicates that the position data
setting is completed.
(9) FB_ERROR Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(10) ERROR_ID Error code Word [signed] 0 The error code of an error occurred in the FB is
stored.
(11) ob_UnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(12) ow_UnitErrId Unit error code Word [signed] 0 The error code of an error occurred in the module
is stored.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


78 3.5 M+CPU-IAIPosiSp_TeachingPosi-ST
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
*1
QJ71C24N The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
QJ71C24N-R4*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later 3
higher.
LJ71C24*1  GX Works2 Version 1.570U or later

*1 Available only in CH2.

■ CPU module
• QCPU*1
• LCPU
*1 Universal model QCPUs and process CPUs only

Basic specifications
Item Description
Language ST
Number of basic steps 2017 steps
The number of steps of the FB which is embedded in a program varies depending on the CPU module being used, input/output
definitions, and option settings of GX Works2. For the option settings of GX Works2, refer to the GX Works2 Version 1 Operating
Manual (Common).
Number of points of a • Label: 0.04K points (Word), 0.01K points (Bit)
label used • Latch label: 0 point (Word), 0 point (Bit)
The number of points of a label used which is embedded in a program varies depending on the device specified for an argument and
option settings of GX Works2. For the option settings of GX Works2, refer to GX Works2 Version 1 Operating Manual (Common).
FB dependence M+CPU-IAIPosiSp_TeachingPosi-ST
M+CPU-IAIPosiSp_CPRTCL-ST
FB compilation Macro type
method
FB operation Pulse execution (multiple scan execution type)

Processing
• Before executing this FB, check that the G_CPRTCL instruction which is executed for the specified start I/O number exists
in the M+CPU-IAIPosiSp_CPRTCL-ST program. (Page 55 Checking the start I/O number, Page 101 M+CPU-
IAIPosiSp_CPRTCL-ST)
• Specify the axis number of the operation target in iw_Axis (target axis).
• Specify the position table number to be set for iw_TableNo (position table No.).
• This FB switches from PIO to Modbus communication at the rise of FB_EN (execution command) and sets id_PositionData
(position data) to the target position of the specified position table number of a controller. For details on the position table,
refer to the IAI Corporation manuals related to serial communication (Modbus version).
• FB_OK (normal completion) is turned ON when the position table setting is completed.
• When a value out of the range is set for the start I/O number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '10' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target channel, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '11' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target axis, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '12' is stored in ERROR_ID (error code).
• When a value out of the range is set for the position table number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '15' is stored in ERROR_ID (error code).
• When a value out of the range is set for the position data, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '16' is stored in ERROR_ID (error code).

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.5 M+CPU-IAIPosiSp_TeachingPosi-ST 79
• When the connected device is not the operation target, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '20' is stored in ERROR_ID (error code).
• When turning OFF FB_EN (execution command) before FB_OK (normal completion), FB_ERROR (error completion), or
ob_UnitErr (unit error completion) is turned ON, FB_ERROR (error completion) is turned ON for one scan only. In addition,
the error code '21' is stored in ERROR_ID (error code) for one scan.
• When turning ON FB_EN (execution command) of this FB while executing the following FB, FB_ERROR (error completion)
is turned ON. In addition, the error code '22' is stored in ERROR_ID (error code).
M+CPU-IAIPosiSp_StartPosi-ST
• When an error occurs while sending/receiving a message to/from the predefined protocol, FB_ERROR (error completion) is
turned ON and the processing of the FB is interrupted. In addition, an error code is stored in ERROR_ID (error code). For
details on the error code, refer to Q Corresponding Serial Communication Module User's Manual (Basic) or
MELSEC-L Serial Communication Module User's Manual (Basic).
• When this FB receives an error code due to an error occurred in an electric actuator, ob_UnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in ow_UnitErrId (unit
error code).

Timing chart of I/O signals


■ In normal completion

FB_EN

FB_ENO

Instruction command Not Not


PIO/Modbus switching Connected device read Position table data write
communication performed performed

FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

■ In error completion

FB_EN

FB_ENO

Instruction command
Not performed
communication

FB_OK OFF

FB_ERROR

ERROR_ID
0 Error code 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


80 3.5 M+CPU-IAIPosiSp_TeachingPosi-ST
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
FB_EN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF FB_EN (execution command).
• This FB requires the configuration of the ladder for every input label.
3
• This FB writes to the non-volatile memory. For details, refer to the IAI Corporation manuals related to serial communication
(Modbus version).
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• Specify the start I/O number assigned to a serial communication module in iw_StartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, a stop error (2110H) occurs in the CPU module.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following intelligent function module data (parameters of a serial
communication module) to a module in GX Works2.
Item Setting value
Switch Setting Transmission Data Bit 8
Setting
Parity Bit None
Stop bit 1
Communication rate setting Set the value according to the setting of an electric actuator controller to be used.
Communication protocol setting Predefined protocol
Various Control Echo back permit/prohibit specification 1: Prohibited
Specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning (Q/L) to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Macro type
• CPU module: Q04UDVCPU
• Serial communication module: QJ71C24N
• Controller: 
• Electric actuator: ERC3-SA5C-I-42P-12-50-SE-P-CN
Time required for the Maximum scan time Number of scans required for
processing*1 the processing
63.000 ms 0.815 ms 243 scans

*1 The time required from start to end of the processing.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.5 M+CPU-IAIPosiSp_TeachingPosi-ST 81
Error code
Error code Description Corrective action
(Decimal)
10 The value set for the start I/O number is out of the range. Set the start I/O number to which a serial communication module is
mounted and execute FB again.
11 The value set for the target channel is out of the range. Set 2 for the target channel and execute the FB again.
12 The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
15 The position table number is out of the range. Set a value within the range from 0 to 767 for the position table
number and execute the FB again.
16 The position data is out of the range. Set a value within the range from -999999 to 999999 for the position
data and execute the FB again.
20 An unsupported device is connected. Review and correct the connected device and execute the FB
again.
21 The execution command turned OFF during the processing. Do not turn OFF FB_EN (execution command) until FB_OK (normal
completion), FB_ERROR (error completion), or ob_UnitErr (unit
error completion) is turned ON.
(This error code is output for one scan only.)
22 Other FB which may affect the operation of an electric actuator is After stopping M+CPU-IAIPosiSp_StartPosi-ST, execute the FB
executing. again.
24 The G_CPRTCL instruction which is executed for the specified start Add the G_CPRTCL instruction, which is executed for the specified
I/O number is not defined. start I/O number, to the M+CPU-IAIPosiSp_CPRTCL-ST program.
For details, refer to the following:
Page 55 Checking the start I/O number
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error Q Corresponding Serial Communication Module User's Manual
code (Basic)
MELSEC-L Serial Communication Module User's Manual
(Basic)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


82 3.5 M+CPU-IAIPosiSp_TeachingPosi-ST
3.6 M+CPU-IAIPosiSp_StartPosi-ST

Advanced preparation is required for using this FB. For details, refer to the following:
Page 55 Importing M+CPU-IAIPosiSp_CPRTCL-ST
Page 55 Checking the start I/O number

Overview 3
Executes positioning operation based on the specified position table data.

M+CPU-IAIPosiSp_StartPosi-ST
(1) B : FB_EN FB_ENO : B (6)

(2) W : iw_StartIONo FB_OK : B (7)

(3) W : iw_Ch FB_ERROR : B (8)

(4) W : iw_Axis ERROR_ID : W (9)

(5) W : iw_TableNo ob_UnitErr : B (10)

ow_UnitErrId : W (11)

Labels

Input label
No. Label Name Data type Range Description
(1) FB_EN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) iw_StartIONo Start I/O No. Word [signed] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) iw_Ch Target channel Word [signed] 2 Specify the channel of a serial communication
module.
(4) iw_Axis Target axis Word [signed] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) iw_TableNo Position table No. Word [signed] 0 to 767 Specify the position table number whose
positioning operation is executed.

Output label
No. Label Name Data type Default value Description
(6) FB_ENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(7) FB_OK Normal completion Bit OFF The ON state indicates that positioning operation
is completed.
(8) FB_ERROR Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(9) ERROR_ID Error code Word [signed] 0 The error code of an error occurred in the FB is
stored.
(10) ob_UnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(11) ow_UnitErrId Unit error code Word [signed] 0 The error code of an error occurred in the module
is stored.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.6 M+CPU-IAIPosiSp_StartPosi-ST 83
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
*1
QJ71C24N The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
QJ71C24N-R4*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
LJ71C24*1  GX Works2 Version 1.570U or later

*1 Available only in CH2.

■ CPU module
• QCPU*1
• LCPU
*1 Universal model QCPUs and process CPUs only

Basic specifications
Item Description
Language ST
Number of basic steps 4483 steps
The number of steps of the FB which is embedded in a program varies depending on the CPU module being used, input/output
definitions, and option settings of GX Works2. For the option settings of GX Works2, refer to the GX Works2 Version 1 Operating
Manual (Common).
Number of points of a • Label: 0.08K points (Word), 0.04K points (Bit)
label used • Latch label: 0 point (Word), 0 point (Bit)
The number of points of a label used which is embedded in a program varies depending on the device specified for an argument and
option settings of GX Works2. For the option settings of GX Works2, refer to GX Works2 Version 1 Operating Manual (Common).
FB dependence M+CPU-IAIPosiSp_StartPosi-ST
M+CPU-IAIPosiSp_ServoControl-ST
M+CPU-IAIPosiSp_CPRTCL-ST
FB compilation Macro type
method
FB operation Pulse execution (multiple scan execution type)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


84 3.6 M+CPU-IAIPosiSp_StartPosi-ST
Processing
• Before executing this FB, check that the G_CPRTCL instruction which is executed for the specified start I/O number exists
in the M+CPU-IAIPosiSp_CPRTCL-ST program. (Page 55 Checking the start I/O number, Page 101 M+CPU-
IAIPosiSp_CPRTCL-ST)
• Specify the axis number of the operation target in iw_Axis (target axis).
• Set the position table number to be executed in iw_TableNo (position table No.).
• This FB switches from PIO to Modbus communication at the rise of FB_EN (execution command) and starts positioning
operation.
3
• FB_OK (normal completion) is turned ON when positioning operation is completed.
• When a value out of the range is set for the start I/O number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '10' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target channel, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '11' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target axis, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '12' is stored in ERROR_ID (error code).
• When a value out of the range is set for the position table number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '15' is stored in ERROR_ID (error code).
• When the connected device is not the operation target, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '20' is stored in ERROR_ID (error code).
• When turning OFF FB_EN (execution command) before FB_OK (normal completion), FB_ERROR (error completion), or
ob_UnitErr (unit error completion) is turned ON, FB_ERROR (error completion) is turned ON for one scan only. In addition,
the error code '21' is stored in ERROR_ID (error code) for one scan.
• When turning ON FB_EN (execution command) of this FB while executing any of the following FBs, FB_ERROR (error
completion) is turned ON. In addition, the error code '22' is stored in ERROR_ID (error code).
M+CPU-IAIPosiSp_StartHomePosi-ST, M+CPU-IAIPosiSp_JogInching-ST, M+CPU-IAIPosiSp_TeachingPosi-ST,
M+CPU-IAIPosiSp_StartPosi-ST, and M+CPU-IAIPosiSp_ServoControl-ST
• When an error occurs while sending/receiving a message to/from the predefined protocol, FB_ERROR (error completion) is
turned ON and the processing of the FB is interrupted. In addition, an error code is stored in ERROR_ID (error code). For
details on the error code, refer to Q Corresponding Serial Communication Module User's Manual (Basic) or
MELSEC-L Serial Communication Module User's Manual (Basic).
• When this FB receives an error code due to an error occurred in an electric actuator, ob_UnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in ow_UnitErrId (unit
error code).

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.6 M+CPU-IAIPosiSp_StartPosi-ST 85
Timing chart of I/O signals
■ In normal completion

FB_EN

FB_ENO

iw_TableNo
K1

Instruction command Not Instruction command communication from K1 operation Not


Controller status signal read
communication performed M+CPU-IAIPosiSp_ServoControl-ST command performed

FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

■ In error completion

FB_EN

FB_ENO

Instruction command
Not performed
communication

FB_OK OFF

FB_ERROR

ERROR_ID 0 Error code 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


86 3.6 M+CPU-IAIPosiSp_StartPosi-ST
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
FB_EN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF FB_EN (execution command).
• This FB requires the configuration of the ladder for every input label.
3
• After positioning operation is started by using this FB, when turning OFF FB_EN (execution command) before FB_OK
(normal completion), FB_ERROR (error completion), or ob_UnitErr (unit error completion) is turned ON, an electric actuator
continues to operate until a home position return is completed.
• After turning ON the power, when this FB is operated without executing a home position return, positioning operation is
performed automatically after executing the home position return.
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• Specify the start I/O number assigned to a serial communication module in iw_StartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, a stop error (2110H) occurs in the CPU module.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• Before operating an electric actuator, write the following intelligent function module data (parameters of a serial
communication module) to a module in GX Works2.
Item Setting value
Switch Setting Transmission Data Bit 8
Setting
Parity Bit None
Stop bit 1
Communication rate setting Set the value according to the setting of an electric actuator controller to be used.
Communication protocol setting Predefined protocol
Various Control Echo back permit/prohibit specification 1: Prohibited
Specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning (Q/L) to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.6 M+CPU-IAIPosiSp_StartPosi-ST 87
Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Macro type
• CPU module: Q04UDVCPU
• Serial communication module: QJ71C24N
• Controller: 
• Electric actuator: ERC3-SA5C-I-42P-12-50-SE-P-CN
• Electric actuator initial position: Home position (0.00 mm)
• Position table execution setting:
Target position: 10.00 mm
Positioning width: 0.1 mm
Speed: 25.00 mm/sec
Acceleration: 0.3 G
Deceleration: 0.3 G
Other setting value: 0
Timing for turning execution Time required for Maximum scan time Number of scans
command ON the processing*1 required for the
processing
Immediately after power supply ON 2590.000 ms 0.915 ms 8949 scans
After executing home position return 628.000 ms 0.800 ms 1851 scans

*1 The time required from start to end of the processing.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


88 3.6 M+CPU-IAIPosiSp_StartPosi-ST
Error code
Error code Description Corrective action
(Decimal)
10 The value set for the start I/O number is out of the range. Set the start I/O number to which a serial communication module is
mounted and execute FB again.
11 The value set for the target channel is out of the range. Set 2 for the target channel and execute the FB again.
12 The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
15 The position table number is out of the range. Set a value within the range from 0 to 767 for the position table 3
number and execute the FB again.
20 An unsupported device is connected. Review and correct the connected device and execute the FB
again.
21 The execution command turned OFF during the processing. Do not turn OFF FB_EN (execution command) until FB_OK (normal
completion), FB_ERROR (error completion), or ob_UnitErr (unit
error completion) is turned ON.
(This error code is output for one scan only.)
22 Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+CPU-IAIPosiSp_StartHomePosi-ST
• M+CPU-IAIPosiSp_JogInching-ST
• M+CPU-IAIPosiSp_TeachingPosi-ST
• M+CPU-IAIPosiSp_StartPosi-ST
• M+CPU-IAIPosiSp_ServoControl-ST
For M+CPU-IAIPosiSp_JogInching-ST, check that ob_ParamOK
(parameter setting completion flag) is turned ON and ob_Busy
(busy signal) is turned OFF.
23 Emergency stop or major failure is occurring. Check the status of a controller in M+CPU-IAIPosiSp_Monitoring-
ST.
After checking the status, remove the cause of the error and
execute the FB again.
24 The G_CPRTCL instruction which is executed for the specified start Add the G_CPRTCL instruction, which is executed for the specified
I/O number is not defined. start I/O number, to the M+CPU-IAIPosiSp_CPRTCL-ST program.
For details, refer to the following:
Page 55 Checking the start I/O number
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error Q Corresponding Serial Communication Module User's Manual
code (Basic)
MELSEC-L Serial Communication Module User's Manual
(Basic)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.6 M+CPU-IAIPosiSp_StartPosi-ST 89
3.7 M+CPU-IAIPosiSp_Monitoring-ST

Advanced preparation is required for using this FB. For details, refer to the following:
Page 55 Importing M+CPU-IAIPosiSp_CPRTCL-ST
Page 55 Checking the start I/O number

Overview
Monitors a current position and alarms, and reset the alarms.

M+CPU-IAIPosiSp_Monitoring-ST
(1) B : FB_EN FB_ENO : B (7)
(2) W : iw_StartIONo FB_OK : B (8)
(3) W : iw_Ch FB_ERROR : B (9)

(4) W : iw_Axis ERROR_ID : W (10)


(5) B : ib_AlmReset ob_UnitErr : B (11)
(6) W : iw_TableStartPos ow_UnitErrId : W (12)
ob_MonitorOK : B (13)

Labels

Input label
No. Label Name Data type Range Description
(1) FB_EN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) iw_StartIONo Start I/O No. Word [signed] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) iw_Ch Target channel Word [signed] 2 Specify the channel of a serial communication
module.
(4) iw_Axis Target axis Word [signed] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) ib_AlmReset Reset alarm Bit ON, OFF ON: An alarm is reset
OFF: An alarm does not operate
(6) iw_TableStartPos Monitoring table Word [signed] 0 to FFFFH Specify the start number of D device, which stores
starting position monitoring table values, in hexadecimal.
For details on the monitoring table, refer to the
following:
Page 105 Monitoring table

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


90 3.7 M+CPU-IAIPosiSp_Monitoring-ST
Output label
No. Label Name Data type Default value Description
(7) FB_ENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(8) FB_OK Normal completion Bit OFF The ON state indicates that an alarm is cleared
normally.
(9) FB_ERROR Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(10) ERROR_ID Error code Word [signed] 0 The error code of an error occurred in the FB is
stored.
3
(11) ob_UnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(12) ow_UnitErrId Unit error code Word [signed] 0 The error code of an error occurred in the module
is stored.
(13) ob_MonitorOK Monitoring status Bit OFF The ON state indicates that a current position and
alarms are monitored normally.

FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
QJ71C24N*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
QJ71C24N-R4*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
LJ71C24*1  GX Works2 Version 1.570U or later

*1 Available only in CH2.

■ CPU module
• QCPU*1
• LCPU
*1 Universal model QCPUs and process CPUs only

Basic specifications
Item Description
Language ST
Number of basic steps 2511 steps
The number of steps of the FB which is embedded in a program varies depending on the CPU module being used, input/output
definitions, and option settings of GX Works2. For the option settings of GX Works2, refer to the GX Works2 Version 1 Operating
Manual (Common).
Number of points of a • Label: 0.03K points (Word), 0.02K points (Bit)
label used • Latch label: 0 point (Word), 0 point (Bit)
The number of points of a label used which is embedded in a program varies depending on the device specified for an argument and
option settings of GX Works2. For the option settings of GX Works2, refer to GX Works2 Version 1 Operating Manual (Common).
FB dependence M+CPU-IAIPosiSp_Monitoring-ST
M+CPU-IAIPosiSp_CPRTCL-ST
FB compilation Macro type
method
FB operation Real-time execution

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.7 M+CPU-IAIPosiSp_Monitoring-ST 91
Processing
• Before executing this FB, check that the G_CPRTCL instruction which is executed for the specified start I/O number exists
in the M+CPU-IAIPosiSp_CPRTCL-ST program. (Page 55 Checking the start I/O number, Page 101 M+CPU-
IAIPosiSp_CPRTCL-ST)
• Specify the axis number of the operation target in iw_Axis (target axis).
• This FB switches from PIO to Modbus communication at the rise of FB_EN (execution command) and starts monitoring for
a controller target axis. The monitoring data (such as a current position and alarm codes) is stored in a device after the D
device specified in iw_TableStartPos (monitoring table starting position). For details on the monitoring table, refer to
Page 105 Monitoring table.
• ob_MonitorOK (monitoring status) is turned ON while monitoring the target axis.
• The alarm is reset by turning ON FB_EN (execution command), and then turning ON ib_AlmReset (reset alarm) while the
alarm is occurring.
• FB_OK (normal completion) is turned ON when the alarm reset is completed.
• When a value out of the range is set for the start I/O number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '10' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target channel, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '11' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target axis, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '12' is stored in ERROR_ID (error code).
• When the connected device is not the operation target, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '20' is stored in ERROR_ID (error code).
• When turning OFF FB_EN (execution command) before monitoring is started, FB_ERROR (error completion) is turned ON
for one scan only. In addition, the error code '21' is stored in ERROR_ID (error code) for one scan.
• When an error occurs while sending/receiving a message to/from the predefined protocol, FB_ERROR (error completion) is
turned ON and the processing of the FB is interrupted. In addition, an error code is stored in ERROR_ID (error code). For
details on the error code, refer to Q Corresponding Serial Communication Module User's Manual (Basic) or
MELSEC-L Serial Communication Module User's Manual (Basic).
• When this FB receives an error code due to an error occurred in an electric actuator, ob_UnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in ow_UnitErrId (unit
error code).

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


92 3.7 M+CPU-IAIPosiSp_Monitoring-ST
Timing chart of I/O signals
■ In normal completion

FB_EN

FB_ENO

ib_AlmReset
3
Instruction command Not PIO/Modbus Connected Various monitor Various monitor
Alarm reset Various monitor Various monitor Not
communication performed switching device read information read information read information read information read performed

ob_MonitorOK

FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

Monitor table Various monitor Various monitor information Various monitor information
0 information (alarm occurring)

■ In error completion

FB_EN

FB_ENO

Instruction command
Not performed
communication

FB_OK OFF

FB_ERROR

ERROR_ID
0 Error code 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.7 M+CPU-IAIPosiSp_Monitoring-ST 93
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
FB_EN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF FB_EN (execution command).
• This FB requires the configuration of the ladder for every input label.
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• Specify the start I/O number assigned to a serial communication module in iw_StartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, a stop error (2110H) occurs in the CPU module.
• This FB uses the index register (Z9 and Z8). Do not use the Z9 and Z8 in an interrupt program.
• Before operating an electric actuator, write the following intelligent function module data (parameters of a serial
communication module) to a module in GX Works2.
Item Setting value
Switch Setting Transmission Data Bit 8
Setting
Parity Bit None
Stop bit 1
Communication rate setting Set the value according to the setting of an electric actuator controller to be used.
Communication protocol setting Predefined protocol
Various Control Echo back permit/prohibit specification 1: Prohibited
Specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning (Q/L) to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Macro type
• CPU module: Q04UDVCPU
• Serial communication module: QJ71C24N
• Controller: 
• Electric actuator: ERC3-SA5C-I-42P-12-50-SE-P-CN
Measuring range Time required for Maximum scan time Number of scans
the processing*1 required for the
processing
From when FB_EN (execution command) is turned ON to when 91.700 ms 0.700 ms 330 scans
ob_MonitorOK (monitoring status) is turned ON
From when ib_AlmReset (reset alarm) is turned ON to when an 73.800 ms 0.785 ms 169 scans
alarm reset is completed

*1 The time required from start to end of the processing.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


94 3.7 M+CPU-IAIPosiSp_Monitoring-ST
Error code
Error code Description Corrective action
(Decimal)
10 The value set for the start I/O number is out of the range. Set the start I/O number to which a serial communication module is
mounted and execute FB again.
11 The value set for the target channel is out of the range. Set 2 for the target channel and execute the FB again.
12 The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
20 An unsupported device is connected. Review and correct the connected device and execute the FB 3
again.
21 The execution command turned OFF during the processing. Do not turn OFF FB_EN (execution command) until monitoring
starts.
(This error code is output for one scan only.)
24 The G_CPRTCL instruction which is executed for the specified start Add the G_CPRTCL instruction, which is executed for the specified
I/O number is not defined. start I/O number, to the M+CPU-IAIPosiSp_CPRTCL-ST program.
For details, refer to the following:
Page 55 Checking the start I/O number
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error Q Corresponding Serial Communication Module User's Manual
code (Basic)
MELSEC-L Serial Communication Module User's Manual
(Basic)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.7 M+CPU-IAIPosiSp_Monitoring-ST 95
3.8 M+CPU-IAIPosiSp_ServoControl-ST

Advanced preparation is required for using this FB. For details, refer to the following:
Page 55 Importing M+CPU-IAIPosiSp_CPRTCL-ST
Page 55 Checking the start I/O number

Overview
Requests a servo to turn ON or OFF.

M+CPU-IAIPosiSp_ServoControl-ST
(1) B : FB_EN FB_ENO : B (7)

(2) W : iw_StartIONo FB_OK : B (8)

(3) W : iw_Ch FB_ERROR : B (9)

(4) W : iw_Axis ERROR_ID : W (10)

(5) B : ib_Servo ob_UnitErr : B (11)

(6) B : ib_Press ow_UnitErrId : W (12)

Labels

Input label
No. Label Name Data type Range Description
(1) FB_EN Execution command Bit ON, OFF ON: The FB is activated.
OFF: The FB is not activated.
(2) iw_StartIONo Start I/O No. Word [signed] 00H to FEH Specify the value obtained by dividing the start I/O
number to which a target serial communication
module is mounted by 16.
(3) iw_Ch Target channel Word [signed] 2 Specify the channel of a serial communication
module.
(4) iw_Axis Target axis Word [signed] 1 to 16 Specify the value obtained by incrementing the
axis number set in a controller by one.
(5) ib_Servo Servo ON/OFF Bit ON, OFF ON: Servo ON
replacement OFF: Servo OFF
(6) ib_Press Servo press ON/ Bit ON, OFF ON: Servo press ON
OFF replacement OFF: Servo press OFF

Output label
No. Label Name Data type Default value Description
(7) FB_ENO Execution status Bit OFF ON: The execution command is ON.
OFF: The execution command is OFF.
(8) FB_OK Normal completion Bit OFF The ON state indicates that the execution of servo
ON or OFF command (servo press ON or OFF
command) is completed.
(9) FB_ERROR Error completion Bit OFF The ON state indicates that an error has occurred
in the FB.
(10) ERROR_ID Error code Word [signed] 0 The error code of an error occurred in the FB is
stored.
(11) ob_UnitErr Unit error completion Bit OFF The ON state indicates that an error has occurred
in the module.
(12) ow_UnitErrId Unit error code Word [signed] 0 The error code of an error occurred in the module
is stored.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


96 3.8 M+CPU-IAIPosiSp_ServoControl-ST
FB details

Available device
■ Serial communication module
Target module Firmware version Engineering tool
*1
QJ71C24N The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later
higher.
QJ71C24N-R4*1 The first five digits of the serial number are '11062' or GX Works2 Version 1.570U or later 3
higher.
LJ71C24*1  GX Works2 Version 1.570U or later

*1 Available only in CH2.

■ CPU module
• QCPU*1
• LCPU
*1 Universal model QCPUs and process CPUs only

Basic specifications
Item Description
Language ST
Number of basic steps 2264 steps
The number of steps of the FB which is embedded in a program varies depending on the CPU module being used, input/output
definitions, and option settings of GX Works2. For the option settings of GX Works2, refer to the GX Works2 Version 1 Operating
Manual (Common).
Number of points of a • Label: 0.03K points (Word), 0.02K points (Bit)
label used • Latch label: 0 point (Word), 0 point (Bit)
The number of points of a label used which is embedded in a program varies depending on the device specified for an argument and
option settings of GX Works2. For the option settings of GX Works2, refer to GX Works2 Version 1 Operating Manual (Common).
FB dependence M+CPU-IAIPosiSp_ServoControl-ST
M+CPU-IAIPosiSp_CPRTCL-ST
FB compilation Macro type
method
FB operation Pulse execution (multiple scan execution type)

Processing
• Before executing this FB, check that the G_CPRTCL instruction which is executed for the specified start I/O number exists
in the M+CPU-IAIPosiSp_CPRTCL-ST program. (Page 55 Checking the start I/O number, Page 101 M+CPU-
IAIPosiSp_CPRTCL-ST)
• Specify the axis number of the operation target in iw_Axis (target axis).
• This FB switches from PIO to Modbus communication at the rise of FB_EN (execution command). The FB requests a servo
to turn ON when ib_Servo (servo ON/OFF replacement) is turned ON, and requests to turn OFF when ib_Press is turned
OFF. In addition, the FB requests a servo press to turn ON when ib_Press (servo press ON/OFF replacement) is turned
ON, and requests to turn OFF when ib_Press is turned OFF. Note whether the servo turns ON or OFF is not checked with
this FB. Check the servo status using M+CPU-IAIPosiSp_Monitoring-ST. (Page 90 M+CPU-IAIPosiSp_Monitoring-ST)
• At the completion of the servo ON/OFF command execution, FB_OK (normal completion) is turned ON.
• When a value out of the range is set for the start I/O number, FB_ERROR (error completion) is turned ON and the
processing of the FB is interrupted. In addition, the error code '10' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target channel, FB_ERROR (error completion) is turned ON and the processing
of the FB is interrupted. In addition, the error code '11' is stored in ERROR_ID (error code).
• When a value out of the range is set for the target axis, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '12' is stored in ERROR_ID (error code).
• When the connected device is not the operation target, FB_ERROR (error completion) is turned ON and the processing of
the FB is interrupted. In addition, the error code '20' is stored in ERROR_ID (error code).
• When turning OFF FB_EN (execution command) before FB_OK (normal completion), FB_ERROR (error completion), or

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.8 M+CPU-IAIPosiSp_ServoControl-ST 97
ob_UnitErr (unit error completion) is turned ON, FB_ERROR (error completion) is turned ON for one scan only. In addition,
the error code '21' is stored in ERROR_ID (error code) for one scan.
• When turning ON FB_EN (execution command) of this FB while executing any of the following FBs, FB_ERROR (error
completion) is turned ON. In addition, the error code '22' is stored in ERROR_ID (error code).
M+CPU-IAIPosiSp_StartHomePosi-ST, M+CPU-IAIPosiSp_JogInching-ST, M+CPU-IAIPosiSp_StartPosi-ST,
and M+CPU-IAIPosiSp_ServoControl-ST
• When an error occurs while sending/receiving a message to/from the predefined protocol, FB_ERROR (error completion) is
turned ON and the processing of the FB is interrupted. In addition, an error code is stored in ERROR_ID (error code). For
details on the error code, refer to Q Corresponding Serial Communication Module User's Manual (Basic) or
MELSEC-L Serial Communication Module User's Manual (Basic).
• When this FB receives an error code due to an error occurred in an electric actuator, ob_UnitErr (unit error completion) is
turned ON and the processing of the FB is interrupted. In addition, the received error code is stored in ow_UnitErrId (unit
error code).

Timing chart of I/O signals


■ In normal completion

FB_EN

FB_ENO

Instruction command Not Not


performed PIO/Modbus switching Connected device read Servo ON/OFF command performed
communication

FB_OK

FB_ERROR OFF

ERROR_ID 0

ob_UnitErr OFF

ow_UnitErrId 0

■ In error completion

FB_EN

FB_ENO

Instruction command
Not performed
communication

FB_OK OFF

FB_ERROR

ERROR_ID
0 Error code 0

ob_UnitErr OFF

ow_UnitErrId 0

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


98 3.8 M+CPU-IAIPosiSp_ServoControl-ST
Restrictions or precautions
• This FB does not include error recovery processing. Program the error recovery processing separately in accordance with
the required system operation.
• This FB cannot be used in an interrupt program.
• Do not use this FB in programs that are executed only once, such as a subroutine program or FOR-NEXT loop, because
FB_EN (execution command) cannot be turned OFF and the normal operation cannot be performed. Always use this FB in
programs that can turn OFF FB_EN (execution command).
• This FB requires the configuration of the ladder for every input label.
3
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• Specify the start I/O number assigned to a serial communication module in iw_StartIONo (start I/O No.). If the start I/O
number which is not assigned to the module is specified, a stop error (2110H) occurs in the CPU module.
• This FB uses the index register Z9. Do not use the Z9 in an interrupt program.
• This FB must satisfy the following conditions in the monitoring table. (Page 105 Monitoring table)
Bit 10 in device status 1 (Major failure status): 0
Bit 15 in device status 1 (EMG status): 0
Bit 15 in device status 2 (Enable): 1
Bit 17 in system status (Auto servo OFF): 0
If the conditions are not satisfied, FB_OK (normal completion) turns ON but a servo is not turned ON or OFF. For details,
refer to the IAI Corporation manuals related to serial communication (Modbus version).
• Before operating an electric actuator, write the following intelligent function module data (parameters of a serial
communication module) to a module in GX Works2.
Item Setting value
Switch Setting Transmission Data Bit 8
Setting Parity Bit None
Stop bit 1
Communication rate setting Set the value according to the setting of an electric actuator controller to be used.
Communication protocol setting Predefined protocol
Various Control Echo back permit/prohibit specification 1: Prohibited
Specification

• Use the protocol send/receive setting of Predefined Protocol Support Tool For Positioning (Q/L) to change a communication
timeout or the number of retries. (Predefined Protocol Support Tool For Positioning Operating Manual)

Performance value
The following table lists the performance values of this FB under the following conditions.
• FB compilation method: Macro type
• CPU module: Q04UDVCPU
• Serial communication module: QJ71C24N
• Controller: 
• Electric actuator: ERC3-SA5C-I-42P-12-50-SE-P-CN
Input label Time required for Maximum scan time Number of scans
ib_Servo ib_Press the processing*1 required for the
(Servo ON/OFF (Servo press ON/OFF processing
replacement) replacement)
OFF OFF 59.400 ms 0.700 ms 224 scans
ON OFF 58.800 ms 0.700 ms 225 scans
ON ON 58.800 ms 0.700 ms 222 scans
OFF ON 60.200 ms 0.700 ms 222 scans

*1 The time required from start to end of the processing.

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.8 M+CPU-IAIPosiSp_ServoControl-ST 99
Error code
Error code Description Corrective action
(Decimal)
10 The value set for the start I/O number is out of the range. Set the start I/O number to which a serial communication module is
mounted and execute FB again.
11 The value set for the target channel is out of the range. Set 2 for the target channel and execute the FB again.
12 The value set for the target axis is out of the range. Set a value within the range from 1 to 16 for the target axis and
execute the FB again.
20 An unsupported device is connected. Review and correct the connected device and execute the FB
again.
21 The execution command turned OFF during the processing. Do not turn OFF FB_EN (execution command) until FB_OK (normal
completion), FB_ERROR (error completion), or ob_UnitErr (unit
error completion) is turned ON.
(This error code is output for one scan only.)
22 Other FB which may affect the operation of an electric actuator is Stop the FB which may affect the operation of the electric actuator
executing. other than this FB, and execute this FB again.
Target FB:
• M+CPU-IAIPosiSp_StartHomePosi-ST
• M+CPU-IAIPosiSp_JogInching-ST
• M+CPU-IAIPosiSp_StartPosi-ST
• M+CPU-IAIPosiSp_ServoControl-ST
24 The G_CPRTCL instruction which is executed for the specified start Add the G_CPRTCL instruction, which is executed for the specified
I/O number is not defined. start I/O number, to the M+CPU-IAIPosiSp_CPRTCL-ST program.
For details, refer to the following:
Page 55 Checking the start I/O number
Predefined An error code that occurs during communication. For details, refer to the following:
protocol error Q Corresponding Serial Communication Module User's Manual
code (Basic)
MELSEC-L Serial Communication Module User's Manual
(Basic)

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


100 3.8 M+CPU-IAIPosiSp_ServoControl-ST
3.9 M+CPU-IAIPosiSp_CPRTCL-ST
Overview
This FB executes the G_CPRTCL instruction by using the FB in each MELSEC-Q/L series FB.

FB details
3
Basic specifications
Item Description
FB compilation Macro type
method
FB operation Pulse execution (multiple scan execution type)

Processing
This FB is called from the following FBs and executes an instruction for predefined protocol communication (G_CPRTCL).
• M+CPU-IAIPosiSp_StartHomePosi-ST
• M+CPU-IAIPosiSp_JogInching-ST
• M+CPU-IAIPosiSp_ReadPosiTable-ST
• M+CPU-IAIPosiSp_TeachingPosi-ST
• M+CPU-IAIPosiSp_StartPosi-ST
• M+CPU-IAIPosiSp_Monitoring-ST
• M+CPU-IAIPosiSp_ServoControl-ST

Restrictions or precautions
• Do not use this FB in a user-created program as this is used only internally in other FBs.
• This FB uses the G_CPRTCL instruction. For details, refer to MELSEC-Q/L Structured Programming Manual (Special
Instructions).
• When the start I/O number of a serial communication module which executes the G_CPRTCL instruction is other than 00H
to F0H, the start I/O number needs to be set after adding the G_CPRTCL instruction to a program. For details, refer to the
following:
Page 55 Checking the start I/O number

3 DETAILS OF THE FB LIBRARY (MELSEC-Q/L SERIES)


3.9 M+CPU-IAIPosiSp_CPRTCL-ST 101
APPENDIX
Appendix 1 Table Information (MELSEC iQ-R Series)
Position table structure (stPositionTable)
The following shows the list of position table structure (stMonitoringTable).
Label Name Data type Range Description
dTargetPosition Target position Double Word [signed] -999999 to 999999 To store the set target position [0.01 mm units]
in the specified position table number.
udPositioningWidth Positioning Double Word [unsigned] 1 to 999999 To store the set positioning width [0.01 mm
width units] in the specified position table number.
udSpeed Speed Double Word [unsigned] 1 to 999999 To store the set speed [0.01 mm/s units] in the
command specified position table number.
dZoneBoundaryPlus Individual zone Double Word [signed] -999999 to 999999 To store the set individual zone boundary plus
boundary plus side [0.01 mm units] in the specified position
side table number.
dZoneBoundaryMinus Individual zone Double Word [signed] -999999 to 999999 To store the set individual zone boundary
boundary minus minus side [0.01 mm units] in the specified
side position table number.
uAcceleration Acceleration Word [unsigned] 0001H to 012CH To store the set acceleration [0.01 G units] in
command hexadecimal in the specified position table
number.
uDeceleration Deceleration Word [unsigned] 0001H to 012CH To store the set deceleration [0.01 G units] in
command hexadecimal in the specified position table
number.
uPressingCurrentLimit Pressing Word [unsigned] 0033H to 01FEH (0033H to To store the set pressing current limit value in
current limit 00B2H) hexadecimal in the specified position table
value The range may varies depending number.
on the model of an electric
actuator.
uLoadCurrentThreshold Load current Word [unsigned] 0 to the value depending on the To store the set load current threshold value in
threshold setting range of an electric hexadecimal in the specified position table
actuator. number.
uControlFlag Control flag Word [unsigned] 0000H to 30FEH To store the set control flag in hexadecimal in
specification • Bit 1: Push-motion operation the specified position table number.*1
• Bit 2: Forward direction (reverse
direction) after approach
• Bit 3: Pitch feed
• Bit 4 and 5: Parameter set
• Bit 6 and 7: Acceleration pattern
• Bit 12 and 13: Vibration control
• Others: Not used

*1 For details, refer to the IAI Corporation manuals related to serial communication (Modbus version).

Monitoring table structure (stMonitoringTable)


The following shows the list of monitoring table structure (stMonitoringTable).
Label Name Data type Range Description
uAlmDetailCode Alarm detail code Word [unsigned] 0000H to FFFFH To store the latest alarm detail code in hexadecimal.
'0000H' is stored when no alarm is generated.
uAlmAddress Alarm address Word [unsigned] 0000H to FFFFH To store the latest alarm address in hexadecimal.
'FFFFH' is stored when no alarm is generated.
uAlmCode Alarm code Word [unsigned] 0000H to FFFFH To store the latest alarm code in hexadecimal.
'0000H' is stored when no alarm is generated.
udAlmTime Alarm occurrence Double Word 0 to 4294967295 To store the latest alarm occurrence time.
time [unsigned] (Passed time from the origin time or power ON [s])
dCurrentPosition Current position Double Word -999999 to 999999 To store a current position in 0.01 mm units.
monitor [signed]

APPX
102 Appendix 1 Table Information (MELSEC iQ-R Series)
Label Name Data type Range Description
uCurrentAlmCode Current alarm code Word [unsigned] 0000H to FFFFH To store the current alarm code in hexadecimal.
'0000H' is stored when no alarm is generated.
uInputPort Input port Word [unsigned] 0000H to FFFFH To store the input port value of a controller in hexadecimal.*1
uOutputPort Output port Word [unsigned] 0000H to FFFFH To store the output port value of a controller in
hexadecimal. *1
uStatus1 Device status1 Word [unsigned] 0000H to FFFFH To store the controller status in hexadecimal.*1
uStatus2 Device status2 Word [unsigned] 0000H to FFFFH To store the controller status in hexadecimal.*1
uExtendedDeviceStatus Extended device Word [unsigned] 0000H to FFFFH To store the controller status (extended device) in
status hexadecimal. *1
udSystemStatus System status Double Word 00000000H to To store the internal operation status of a controller.*1
[unsigned] FFFFFFFFH
dCurrentSpeed Current speed Double Word -999999 to 999999 To store the monitor data of actual motor speed in 0.01 mm/
[signed] s units.
dElectricCurrentValue Electric current Double Word -2147483648 to To store the monitor data of the motor current (torque
value [signed] 2147483647 current command value) in 1 mA units.
dDeviation Deviation Double Word -2147483648 to To store the deviation over a 1 ms period between the
[signed] 2147483647 position command value and the feedback value (actual
position) in 1 pulse units.
udSystemOpeTime System operating Double Word 0 to 4294967295 To store the total time since the controller power is turned
time [unsigned] ON in 1 ms units.
uSpecialInputPort Special input port Word [unsigned] 0000H to FFFFH To store the status of input ports other than the normal input
port.*1
uZoneStatus Zone status Word [unsigned] 0000H to FFFFH To store the status of zone output in hexadecimal.*1
uDoneOrRunProgramNo Positioning Word [unsigned] 0 to 1023 To store the positioning completed position No. or running
completed position program number.
No. status/Running
program No.
uExpansionSystemStaus Extended system Word [unsigned] 0000H to FFFFH To store the internal operation status of a controller
status (extended device) in hexadecimal.*1

*1 For details, refer to the IAI Corporation manuals related to serial communication (Modbus version).
A

APPX
Appendix 1 Table Information (MELSEC iQ-R Series) 103
Appendix 2 Table Information (MELSEC-Q/L Series)
Position table
The following table shows the list of position table when the start number of D device specified for iw_TableStartPos (position
table starting position) is D0.
Add the value of the start number of D device, which is specified for position table starting position, to the following device
numbers.
Device Item Data type Range Description
D0 Target position Double Word [signed] -999999 to 999999 To store the set target position [0.01 mm units]
in the specified position table number.
D1
D2 Positioning width Double Word [signed] 1 to 999999 To store the set positioning width [0.01 mm
units] in the specified position table number.
D3
D4 Speed command Double Word [signed] 1 to 999999 To store the set speed [0.01 mm/s units] in the
specified position table number.
D5
D6 Individual zone Double Word [signed] -999999 to 999999 To store the set individual zone boundary plus
boundary plus side side [0.01 mm units] in the specified position
D7
table number.
D8 Individual zone Double Word [signed] -999999 to 999999 To store the set individual zone boundary minus
boundary minus side side [0.01 mm units] in the specified position
D9
table number.
D10 Acceleration command Word [signed] 0001H to 012CH To store the set acceleration [0.01 G units] in
hexadecimal in the specified position table
number.
D11 Deceleration command Word [signed] 0001H to 012CH To store the set deceleration [0.01 G units] in
hexadecimal in the specified position table
number.
D12 Pressing current limit Word [signed] 0033H to 01FEH (0033H to 00B2H) To store the set pressing current limit value in
value The range may varies depending on hexadecimal in the specified position table
the model of an electric actuator. number.
D13 Load current threshold Word [signed] 0 to the value depending on the To store the set load current threshold value in
setting range of an electric actuator. hexadecimal in the specified position table
number.
D14 Control flag Word [signed] 0000H to 30FEH To store the set control flag in hexadecimal in
specification • Bit 1: Push-motion operation the specified position table number.*1
• Bit 2: Forward direction (reverse
direction) after approach
• Bit 3: Pitch feed
• Bit 4 and 5: Parameter set
• Bit 6 and 7: Acceleration pattern
• Bit 12 and 13: Vibration control
• Others: Not used

*1 For details, refer to the IAI Corporation manuals related to serial communication (Modbus version).

APPX
104 Appendix 2 Table Information (MELSEC-Q/L Series)
Monitoring table
The following table shows the list of monitoring table when the start number of D device specified for iw_TableStartPos
(monitoring table starting position) is D0.
Add the value of the start number of D device, which is specified for monitoring table starting position, to the following device
numbers.
Device Name Data type Range Description
D0 Alarm detail code Word [signed] 0000H to FFFFH*1 To store the latest alarm detail code in hexadecimal.
'0000H' is stored when no alarm is generated.
D1 Alarm address Word [signed] 0000H to FFFFH*1 To store the latest alarm address in hexadecimal.
'FFFFH' is stored when no alarm is generated.
D2 Alarm code Word [signed] 0000H to FFFFH*1 To store the latest alarm code in hexadecimal.
'0000H' is stored when no alarm is generated.
D3 Alarm occurrence time Double Word [signed] 0 to 4294967295*1 To store the latest alarm occurrence time.
(Passed time from the origin time or power ON [s])
D4
D5 Current position monitor Double Word [signed] -999999 to 999999 To store a current position in 0.01 mm units.
D6
D7 Current alarm code Word [signed] 0000H to FFFFH*1 To store the current alarm code in hexadecimal.
'0000H' is stored when no alarm is generated.
D8 Input port Word [signed] 0000H to FFFFH*1 To store the input port value of a controller in
hexadecimal. *2
D9 Output port Word [signed] 0000H to FFFFH*1 To store the output port value of a controller in
hexadecimal. *2
D10 Device status1 Word [signed] 0000H to FFFFH*1 To store the controller status in hexadecimal.*2
D11 Device status2 Word [signed] 0000H to FFFFH*1 To store the controller status in hexadecimal.*2
D12 Extended device status Word [signed] 0000H to FFFFH*1 To store the controller status (extended device) in
hexadecimal. *2
D13 System status Double Word [signed] 00000000H to To store the internal operation status of a controller.*2
FFFFFFFFH*1
D14
D15 Current speed Double Word [signed] -999999 to 999999 To store the monitor data of actual motor speed in 0.01 A
mm/s units.
D16
D17 Electric current value Double Word [signed] -2147483648 to To store the monitor data of the motor current (torque
D18 2147483647 current command value) in 1 mA units.

D19 Deviation Double Word [signed] -2147483648 to To store the deviation over a 1 ms period between the
2147483647 position command value and the feedback value (actual
D20
position) in 1 pulse units.
D21 System operating time Double Word [signed] 0 to 4294967295*1 To store the total time since the controller power is turned
D22 ON in 1 ms units.

D23 Special input port Word [signed] 0000H to FFFFH*1 To store the status of input ports other than the normal
input port.*2
D24 Zone status Word [signed] 0000H to FFFFH*1 To store the status of zone output in hexadecimal.*2
D25 Positioning completed Word [signed] 0 to 1023 To store the positioning completed position No. or
position No. status/Running running program number.
program No.
D26 Extended system status Word [signed] 0000H to FFFFH*1 To store the internal operation status of a controller
(extended device) in hexadecimal.*2

*1 An unsigned value is stored. If a stored value is negative, replace it to an unsigned value.


*2 For details, refer to the IAI Corporation manuals related to serial communication (Modbus version).

APPX
Appendix 2 Table Information (MELSEC-Q/L Series) 105
MEMO

APPX
106 Appendix 2 Table Information (MELSEC-Q/L Series)
INSTRUCTION INDEX

M
M+CPU-IAIPosiSp_CPRTCL-ST . . . . . . . . . . . 101
M+CPU-IAIPosiSp_JogInching-ST . . . . . . . . . . . 61
M+CPU-IAIPosiSp_Monitoring-ST . . . . . . . . . . . 90
M+CPU-IAIPosiSp_ReadPosiTable-ST . . . . . . . . 72
M+CPU-IAIPosiSp_ServoControl-ST . . . . . . . . . 96
M+CPU-IAIPosiSp_StartHomePosi-ST . . . . . . . . 56
M+CPU-IAIPosiSp_StartPosi-ST . . . . . . . . . . . . 83
M+CPU-IAIPosiSp_TeachingPosi-ST . . . . . . . . . 78
M+IAIJogInching_R . . . . . . . . . . . . . . . . . . . . . . 16
M+IAIMonitoring_R . . . . . . . . . . . . . . . . . . . . . . 44
M+IAIReadPositionTable_R . . . . . . . . . . . . . . . . 27
M+IAIServoControl_R . . . . . . . . . . . . . . . . . . . . 49
M+IAIStartHomePositioning_R . . . . . . . . . . . . . . 11
M+IAIStartPositioning_R . . . . . . . . . . . . . . . . . . 37
M+IAITeachingPosition_R . . . . . . . . . . . . . . . . . 32

107
MEMO

108
REVISIONS
*The manual number is given on the bottom left of the back cover.
Revision date *Manual number Description
June 2019 BCN-P5999-1179-A First edition
June 2020 BCN-P5999-1179-B ■Added or modified parts
SAFETY PRECAUTIONS, TERMS, Section 1.1, Section 1.3, Chapter 3, Appendix 2

Japanese manual number: BCN-P5999-1178-B


This manual confers no industrial property rights or any rights of any other kind, nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot
be held responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual.

 2019 MITSUBISHI ELECTRIC CORPORATION

109
TRADEMARKS
The company names, system names and product names mentioned in this manual are either registered trademarks or
trademarks of their respective companies.
In some cases, trademark symbols such as '' or '' are not specified in this manual.

110
BCN-P5999-1179-B(2006)

HEAD OFFICE : TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN
NAGOYA WORKS : 1-14 , YADA-MINAMI 5-CHOME , HIGASHI-KU, NAGOYA , JAPAN

When exported from Japan, this manual does not require application to the
Ministry of Economy, Trade and Industry for service transaction permission.

Specifications subject to change without notice.

You might also like