All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of Yaskawa. No patent liability is assumed with respect to
the use of the information contained herein. Moreover, because Yaskawa is constantly striving to
improve its high-quality products, the information contained in this manual is subject to change without
notice. Every precaution has been taken in the preparation of this manual. Nevertheless, Yaskawa
assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in this publication.
About this Manual
This manual provides comprehensive information on ladder programming for MP2000-series
Machine Controllers. It provides the following information on MP2000-series Machine Controllers.
• Introduction to Ladder Programming
• Specifications
• Program Development Flow
• Programming
• Instructions
• MPE720 Engineering Tool
• Troubleshooting
This manual provides information on MP2000-series Machine Controllers and MPE720 version 6.
For information on the MP900-series Machine Controllers and MPE720 version 5, refer to the
appropriate manuals for them.
Read this manual carefully to ensure the proper use of the MP2000-series Machine Controllers.
Keep this manual in a safe place so that it can be referred to whenever necessary.
Using this Manual
Intended Audience
This manual is intended for the following users.
• Those responsible for designing the MP2000-series Machine Controller system
• Those responsible for writing the MP2000-series Machine Controller ladder programs
MPE720 Engineering Tool Version Number
In this manual, the operation of the MPE720 is described using screen captures of MPE720 version 6.
For this reason, the screen captures and some descriptions may differ for MPE720 version 5.
Abbreviations
The following abbreviation is used in this manual.
• MP2000: A generic term for the MP2100, MP2100M, MP2101, MP2101M, MP2101T, MP2101TM, MP2200,
MP2300, MP2300S, MP2310, MP2400, MP2500/M/B/MB, and MPU-01.
MP2000-series Manuals
The MP2000 Series includes the MP2100, MP2100M, MP2101, MP2101M, MP2101T, MP2101TM,
MP2200, MP2300, MP2300S, MP2310, MP2400, MPU-01, MP2500/M/B/MB, and MPU-01.
There are many manuals available for one or more of these Machine Controllers. A list of the
related manuals is provided on the following page. Refer to these manuals as required.
iii
Related Manuals
The following manuals are related to the MP2000 Series. Refer to these manuals as required.
Manual NameManual NumberDescription
Machine Controller MP210/MP210M
User’s Manual, Design and Maintenance
Machine Controller MP2000 Series
Communication Module User’s Manual
Machine Controller MP2000 Series
262IF-01 FL-net Communication Module
User’s Manual
Machine Controller MP2000 Series
263IF-01 EtherNet/IP Communication
Module User’s Manual
Machine Controller MP2000 Series
I/O Module User’s Manual
Machine Controller MP2000 Series
Analog Input/Analog Output Module
AI-01/AO-01 User’s Manual
Machine Controller MP2000 Series
Counter Module CNTR-01 User’s Manual
Machine Controller MP2000 Series
MPU-01 Multiple-CPU Module
User’s Manual
Machine Controller MP2000 Series
User’s Manual for Motion Programming
Engineering Tool for MP2000 Series
Machine Controller MPE720 Version 6
User’s Manual
Machine Controller MP900/MP2000 Series
MPE720 Software for Programming Device
User’s Manual
Machine Controller MP2000 Series
Embedded C-Language Programming
Package Development Guide
Machine Controller MP900/MP2000 Series
New Ladder Editor User’s Manual
SIEP C880700 01
SIEP C880700 03
SIEP C880732 00
SIEP C880732 01
SIEP C880752 00
SIEP C880700 33
SIEP C880700 41
SIEP C880700 32
SIEP C880700 28
SIEP C880700 04
SIEP C880700 36
SIEP C880700 39
SIEP C880700 34
SIEP C880700 26
SIEP C880700 27
SIEP C880781 05
SIEP C880700 38
SIEP C880700 30
SIEP C880700 05
SIEP C880700 25
SIEZ-C887-13.2
Describes the functions, specifications, setup procedures, and
operating methods of the MP2100/MP2100M.
Describes the functions, specifications, setup procedures, and
operating methods of the MP2200.
Describes the functions, specifications, setup procedures, and
operating methods of the MP2300.
Describes the functions, specifications, setup procedures, and
operating methods of the MP2300S.
Describes the functions, specifications, setup procedures, and
operating methods of the MP2310.
Describes the functions, specifications, setup procedures, and
operating methods of the MP2400.
Describes how to use the MP2500, MP2500M, MP2500D, and
MP2500MD Machine Controllers.
Describes the SVB Module that is built into an MP2000-series
Machine Controller and the SVB-1 Optional Module.
Describes the SVC-01 SVA Motion Module for MP2000-series
Machine Controllers.
Describes the SVA-01 SVA Motion Module for MP2000-series
Machine Controllers.
Describes the PO-01 Pulse Output Motion Module for MP2000series Machine Controllers.
Describes the Communications Modules that can be connected to
MP2000-series Machine Controllers.
Describes the 262IF-01 FL-net Communications Module for
MP2000-series Machine Controllers.
Describes the 263IF-01 EtherNet/IP Communications Module for
MP2000-series Machine Controllers.
Describes the I/O Modules that can be connected to MP2000series Machine Controllers.
Describes the AI-01 Analog Input Module and AO-01 Analog
Output Module for MP2000-series Machine Controllers.
Describes the CNTR-01 Counter Module for MP2000-series
Machine Controllers.
Describes the MPU-01 Multiple-CPU Module for MP2000-series
Machine Controllers.
Describes the
MP2000-series Machine Controllers.
Describes how to install and operate the MPE720 version 6 Engineering Tool for MP2000-series Machine Controllers.
Describes how to install and operate the MPE720 programming
device software for MP900/MP2000-series Machine Controllers.
Describes how to develop, design, and maintain embedded C-language application programs for MP2000-series Machine Controllers.
Describes the operating methods of the New Ladder Editor, which
assists MP900/MP2000-series design and maintenance.
instructions that are used
in motion programming for
iv
Manual NameManual NumberDescription
Machine Controller MP900/MP2000 Series
Distributed I/O Module User’s Manual,
MECHATROLINK System
Machine Controller MP900/MP2000 Series
User’s Manual, For Linear Servomotors
AC Servo Drives Σ-V Series User’s Manual,
Setup, Rotational Motor
AC Servo Drives Σ-V Series User’s Manual,
Setup, Linear Motor
AC Servo Drives Σ-V Series User’s Manual,
Design and Maintenance, Analog-voltage,
Pulse-string Reference, Rotational Motor
AC Servo Drives Σ-V Series User’s Manual,
Design and Maintenance, Analog-voltage/
Pulse-string Reference, Linear Motor
AC Servo Drives Σ-V Series User’s Manual,
Design and Maintenance,
MECHATROLINK-II Communications
Reference, Rotational Motor
AC Servo Drives Σ-V Series User’s Manual,
Design and Maintenance,
MECHATROLINK-II Communications
Reference, Linear Motor
AC Servo Drives Σ-V Series User’s Manual,
MECHATROLINK-II Commands
AC Servo Drives Σ-V Series User’s Manual,
Operation of Digital Operator
SIE-C887-5.1
SIEP C880700 06
SIEP S800000 43
SIEP S800000 44
SIEP S800000 45
SIEP S800000 47
SIEP S800000 46
SIEP S800000 48
SIEP S800000 54
SIEPS 800000 55
Describes MECHATROLINK distributed I/O for MP900/
MP2000-series Machine Controllers.
Describes the connection methods, setting methods, and other
information for Linear Servomotors.
Describes the installation, wiring, connections, and trial operation
of the
Σ-V Series Servo Drives and Rotational Servomotors.
Describes the installation, wiring, connections, and trial operation
Σ-V Series Servo Drives and Linear Servomotors.
of the
Describes the design and maintenance of the
Servo Drives and Rotational Servomotors.
Describes the design and maintenance of the
Servo Drives and Linear Servomotors.
Describes the design and maintenance of the
TROLINK-II Communications-reference Servo Drives and Rotational Servomotors.
Describes the design and maintenance of the
TROLINK-II Communications-reference Servo Drives and Linear
Servomotors.
Describes the MECHATROLINK-II communications commands
Σ-V Series Servo Drives with MECHATROLINK-II com-
of the
munications references.
Describes operating procedures of the Digital Operator for
Series Servo Drives.
Σ-V Series Analog
Σ-V Series Analog
Σ-V Series MECHA-
Σ-V Series MECHA-
Σ-V
v
IMPORTANT
INFO
EXAMPLE
TERMS
WARNING
CAUTION
PROHIBITED
Visual Aids
The following visual aids are used to indicate certain types of information for easier reference. Use these to help you
understand the different types of information.
• Indicates information that must be remembered.
Also indicates alarm displays and other minor precautions that will not result in machine damage.
• Indicates supplemental information and convenient information to remember.
• Indicates concrete examples.
• Indicates definitions of difficult terms or terms that have not been previously explained in this manual.
Copyrights
• DeviceNet is a registered trademark of the ODVA (Open DeviceNet Venders Association).
• PROFIBUS is a trademark of the PROFIBUS User Organization.
• Ethernet is a registered trademark of the Xerox Corporation.
• MPLINK is a registered trademark of Yaskawa Electric Corporation.
• Microsoft, Windows, Windows NT, and Internet Explorer are trademarks or registered trademarks of the
Microsoft Corporation.
• Pentium is a registered trademark of the Intel Corporation.
• MECHATROLINK is a trademark of the MECHATROLINK Members Association.
• Other product names and company names are the trademarks or registered trademarks of the respective company. “TM” and the ® mark do not appear with product or company names in this manual.
Safety Information
The following signal words and marks are used to indicate safety precautions in this manual. Information marked as
shown below is important for safety. Always read this information and heed the precautions that are provided.
Indicates precautions that, if not heeded, could possibly result in loss of life or serious injury.
Indicates precautions that, if not heeded, could result in relatively serious or minor injury, or
property damage.
If not heeded, even precautions classified as cautions () can lead to serious results depending on
circumstances.
CAUTION
vi
MANDATORY
Indicates prohibited actions. For example, indicates prohibition of open flame.
Indicates mandatory actions. For example, indicates that grounding is required.
CAUTION
Safety Precautions
This section provides important precautions that must be observed in ladder programming. Before you start to program,
carefully read all of this manual and all other provided manuals and make sure that you program the MP2000-series
Machine Controller correctly. You must be completely familiar with the MP2000-series Machine Controllers, safety
information, and all safety precautions before you attempt to use the Machine Controller.
Storage and Transportation
If disinfectants or insecticides must be used to treat packing materials such as wooden frames, pallets, or
plywood, the packing materials must be treated before the product is packaged, and methods other than
fumigation must be used.
Example: Heat treatment, where materials are kiln-dried to a core temperature of 56°C for 30 minutes or
more.
If the electronic products, which include stand-alone products and products installed in machines, are packed with
fumigated wooden materials, the electrical components may be greatly damaged by the gases or fumes resulting from
the fumigation process. In particular, disinfectants containing halogen, which includes chlorine, fluorine, bromine, or
iodine can contribute to the erosion of the capacitors.
Other General Precautions
Observe the following general precautions to ensure safe application.
The MP2000-series Machine Controllers were not designed or manufactured for use in devices or systems
directly related to human life.
Users who intend to use products that are described in this manual for special purposes such as devices or systems relating to transportation, medical, space aviation, atomic power control, or underwater use must contact
Yaskawa Electric Corporation beforehand.
The MP2000-series Machine Controllers have been manufactured under strict quality control guidelines. However,
if an MP2000-series Machine Controller is to be installed in any location in which a failure of the MP2000-series
Machine Controllers could involve a life and death situation or in a facility where failure may cause a serious accident, safety devices MUST be installed to minimize the likelihood of any serious accident.
The products shown in illustrations in this manual are sometimes shown without covers or protective guards.
Always replace the cover or protective guard as specified first, and then operate the products in accordance with
the manual.
The drawings that are presented in this manual are typical examples and may not match the product you received.
If the manual must be ordered due to loss or damage, inform your nearest Yaskawa representative or one of the
offices listed on the back of this manual.
Contact your nearest Yaskawa representative or one of the offices listed on the back of this manual to order a new
nameplate whenever a nameplate becomes worn or damaged.
vii
Warranty
( 1 ) Details of Warranty
Warranty Period
The warranty period for a product that was purchased (hereinafter called “delivered product”) is one year from the time
of delivery to the location specified by the customer or 18 months from the time of shipment from the Yaskawa factory,
whichever is sooner.
Warranty Scope
Yaskawa shall replace or repair a defective product free of charge if a defect attributable to Yaskawa occurs during the
warranty period above. This warranty does not cover defects caused by the delivered product reaching the end of its
service life and replacement of parts that require replacement or that have a limited service life.
This warranty does not cover failures that result from any of the following causes.
1. Improper handling, abuse, or use in unsuitable conditions or in environments not described in product catalogs or
manuals, or in any separately agreed-upon specifications
2. Causes not attributable to the delivered product itself
3. Modifications or repairs not performed by Yaskawa
4. Abuse of the delivered product in a manner in which it was not originally intended
5. Causes that were not foreseeable with the scientific and technological understanding at the time of shipment from
Ya sk aw a
6. Events for which Yaskawa is not responsible, such as natural or human-made disasters
( 2 ) Limitations of Liability
1. Yaskawa shall in no event be responsible for any damage or loss of opportunity to the customer that arises due to
failure of the delivered product.
2. Yaskawa shall not be responsible for any programs (including parameter settings) or the results of program execution of the programs provided by the user or by a third party for use with programmable Yaskawa products.
3. The information described in product catalogs or manuals is provided for the purpose of the customer purchasing
the appropriate product for the intended application. The use thereof does not guarantee that there are no infringements of intellectual property rights or other proprietary rights of Yaskawa or third parties, nor does it construe a
license.
4. Yaskawa shall not be responsible for any damage arising from infringements of intellectual property rights or other
proprietary rights of third parties as a result of using the information described in catalogs or manuals.
viii
( 3 ) Suitability for Use
1. It is the customer’s responsibility to confirm conformity with any standards, codes, or regulations that apply if the
Yaskawa product is used in combination with any other products.
2. The customer must confirm that the Yaskawa product is suitable for the systems, machines, and equipment used by
the customer.
3. Consult with Yaskawa to determine whether use in the following applications is acceptable. If use in the application
is acceptable, use the product with extra allowance in ratings and specifications, and provide safety measures to
minimize hazards in the event of failure.
• Outdoor use, use involving potential chemical contamination or electrical interference, or use in conditions or
environments not described in product catalogs or manuals
• Nuclear energy control systems, combustion systems, railroad systems, aviation systems, vehicle systems,
medical equipment, amusement machines, and installations subject to separate industry or government regulations
• Systems, machines, and equipment that may present a risk to life or property
• Systems that require a high degree of reliability, such as systems that supply gas, water, or electricity, or systems that operate continuously 24 hours a day
• Other systems that require a similar high degree of safety
4. Never use the product for an application involving serious risk to life or property without first ensuring that the system is designed to secure the required level of safety with risk warnings and redundancy, and that the Yaskawa
product is properly rated and installed.
5. The circuit examples and other application examples described in product catalogs and manuals are for reference.
Check the functionality and safety of the actual devices and equipment to be used before using the product.
6. Read and understand all use prohibitions and precautions, and operate the Yaskawa product correctly to prevent
accidental harm to third parties.
( 4 ) Specifications Change
The names, specifications, appearance, and accessories of products in product catalogs and manuals may be changed at
any time based on improvements and other reasons. The next editions of the revised catalogs or manuals will be published with updated code numbers. Consult with your Yaskawa representative to confirm the actual specifications
before purchasing a product.
A ladder program uses ladder instructions and registers to symbolically represent electrical circuits that consist of
switches, timers, lamps, and other devices.
Ladder programming allows you to easily program large, complex circuits.
Each of the ladder programs that you create is executed in a single scan and then executed repeatedly at fixed
intervals.
1-2
1.2 Features of Ladder Programming for MP2000-series Machine Controllers
Introduction to Ladder Programming
1
Interrupt
signal
Power ON
High-speed
scan cycle
Low-speed scan cycle
Processed during
idle time of the
high-speed scan.
High-speed
scan cycle
High-speed
scan cycle
Interrupt signal
DWG.A
→ Executed only when power
is turned ON.
DWG.H
→ Executed in the high-speed
scan cycle.
DWG.L
→ Executed in the low-speed
scan cycle.
DWG.I
→ Executed only when an
interrupt signal is detected.
On standby while
drawings of higher
priority are processed.
:
↓
↓
1.2.1 Types of Ladder Drawings and Their Different Execution Timing
1.2 Features of Ladder Programming for MP2000-series Machine
Controllers
This section describes the features of ladder programming.
1.2.1 Types of Ladder Drawings and Their Different Execution Timing
Ladder programs are managed in units of drawings (DWG). These are called ladder drawings.
In the MP2000-series Machine Controllers, ladder drawings are executed at various times, as illustrated in the following figure.
Processing can be executed at the appropriate time by programming it in the appropriate ladder drawing.
Drawing Execution Timing
The drawings with lower numbers have higher execution priority.
This drawing is executed only once when the power supply is turned ON
(e.g., for data initialization).
This drawing is executed when an interrupt signal is detected (e.g., for
interrupt processing for external signals).
This drawing is executed every high-speed scan cycle (e.g., for motion
control).
This drawing is executed every low-speed scan cycle (e.g., for touch
panel display processing).
1-3
1.2 Features of Ladder Programming for MP2000-series Machine Controllers
1.2.2 Program Modules
1.2.2 Program Modules
The main program can be separated into modular units to suit different processing requirements, such as child drawings, grandchild drawings, and functions, to make the program easier to read.
H: Main program
# Automatic operation processing
H: Main program
SEE instruction
Automatic operation
processing drawing
# Manual operation processing
# Difference numeric processing
# Manual operation processing
# Difference numeric processing
END
Modularization
c
d
SEE instruction
SEE instruction
Manual operation
processing c drawing
Manual operation
processing d drawing
1.2.3 Programming Complicated Numeric Operations
Complicated calculations written over several lines can be written easily within a single EXPRESSION instruction.
Variables, structures, and basic functions, such as those for sine and cosine calculations, can be programmed using
familiar C-like expressions.
You can display the current value inside expressions in the same way as you can for other ladder language instructions.
FUNC
instruction
FUNC
instruction
Difference numeric
processing function
1-4
1.2 Features of Ladder Programming for MP2000-series Machine Controllers
Introduction to Ladder Programming
1
MP2000-series Machine Controller
• MSG-SND instruction
(Send Message)
• MSG-RCV instruction
(Receive Message)
Ladder Program
Touch Panel
PLC
Registers
External Device
INFO
1.2.4 Communications Control with External Devices
The MSG-SND and MSG-RCV ladder instructions support various protocols and can be used to control communications with many external devices, such as a touch panels or host PLCs. This allows external devices to access registers
in the Machine Controller.
1.2.4 Communications Control with External Devices
Instead of using a ladder program, the Machine Controller can also communicate with external devices by using I/O message
communications or automatic reception.
Refer to Chapter 6 Ethernet Communications in the Machine Controller MP2310 Basic Module User’s Manual (Manual No.:
SIEP C880732 01) for details.
1.2.5 Complete Synchronization with Motion Control
Ladder programs that are started in the high-speed scan are processed in complete synchronization with motion control
processing. This allows you to call and process a motion program that performs complicated motion control synchronously with a ladder program.
Sequence Control
Motion control is processed in
Ladder Program (High-speed Scan)
Start of a Motion
Program
complete synchronization with
the high-speed scan.
Motion Program
Setting
motion
parameters
Motion Control
(Motion Module)
Completely
synchronized
control
Position
control
Speed
Motion parameters
control
Torque
control
1-5
Specifications for Ladder Programs
2
2
Specifications for Ladder Programs
This chapter gives the specifications for ladder programs.
MP2101T, MP2101TM,
MP2200 with CPU-03,
MP2200 with CPU-04,
and MPU-01
Applicable Models
Number of
Programs
Number of Groups
Number of Tasks
Motion Programs
Number of Parallel
Forks per Task
Applicable Models
Number of
Programs
Number of Tasks
Sequence Programs
M Registers
S Registers
I Registers
O Registers
C Registers
D Registers
Accessible Registers
# Registers
Capacity of Table Data
Backed Up by a Battery
∗ 1. This is the total capacity for ladder programs and motion programs.
∗ 2. This is supported only for version 2.66 or higher.
∗ 3. The # registers can be used only when ladder programs are used.
Applicable
256 programs max. including motion programs and sequence programs
8 groups (Up to 16 axes can be set in one group.)
16 tasks max. (This is the number of simultaneously executable motion programs.)
8 (4 main program forks × 2 subprogram forks)
NAApplicable ApplicableNAApplicable NAApplicable
256 programs max. including motion programs and sequence programs
16 tasks max. (This is the number of simultaneously executable sequence programs.)
Applicable (65,535 words)
These registers are backed up with a battery.
Applicable (8,192 words)
These registers are backed up with a battery.
Applicable (32,768 words + motion monitor parameters)
Applicable (32,768 words + motion setting parameters)
Applicable (16,384 words)
Applicable (Can be specified to between 0 and 16,384 words.)
These registers are unique to each drawing (DWG). They can be used within each drawing.
Applicable (Can be specified to between 0 and 16,384 words.)
These are internal registers that are unique to each drawing (DWG). They can be referenced within each drawing.
None1 MB3 MB
*3
*3
2-3
2.2 Engineering Tool Specifications
INFO
2.2.1 Applicable Engineering Tool
2.2 Engineering Tool Specifications
This section gives the specifications for programs for the Engineering Tool.
2.2.1 Applicable Engineering Tool
You can create ladder programs with the following Engineering Tool.
• MPE720 version 5 for all MP2000-series Machine Controllers except for the MP2400
• MPE720 version 6 for all MP2000-series Machine Controllers
In addition to the Engineering Tool, you can also use the following Support Tools to monitor Machine Controller information
and transfer data.
• MPLOGGER (Control Information Monitoring Tool)
• MPLoader (Data Transfer Tool)
• MPLoadMaker (Automatic Transfer Data Creation Tool)
You can install the Engineering Tool and Support Tools in one PC to use them.
2.2.2 MPE720 Version 6 Engineering Tool Specifications
The following table shows the relationship between the Engineering Tool and the Machine Controller.
Machine Controller
MP2100Applicable
MP2100MApplicable
MP2101Applicable
MP2101MApplicable
MP2101TApplicable
MP2101TMApplicable
MP2200 with CPU-01Applicable
MP2200 with CPU-02Applicable
MP2200 with CPU-03Applicable
MP2200 with CPU-04Applicable
MP2300Applicable
MP2300SApplicable
MP2310Applicable
MPU-01Applicable
MPE720 Version 6
(CPMC-MPE770)
Remarks
–
–
Applicable with MPE720 version 6.24 or higher
Applicable with MPE720 version 6.24 or higher
Applicable with MPE720 version 6.24 or higher
Applicable with MPE720 version 6.24 or higher
–
–
Applicable with MPE720 version 6.20 or higher
Applicable with MPE720 version 6.22 or higher
–
Applicable with MPE720 version 6.04 or higher
Applicable with MPE720 version 6.04 or higher
Applicable with MPE720 version 6.23 or higher
The following table shows the relationship between the Engineering Tool and the programs.
Program
Ladder ProgramsApplicable
Motion ProgramsApplicable
Sequence ProgramsApplicable
MPE720 Version 6
(CPMC-MPE770)
Remarks
–
–
–
2-4
Specifications for Ladder Programs
2
2.3 Ladder Programming Instructions
The following table lists the ladder programming instructions.
Refer to the reference sections for details on individual instructions.
TypeSymbolFunctionReference
NOCNO Contact
NCCNC Contact
TON[10 ms]10-ms ON-Delay Timer
TOFF[10 ms]10-ms OFF-Delay Timer
TON[1 s]1-s ON-Delay Timer
TOFF[1 s]1-s OFF-Delay Timer
ON-PLSRising-edge Pulses
OFF-PLSFalling-edge Pulses
COILCoil
Relay Circuit Instructions
S-COILSet Coil
R-COILReset Coil
STOREStore
ADDAdd
ADDXExtended Add
SUBSubtract
SUBXExtended Subtract
MULMultiply
DIVDivide
MODInteger Remainder
REMReal Remainder
INCIncrement
DECDecrement
TMADDAdd Time
TMSUBSubtract Time
SPENDSpend Time
INVInvert Sign
COMOne’s Complement
Numeric Operation Instructions
ABSAbsolute Value
BINBinary Conversion
BCDBCD Conversion
PARITYParity Conversion
ASCIIASCII Conversion 1
BINASCASCII Conversion 2
ASCBINASCII Conversion 3
ANDInclusive AND
ORInclusive OR
XORExclusive OR
<Less Than
≤Less Than or Equal
=Equal
≠Not Equal
≥Greater Than or Equal
>Greater Than
Logic Operation Instructions
RCHKRange Check
2.3 Ladder Programming Instructions
5.2.1
5.2.2
5.2.3
5.2.4
5.2.5
5.2.6
5.2.7
5.2.8
5.2.9
5.2.10
5.2.11
5.3.1
5.3.2
5.3.3
5.3.4
5.3.5
5.3.6
5.3.7
5.3.8
5.3.9
5.3.10
5.3.11
5.3.12
5.3.13
5.3.14
5.3.15
5.3.16
5.3.17
5.3.18
5.3.19
5.3.20
5.3.21
5.3.22
5.3.23
5.4.1
5.4.2
5.4.3
5.4.4
5.4.5
5.4.6
5.4.7
5.4.8
5.4.9
5.4.10
2-5
2.3 Ladder Programming Instructions
TypeSymbolFunctionReference
SEECall Sequence Subprogram
MSEECall Motion Program
FUNCCall User Function
INSDirect Input String
OUTSDirect Output String
XCALLCall Extended Program
WHILE
END_WHILE
FOR
END_FOR
IF
END_IF
Program Control Instructions
IF
ELSE
END_IF
EXPRESSIONExpression
SQRTSquare Root
SINSine
COSCosine
TANTangent
ASINArc Sine
ACOSArc Cosine
ATANArc Tangent
EXPExponential
LNNatural Logarithm
Basic Function Instructions
LOGCommon Logarithm
ROTLBit Rotate Left
ROTRBit Rotate Right
MOVBMove Bit
MOVWMove Word
XCHGExchange
SETWTable Initialization
BEXTDByte-to-word Expansion
BPRESSWord-to-byte Compression
BSRCHBinary Search
SORTSort
SHFTLBit Shift Left
Data Manipulation Instructions
SHFTRBit Shift Right
COPYWCopy Word
BSWAPByte Swap
DZADead Zone A
DZBDead Zone B
LIMITUpper/Lower Limit
PIPI Control
PDPD Control
PIDPID Control
LAGFirst Order Lag
LLAGPhase Lead Lag
FGNFunction Generator
DDC Instructions
IFGNInverse Function Generator
LAULinear Accelerator/Decelerator 1
SLAULinear Accelerator/Decelerator 2
PWMPulse Width Modulation
WHILE construct
FOR construct
IF construct
IF ELSE construct
5.5.1
5.5.2
5.5.3
5.5.4
5.5.5
5.5.6
5.5.7
5.5.8
5.5.9
5.5.10
5.5.11
5.6.1
5.6.2
5.6.3
5.6.4
5.6.5
5.6.6
5.6.7
5.6.8
5.6.9
5.6.10
5.7.1
5.7.2
5.7.3
5.7.4
5.7.5
5.7.6
5.7.7
5.7.8
5.7.9
5.7.10
5.7.11
5.7.12
5.7.13
5.7.14
5.8.1
5.8.2
5.8.3
5.8.4
5.8.5
5.8.6
5.8.7
5.8.8
5.8.9
5.8.10
5.8.11
5.8.12
5.8.13
2-6
2.3 Ladder Programming Instructions
Specifications for Ladder Programs
2
TypeSymbolFunctionReference
TBLBRRead Table Block
TBLBWWrite Table Block
TBLSRLSearch Table Row
TBLSRCSearch Table Column
TBLCLClear Table Block
TBLMVMove Table Block
QTBLRRead Queue Table
QTBLRI
QTBLWWrite Queue Table
Table Manipulation Instructions
QTBLWI
QTBLCLClear Queue Table Pointer
COUNTERCounter
FINFOUTFirst-in First-out
TRACETrace
DTRC-RDRead Data Trace
ITRC-RDRead Inverter Trace
MSG-SNDSend Message
MSG-RCVReceive Message
ICNS-WRWrite Inverter Parameters
ICNS-RDRead Inverter Parameters
MLNK-SVWWrite SERVOPACK Parameters
MOTREG-WWrite Motion Register
Standard System Function Instructions
MOTREG-RRead Motion Register
Read Queue Table with Pointer Increment
Write Queue Table with Pointer Increment
5.9.1
5.9.2
5.9.3
5.9.4
5.9.5
5.9.6
5.9.7
5.9.7
5.9.8
5.9.8
5.9.9
5.10.1
5.10.2
5.10.3
5.10.4
5.10.5
5.10.6
5.10.7
5.10.8
5.10.9
5.10.10
5.10.11
5.10.12
C-FUNCCall User C-language Function
Instructions
TSK-CTRLControl User C-language Task
C-language Control
5.11.1
5.11.2
2-7
Ladder Program Development Flow
3
3
Ladder Program Development Flow
This chapter describes the development flow for ladder programs.
Create a project before you start ladder program
development.
c Preparation for Devices to Be Connected
Assemble and wire all devices to be connected.
Install MPE720 on a PC.
d
System Startup
Perform self configuration and start the system.
g
Transferring Ladder Programs
Transfer the ladder programs that you created to
the MP2000-series Machine Controllers.
h
Checking the Operation of the Ladder Programs
Check the operation of the ladder programs.
i
Saving the Ladder Programs to Flash Memory
Save the debugged ladder programs to flash memory.
f
Creating Ladder Programs
Enter the ladder programs in the Ladder Editor.
Refer to 3.1.1 Connecting the Hardware.
Refer to 3.1.2 Installing MPE720 Version 6.
Refer to 3.1.3 Communications Settings.
Refer to 3.1.4 System Startup.
Refer to 3.1.5 Creating a Project.
Refer to 3.1.6 Creating Ladder Programs.
Refer to 3.1.7 Transferring Ladder Programs.
Refer to 3.1.8 Checking the Operation of the Ladder Programs.
Refer to 3.1.9 Saving the Ladder Programs to Flash Memory.
3.1 Ladder Program Design Procedures
This section describes the design procedures for ladder programs as outlined below.
The above flowchart is an example of the ladder program design process. Settings to interface the external devices
must be completed to use programs on the actual system.
3-2
Ladder Program Development Flow
3
3.1.1 Connecting the Hardware
Virtual I/O Devices*
(Entered on MPE720.)
SW1
SW2SW3
MB00000 MB00001
Lamp 1Lamp 2
MB00010MB00011
Ethernet cable
PC running MPE720
24-VDC
power supply
Machine Controller
MB00002
DC24V
DC 0V
MP2300
YASKAWA
TEST
RDY
ALM
TX
RUN
ERR
BAT
MON
CNFG
INT
SUP
STOP
SW1
OFF ON
BATTERY
CPU I/O
M-I/II
218IF-01
ERR
COL
RX
RUN
STRX
TX
INIT
TEST
ONOFF
PORT
10Base-T
Optional Module
Optional Module
The flow of ladder program development that is described in this chapter is based on the following system configuration.
3.1 Ladder Program Design Procedures
3.1.1 Connecting the Hardware
∗ In this chapter, M registers in the Machine Controller are used to simulate virtual I/O devices in the example system.
In practice, the input and output signals would be connected to I/O Modules on the Machine Controller, and the ladder program
would be created using I and O registers.
3-3
3.1 Ladder Program Design Procedures
3.1.2 Installing MPE720 Version 6
3.1.2 Installing MPE720 Version 6
Install MPE720 version 6 on a PC.
Refer to the Engineering Tool for MP2000 Series Machine Controller MPE720 Version 6 User’s Manual (SIEP
C880700 30) for the installation procedure.
3.1.3 Communications Settings
After you install MPE720 version 6 on the PC, set up communications between the MP2000-series Machine Controller
and the PC.
Refer to the Engineering Tool for MP2000 Series Machine Controller MPE720 Version 6 User’s Manual (SIEP
C880700 30) for the communications setup procedure.
3.1.4 System Startup
Set up the system by performing self configuration. Self configuration automatically recognizes the Modules that are
installed in the MP2000-series Machine Controller and the devices that are connected through the MECHATROLINK
connector. This allows you to quickly and easily set up the system. You can perform self configuration by using the
DIP switch on the Machine Controller or by using the MPE720.
Refer to the user’s manual for your Machine Controller for details on self configuration.
3-4
Ladder Program Development Flow
3
3.1.5 Creating a Project
Use the following procedure to create a project.
1.Double-click the following icon on the PC desktop to start MPE720 version 6.
2.When MPE720 version 6 starts, select New on the Start Tab Page.
3.1 Ladder Program Design Procedures
3.1.5 Creating a Project
3.Specify the file name, file storage location, and Machine Controller model, and then click the Create
Button.
Specify the file storage location.
Specify the file name.
Specify the model of the
MP2000-series Machine Controller.
3-5
3.1 Ladder Program Design Procedures
3.1.6 Creating Ladder Programs
3.1.6 Creating Ladder Programs
Start the Ladder Editor and use the following procedure to create a ladder program.
1.In the pane on the left, expand the tree under Ladder program. Right-click High-speed and select
New from the menu.
Expand.
Right-click.
Select.
2.Click the OK Button.
3-6
3.1 Ladder Program Design Procedures
Ladder Program Development Flow
3
3.1.6 Creating Ladder Programs
3.Create the ladder program in the Ladder Editor that you started.
Ladder programs are entered by inserting rungs, then instructions, and finally parameters for the instructions.
The following example shows how to insert an NO Contact instruction.
c Right-click the tab with the row number, and select Insert Rung.
Right-click.
Select.
d Drag the instruction to insert (here, the NO Contact instruction under the relay instructions) from the Ladder
Instructions Pane to the inserted rung.
Drag and drop.
e Click the portion of the instruction with a question mark and enter the parameter (MB00000) from the key-
board.
The types and number of instruction parameters depend on the instruction. Refer to Chapter 5 Instructions for
details on individual instructions.
3-7
3.1 Ladder Program Design Procedures
IMPORTANT
3.1.6 Creating Ladder Programs
f Repeat steps 1 to 3 until you have created the entire ladder program. The following figures show examples of
a ladder program and its timing chart.
The ladder program example that is shown above uses M registers for switches and lamps.
When you enter a ladder program for an actual system, use the appropriate I and O registers.
AND Circuit Operation
SW1 (MB00000)
SW2 (MB00001)
Lamp 1 (MB00010)
Timer Circuit Operation
SW3 (MB00002)
Timer (DW00000)
Lamp 2 (MB00011)
ON
OFF
ON
OFF
ON
OFF
ON
OFF
5
0
ON
OFF
5 s
3-8
4.While displaying the ladder program, select Compile - Compile from the menu bar to compile the pro-
gram. When the compilation is finished, the ladder program will be saved automatically.
If an error is displayed in the Output Pane during compilation, the ladder program will not be saved.
Ladder Program Development Flow
3
3.1.7 Transferring Ladder Programs
Use the following procedure to transfer the ladder program to the MP2000-series Machine Controller. This procedure
is not necessary if you created the ladder program online.
1.Select Communications Setting on the Start Tab Page.
3.1 Ladder Program Design Procedures
3.1.7 Transferring Ladder Programs
2.Select the desired communications port in the Communications Setting Box, and then click the Con-
nection Button.
3.Wait for the MPE720 to go online, and then select Transfer − Write into controller.
3-9
3.1 Ladder Program Design Procedures
INFO
3.1.7 Transferring Ladder Programs
4.Click the Individual Button, then select the Program Check Box. Click the Start Button.
• When an individual transfer is selected, the same file in the Machine Controller will be overwritten with the selected project
file data.
• When a batch transfer is selected, the RAM in the MP2000-series Machine Controller will be cleared before the transfer, and
all project file data will be written in the RAM.
5.Click the CPU STOP Button. The transfer will start.
3-10
3.1.8 Checking the Operation of the Ladder Programs
Ladder Program Development Flow
3
Double-click.
3.1.8 Checking the Operation of the Ladder Programs
This section provides procedures to check the ladder program that was created in 3.1.6 Creating Ladder Programs.
Confirm that your program operates correctly by manipulating registers with the Register List, and by checking the
runtime monitor in the Register List and Ladder Editor.
( 1 ) Preparations for Checking Operation
1.Open the ladder program that was transferred.
3.1 Ladder Program Design Procedures
2.Click the Register List 1 Tab, and then enter “MB000000” in the Register Box.
If the Register List 1 Tab is not visible, select View − Register List − Register List 1 from the menu
bar. The tab will be displayed and the register list will be opened.
Enter “MB000000.”
Click.
3-11
3.1 Ladder Program Design Procedures
Input ON.
c
Confirm that the contact changes to blue.
c
Confirm that the coil changes to blue.
c
Confirm that the contact changes to blue.
Input ON.
d
Confirm that the register is ON.
3.1.8 Checking the Operation of the Ladder Programs
( 2 ) Confirming the Operation of the 0000th Line (AND Circuit)
1.Set MB000000 to ON in the Register List. Confirm that the NO contact for MB000000 in the Ladder
Editor changes to blue.
When a coil or contact is highlighted in blue, it means that it is ON.
2.Set MB000001 to ON in the Register List. Confirm the following points.
• In the Ladder Editor, the NO contact for MB000001 and coil for MB000010 must be blue.
• In the Register List, MB000010 must be ON.
If no problems occur in the above procedure, then this concludes checking the operation of the 0000th line.
3-12
3.1.8 Checking the Operation of the Ladder Programs
Ladder Program Development Flow
3
( 3 ) Confirming the Operation of the 0001st Line (Timer Circuit)
Set MB000002 to ON in the Register List. Confirm the following points.
c The DW00000 timer must increment every second.
Confirm that the value
c
increments every second.
3.1 Ladder Program Design Procedures
Input ON.
dAfter five seconds, the coil for MB000011 must turn blue in the Ladder Editor.
eIn the Register List, MB000011 must be ON for step d.
Confirm that the coil changes to blue.
d
If no problems occur in the above procedure, then this concludes checking the operation of the 0001st line.
Confirm that the register is ON.
e
3-13
3.1 Ladder Program Design Procedures
3.1.9 Saving the Ladder Programs to Flash Memory
3.1.9 Saving the Ladder Programs to Flash Memory
Use the following procedure to save the data from the RAM in the MP2000-series Machine Controller to the flash
memory in the MP2000-series Machine Controller.
1.Select Transfer − Save to flash from the following window.
2.Click the Start Button.
3.Click the CPU STOP Button. The transfer will start.
4.Click the Yes Button in the following dialog box. The Machine Controller will switch to RUN Mode.
3-14
Programming
4
4
Programming
This chapter describes ladder programming methods and the elements that are necessary for ladder
programming.
Ladder PaneVariables PaneLadder Program Editing Tab Page
4.1 Ladder Program Editor
On the MPE720 version 6 Engineering Tool, the following panes are displayed to edit a ladder program. These
panes are used to create and edit ladder programs.
Ladder Pane
Ladder programs are displayed by drawing.
Refer to 4.2 Ladder Drawings for details on drawings.
Ladder Program Editing Tab Page
This tab page is used to edit ladder programs.
Variables Pane
This pane displays variables. Refer to 4.4 Registers (Variables) for details on variables.
In addition to the panes and tab page that were just described, various other panes, tab pages, and tool bars
also exist.
Refer to the Engineering Tool for MP2000 Series Machine Controller MPE720 Version 6 User’s Manual
(SIEP C880700 30) for details on MPE720 version 6.
4-2
Programming
4
4.2 Ladder Drawings
Ladder programs are managed as drawings (ladder drawings) that are identified by their drawing numbers (DWG
numbers).
The ladder drawings form the basis of the ladder programs.
4.2.1 Types of Ladder Drawings
( 1 ) Types and Priorities of Drawings
There are the following types of ladder drawings: parent drawings, child drawings, grandchild drawings, and operation
error drawings.
• Parent Drawings
These drawings are automatically executed by the system when the execution conditions that are listed in the following table are met.
• Child Drawings
These drawings are executed when they are called from a parent drawing with a Call Program (SEE) instruction.
• Grandchild Drawings
These drawings are executed when they are called from a child drawing with a Call Program (SEE) instruction.
• Operation Error Drawings
These drawings are automatically executed by the system when an operation error occurs.
There are also five different types of drawings based on their role.
The following table gives the priority and parent drawing execution conditions for each type of drawing.
Parent drawing type (A, I, H, or L)
of the drawing where the error occurs
Drawing name:
The following notation is used for operation error drawings.
A
Parent
drawing
A01A01.01
A01.02
A02A02.01
Child
drawings
Grandchild
drawings
Functions
FUNC01
FUNC02
FUNC03
Fixed value (00)
4.2.1 Types of Ladder Drawings
( 2 ) Hierarchical Configuration of Drawings
Each process program is organized in a parent-child-grandchild hierarchy.
The parent drawing first must call a child drawing, and then the child drawing must call a grandchild drawing. This is
called the hierarchical configuration of drawings.
A parent drawing cannot call a child drawing with a different drawing type. Similarly, a child drawing cannot call a
grandchild drawing from a different drawing type. A parent drawing cannot call a grandchild drawing directly.
You can call functions from any drawing regardless of the drawing type or hierarchy.
The hierarchy of drawings is shown below using DWG.A drawings as an example.
4-4
Programming
4
4.2.2 Controlling the Execution of Drawings
Power ON
DWG.A
Startup drawing
DWG.H
High-speed scan
process drawings
DWG.L
Low-speed scan
process drawings
Every high-speed scan
Batch outputsBatch outputs
Batch inputsBatch inputs
Every low-speed scan
Operation errorInterrupt signal
DWG.X00
Operation error drawing
X: A, H, or L
Execution is continued from
the point before the error.
DWG.I
Interrupt process drawing
Execution is continued
from the point before
the interrupt.
Background*
DWG.L
DWG.H
High-speed scan High-speed scan
Low-speed scan
High-speed scan High-speed scan
: Execution in progress
( 1 ) Controlling the Execution of Drawings
Drawings are executed based on their priorities, as shown in the following figure.
4.2 Ladder Drawings
4.2.2 Controlling the Execution of Drawings
The parent drawing of each drawing is automatically called and executed by the system.
( 2 ) Scheduling the Execution of Scan Process Drawings
All scan process drawings are not executed at the same time. The following figure shows how execution time is allocated to them based on their priority levels.
∗ This time is used to execute internal system processing, such as self-diagnosis.
The low-speed scan is executed during the time that is not used by the high-speed scans. Set the time of the high-speed
scan to approximately twice the total execution time of the high-speed drawings (DWG.H).
4-5
4.2 Ladder Drawings
Execution is started by the system program
when the execution condition is met.
Parent Drawing
H
H01
H02
H00
H01.01
FUNC 01
Child DrawingsGrandchild Drawings
Function
Execution is
automatically
started by the
system.
An operation
error occurs.
SEE
H01
SEE
H02
END
END
END
END
END
END
SEE
H01.H01
FUNC
01
4.2.2 Controlling the Execution of Drawings
( 3 ) Execution Processing of Drawings
The execution processing for drawings is executed by calling the drawings from the top to the bottom, following the
hierarchy of the drawings. The hierarchy of drawings is shown below using DWG.A drawings as an example.
The parent drawing is automatically called and executed by the system.
Child drawings and grandchild drawings are executed by calling them from a parent drawing or a child drawing using
the Call Program (SEE) instruction.
You can call functions from any drawing. You can also call functions from other functions.
4-6
If an operation error occurs, the operation error drawing for the drawing type will be started automatically.
Programming
4
4.3 User Functions
Program Number
Function Input Definition
• Number of inputs
• Data type
• Comments
Function Input Definition
• Number of inputs
• Data types
• Comments
Function Address Definition
• Presence of definition
• Comments
IMPORTANT
4.3.1 What Is a User Function?
( 1 ) Overview of User Functions
A user function contains a function definition (program number and I/O definitions) and processing instructions that
are defined by the user.
The following figure shows an example of a function definition.
4.3 User Functions
4.3.1 What Is a User Function?
The processing to be performed by a function is created using a ladder program.
Functions are executed when they are called from a parent, child, or grandchild drawing with the FUNC instruction.
You can call a user function freely from any drawing. You can also simultaneously call the same function from different types or different levels of drawings. You can also call user functions from other user functions.
The use of functions provides the following advantages.
• Easy user program modularization
• Easy user programming and program maintenance
User functions can be called from any programs, any number of times.
When you call a user function, consider what values could be in the variables in each function, and perform
initialization as needed.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
4-7
4.3 User Functions
XB000000 to XB00000F
XW00001
XW00002
XW00003
XW00015
XW00016
YB000000 to YB00000F
YW00001
YW00002
YW00003
YW00015
YW00016
X Registers
(Function Input Registers)
Y Registers
(Function Output Registers)
Z Registers# RegistersD Registers
AW00000
AW00001
AW00002
AW00003
A Registers
(Function External Registers)
MW00100
MW00101
MW00102
MW00103
Address Inputs
MA00100
Registers within a User Function
Bit data inputs
(16 bits max.)
Data inputs
• Word data
• Long data
• Float data
(16 words max.)
Bit data outputs
(16 bits max.)
Data outputs
• Word data
• Long data
• Float data
(16 words max.)
IMPORTANT
INFO
4.3.1 What Is a User Function?
( 2 ) Relationship between I/O Data for a Function and Registers in the Function
The X, Y, Z, and D registers are initialized to different values when a function is called.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
4-8
The S, M, I, O, and C registers can also be accessed from within a function.
Programming
4
4.3.2 Creating User Functions
Select.
Enter “FUNC01.”
This section describes how to create a user function that has, as an example, the following specifications.
Function Definition ItemNameRemarks
Program NumberFUNC01
Function Input ValueINInteger data
Function Output Value 1OUT1Integer data
Function Output Value 2OUT2Integer data
Processing Details
Multiply the function input value (IN) by 2 and output it to function output value 1 (OUT1).
Multiply the function input value (IN) by 3 and output it to function output value 2 (OUT2).
Procedure to Create a User Function
1.In the pane on the left, expand the tree under Ladder program. Right-click Function and select New
from the menu.
4.3 User Functions
4.3.2 Creating User Functions
2.Enter “FUNC01” in the Program No. Box.
4-9
4.3 User Functions
Enter.
4.3.2 Creating User Functions
3.Select Function input definition under I/O definition and enter the following information.
4.Select Function output definition under I/O definition and enter the following information.
Enter.
5.Click the OK Button. This concludes setting the function definition.
Click.
4-10
4.3 User Functions
Programming
4
4.3.2 Creating User Functions
6.Create the following ladder program in the drawing of the FUNC01 user function that was created in
step 5.
7.Compile the user function to conclude the creation of the user function.
4-11
4.3 User Functions
Input defined in
the user function
Output defined in
the user function
Program number of
the user function to call
XB000000 to XB00000F
XW00001
XW00002
XW00016
YB000000 to YB00000F
YW00003
YW00016
X Registers
(Function Input Registers)
Y Registers
(Function Output Registers)
Registers within the FUNC01 User Function
DW00001
Values that are setUndefined values
DW00002
YW00001
YW00002
DW00000
×2
×3
INOUT1
OUT2
4.3.3 Calling a User Function
4.3.3 Calling a User Function
You can call a user function by using a FUNC instruction in the ladder drawing.
This section describes how to call the user function that was created in the previous section from the high-speed drawing (DWG.H).
Example for Calling the FUNC01 User Function from DWG.H
Program a FUNC instruction in DWG.H as shown below.
This diagram shows a conceptual image of what the programming shown above accomplishes.
In this example, when DW00000 in DWG.H is set to 10, DW00001 becomes 20 and DW00002 becomes 30, demonstrating that the user function was called correctly.
4-12
Programming
4
4.4 Registers (Variables)
Ladder programsUser functions
Motion programs/
sequence programs
S registers
8,192 words
M registers
65,535 words
I registers
32,768 words +
Monitor parameters
O registers
32,768 words +
Setting parameters
C registers
16,384 words
Global Registers
4.4.1 What Are Registers?
Registers are areas that store data within the Machine Controller. Variables are registers with labels (variable names).
There are two kinds of registers: global registers that are shared between all programs, and local registers that are used
only by a specific program.
( 1 ) Global Registers
Global registers are variables that are shared by ladder programs, user functions, motion programs, and sequence programs. Memory space for global registers is reserved by the system for each register type.
4.4 Registers (Variables)
4.4.1 What Are Registers?
( 2 ) Local Registers
Local registers can be used within a specific drawing. They cannot be used in other drawings.
Parent drawing
H
# registers
D registers
Child drawing
H01
# registers
D registers
Local Registers
User function
X registers
Y registers
Z registers
# registers
D registers
FUNC01
User function
FUNC02
X registers
Y registers
Z registers
# registers
D registers
4-13
4.4 Registers (Variables)
4.4.2 Register Types
4.4.2 Register Types
( 1 ) Global Registers
Global registers are variables that are shared by ladder programs, user functions, motion programs, and sequence programs. In other words, the operation results of a ladder program can be used by other user functions, motion programs,
or sequence programs.
Typ eName
System registers
S
(S registers)
Data registers
M
(M registers)
Input registers
I
(I registers)
Output registers
O
(O registers)
Constant registers
C
(C registers)
Designation
Method
SBnnnnnh,
SWnnnnn,
SLnnnnn,
SFnnnnn,
SAnnnnn
MBnnnnnh,
MWnnnnn,
MLnnnnn,
MFnnnnn,
MAnnnnn
IBhhhhh, IWhhhh, ILhhhh,
IFhhhh
OBhhhhh, OWhhhh, OLhhhh,
OFhhhh
CBnnnnnh,
CWnnnnn,
CLnnnnn,
CFnnnnn,
CAnnnnn
Usable RangeDescription
These registers are prepared by the system. They report the
SW00000 to
SW08191
MW00000 to
MW65534
IW0000 to
IW7FFF
IW8000 to
IWFFFF
OW0000 to
OW0FFF
OW8000 to
OWFFFF
CW00000 to
CW16383
status of the Machine Controller and other information.
The system clears the registers from SW00000 to
SW00049 to 0 at startup.
They have a battery backup.
These registers are used as interfaces between programs.
They have a battery backup.
These registers are used for input data.
These registers store the motion monitor parameters.
These registers are used for Motion Modules.
These registers are used for output data.
These registers store the motion setting parameters.
These registers are used for Motion Modules.
These registers can be read in programs but they cannot be
written.
The values are set from the MPE720.
n: decimal digit, h: hexadecimal digit
4-14
4.4 Registers (Variables)
Programming
4
IMPORTANT
4.4.2 Register Types
( 2 ) Local Registers
Local registers are valid within only one specific program. The local registers in other programs cannot be accessed.
You specify the usable range of local registers from the MPE720.
TypeNameDesignation MethodDescription
#Bnnnnnh, #Wnnnn,
## registers
DD registers
n: decimal digit, h: hexadecimal digit
#Lnnnnn, #Fnnnnn,
#Annnnn
DBnnnnnh, DWnnnn,
DLnnnnn, DFnnnnn,
DAnnnnn
These registers can be read in programs but they cannot be written. The values are set from the MPE720.
These registers can be used for general purposes within a program.
By default, 32 words are reserved for each program.
The default values after startup depend on the setting of the D
Register Clear when Start Option. For details, refer to Setting
the D Register Clear When Start Option.
Local Registers within a User Function
In addition to the # registers and D registers, there are local registers that can be used only within user functions.
TypeNameDesignation MethodDescription
These registers are used for inputs to functions.
Bit inputs: XB000000 to XB00000F
Integer inputs: XW00001 to XW00016
Double-length integers: XL00001 to XL00015
Real numbers: XF00001 to XF00015
These registers are used for outputs from functions.
Bit outputs: YB000000 to YB00000F
Integer outputs: YW00001 to YW00016
Double-length integers: YL00001 to YL00015
Real numbers: YF00001 to YF00015
These are internal registers that are unique within each function.
You can use them for internal processing in functions.
These are external registers that use the address input values as the
base addresses.
When the address input value of an M or D register is provided by
the source of the function call, then the registers of the source of
the function call can be accessed from inside the function by using
that address as the base.
XFunction input registers
Function output
Y
registers
Function internal
Z
registers
Function external
A
registers
XBnnnnnh, XWnnnnn,
XLnnnnn, XFnnnnn
YBnnnnnh, YWnnnnn,
YLnnnnn, YFnnnnn
ZBnnnnnh, ZWnnnnn,
ZLnnnnn, ZFnnnnn
ABnnnnnh, AWnnnnn,
ALnnnnn, AFnnnnn
n: decimal digit, h: hexadecimal digit
User functions can be called from any programs, any number of times.
When you call a user function, consider what values could be in the local registers, and perform initialization
as needed.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
4-15
4.4 Registers (Variables)
4.4.2 Register Types
( 3 ) Precautions When Using Local Registers within a User Function
When you call a user function, consider what values should be in the local registers, and perform initialization as
needed.
NamePrecaution
X registers (function
input registers)
Y registers (function output registers)
Z registers (function
internal registers)
# registersThese are constant registers. Their values cannot be changed.
D registers
If input values are not set, the values will be uncertain.
Do not use X registers that are outside of the range that is specified in the input definitions.
If output values are not set, the values will be uncertain.
Always set the values of the range of Y registers that is specified in the output definitions.
When the function is called, the previously set values will be lost and the values will be uncertain.
These registers are not appropriate for instructions if the previous value must be retained.
Use them only after initializing them within the function.
When the function is called, the previously set values are preserved.
If a previous value is not necessary, initialize the value or use a Z register instead. D registers retain
the data until the power is turned OFF.
The default values after startup depend on the setting of the D Register Clear when Start Option. For
details, refer to Setting the D Register Clear When Start Option.
Setting the D Register Clear When Start Option
1.Select File − Environment Setting from the MPE720 Version 6 Window.
2.Select Setup − System Setting.
3.Select Enable or Disable for the D Register Clear when Start Option.
Set Values
Disable: The initial values will be uncertain.
Enable: The initial values will be 0.
4-16
Programming
4
4.4.3 Data Types
IMPORTANT
( 1 ) List of Data Types
There are various data types that you can use depending on the purpose of the application: bit, integer, double-length
integer, real number, and address.
SymbolData TypeRange of ValuesRemarks
BBit1 (ON) or 0 (OFF)Used in relay circuits and to determine ON/OFF status.
WInteger-32,768 to 32,767 (8000 to 7FFF hex)
Double-length
L
integer
Single-preci-
F
sion real number
AAddress0 to 32,767Used only as pointers for addressing.
The MP3000-series Machine Controllers do not have separate registers for each data type. As shown in the following figure, the same address will access the same register even if the data type is different.
For example, MB001003, a bit address, and the MW00100, an integer address, have different data types, but
they both access the same register, MW00100.
Used for numeric operations. The values in parentheses on
the left are for logical operations.
-2,147,483,648 to 2,147,483,647
(80000000 to 7FFFFFFF hex)
±(1.175E-38 to 3.402E+38) or 0Used for numeric operations.
Used for numeric operations. The values in parentheses on
the left are for logical operations.
4.4 Registers (Variables)
4.4.3 Data Types
Data Types and Register Designations
One word is allocated for each register address.
Integer data type
Address data type
MA00101
A continuous data area is addressed,
with the specified register address
(00101) as the first address.
MW00100
MW00101
MW00102
MW00103
[MB00103B]
An extra digit that specifies the bit (3) is appended
to the end of the register address (00100).
MB001003
Bit data type
0123456789ABCDEF
Double-length integer or
The addressed register (00102) and the
following register (00103) are combined
as a 2-word area. Therefore the register
addresses are specified at intervals of 2.
Bit data type
ML00100
MF00100
ML00102
MF00102
real number data type
4-17
4.4 Registers (Variables)
4.4.3 Data Types
( 2 ) Precautions for Operations Using Different Data Types
If you perform an operation using different data types, the results will be different depending on the data type of the
storage register, as described below.
[ a ] Storing Real Number Data in an Integer Register
MW00100 = MF00200: The real number data is converted to integer data and stored in the destination register.
(00001) (1.234)
There may be rounding error due to storing a real number in an integer register.
Whether numbers are rounded or truncated when converting a real number to an integer can be set in the properties
of the drawing. (See below.)
MW00100 = MF00200 + MF00202:
(0124) (123.48) (0.02) The result of the operation may be different depending on the value of the variable.
(0123) (123.49) (0.01)
[ b ] Storing Real Number Data in a Double-length Integer Register
ML00100 = MF00200: The real number data is converted to integer data and stored in the destination register.
(65432) (65432.1)
[ c ] Storing Double-length Integer Data in an Integer Register
MW00100 = ML00200: The lower 16 bits of the double-length integer data are stored without change.
(-00001) (65535)
[ d ] Storing Integer Data in a Double-length Integer Register
ML00100 = MW00200: The integer data is converted to double-length integer data and stored in the destination register.
(0001234) (1234)
Setting for Real Number Casting
The casting method (truncating or rounding) can be set in the detailed definitions in the Program Property Dialog Box.
The method to use for real number casting is set for each drawing.
4-18
Programming
4
4.4.4 Index Registers (i, j)
If i = 2,
DB000000 = MB00000i.
DB000000 = MB00002
Using an index is the same as adding
the value of i or j to the register address.
For example, if i = 2, MB00000i is
the same as MB00002.
Equivalent
If i = 30,
DW000000 = MW00001i.
DW000000 = MW00031
Using an index is the same as adding
the value of i or j to the register address.
For example, if i = 30, MW00001i is
the same as MW00031.
Equivalent
There are two index registers, i and j, that are used to modify relay and register addresses. The functions of i and j are
identical.
There are index registers for each program type, as shown in the following figure.
4.4 Registers (Variables)
4.4.4 Index Registers (i, j)
DWG.A
i and j registers
DWG.HDWG.L
i and j registersi and j registersi and j registers
∗ Motion programs and sequence programs have separate i and j registers for each task.
Functions reference the i and j registers that belong to the calling drawing.
For example, a function called by DWG.H will reference the i and j registers for DWG.H.
The operation for each register data type is described next.
[ a ] Attaching an Index to a Bit Register
[ b ] Attaching an Index to an Integer Register
DWG.I
i and j registers
Motion
program*
Sequence
program*
i and j registers
[ c ] Attaching an Index to a Double-length Integer or a Real Number Register
Double-length Integer
If j = 0, ML00000j is ML00000.
If j = 1, ML00000j is ML00001.
Real Number
If j = 0, MF00000j is MF00000.
If j = 1, MF00000j is MF00001.
Upper word
MW00001
MW00002MW00001
Upper word
MW00001
MW00002MW00001
Lower word
MW00000
Lower word
MW00000
Using an index is the same as adding the value of i or
j to the register address.
For example, if j = 1, ML00000j is the same as ML00001.
Similarly, if j = 1, MF00000j is the same as MF00001.
In the case of double-length integers and real numbers, the
one-word area of the register address and the one-word
area of the register address + 1 are used together. Be
careful of overlapping areas when indexing
double-length integer or real number register
addresses. For example, when using ML00000j with
both j = 0 and j = 1, the one-word area of MW00001 will
overlap.
4-19
4.4 Registers (Variables)
4.4.4 Index Registers (i, j)
A programming example that uses indexed registers is shown below.
This example uses index j to find the total of the values in 50 registers from ML00100 to ML00198.
4-20
Programming
4
4.5 Table Data
Data
Table data
Read Queue Table Instruction
Registers
Write Queue Table Instruction
TBL1
Creating Table Data
Set the table
definition information.
Set the column attributes.
End of Creating Table Data
Table Definition
Information
Description
Table NameThis is the name of the table.
Table TypeSelect an array-type or record-type table.
Number of Columns This is the number of columns in the table.
(10,000 columns max.)
Number of RowsThis is the number of rows in the table. (10,000 rows max.)
Table CommentThis is a comment for the table.
Table Data
Storage Location
Column AttributeDescription
Column NameThis is the name of the column.
Data Type
The data type can be integer, double-length integer, real
number, or text string.
SizeThis is the length of the data type.
Display Type
The display type can be binary, decimal, hexadecimal,
real number, or text string.
Column Comment This is a comment for the column.
Select normal or battery backup.
Refer to 2.1.2 Machine Controller Program Specifications
for details on the maximum size of tables and
which models have battery backup storage.
INFO
4.5.1 What Is Table Data?
Table data is data that is managed in tabular form. The data is stored separately from the registers.
Data can be copied from a table to registers or from registers to a table by executing table data manipulation instructions in the ladder program. Tables can also be used to hold data when there is not a sufficient range of registers.
4.5 Table Data
4.5.1 What Is Table Data?
4.5.2 Creating Table Data
Use the following procedure to create table data. The table definition information and column attributes that are set for
table data are listed in the following table.
You can select one of the following table types when you create table data.
• Array type: Specifies a table where all columns have the same attributes.
• Record type: Specifies a table where each column has a different attribute.
You can select one of the following table data storage locations.
• Normal: Refer to 2.1.2 Machine Controller Program Specifications for the maximum program size. The maximum size per
• Battery backup: Refer to 2.1.2 Machine Controller Program Specifications for the maximum size of table data that can be
table is 5 MB.
backed up with the battery. The maximum size per table is 3 MB.
4-21
4.5 Table Data
INFO
4.5.2 Creating Table Data
Procedure to Create Table Data
1.Select File - Open − Define Data Table − Data Table Map in the Module Configuration Definitions
Window. The Table Data Store Target Dialog Box will be displayed.
2.Select File − Create New from the menu bar. The Table Definition Dialog Box will be displayed. Set the
table definition information and click the OK Button.
3.The Data Table Column Attribute Dialog Box will be displayed. Set the table data column attributes,
and then save them.
If the table is set to an array-type table, set only one row of column attributes.
The Table Data Store Target Dialog Box that was displayed in step 1 will show the table that you created.
This concludes the creation of the data table.
4-22
When a table is created, the contents are initialized to 0.
Select the table that was created in the Table Data Store Target Dialog Box, and click the Tabl e D a t a Button to read or write
table data.
Use the table instructions to perform operations on the table data from a ladder program.
Programming
4
4.6 Transferring Data
IMPORTANT
You can perform one of the four operations that are shown in the following figure to transfer data.
4.6 Transferring Data
Hard disk in PC
Data can be read from
e
and written to projects.
MPE720 version 6
Project
Project
Data can be written to
c
the Machine Controller.
Data can be read from
d
the Machine Controller.
Data can be saved
f
to flash memory.
MP2000-series
Machine Controller
Flash memory
c Writing Data to a Machine Controller
You can transfer the project data that was created offline to RAM in the Machine Controller.
d Reading Data from the Machine Controller.
You can transfer data from the Machine Controller to a project on the hard disk of the PC.
RAM
e Reading Data from and Writing Data to Projects
You can transfer data between projects on the hard disk of the PC.
f Saving Data to Flash Memory
You can transfer the data in RAM in the Machine Controller to flash memory.
Always save the data to flash memory after you transfer it to the MP2000-series Machine Controller.
Failure to save the data to flash memory will result in losing the data that was transferred when the power is
turned OFF and ON again, causing the Machine Controller to run on the data that was last saved in the flash
memory.
4-23
4.7 Setting the High-speed/Low-speed Scan Times
4.7 Setting the High-speed/Low-speed Scan Times
( 1 ) What Are the Scan Times?
With an MP2000-series Machine Controller, both the high-speed scan and low-speed scan can be set. The high-speed
scan time is the cycle at which high-speed drawings are executed. The low-speed scan time is the cycle at which lowspeed drawings are executed. The following table shows the possible set values and default values for each scan time.
ItemPossible Set ValuesDefault
High-speed Scan Time0.5 to 32 ms (in 0.5-ms increments)10.0 ms
Low-speed Scan Time2.0 to 300.0 ms (in 0.5-ms increments)200.0 ms
The possible set values and default values depend on the model. Refer to the user’s manual for the Module you are
using for details.
( 2 ) Scan Time Set Value Precautions
Observe the following precautions when setting the high-speed scan time and low-speed scan time.
• Set the scan set value so that it is 1.25 times greater than the maximum value.
If the scan set value is too close to the maximum value, the refresh rate of the MPE720 window will noticeably
drop and can cause communications timeout errors to occur. If the maximum value exceeds the scan set
value, a watchdog error may occur and cause the Machine Controller system to shut down.
• If you are using MECHATROLINK-II or MECHATROLINK-III, set values that are an integral multiple of the
communications cycle. If you change the communications cycle, check the scan time set values.
• Do not change the scan set value while the Servo is ON. Never change the scan set values while an axis is in
motion (i.e., while the motor is rotating). Doing so may cause the motor to rotate out of control.
• After changing or setting the scan times, make sure to save the data to flash memory.
( 3 ) Checking and Setting the Scan Times
You can check the current and maximum values of the scan times and the set values of the scan times, and you can set
the scan times in the following dialog box of MPE720 Version 6.0.
You can call motion programs
without a ladder program.
Called.
Called.
You can call up
to 16 programs
at the same time.
Motion parameters
You can create up
to 256 programs.
SVR
Built-in
SVB
SVB-01
SVA-01
PO-01
4.8.1 Motion Programs
A motion program is written in a text-based motion language. In addition to basic motion control and operations,
motion programs can also be used to easily program complex movements, such as linear interpolation and circular
interpolation.
You can execute motion programs either by placing MSEE instructions in ladder programming in high-speed drawings,
or by registering the motion programs in the Program Definition Tab Page for the M-EXECUTOR.
4.8 Advanced Programming
4.8.1 Motion Programs
For details on motion programs, refer to the Machine Controller MP2000 Series User’s Manual for Motion Programming (Manual No.: SIEP C880700 38).
4-25
4.8 Advanced Programming
4.8.2 C-language Programs
4.8.2 C-language Programs
You can use the MP2000-series Machine Controller Embedded C-language Programming Package to use C-language
functions and C-language tasks in addition to ladder programs and motion programs.
You can call C-language functions and start and stop C-language tasks from the ladder programs.
The following configuration is for using C-language programming.
MP2000
Ladder language
Function called.
C-language
function
User-defined
C-language task A
Task started and stopped.
Function called.
Task started and stopped.
Motion language
Can be accessed
from
ladder-language
or C-language
programming.
Table data
Global variables
Can be accessed only from
C-language programming.
External signal
Registers
Can be accessed
from
ladder-language,
motion-language,
or C-language
programming.
User-defined
C-language task B
Local task made dormant.
Automatically started
at start of H or L scan.
For details on C-language programming, refer to the Machine Controller MP2000 Series Embedded C-Language Programming Package Development Guide (Manual No.: SIEP C880700 25).
4-26
Programming
4
4.8.3 Security
MPE720 version 6 has the following security features. You can use these security features for data protection by specifying access privileges for individual projects and program drawings.
User Administration (User Name and Password Setting)
You can register and change the name of the users who can open projects.
If the setting is performed while the Machine Controller is online, the setting will provide access privileges to the
Machine Controller.
Project Password Setting
You can set a password for opening a project file.
Program Password Setting
You can set a password for opening ladder programs and motion programs. A password can be set for each program.
4.8 Advanced Programming
4.8.3 Security
Online Security Setting
You can set a security key (i.e., a password) and privilege levels for reading data from a Machine Controller. This
allows you to restrict the ability to read the program data from the Machine Controller or the ability to open the programs to users who have the specified level of privilege or a higher privilege.
Refer to the Engineering Tool for MP2000 Series Machine Controller MPE720 Version 6 User’s Manual (SIEP
C880700 30) for detailed setting procedures for security.
4-27
4.8 Advanced Programming
4.8.4 Tracing
4.8.4 Tracing
MPE720 version 6 has three trace modes.
Realtime Tracing
You can monitor specified registers on a graph in real time.
Data Tracing
You can have the Machine Controller collect data for specified registers during a specified time period, and perform
operations on that data and plot it on a graph.
This allows you to analyze register data that is acquired during specific time periods to debug ladder programs.
XY Tracing
This trace mode acquires the position data of the X axis and Y axis every scan, and displays the data in a 2-dimensional
graph.
All three modes support exporting the trace data to CSV files.
Use tracing to check operation and to debug the ladder programs and motion programs.
Data Tracing Display Example
4-28
Refer to the Engineering Tool for MP2000 Series Machine Controller MPE720 Version 6 User’s Manual (SIEP
C880700 30) for detailed setting procedures for tracing.
Instructions
5
5
Instructions
This chapter describes the ladder programming instructions in detail.
This chapter describes each instruction using the following format.
( 1 ) Operation
The operation performed by the instruction is described.
Figures are used to show the operation performed by the instruction.
( 2 ) Format
This area shows how the instruction
appears in a ladder program.
Icon:
Shows the icon used in the MPE720.
Key entry:
Shows the shortcut key combination
used in the Ladder Editor.
Parameter Name
The name of the parameter
that appears in the ladder
programs is given.
BWLFAIndexConstant
×
{{{
Applicable Data Types
×
{{
×: This data type cannot be used.
{: All registers with this data type can be used.
( 3 ) Programming Example
This section gives a ladder programming example that uses the instruction.
( 4 ) Additional Information
This section contains additional information about the instruction. It is omitted if there is no additional information that
is required for the instruction.
5-4
Instructions
5
5.2 Relay Circuit Instructions
1 (ON)
0 (OFF)
ON
OFF
Output of the NOC instruction
Relay address
Bit
Relay address
Icon:
Key entry: ][
5.2.1 NO Contact (NOC)
( 1 ) Operation
The NOC instruction outputs ON whenever the bit with the specified relay address is 1 (ON).
The NOC instruction outputs OFF when the bit is 0 (OFF).
( 2 ) Format
5.2 Relay Circuit Instructions
5.2.1 NO Contact (NOC)
Parameter Name
Relay address
BWLFAIndexConstant
{
ЧЧЧЧЧЧ
Applicable Data Types
( 3 ) Programming Example
The DB000001 output coil is ON whenever the DB000000 relay in the NOC instruction is ON.
5-5
5.2 Relay Circuit Instructions
Relay address
Icon:
Key entry: ]/
5.2.2 NC Contact (NCC)
5.2.2 NC Contact (NCC)
( 1 ) Operation
The NCC instruction outputs OFF whenever the bit with the specified relay address is 1 (ON).
The NCC instruction outputs ON when the bit is 0 (OFF).
Relay address
Output of the NCC instruction
( 2 ) Format
Bit
1 (ON)
0 (OFF)
ON
OFF
Parameter Name
Relay address{ЧЧЧЧЧЧ
BWLFAIndexConstant
Applicable Data Types
( 3 ) Programming Example
The DB000001 coil is ON whenever the DB000000 relay in the NCC instruction is OFF.
5-6
Instructions
5
5.2.3 10-ms ON-Delay Timer (TON[10ms])
Icon:
Key entry: [ON
Set value
Count value
( 1 ) Operation
The timer counts the time whenever the timer bit input is 1 (ON). The bit output is set to 1 (ON) when the count value
equals the set value.
If the bit input changes to 0 (OFF) during counting, the timer will stop counting. If the bit input changes to 1 (ON)
again, the timer starts counting again from the beginning (i.e., from 0). The actual counted time (in units of 10 ms) is
stored in the Count register.
5.2 Relay Circuit Instructions
5.2.3 10-ms ON-Delay Timer (TON[10ms])
The counting error is 10 ms or less.
( 2 ) Format
Bit input →
Bit input
Bit output
Set value
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
0
Timer
→ Bit output
The set value and count value are in units of 10 ms.
Count value
Parameter Name
Set value (Set)
Count value (Count)
∗ C and # registers cannot be used.
Applicable Data Types
BWLFAIndexConstant
×
×
{
{*
ЧЧЧЧ
ЧЧЧЧЧ
{
5-7
5.2 Relay Circuit Instructions
DB000000
DB000001
ON
OFF
ON
OFF
DW00001500
500 ms - Ts
(Ts: Scan time set value)
5.2.3 10-ms ON-Delay Timer (TON[10ms])
( 3 ) Programming Example
In the following programming example, the set value of the TON instruction is 50, and the count value is stored in the
DW00001 register.
The DB000001 coil will turn ON after the DB000000 relay stays ON for 500 ms.
The timing chart is shown below.
5-8
Instructions
5
5.2.4 10-ms OFF-Delay Timer (TOFF[10ms])
Bit input
Count value
Set value
0
Bit output
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
Timer
Bit input →
The set value and count value are in units of 10 ms.
→ Bit output
Set value
Count value
Icon:
Key entry: [OFF
( 1 ) Operation
The timer counts the time whenever the timer bit input is 0 (OFF). The bit output is set to 0 (OFF) when the count value
equals the set value.
If the bit input changes to 0 (OFF) during counting, the timer will stop counting. If the bit input changes to 1 (ON)
again, the timer starts counting again from the beginning (i.e., from 0). The actual counted time (in units of 10 ms) is
stored in the Count register.
5.2 Relay Circuit Instructions
5.2.4 10-ms OFF-Delay Timer (TOFF[10ms])
The counting error is 10 ms or less.
( 2 ) Format
Parameter Name
Set value (Set)
Count value (Count)
∗ C and # registers cannot be used.
BWLFAIndexConstant
×
×
{
{*
Applicable Data Types
ЧЧЧЧ
ЧЧЧЧЧ
{
5-9
5.2 Relay Circuit Instructions
5.2.4 10-ms OFF-Delay Timer (TOFF[10ms])
( 3 ) Programming Example
In the following programming example, the set value of the TOFF instruction is 50, and the count value is stored in the
DW00001 register.
The DB000001 coil will turn OFF after the DB000000 relay stays OFF for 500 ms.
The timing chart is shown below.
DB000000
DB000001
DW00001500
ON
OFF
ON
OFF
500 ms - Ts
(Ts: Scan time set value)
5-10
Instructions
5
5.2.5 1-s ON-Delay Timer (TON[1s])
( 1 ) Operation
The timer counts the time whenever the timer bit input is 1 (ON). The bit output is set to 1 (ON) when the count value
equals the set value.
If the bit input changes to 0 (OFF) during counting, the timer will stop counting. If the bit input changes to 1 (ON)
again, the timer starts counting again from the beginning (i.e., from 0). The actual counted time (in units of 1 s) is
stored in the Count register.
5.2 Relay Circuit Instructions
5.2.5 1-s ON-Delay Timer (TON[1s])
The counting error is 1 s or less.
( 2 ) Format
Bit input
Bit output
Bit input →
Set value
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
0
Timer
→ Bit output
The set value and count value are in units of 1 s.
Count value
Icon:
Parameter Name
Set value (Set)
Count value (Count)
∗ C and # registers cannot be used.
BWLFAIndexConstant
×
×
{
{*
Set value
Count value
Applicable Data Types
ЧЧЧЧ
ЧЧЧЧЧ
Key entry: [SON
{
5-11
5.2 Relay Circuit Instructions
DB000000
DB000001
ON
OFF
ON
OFF
DW0000150
5 s - Ts
(Ts: Scan time set value)
5.2.5 1-s ON-Delay Timer (TON[1s])
( 3 ) Programming Example
In the following programming example, the set value of the TON instruction is 5, and the count value is stored in the
DW00001 register.
The DB000001 coil will turn ON after the DB000000 relay stays ON for 5 s.
The timing chart is shown below.
5-12
Instructions
5
5.2.6 1-s OFF-Delay Timer (TOFF[1s])
( 1 ) Operation
The timer counts the time whenever the timer bit input is 0 (OFF). The bit output is set to 1 (ON) when the count value
equals the set value.
If the bit input changes to 0 (OFF) during counting, the timer will stop counting. If the bit input changes to 1 (ON)
again, the timer starts counting again from the beginning (i.e., from 0). The actual counted time (in units of 1 s) is
stored in the Count register.
5.2 Relay Circuit Instructions
5.2.6 1-s OFF-Delay Timer (TOFF[1s])
The counting error is 1 s or less.
( 2 ) Format
Bit input
Bit output
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
TimerBit input →
Set value
→ Bit output
The set value and count value are in units of 1 s.
Count value
0
Icon:
Set value
Count value
Parameter Name
Set value (Set)×{××××{
Count value (Count)×{*ЧЧЧЧЧ
∗ C and # registers cannot be used.
BWLFAIndexConstant
Applicable Data Types
Key entry: [SOFF
5-13
5.2 Relay Circuit Instructions
5.2.6 1-s OFF-Delay Timer (TOFF[1s])
( 3 ) Programming Example
In the following programming example, the set value of the TOFF instruction is 5, and the count value is stored in the
DW00001 register.
The DB000001 coil will turn OFF after the DB000000 relay stays OFF for 5 s.
The timing chart is shown below.
DB000000
DB000001
DW0000150
ON
OFF
ON
OFF
5 s - Ts
(Ts: Scan time set value)
5-14
Instructions
5
5.2.7 Rising-edge Pulses (ON-PLS)
Bit input
Bit output
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
Previous Value
Register
1 (ON)
0 (OFF)
1 scan1 scan
Previous Value Register
Icon:
Key entry: ]P
( 1 ) Operation
The ON-PLS instruction sets the bit output to 1 (ON) for only one scan when the bit input changes from 0 (OFF) to 1
(ON). The previous value of the bit input is saved in the Previous Value Register of the ON-PLS instruction.
The following table shows the relationship between the bit input of the ON-PLS instruction, the Previous Value Register, and the bit output.
5.2 Relay Circuit Instructions
5.2.7 Rising-edge Pulses (ON-PLS)
Bit InputPrevious Value RegisterON-PLS InstructionBit Output
0 (OFF)0 (OFF)→0 (OFF)
0 (OFF)1 (ON)→0 (OFF)
1 (ON)0 (OFF)→1 (ON)
1 (ON)1 (ON)→0 (OFF)
In the third row of the table, notice how the bit input changes from 0 (OFF) in the Previous Value Register to 1 (ON),
causing the ON-PLS instruction to set the bit output to 1 (ON).
( 2 ) Format
Parameter Name
Previous Value
Register
BWLFAIndexConstant
{*
ЧЧЧЧЧЧ
Applicable Data Types
∗ C and # registers cannot be used.
The Previous Value Register holds the previous value of the bit input. Do not use other instructions to set the value
of this register.
5-15
5.2 Relay Circuit Instructions
DB000000
DB000002
ON
OFF
ON
OFF
ON
OFF
1 scan1 scan
DB000001
5.2.7 Rising-edge Pulses (ON-PLS)
( 3 ) Programming Example
The DB000002 output coil turns ON for only one scan if the status of DB000001 changes when the DB000000 relay
changes from OFF to ON.
The timing chart is shown below.
5-16
Instructions
5
5.2.8 Falling-edge Pulses (OFF-PLS)
Bit input
Bit output
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
Previous Value
Register
1 (ON)
0 (OFF)
1 scan1 scan
Previous Value Register
Icon:
Key entry: ]N
( 1 ) Operation
The OFF-PLS instruction sets the bit output to 1 (ON) for only one scan when the bit input changes from 1 (ON) to 0
(OFF). The previous value of the bit input is saved in the Previous Value Register of the OFF-PLS instruction.
The following table shows the relationship between the bit input of the OFF-PLS instruction, the Previous Value Register, and the bit output.
5.2 Relay Circuit Instructions
5.2.8 Falling-edge Pulses (OFF-PLS)
Bit InputPrevious Value RegisterOFF-PLS InstructionBit Output
0 (OFF)0 (OFF)→0 (OFF)
0 (OFF)1 (ON)→1 (ON)
1 (ON)0 (OFF)→0 (OFF)
1 (ON)1 (ON)→0 (OFF)
In the second row of the table, notice how the bit input changes from 1 (ON) in the Previous Value Register to 0 (OFF),
causing the OFF-PLS instruction to set the bit output to 1 (ON).
( 2 ) Format
Parameter Name
Previous Value
Register
BWLFAIndexConstant
{*
ЧЧЧЧЧЧ
Applicable Data Types
∗ C and # registers cannot be used.
The Previous Value Register holds the previous value of the bit input. Do not use other instructions to set the value
of this register.
5-17
5.2 Relay Circuit Instructions
5.2.8 Falling-edge Pulses (OFF-PLS)
( 3 ) Programming Example
The DB000002 output coil turns ON for only one scan if the status of DB000001 changes when the DB000000 relay
changes from ON to OFF.
The timing chart is shown below.
DB000000
DB000001
DB000002
ON
OFF
ON
OFF
ON
OFF
1 scan1 scan
5-18
Instructions
5
5.2.9 Coil (COIL)
Coil address
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
Bit input
Bit value
Coil address
Icon:
Key entry: @
( 1 ) Operation
The COIL instruction sets the value of the bit at the coil address to 1 (ON) whenever the bit input is 1 (ON). The value
of the bit at the coil address is set to 0 (OFF) whenever the bit input is 0 (OFF).
( 2 ) Format
5.2 Relay Circuit Instructions
5.2.9 Coil (COIL)
Parameter Name
Coil address
∗ C and # registers cannot be used.
BWLFAIndexConstant
{*
ЧЧЧЧЧЧ
Applicable Data Types
( 3 ) Programming Example
The DB000000 coil turns ON when the DB000001 relay turns ON.
If there are no instructions on the left side, the DB000000 coil is OFF because there is no input.
5-19
5.2 Relay Circuit Instructions
Bit input
Coil address
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
Bit value
5.2.10 Set Coil (S-COIL)
5.2.10 Set Coil (S-COIL)
( 1 ) Operation
The S-COIL instruction sets the value of the bit at the coil address to 1 (ON) when the bit input is 1 (ON). The set coil
stays in the ON state.
( 2 ) Format
Icon:
Coil address
Parameter Name
Coil address
∗ C and # registers cannot be used.
BWLFAIndexConstant
{*
ЧЧЧЧЧЧ
Applicable Data Types
( 3 ) Programming Example
The DB000001 set coil stays in the ON state when the DB000000 relay turns ON.
The timing chart is shown below.
Key entry: @S
5-20
DB000000
DB000001
ON
OFF
ON
OFF
Instructions
5
5.2.11 Reset Coil (R-COIL)
DB000000
DB000001
ON
OFF
ON
OFF
ON
OFF
DB000002
( 1 ) Operation
The R-COIL instruction sets the bit at the reset coil address to 1 (ON) when the bit input is 1 (ON). The set coil is
changed to OFF.
5.2 Relay Circuit Instructions
5.2.11 Reset Coil (R-COIL)
Bit input
Coil address
Bit value
( 2 ) Format
Parameter Name
Coil address
∗ C and # registers cannot be used.
( 3 ) Programming Example
1 (ON)
0 (OFF)
1 (ON)
0 (OFF)
Coil address
Applicable Data Types
BWLFAIndexConstant
{*
ЧЧЧЧЧЧ
Icon:
Key entry: @R
In the following programming example, the reset coil is used to turn OFF the set coil that was turned ON in the first
line.
The DB000001 reset coil in the second line turns ON if the DB000002 relay turns ON while the DB000001 set coil is
ON, therefore turning OFF the DB000001 set coil.
The timing chart is shown below.
5-21
5.3 Numeric Operation Instructions
5.3.1 Store (STORE)
5.3 Numeric Operation Instructions
5.3.1 Store (STORE)
( 1 ) Operation
The input data is stored in the output register.
( 2 ) Format
Parameter Name
Input data (Src)
Output register
(Dest)
∗ C and # registers cannot be used.
Input data
Input dataOutput register
Applicable Data Types
BWLFAIndexConstant
×{{{{{{
×
{*{*{*{*
Output register
Icon:
Key entry: ;
{×
5-22
Instructions
5
( 3 ) Programming Examples
INFO
In the following programming examples, the input data is stored in the output register.
• Storing the Input Data, an Integer Value of 12345, in the MW00000 Output Register
• Storing the Input Data, a Real Value of 123.45, in the MW00000 Output Register
5.3 Numeric Operation Instructions
5.3.1 Store (STORE)
• Storing the Double-length Integer 89ABCDEF Hex in the MW00000 Output Register
The lower word of the double-length integer –12,817 (CDEF hex) is stored in MW00000.
• Storing the Input Data, an Integer Value of 1234, in the MF00000 Output Register
When performing operations with different data types, the result of the operation will depend on the data type of the output register.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
5-23
5.3 Numeric Operation Instructions
Input data A
Output data
Input data B
+
Input data B
Input data A
Output data
Icon:
Key entry: +
5.3.2 Add (ADD (+))
5.3.2 Add (ADD (+))
( 1 ) Operation
Input data A and input data B are added and the result is stored in the output data.
An operation error occurs if the result produces an overflow or underflow.
( 2 ) Format
Parameter Name
Input data A (SrcA)
Input data B (SrcB)
Output data (Dest)
∗ C and # registers cannot be used.
BWLFAIndexConstant
×
×
×
Applicable Data Types
{{{
{{{
{*{*{*
×
×
×
{{
{{
{
×
5-24
5.3 Numeric Operation Instructions
Instructions
5
INFO
5.3.2 Add (ADD (+))
( 3 ) Programming Examples
In the following programming examples, input data A and input data B are added and the result is stored in the output
data.
• Storing the Output Data in MW00000 When Input Data A Is 100 and Input Data B Is 200
100 + 200 → MW00000 = 300
• Storing the Output Data in MW00000 When Input Data A Is 10.5 and Input Data B Is 10
10.5 + 10 → MW00000 = 20 (when truncating below the decimal point is set)
• Storing the Output Data in ML00000 When Input Data A in MW00002 Is 20,000 and Input Data B in MW00003
Is 30,000
MW00002 (20,000) + MW00003 (30,000) → ML00000 = 32,767*
∗ In the example given above, an overflow error occurs because both input data A and B are integers, which lim-
its the result to a number within the range for integers.
( 4 ) Additional Information
With integer operations, an overflow operation error occurs if the result exceeds 32,767 and an underflow operation
error occurs if the result is less than -32,768.
With double-length integer operations, an overflow operation error occurs if the result exceeds 2,147,483,647 and an
underflow operation error occurs if the result is less than -2,147,483,648.
When performing operations with different data types, the result of the operation will depend on the data type of the output register.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
Normally, addition and subtraction instructions (+, –, ++, and – –) involving double-length integers are performed as 32-bit
operations.
However, these instructions are performed as 64-bit operations if they are used to correct the remainder produced by an immediately preceding MUL instruction (×) and are immediately followed by a DIV instruction (÷).
5-25
5.3 Numeric Operation Instructions
Output data (See notes.)
0
32,767 (7FFF hex)
−32,768 (8000 hex)
+1
32,767
-32,768
+1
Input data B
Output data
Input data A
Icon:
Key entry: ++
5.3.3 Extended Add (ADDX (++))
5.3.3 Extended Add (ADDX (++))
( 1 ) Operation
Input data A and input data B are added and the result is stored in the output data.
Overflows are not treated as operation errors. Operation continues from the maximum value in the negative direction.
Underflows are not treated as operation errors. Operation continues from the maximum value in the positive direction.
Input data A
Output Data Behavior
Extended Add
++
Input data B
Output data
In the example shown above, the output data is integer data. With double-length integers, adding 1 to
Unlike operations for the ADD, SUB, or EXPRESSION instructions, overflows and underflows do not occur.
( 2 ) Format
Parameter Name
Input data A (SrcA)×
Input data B (SrcB)
Output data (Dest)
2,147,483,647 (7FFFFFFF hex) results in -2,147,483,648 (80000000 hex).
Applicable Data Types
BWLFAIndexConstant
{{
×
×
{{
{*{*
××
××
××
{{
{{
{
×
5-26
∗ C and # registers cannot be used.
5.3 Numeric Operation Instructions
Instructions
5
INFO
5.3.3 Extended Add (ADDX (++))
( 3 ) Programming Examples
In the following programming examples, input data A and input data B are extended-added and the result is stored in
the output data.
• Storing the Output Data in MW00000 When Input Data A Is 32,760 and Input Data B Is 10
32,760 ++ 10 → MW00000 = -32,766
• Storing the Output Data in ML00000 When Input Data A in MW00002 Is 20,000 and Input Data B in MW00003
is 30,000
20,000 ++ 30,000 → ML00000 = -15,536*
∗ In the example given above, ML00000 does not equal 50,000 because both input data A and B are integers,
which limits the result to a number within the range for integers.
• Storing the Output Data in ML00000 When Input Data A Is 2,147,483,647 and Input Data B Is 2
2,147,483,647 ++ 2 → ML00000 = -241,783,647
• Storing the Output Data in MW00000 When Input Data A Is -32,768 and Input Data B Is -1
-32,768 ++ -1 → MW00000 = 32,767
When performing operations with different data types, the result of the operation will depend on the data type of the output register.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
Normally, addition and subtraction instructions (+, –, ++, and – –) involving double-length integers are performed as 32-bit
operations.
However, these instructions are performed as 64-bit operations if they are used to correct the remainder produced by an immediately preceding MUL instruction (×) and are immediately followed by a DIV instruction (÷).
5-27
5.3 Numeric Operation Instructions
Input data A
Output data
Input data B
−
5.3.4 Subtract (SUB (−))
5.3.4 Subtract (SUB (−))
( 1 ) Operation
Input data B is subtracted from input data A and the result is stored in the output data.
An operation error occurs if the result produces an overflow or underflow.
( 2 ) Format
Icon:
Input data B
Input data A
Parameter Name
Input data A (SrcA)
Input data B (SrcB)
Output data (Dest)
∗ C and # registers cannot be used.
BWLFAIndexConstant
×
×
×
{{{
{{{
{*{*{*
Output data
Applicable Data Types
×
×
×
Key entry: −
{{
{{
{
( 3 ) Programming Examples
In the following programming examples, input data B is subtracted from input data A and the result is stored in the output data.
• Storing the Output Data in MW00000 When Input Data A Is 100 and Input Data B Is 200
100 – 200 → MW00000 = -100
×
5-28
5.3 Numeric Operation Instructions
Instructions
5
INFO
5.3.4 Subtract (SUB (−))
• Storing the Output Data in MW00000 When Input Data A Is 10.5 and Input Data B Is 10
10.5 – 10 → MW00000 = 0 (when truncating below the decimal point is set)
• Storing the Output Data in ML00000 When Input Data A in MW00002 Is -20,000 and Input Data B in
MW00003 Is 30,000
-20,000 – 30,000 → ML00000 = -32,768*
∗ In the example given above, an underflow error occurs because both input data A and B are integers, which
limits the result to a number within the range for integers.
( 4 ) Additional Information
With integer operations, an overflow operation error occurs if the result exceeds 32,767 and an underflow operation
error occurs if the result is less than -32,768.
With double-length integer operations, an overflow operation error occurs if the result exceeds 2,147,483,647 and an
underflow operation error occurs if the result is less than -2,147,483,648.
When performing operations with different data types, the result of the operation will depend on the data type of the output register.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
Normally, addition and subtraction instructions (+, –, ++, and – –) involving double-length integers are performed as 32-bit
operations.
However, these instructions are performed as 64-bit operations if they are used to correct the remainder produced by an immediately preceding MUL instruction (×) and are immediately followed by a DIV instruction (÷).
5-29
5.3 Numeric Operation Instructions
0
-1
32,767
-32,768
-1
Output data
32,767 (7FFF hex)
-32,768 (8000 hex)
Input data B
Output data
Input data A
Icon:
Key entry: −−
5.3.5 Extended Subtract (SUBX (− −))
5.3.5 Extended Subtract (SUBX (− −))
( 1 ) Operation
Input data B is subtracted from input data A and the result is stored in the output data.
Overflows are not treated as operation errors. Operation continues from the maximum value in the negative direction.
Underflows are not treated as operation errors. Operation continues from the maximum value in the positive direction.
Extended Subtract
Input data A
− −
Output Data Behavior
Input data B
Output data
In the example shown above, the output data is integer data. With double-length integers, subtracting 1 from -
Unlike operations for the ADD, SUB, or EXPRESSION instructions, overflows and underflows do not occur.
( 2 ) Format
Parameter Name
Input data A (SrcA)×
Input data B (SrcB)
Output data (Dest)
2,147,483,647 (80000000 hex) results in 2,147,483,647(7FFFFFFF hex).
Applicable Data Types
BWLFAIndexConstant
{{
×
×
{{
{*{*
××
××
××
{{
{{
{
×
5-30
∗ C and # registers cannot be used.
5.3 Numeric Operation Instructions
Instructions
5
INFO
5.3.5 Extended Subtract (SUBX (− −))
( 3 ) Programming Examples
In the following programming examples, input data B is extended-subtracted from input data A and the result is stored
in the output data.
• Storing the Output Data in MW00000 When Input Data A Is -32,760 and Input Data B Is 10
-32,768 – – 10 → MW00000 = 32,766
• Storing the Output Data in ML00000 When Input Data A in MW00002 Is -20,000 and Input Data B in
MW00003 Is 30,000
-20,000 – –30,000 → ML00000 = 15,536*
∗ In the example given above, ML00000 does not equal -50,000 because both input data A and B are integers,
which limits the result to a number within the range for integers.
• Storing the Output Data in ML00000 When Input Data A Is -2,147,483,648 and Input Data B Is 2
-2,147,483,648 – – 2 → ML00000 = 241,783,646
• Storing the Output Data in MW00000 When Input Data A Is 32,767 and Input Data B Is -1
32,767 – – -1 → MW00000 = -32,768
When performing operations with different data types, the result of the operation will depend on the data type of the output register.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
Normally, addition and subtraction instructions (+, –, ++, and – –) involving double-length integers are performed as 32-bit
operations.
However, these instructions are performed as 64-bit operations if they are used to correct the remainder produced by an immediately preceding MUL instruction (×) and are immediately followed by a DIV instruction (÷).
5-31
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.